QuestionnaireResponse
QuestionnaireResponses are an essential part of Atticus. On this page, we'll dive into the different QuestionnaireResponse endpoints you can use to manage responses programmatically. We'll look at how to query, create, update, and delete responses.
The QuestionnaireResponse model
The QuestionnaireResponse model contains all responded answers to a questionnaire.
Properties
The QuestionnaireResponse model conforms to the FHIR QuestionnaireResponse resource. The following properties are available:
- Name
resourceType*- Type
- 'QuestionnaireResponse'
- Description
The FHIR resource type. This must be set to
'QuestionnaireResponse'.
- Name
questionnaire*- Type
- Canonical
- Description
A FHIR
Canonicalurl to the corresponding questionnaire (the form definition). For questionnaires (='templates') designed in Atticus Designer, this url will start withhttp://templates.tiro.health/templates/. Optionally, a version can be specified by appending|<version>to the url. This allows you to specify a specific version of the questionnaire:http://templates.tiro.health/templates/unreadable-unique-id|1.0.1.
- Name
identifier- Type
- Identifier[]
- Description
An array of
Identifierobjects for this questionnaire response. More information about identifiers in Atticus can be found here.
- Name
status*- Type
- enum
- Description
The status of the response. Possible values are:
in-progress(most common)completedamendedentered-in-error
Create a new QuestionnaireResponse
This endpoint allows you to create a new QuestionnaireResponse.
Posting a QuestionnaireResponse whose identifier already exists returns 409 Conflict with issue code conflict. Unlike other resources, no Location header is returned and the issue code is not duplicate.
Request
curl -X POST https://reports.tiro.health/fhir/r5/QuestionnaireResponse \
-H "Authorization: Basic {{apikey}}" \
-H "Content-Type: application/fhir+json" \
-d '{
"resourceType": "QuestionnaireResponse",
"questionnaire": "http://templates.tiro.health/templates/unreadable-unique-id|1",
"status": "in-progress",
"identifier": [
{
"system": "http://example.com/my-hospital-reports/",
"value": "123"
}
],
"subject": {
"reference": "Patient/123"
},
"encounter": {
"reference": "Encounter/456"
}
}'
Response
{
"resourceType": "QuestionnaireResponse",
"id": "1",
"questionnaire": "http://templates.tiro.health/templates/unreadable-unique-id|1.0.1",
"status": "in-progress",
"identifier": [
{
"system": "http://example.com/my-hospital-reports/",
"value": "123"
}
],
"subject": {
"reference": "Patient/123"
},
"encounter": {
"reference": "Encounter/456"
}
}
Get an existing QuestionnaireResponse
This endpoint allows you to retrieve an existing QuestionnaireResponse by providing the QuestionnaireResponse id.
Request
curl -G https://reports.tiro.health/fhir/r5/QuestionnaireResponse/1 \
-H "Authorization: Basic {{apikey}}" \
-H "Content-Type: application/fhir+json" \
Response
{
"resourceType": "QuestionnaireResponse",
"id": "1",
"questionnaire": "http://templates.tiro.health/templates/unreadable-unique-id|1.0.1",
"status": "in-progress",
"identifier": [
{
"system": "http://example.com/my-hospital-reports/",
"value": "123"
}
],
"subject": {
"reference": "Patient/123"
},
"encounter": {
"reference": "Encounter/456"
}
}
Delete an existing QuestionnaireResponse
This endpoint allows you to delete an existing QuestionnaireResponse by providing the QuestionnaireResponse id. Once a QuestionnaireResponse is deleted, it cannot be recovered.
A successful deletion returns 204 No Content with an empty body.
Only the author (the API key or user that created the response) may delete it. Requests from anyone else return 403 Forbidden. If the response is still referenced by another resource (for example as a Task output), the deletion returns 409 Conflict.
Request
curl -X DELETE https://reports.tiro.health/fhir/r5/QuestionnaireResponse/1 \
-H "Authorization: Basic {{apikey}}" \
-H "Content-Type: application/fhir+json" \
Response
HTTP/1.1 204 No Content
Special considerations in Response
A QuestionnaireResponse resource has some special response body properties that you should be aware of.
Versioning info
The questionnaire property of the response body contains the canonical reference to the corresponding questionnaire (the form definition).
The full version is always appended in the response.
When sending a request with a partial version:
{
"resourceType": "QuestionnaireResponse",
//...
"questionnaire": "http://templates.tiro.health/templates/unreadable-unique-id|1"
//...
}
you will receive aresponse with a full version
{
"resourceType": "QuestionnaireResponse",
//...
"questionnaire": "http://templates.tiro.health/templates/unreadable-unique-id|1.0.1"
//...
}