Each panel in the patient insights can optionally include an interpretation. The takes a script or endpoint with the aggregated data passed into it. The interpretation object looks like
Plain Text
{
script: "string",
endpoint: "string"
}
Either script or endpoint has to be set.script takes a base64 encoded script (javascript). The aggregated data is available in the script in the data variable. The result of the last statement in the script will be taken as the result.
Plain Text
// Example scriptconst interpret = () => {if (data.questionnaire_questionnaire_1_question_1[0].value < 2) {return 'low'} else if (data.questionnaire_questionnaire_1_question_1[0].value < 3) {return 'medium'} else {return 'high'}}interpret()
If endpoint is set, a POST request with the data in a JSON encoded body will be sent to the specified endpoint. The endpoint should respond with the following format:
Plain Text
{
"interpretation": string | null,
"error": string | null
}
If a non-200 status is returned this will be interpreted as an error.