Skip to main content

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

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()

Request fields

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.value is 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 own mediaValidity block (see Image quality assessment) and per-site sub-scores. Inspect each mediaValidity.isValid individually: 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 */ } }
}
}
}
}