Rationale

API v3 is already available!

API v3 introduces significant improvements including enhanced reasoning algorithm, which provides better diagnostic and triage accuracy. The current version API v2 will be supported for the next six months, although the medical content updates will only be continued on v3. We recommend you to adapt your application to the v3 version.

Check the API v3 migration guidelines >>

Go to the API v3 documentation >>

This endpoint allows you to explain why the given question has been selected by the reasoning engine. The rationale feature gives you more transparency and insight into the internal logic of the question selection process. Such information can be displayed to the end-user during the diagnostic interview to build better understanding and confidence.

Please note that the free trial plan of the Infermedica API allows for only a limited number of calls to the /rationale endpoint. Please contact us for other plan options.

Request

The /rationale endpoint simply responds to POST requests and accepts the same JSON object as the /diagnosis endpoint.

curl "https://api.infermedica.com/v2/rationale" \
  -X "POST" \
  -H "App-Id: XXXXXXXX" -H "App-Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
  -H "Content-Type: application/json" -d '{
        "age" : 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 can be linked to the descriptions presented below. Please note that in place of condition_params or observation_params you should insert common names of such objects:

  • r0 – I'm asking this question because a negative response reduces probability of condition_params and other conditions.
  • r1 – I'm asking this question because observation_params might be related with one or more considered conditions.
  • r2 – I'm asking this question because a negative response reduces probability of condition_params and other conditions.
  • r3 – I'm asking this question to either rule in or out conditions such as condition_params.
  • r4 – I'm asking this question because observation_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 injury.
  • r6 – I'm asking this question to learn more about your observation_params.