Severity assessment automatic global
POST /severity-assessment/automatic/global aggregates a severity score across multiple body sites by accepting one image per site and returning a whole-body result.
Request
- Python
- JavaScript
import requests
import base64
base_url = "<base_url>"
params_url = "https://medical-device-params.legit.health/v2.0"
url = f"{base_url}/severity-assessment/automatic/global"
# 1. Discover the accepted body-site codes at integration time so the
# integration does not break when new sites are added.
body_sites = [bs["code"] for bs in requests.get(f"{params_url}/body-sites").json()]
# 2. Build one entry per body site you photographed. Send a subset if some
# anatomy was not captured; the score is computed over what is provided.
image_folder = "<path_to_your_image_folder>" # one file per body site, e.g. <body_site_code>.jpg
items = {}
for site in body_sites:
with open(f"{image_folder}/{site}.jpg", "rb") as f:
items[site] = {
"payload": {
"contentAttachment": {
"data": base64.b64encode(f.read()).decode("utf-8")
}
}
}
json_payload = {
"knownCondition": {
"conclusion": { "text": "<plain-text condition>" }
},
"scoringSystem": {
"<scoring_system_code>": { "item": items } # any global-capable code from GET /questionnaires
}
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <access_token>"
}
response = requests.post(url, json=json_payload, headers=headers)
result = response.json()
const fs = require("fs");
const path = require("path");
const baseUrl = "<base_url>";
const paramsUrl = "https://medical-device-params.legit.health/v2.0";
const imageFolder = "<path_to_your_image_folder>";
// 1. Discover the accepted body-site codes at integration time so the
// integration does not break when new sites are added.
const bodySites = (await (await fetch(`${paramsUrl}/body-sites`)).json()).map((bs) => bs.code);
// 2. Build one entry per body site you photographed.
const items = {};
for (const site of bodySites) {
const data = fs.readFileSync(path.join(imageFolder, `${site}.jpg`)).toString("base64");
items[site] = { payload: { contentAttachment: { data } } };
}
const json_payload = {
knownCondition: { conclusion: { text: "<plain-text condition>" } },
scoringSystem: {
"<scoring_system_code>": { item: items }, // any global-capable code from GET /questionnaires
},
};
const response = await fetch(`${baseUrl}/severity-assessment/automatic/global`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer <access_token>",
},
body: JSON.stringify(json_payload),
});
const result = await response.json();
Request fields
knownCondition.conclusion.text(required) see Known condition.scoringSystem.<code>(required) must be a global-capable scoring-system code; otherwise as described in Scoring system (scoringSystemandquestionnaireResponse).scoringSystem.<code>.item.<body_site_code>one entry per body site you photographed, keyed by codes returned byGET /body-sites(see Body site). Each entry has the same shape as thepayloadof theautomatic/localendpoint, so itscontentAttachmentfollows the shared Image attachment section.
The Authorization header is the standard bearer token; see Authentication header.
Response
The response follows the shared FHIR response envelope and otherwise mirrors the automatic/local response, with these differences:
score.valueis the aggregate score across all submitted body sites, computed according to the scoring system's rules.- Each per-body-site entry inside
patientEvolution.<scoring_system_code>.item.<body_site_code>carries its ownmediaValidityblock (see Image quality assessment) and per-site sub-scores. Inspect eachmediaValidity.isValidindividually: if a single body site has poor image quality, the global score may be biased.
"patientEvolution": {
"<scoring_system_code>": {
"score": {
"value": 18.4,
"interpretation": { "category": "Moderate", "intensity": 2 }
},
"item": {
// One entry per submitted body site, keyed by the body-site code.
"<body_site_code>": {
"mediaValidity": { /* per-site image-quality block */ },
"score": { "value": 2.1 },
"media": { "attachment": { /* masks for this body site */ } }
}
}
}
}