Documentation
Platform API
Build your solution
Fetching Results

Fetching interview results

After a finished interview (when a question returns HTTP code 204) the client can call a set of endpoints that can summarize an interview and present some useful information. Those endpoints are:

Below is a breakdown of each of them:

Evidence Assessment

To be able to fetch Infermedica’s AI Assessment, the user must both complete the interview and provide evidence during the interview before calling the GET query to /api/mgp/v1/surveys/{survey_id}/evidence_assessment.

ℹ️

Remember that in order to be able to complete an interview the survey needs to be created with section dynamic.

Such a request may look like this:

Evidence Assessment

Example:

cURL
curl "https://api.infermedica.com/api/mgp/v1/surveys/{survey_id}/evidence_assessment" \
  -X "GET" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"

Response:

As you can see in the response below, there are three attributes with null values. In order to obtain a response with condition details or explanations you can use two corresponding query parameters: condition_details and explanations. Examples of requests with both of those parameters are found in the adjacent tabs.

JSON
{
  "conditions": [
    {
      "id": "c_927",
      "name": "De Quervain syndrome",
      "common_name": "De Quervain syndrome",
      "probability": 0.8589,
      "rating": "strong",
      "icd10": [
        {
          "code": "M65.4"
        }
      ],
      "condition_details": null,
      "explain": null,
      "patient_education": null
    }
  ],
  "triage": {
    "level": "self_care",
    "description": "The symptoms you have declared may not require medical evaluation and they usually resolve on their own. Sometimes they can be eased with self-care methods. If the symptoms get worse or new symptoms appear, consult a doctor.",
    "serious": []
  }
}

Response object

conditions (list)

Each response contains a conditions attribute holding a list of possible conditions sorted by their estimated probability.

Each condition in the rankings is represented by a JSON object with the following attributes: id, name, common_name, icd10, and probability.

The probability attribute is a floating point number between 0 and 1, indicating a match between the reported evidence and conditions in the model.

Please note that the condition rankings may be empty [ ] if there is no evidence or, in rare cases, where the combination of evidence isn’t associated with any specific condition.

triage (object)

  • level (str)
    • emergency – the reported evidence may indicate a serious or life-threatening condition and thus the patient may require immediate medical attention,
    • consultation – the patient may require a medical consultation when possible,
    • self_care – the declared symptoms may not require medical evaluation and they usually resolve on their own. Sometimes they can be treated with self-care methods. Patients should observe their symptoms and consult a doctor if the symptoms get worse or new ones appear.
  • serious (list) – Each listed observation has an unique ID and name. All observations returned in the serious list are alarming and require consultation with a medical professional. Each serious observation has a seriousness value of either: serious, emergency, or emergency_ambulance. Observations with emergency or emergency\_ambulance seriousness are particularly urgent and may require immediate attention.

Errors when fetching evidence assessment

Survey not found

If you try to fetch an evidence assessment for a survey that does not exist you will receive a 404 Not Found HTTP response with the following message:

JSON
{
  "detail": "Survey not found"
}

Summary

To be able to fetch the collected information from the survey, the patient must complete the interview then call the GET query to /api/mgp/v1/surveys/{survey_id}/summary.

Intake survey

Example:

cURL
curl "https://api.infermedica.com/api/mgp/v1/surveys/{survey_id}/summary" \
  -X "GET" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"

Response:

JSON
{
  "type": "intake",
  "patient": {
    "id": "bea10e06-c3cb-4fc3-9480-eaaab5bb0fa5",
    "age": {
      "value": 31,
      "unit": "year"
    },
    "sex": "male",
    "dependent": false
  },
  "visit_reasons": [
    {
      "id": "other",
      "name": "Other"
    }
  ],
  "onset_time_symptoms": {
    "id": "less_24h",
    "label": "Less than 24 hours ago"
  },
  "chronic_diseases": [
    {
      "id": "c_1191",
      "name": "Diabetic foot infection",
      "severity": "moderate"
    }
  ],
  "specialists": [
    {
      "id": "sp_10",
      "name": "Endocrinologist"
    }
  ],
  "hospitalizations": [
    {
      "id": "p_318",
      "name": "History of COVID infection",
      "last_occurred": "less_than_1_month"
    }
  ],
  "medications": "",
  "allergies": "",
  "present_symptoms": [
    {
      "id": "s_13",
      "name": "Abdominal pain",
      "source": "initial",
      "choice_id": "present",
      "seriousness": "normal"
    },
    {
      "id": "s_1528",
      "name": "Abdominal pain, right upper quadrant",
      "source": "",
      "choice_id": "present",
      "seriousness": "normal"
    },
    {
      "id": "s_1840",
      "name": "Abdominal pain, lasting less than 2 days",
      "source": "",
      "choice_id": "present",
      "seriousness": "normal"
    }
  ],
  "absent_symptoms": [],
  "risk_factors": [],
  "additional_comment": ""
}

Response object

type (str, required)

patient (object, required)

  • id (str, required) – the unique patient identifier from the client system
  • sex (str, required) – patient's biological sex. Can only have one of two possible values: female and male
  • age (object, required)
    • unit (str) – year or month (year by default if not provided)
    • value (numeric, required) – a numeric value that represents age
  • dependent (bool, required) – false if the patient has conducted the interview for themselves, true if the interview was conducted for someone else

visit_reasons (list of objects)

  • id (str, required) – visit reason ID
  • name (str, required) – display name

onset_time_symptoms (object)

  • id (str, required) - symptom onset time ID, one of:
    • less_24h
    • more_24h_less_1_week
    • more_1_week_less_1_month
    • more_1_month_less_1_year"
    • longer
    • unknown
  • label (str, required) - label corresponding to symptom onset time ID, one of:
    • "Less than 24 hours ago"
    • "More than 24 hours to 1 week ago"
    • "More than 1 week to 1 month ago"
    • "More than 1 month to 1 year ago"
    • "More than 1 year ago"
    • "I can’t remember"

chronic_diseases (list of objects)

  • id (str, optional) – chronic_diseases ID, null if element is provided manually by user
  • name (str, required) – display name
  • severity (str, optional) – possible values: mild, moderate, severe

specialists (list of objects)

  • id (str, optional) – specialist ID, null if element is provided manually by user
  • name (str, required) – display name

hospitalizations (list of objects)

  • id (str, optional) – hospitalization ID, null if element is provided manually by user
  • name (str, required) – display name
  • last_occurred (str, required) – possible values: less_than_1_month, 1_3_months, 4_11_months, 1_5_years, over_5_years

medications (str)

  • The medication input field collects unstructured text data from the patient, allowing them to freely input the names and dosages of medications they are taking. This text data is not constrained by any specific format, enabling patients to describe their medication regimen in their own words. The collected data is then returned as-is by the API endpoint.

allergies (str)

  • The allergies input field collects unstructured text data from the patient, allowing them to freely input information about their allergies. This text data is not constrained by any specific format, enabling patients to describe their allergies in their own words. The collected data is then returned as-is by the API endpoint.

present_symptoms, absent_symptoms, risk_factors (list of objects)

  • id (str) – evidence ID
  • name (str) – display name
  • source (str)
    • "source": "initial" – evidence reported by user,
    • "source": "suggest" – evidence from /suggest endpoint,
    • "source": "red_flags" – evidence from /suggest with "red_flags" method or /red_flags endpoint,
    • no value – for evidence gathered during the interview the source attribute should be entirely omitted.
  • seriousness (str) – possible values: serious, emergency, emergency_ambulance. Observations with emergency or emergency_ambulance seriousness are particularly urgent and may require immediate attention.

additional_comment (str)

  • message from patient to doctor

Errors when fetching survey summary

Survey not found

If you try to fetch a summary for a survey that does not exist you will receive a 404 Not Found HTTP response with the following message:

JSON
{
  "detail": "Survey not found"
}

Specialist Recommendation

The /api/mgp/v1/surveys/{survey_id}/specialist_recommendation endpoint provides a specialist recommendation based on a user's interview responses, specifying the type of specialist to consult and the suggested channel for the consultation.

Example:

cURL
curl "https://api.infermedica.com/api/mgp/v1/surveys/{survey_id}/specialist_recommendation" \
  -X "GET" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"

Response:

JSON
{
  "recommended_specialist": "Orthopedist",
  "recommended_channel": "personal_visit"
}

Response object

The response contains the following attributes:

  • recommended_specialist – name of the recommended specialist, one of:
    • Allergologist
    • Angiologist
    • Cardiologist
    • Dentist
    • Dermatologist
    • Diabetologist
    • Endocrinologist
    • ENT doctor
    • Gastroenterologist
    • General Practitioner
    • Gynecologist
    • Hematologist
    • Infectologist
    • Internal Medicine Specialist
    • Maxillofacial Surgeon
    • Neonatologist
    • Nephrologist
    • Neurologist
    • Oncologist
    • Ophthalmologist
    • Orthopedist
    • Pediatrician
    • Psychiatrist
    • Pulmonologist
    • Rheumatologist
    • Surgeon
    • Toxicologist
    • Urologist
  • recommended_channel – a channel recommendation, one of:
    • personal_visit – In-person visit
    • video_teleconsultation – Video consultation
    • audio_teleconsultation – Telephone or any other consultation with audio only
    • text_teleconsultation – Chat

Errors when fetching specialist recommendation

Survey not found

If you try to fetch a specialist recommendation for a survey that does not exist you will receive a 404 Not Found HTTP response with the following message:

JSON
{
  "detail": "Survey not found"
}

PDF Summary

The /api/mgp/v1/surveys/{survey_id}/summary_pdf endpoint generates and returns a PDF document summarizing the patient's medical interview, encapsulating the details of the survey responses and diagnostic information. The contents of PDF documents are equivalent to those of summary endpoint, but presented in PDF format.

Example:

cURL
curl "https://api.infermedica.com/api/mgp/v1/surveys/{survey_id}/summary_pdf" \
  -X "GET" \
  -H "Authorization: Bearer <ACCESS_TOKEN>"

Response object

A PDF document with interview summary.

Errors when fetching PDF summary

Survey not found

If you try to fetch a PDF summary for a survey that does not exist you will receive a 404 Not Found HTTP response with the following message:

JSON
{
  "detail": "Survey not found"
}