Skip to main content

Diagnosis support

POST /diagnosis-support returns a ranked list of probable conditions for one or more skin images, plus risk indicators and a media-validity block per image.

Request

import requests
import base64

base_url = "<base_url>"
url = f"{base_url}/diagnosis-support"

# Encode each image you want to analyse. Multiple images can be sent in
# the same request: each image becomes a separate item in `payload[]`.
image_path = "<path_to_image>" # e.g. "lesion_image.jpg"
with open(image_path, "rb") as f:
image_data = base64.b64encode(f.read()).decode("utf-8")

json_payload = {
"payload": [
{
"contentAttachment": {
"data": image_data, # required base64-encoded image bytes
"title": "Lesion close-up", # optional free-text label for the image
"contentType": "image/jpeg" # optional defaults to image/png
}
}
# Add more {"contentAttachment": {...}} items here for additional images.
]
}

headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <access_token>" # obtained from /login
}

response = requests.post(url, json=json_payload, headers=headers)
result = response.json()

Request fields

  • payload[] array of images to analyse. At least one entry is required; multiple entries are aggregated into a single result.
  • payload[].contentAttachment (required) image envelope; see the shared Image attachment section for fields.

The Authorization header is the standard bearer token; see Authentication header.

Response

The response follows the FHIR DiagnosticReport resource shape. The top of the response carries the aggregated result; imagingAnalysis[] carries the per-image breakdown including explainability heatmaps.

{
"resourceType": "DiagnosticReport",
"identifier": {
"use": "official",
"value": "f426f15d-fcea-4bd0-942e-7528bf163c5d"
},
"status": "preliminary",
"category": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0074",
"systemDisplay": "HL7 FHIR",
"code": "IMG",
"display": "Diagnostic Imaging"
}
],
"text": "Diagnostic imaging"
}
],
"code": {
"coding": [
{
"system": "http://loinc.org/",
"systemDisplay": "Logical Observation Identifiers Names and Codes (LOINC)",
"code": "100063-7",
"display": "Primary skin concern"
}
],
"text": "Skin condition analysis"
},
"issued": "2026-02-13T14:58:27.466367",
"analysisDuration": 1.11359,
"performanceIndicator": {
"sensitivity": 66.97074175,
"specificity": 98.58783484,
"entropy": 8.4339413
},
"clinicalIndicator": {
"hasCondition": 99.96490132,
"pigmentedLesion": 0.53779946,
"malignancy": 0.24731814,
"urgentReferral": 0.67645404,
"highPriorityReferral": 1.51389415
},
"conclusion": [
{
"code": {
"coding": [
{
"system": "https://icd.who.int/browse/2025-01/mms/en",
"systemDisplay": "ICD-11",
"version": "2025-01",
"code": "EA89",
"display": "Generalised eczematous dermatitis of unspecified type"
}
],
"text": "Eczematous dermatitis"
},
"probability": 94.89877797
},
{
"code": {
"coding": [
{
"system": "https://icd.who.int/browse/2025-01/mms/en",
"systemDisplay": "ICD-11",
"version": "2025-01",
"code": "1F28",
"display": "Dermatophytosis"
}
],
"text": "Tinea"
},
"probability": 0.15845833
}
// ... 4 more shown in production for the top 5; full array contains every supported pathology.
],
"imagingAnalysis": [
{
"mediaValidity": { /* see the "Image quality assessment" common building block */ },
"performanceIndicator": { "entropy": 8.4339413 },
"clinicalIndicator": { /* same shape as top-level clinicalIndicator */ },
"conclusion": [
{
"code": { /* same ICD-11 coding as top-level conclusion[] */ },
"probability": 94.8987782,
"explainability": {
"heatMap": { /* visual attention map for this conclusion */ }
}
}
// ...
]
}
]
}

Top-level fields

The top-level FHIR fields (resourceType, identifier, status, issued, analysisDuration) follow the shared FHIR response envelope. This endpoint also carries category and code blocks describing the type of report (Diagnostic Imaging, LOINC 100063-7 "Primary skin concern"); they are static and can be ignored in most integrations.

performanceIndicator: model performance for this prediction

"performanceIndicator": {
"sensitivity": 66.97074175,
"specificity": 98.58783484,
"entropy": 8.4339413
}
  • sensitivity the model's sensitivity (true-positive rate, in percent) at the operating point used for this prediction.
  • specificity the model's specificity (true-negative rate, in percent) at the operating point used for this prediction.
  • entropy Shannon entropy of the predicted probability distribution. Higher values mean the model is more uncertain about which condition is present.

clinicalIndicator: risk flags

"clinicalIndicator": {
"hasCondition": 99.96490132,
"pigmentedLesion": 0.53779946,
"malignancy": 0.24731814,
"urgentReferral": 0.67645404,
"highPriorityReferral": 1.51389415
}

All values are percentages (0–100):

  • hasCondition likelihood that a relevant skin condition is present in the image.
  • pigmentedLesion likelihood that the lesion is pigmented (relevant for melanoma triage workflows).
  • malignancy likelihood of malignancy.
  • urgentReferral likelihood the case warrants urgent referral to a specialist.
  • highPriorityReferral likelihood the case warrants high-priority referral (less urgent than urgentReferral but still expedited).

conclusion[]: ranked differential diagnosis

{
"code": {
"coding": [
{
"system": "https://icd.who.int/browse/2025-01/mms/en",
"systemDisplay": "ICD-11",
"version": "2025-01",
"code": "EA89",
"display": "Generalised eczematous dermatitis of unspecified type"
}
],
"text": "Eczematous dermatitis"
},
"probability": 94.89877797
}
  • code.coding[].system coding system URL; always ICD-11 for this endpoint.
  • code.coding[].version ICD-11 release version (e.g. 2025-01).
  • code.coding[].code / code.coding[].display ICD-11 code and its official display.
  • code.text short, human-readable label.
  • probability predicted probability (0–100) for this conclusion.

The array is sorted in descending probability. In production it contains every supported pathology (300+ entries); only the top entries are clinically meaningful. Filter the array to the top 5 items for display, and surface a "more" affordance if you want to expose the long tail.

imagingAnalysis[]: per-image breakdown

imagingAnalysis mirrors the top-level result for each input image individually (one entry per item in your request payload[]). Each entry contains:

  • mediaValidity image-quality block; see the Image quality assessment section.
  • performanceIndicator.entropy per-image uncertainty.
  • clinicalIndicator per-image risk flags (same shape as the top-level block).
  • conclusion[] per-image ranked diagnoses; each item additionally carries an explainability.heatMap field with a visual attention map highlighting the regions the model used to reach that conclusion. Once decoded, the heatmap is an image overlay where warmer colours indicate the regions the model weighted most heavily:

Decoded explainability heatmap overlaid on the original lesion image

explainability.heatMap shape

"explainability": {
"heatMap": {
"title": "Heat map showing which regions of the image the AI focuses its attention to predict this class.",
"contentType": "image/jpeg",
"data": "<base64_encoded_image_data>",
"height": 238,
"width": 284,
"colorModel": "RGB"
}
}
  • title human-readable description of the heatmap.
  • contentType MIME type of the encoded image (typically image/jpeg).
  • data Base64-encoded image bytes. Omitted from the example above because the payload is large; decode it the same way as any other Base64 image.
  • height / width pixel dimensions of the decoded image.
  • colorModel colour space of the decoded image (e.g. RGB).