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 "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.
{
"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
, oremergency_ambulance
. Observations withemergency
oremergency\_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:
{
"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:
{
"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 "https://api.infermedica.com/api/mgp/v1/surveys/{survey_id}/specialist_recommendation" \
-X "GET" \
-H "Authorization: Bearer <ACCESS_TOKEN>"
Response:
{
"recommended_specialist": "Orthopedist",
"recommended_channel": "personal_visit",
"specialist": {
"id": "sp_6",
"name": "Orthopedist"
},
"channel": {
"id": "personal_visit",
"name": "In-person visit"
}
}
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_specialist
– Deprecated – name of the recommended specialist. Will be one of the specialist names listed in the Specialist Table below, such asAllergologist
,Cardiologist
, orOrthopedist
. -
recommended_channel
– Deprecated – a channel recommendation id. Will be one of the channel IDs listed in the Channel Table below, such aspersonal_visit
orvideo_teleconsultation
. -
specialist
– An object providing the ID and name of the recommended specialist. Replaces the now deprecatedrecommended_specialist
. Possible values include:id
– a unique identifier for the specialist such assp_23
orsp_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 deprecatedrecommended_channel
. Possible values include:id
– a unique identifier for the channel such aspersonal_visit
orvideo_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 ID | Specialist Name |
---|---|
sp_23 | Allergologist |
sp_21 | Angiologist |
sp_12 | Cardiologist |
sp_18 | Dentist |
sp_9 | Dermatologist |
sp_22 | Diabetologist |
sp_10 | Endocrinologist |
sp_14 | ENT doctor |
sp_5 | Gastroenterologist |
sp_1 | General Practitioner |
sp_15 | Gynecologist |
sp_25 | Hematologist |
sp_19 | Infectologist |
sp_2 | Internal Medicine Specialist |
sp_29 | Maxillofacial Surgeon |
sp_26 | Neonatologist |
sp_24 | Nephrologist |
sp_17 | Neurologist |
sp_13 | Oncologist |
sp_7 | Ophthalmologist |
sp_6 | Orthopedist |
sp_3 | Pediatrician |
sp_16 | Psychiatrist |
sp_27 | Pulmonologist |
sp_20 | Rheumatologist |
sp_4 | Surgeon |
sp_8 | Toxicologist |
sp_11 | Urologist |
Channel Table
Channel ID | Channel Name |
---|---|
personal_visit | In-person visit |
video_teleconsultation | Video consultation |
audio_teleconsultation | Audio-only consultation |
text_teleconsultation | Text-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:
{
"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 "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"],
}'
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:
{
"detail": "Survey not found"
}