Skip to main content

Report Calculations

Calculations over multiple responses.

Calculate over specific responses.

GET /api/v1/dossiers/:dossier_id/report_calculations?calculator=test&response_ids[]=1&response_ids[]=6

Calculate over responses defined by filters

GET /api/v1/dossiers/:dossier_id/report_calculations?calculator=test&filters[questionnaire_keys][]=rand361

Parameters

NameTypeDescription
dossier_idstringRequired. Unique identifier for the patient to be subscribed.
calculatorstringRequired. Name of ReportCalculator.
response_idsarray of intspecific responses to do the calculation over.
filtershashSee below. Required if no responses_ids are given.

filter attributes:

NameTypeDescription
questionnaire_keysarray of stringRequired. Keys of the questionnaires we want responses from.
completed_afterintegerUnix timestamp search for responses after this time
completed_beforeintegerUnix timestamp search for responses before this time

Success

Sample request

GET /api/v1/dossiers/:dossier_id/report_calculations?calculator=test&response_ids[]=1&response_ids[]=6
Status: 200 OK
{
"results": {
"key": "value"
},
"response_ids": [
1,
6
]
}

When validations fail

Sample request

GET /api/v1/dossiers/:dossier_id/report_calculations?calculator=test&response_ids[]=1&response_ids[]=6
Status: 422 Unprocessable Entity
{
"errors": {
"filters": {
"questionnaire_keys": [
"blank"
]
}
}
}