Rationale
This endpoint allows you to explain why a question has been selected by the inference engine. The rationale feature provides more transparency and insight into the internal logic of the question selection process. Such information can be displayed to the end-user during the interview to improve understanding and confidence.
Please note that Infermedica API's trial access allows only a limited number of calls to the /rationale
endpoint. Please contact us for other plan options.
Request
The /rationale
endpoint responds to POST requests and accepts the same JSON object as the /diagnosis
endpoint.
curl "https://api.infermedica.com/v3/rationale" \
-X "POST" \
-H "App-Id: XXXXXXXX" \
-H "App-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-H "Interview-Token: XXX.XXXXXX.XXXX" \
-d '{
"age" : {"value": 25},
"evidence" : [
{
"choice_id" : "present",
"id" : "s_44"
}
],
"sex" : "female"
}'
The example above describes the case of a 25-year-old female patient who has already reported joint pain (represented here by symptom s_44).
Response
The response is represented by a JSON object with the following attributes: type
, observation_params
and condition_params
. observation_params
and condition_params
are lists that represent either observation or condition objects.
{
"type": "r6",
"observation_params": [
{
"id": "s_44",
"name": "Joint pain",
"common_name": "Joint pain"
}
],
"condition_params": []
}
Types of rationale
type
corresponds to the question rationale and allows you to link the descriptions presented below to chosen conditions and symptoms:
r0
– I'm asking this question because a negative response reduces the probability ofcondition_params
and other conditions.r1
– I'm asking this question becauseobservation_params
might be related to one or more considered conditions.r2
– I'm asking this question because a negative response reduces the probability ofcondition_params
and other conditions.r3
– I'm asking this question to either rule in or out conditions such ascondition_params
.r4
– I'm asking this question becauseobservation_params
might be one of the causes of your symptoms.r5
– I'm asking this question because I want to know if you suffered any recent injuries.r6
– I'm asking this question to learn more about yourobservation_params
.
Extras
The extras
attribute may contain additional or experimental options that control the behavior of the inference engine. Some are only valid with custom models or selected partners.
enable_symptom_duration
Flag enable_symptom_duration
enables using a duration
object for initial evidence (observations with "source": "initial"
) in /suggest
endpoint when {"suggest_method": "symptoms"}
is used.
"extras": {
"enable_symptom_duration": true
}
A duration object is composed of two fields:
-
value
- numeric value, this attribute is required -
unit
- text value, this attribute is required and the allowed values are:week
day
hour
minute
{
...
"evidence": [
{
"id": "s_13",
"choice_id": "present",
"source": "initial",
"duration": {
"value": 2,
"unit": "day"
}
}
],
...
}