Extract observations from questionnaire response
POST
/fhir/QuestionnaireResponse/{id}/$extractPOST
/fhir/R4/QuestionnaireResponse/{id}/$extractPOST
/fhir/R5/QuestionnaireResponse/{id}/$extractdev
https://api.sandbox.ovok.comThis endpoint builds Observations based on the provided QuestionnaireResponse.
Please use the Questionnaire/<id>/$populate endpoint to get the QuestionnaireResponse first, save it and then use the id of the saved QuestionnaireResponse in this endpoint.
Example questionnaire response resource in the database
{
"resourceType": "QuestionnaireResponse",
"status": "in-progress",
"questionnaire": "https://fhir.ovok.com/fhir/R4/Questionnaire/59d9a1ce-008c-4e4f-97fb-ef598d3f2c34|0.1.0",
"item": [
{
"linkId": "bmi-calculation",
"text": "BMI Calculation",
"item": [
{
"linkId": "bmi-result",
"answer": [
{
"valueDecimal": 32.7
}
],
"text": "Value"
},
{
"linkId": "patient-height",
"text": "Height",
"answer": [
{
"valueDecimal": 175
}
]
},
{
"linkId": "patient-weight",
"text": "Weight",
"answer": [
{
"valueDecimal": 100
}
]
}
]
}
],
"subject": {
"type": "Patient",
"reference": "Patient/1684f841-953a-41c2-a298-64af08945349"
},
"id": "example-questionnaire-response-id"
}
Given that the above questionnaire response is saved in the database, you can use the id of the questionnaire response in this endpoint to extract the Observations.
Example request
curl -X POST \
--url 'https://api.dev.ovok.com/QuestionnaireResponse/example-questionnaire-response-id/$extract' \
--header 'Authorization: Bearer example.jwt.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NzkzNTA5NzEsImV4cCI6MTc3OTM1NDU3MX0.PO6ZkOtyOEugGyNuZUyg_YxUt3ozpJ_QOdJuriC14uY'
Example response containing a bundle of Observations (wrapped in a Parameter resource)
{
"resourceType": "Parameters",
"parameter": [
{
"name": "response",
"resource": {
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "Observation"
},
"resource": {
"resourceType": "Observation",
"status": "final",
"code": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "60621009",
"display": "Body mass index"
}
]
},
"subject": {
"type": "Patient",
"reference": "Patient/1684f841-953a-41c2-a298-64af08945349"
},
"derivedFrom": [
{
"reference": "QuestionnaireResponse/26073103-8a48-4fed-8f38-b1b1e39f4083"
}
],
"valueQuantity": {
"value": 32.7
}
}
}
]
}
}
]
}
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | FHIR QuestionnaireResponse id to extract Observations (and other resources) from. |
Responses
| Code | Description |
|---|---|
200 | Success. |
400 | The request could not be operated by the server. |
401 | The resource owner or authorization server denied the request. |
404 | The requested resource could not be found. |
422 | The request could not be validated by the server. |
500 | The server encountered an unexpected condition. Please try again later. |
200 → ExtractBodyResponseDto (application/json)
resourceType:string(required)id:string(required)
Additional properties allowed.
Example
{
"resourceType": "Parameters",
"parameter": [
{
"name": "response",
"resource": {
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"request": {
"method": "POST",
"url": "Observation"
},
"resource": {
"resourceType": "Observation",
"status": "final",
"code": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "60621009",
"display": "Body mass index"
}
]
},
"subject": {
"type": "Patient",
"reference": "Patient/1684f841-953a-41c2-a298-64af08945349"
},
"derivedFrom": [
{
"reference": "QuestionnaireResponse/26073103-8a48-4fed-8f38-b1b1e39f4083"
}
],
"valueQuantity": {
"value": 32.7
}
}
}
]
}
}
]
}