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 a dynamic section.

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_ambulance – the reported symptoms are very serious and the patient may require emergency care. The patient should call an ambulance right now,
    • emergency – the reported evidence appears serious and the patient should go to an emergency department. If the patient can't get to the nearest emergency department, they should call an ambulance,
    • consultation_24 – the patient should see a doctor within 24 hours. If the symptoms suddenly get worse, the patient should go to the nearest emergency department,
    • consultation – the patient may require medical evaluation and may need to schedule an appointment with a doctor. If the symptoms get worse, the patient should see a doctor immediately,
    • self_care – the declared symptoms may not require a medical evaluation and they usually resolve on their own. Sometimes they can be treated through 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.

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",
  "specialist": {
    "id": "sp_6",
    "name": "Orthopedist"
  },
  "channel": {
    "id": "personal_visit",
    "name": "In-person visit"
  }
}
⚠️
Deprecated Attributes: The recommended_specialist and recommended_channel attributes are now deprecated and will be removed in a future release. Please use the specialist and channel fields shown in the tables below instead from now on.

Response object

The response contains the following attributes:

  • recommended_specialistDeprecated – name of the recommended specialist. Will be one of the specialist names listed in the Specialist Table below, such as Allergologist, Cardiologist, or Orthopedist.

  • recommended_channelDeprecated – a channel recommendation id. Will be one of the channel IDs listed in the Channel Table below, such as personal_visit or video_teleconsultation.

  • specialist – An object providing the ID and name of the recommended specialist. Replaces the now deprecated recommended_specialist. Possible values include:

    • id – a unique identifier for the specialist such as sp_23 or sp_6 (refer to the Specialist Table below for a full list of available IDs and specialist names)
    • name – the name of the specialist (e.g., Allergologist, Cardiologist)
  • channel – An object providing the ID and name of the recommended consultation channel. Replaces the now deprecated recommended_channel. Possible values include:

    • id – a unique identifier for the channel such as personal_visit or video_teleconsultation (refer to the Channel Table below for a full list of available IDs and channel names)
    • name – the name of the channel (e.g., In-person visit, Video consultation)

Specialist Table

Specialist IDSpecialist Name
sp_23Allergologist
sp_21Angiologist
sp_12Cardiologist
sp_18Dentist
sp_9Dermatologist
sp_22Diabetologist
sp_10Endocrinologist
sp_14ENT doctor
sp_5Gastroenterologist
sp_1General Practitioner
sp_15Gynecologist
sp_25Hematologist
sp_19Infectologist
sp_2Internal Medicine Specialist
sp_29Maxillofacial Surgeon
sp_26Neonatologist
sp_24Nephrologist
sp_17Neurologist
sp_13Oncologist
sp_7Ophthalmologist
sp_6Orthopedist
sp_3Pediatrician
sp_16Psychiatrist
sp_27Pulmonologist
sp_20Rheumatologist
sp_4Surgeon
sp_8Toxicologist
sp_11Urologist

Channel Table

Channel IDChannel Name
personal_visitIn-person visit
video_teleconsultationVideo consultation
audio_teleconsultationAudio-only consultation
text_teleconsultationText-based 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 that summarizes the patient's interview, including all of the patient's survey responses and other relevant information. The contents of PDF documents are equivalent to those found when using the summary endpoint, but presented in PDF format.

Example:

cURL
curl "https://api.infermedica.com/api/mgp/v1/surveys/{survey_id}/summary_pdf" \
  -X "POST" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "custom_stylesheet": "https://example.com/styles.css",
    "disclaimer": "Custom disclaimer text",
    "blocks": ["age", "sex", "symptoms", "possible_conditions", "disclaimer"],
  }'
⚠️
Deprecated Method: The GET method for the /api/mgp/v1/surveys/{survey_id}/summary_pdf endpoint is now deprecated. Please use the POST method instead when generating and retrieving a summary PDF as, while both methods currently work, the GET method does not allow for any customization of the PDF and support for it could be removed in a future update. Updating your integrations to use the POST method as soon as possible is recommended to ensure compatibility.

PDF Summary request parameters in body

The following PDF summary parameters can be added to the request parameter body when generating a PDF. All are optional. An empty body can also be sent. The list of all acceptable PDF parameters includes:

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"
}