Report Calculations
Not yet fully verified
This content is not available in your language yet.
Calculations over multiple responses.
Section titled “Calculations over multiple responses.”Calculate over specific responses.
Section titled “Calculate over specific responses.”GET /api/v1/dossiers/:dossier_id/report_calculations?calculator=test&response_ids[]=1&response_ids[]=6Calculate over responses defined by filters
Section titled “Calculate over responses defined by filters”GET /api/v1/dossiers/:dossier_id/report_calculations?calculator=test&filters[questionnaire_keys][]=rand361Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
dossier_id |
string |
Required. Unique identifier for the patient to be subscribed. |
calculator |
string |
Required. Name of ReportCalculator. |
response_ids |
array of int |
specific responses to do the calculation over. |
filters |
hash |
See below. Required if no responses_ids are given. |
filter attributes:
Section titled “filter attributes:”| Name | Type | Description |
|---|---|---|
questionnaire_keys |
array of string |
Required. Keys of the questionnaires we want responses from. |
completed_after |
integer |
Unix timestamp search for responses after this time |
completed_before |
integer |
Unix timestamp search for responses before this time |
Success
Section titled “Success”Sample request
GET /api/v1/dossiers/:dossier_id/report_calculations?calculator=test&response_ids[]=1&response_ids[]=6 HTTP/1.1Host: api.example.comAuthorization: Bearer YOUR_API_TOKENDOSSIER_ID="your_dossier_id"curl "https://api.example.com/api/v1/dossiers/$DOSSIER_ID/report_calculations?calculator=test&response_ids[]=1&response_ids[]=6" \ -u "username:password"$username = "username"$password = "password"$dossierId = "your_dossier_id"$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password)))
$headers = @{ "Authorization" = "Basic $base64AuthInfo"}
Invoke-RestMethod -Uri "https://api.example.com/api/v1/dossiers/$dossierId/report_calculations?calculator=test&response_ids[]=1&response_ids[]=6" ` -Method GET ` -Headers $headers{ "results": { "key": "value" }, "response_ids": [ 1, 6 ]}When validations fail
Section titled “When validations fail”Sample request
GET /api/v1/dossiers/:dossier_id/report_calculations?calculator=test&response_ids[]=1&response_ids[]=6 HTTP/1.1Host: api.example.comAuthorization: Bearer YOUR_API_TOKENDOSSIER_ID="your_dossier_id"curl "https://api.example.com/api/v1/dossiers/$DOSSIER_ID/report_calculations?calculator=test&response_ids[]=1&response_ids[]=6" \ -u "username:password"$username = "username"$password = "password"$dossierId = "your_dossier_id"$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password)))
$headers = @{ "Authorization" = "Basic $base64AuthInfo"}
Invoke-RestMethod -Uri "https://api.example.com/api/v1/dossiers/$dossierId/report_calculations?calculator=test&response_ids[]=1&response_ids[]=6" ` -Method GET ` -Headers $headers{ "errors": { "filters": { "questionnaire_keys": [ "blank" ] } }}