Replies: 2 comments
-
1 Option: Store answers in a listAll answers stored in a list. [{:id "body-height"
:text "Body Height"
:value 180
:unit "cm"},
{:id "body-weight"
:text "Body Weight"
:value 80
:unit "kg"}] how to handle nested and repeated questionsRepeated values placed in the same list (like in QuestionnaaireResponse). [{:id "blood-pressure-systolic"
:text "Blood Pressure Systolic"
:value 80
:unit "mmHg"},
{:id "blood-pressure-systolic"
:text "Blood Pressure Systolic"
:value 85
:unit "mmHg"}] Nested values places under [{:id "blood-pressure"
:text "Blood Pressure"
:item [{:id "blood-pressure-systolic"
:text "Systolic"
:value 85
:unit "mmHg"}]}] how to query, anaslyse and manage data (SQL, code)?To query data is not straightforward, because of array structure select qr.id
from questionnaireresponse qr,
jsonb_array_elements(resource->'item') item
where item->>'linkId' = 'body-weight'
and (item#>>'{answer,0,value,Quantity,value}')::int > 80 When answer is placed deeper in a tree then SQL is more complex. we need to traverse every level select qr.*
from questionnaireresponse qr,
jsonb_array_elements(resource->'item') item,
jsonb_array_elements(item->'item') item2
where item->>'linkId' = 'blood-pressure'
and item2->>'linkId' = 'systolic'
and (item2#>>'{answer,0,value,Quantity,value}')::int > 200 Analysis is also more difficult with this structure. To get and update data in a code is also not a straightforward. (assoc-in qr (find-item-address qr :blood-pressure) new-value)
(get-in qr (find-item-address qr :blood-pressure)) This format requires more effort to work with how to simplify data conversion to
|
Beta Was this translation helpful? Give feedback.
-
2 Option: Store answers in a mapAll answers stored in a map. {:body-height {:text "Body Height"
:value 180
:unit "cm"}
:body-weigth {:text "Body Weight"
:value 80
:unit "kg"}} how to handle nested and repeated questionsRepeated values will be stored in a list under the map. {:blood-pressure-systolic [{:text "Blood Pressure Systolic"
:value 80
:unit "mmHg"},
{:text "Blood Pressure Systolic"
:value 85
:unit "mmHg"}]} nested values can be stored in a nested map under [{:blood-pressure {:text "Blood Pressure"
:item {:systolic {:text "Systolic"
:value 85
:unit "mmHg"}}}}] how to query, anaslyse and manage data (SQL, code)?select id from sdcdocument
where (resource#> '{body-weight,value}')::int > 80 For more nested data - query is not become more complex select * from sdcdocument
where (resource#> '{blood-pressure,items,systolic,value}')::int > 200 In a code is simplest solution - we can use our build-in functions to get and update the data (assoc-in qr [:blood-pressure :items :systolic] new-value)
(get-in qr [:blood-pressure :items :systolic]) But in this way we need to know full path to a data (don't just a how to simplify data conversion to
|
Beta Was this translation helpful? Give feedback.
-
Description
Form is a list of questions grouped together around specific problem.
Form is used to capture data from respondents (patients,practitioners, etc...).
When respondents fill out the form the answers should be stored in a database.
The format in which answers are stored is very important - that affects the usability and accessibility of that data.
FHIR already has an answer for the question - it has QuestionnaaireResponse resource in which
answers stored as a list of JSON objects.
Example:
In our current
Aidbox Forms
we have used a nested map with stripped values.Both variants has it's pros and cons. We need to test these options against our questions.
Form DSL
metadata?FHIR
/QuestionnaireResponse
?QuestionnaireResponse
?Problem
Find a solution that more appropriate according our questions
Use Cases
Options
Decision matrix
Call for action
You can read more about options in next comments.
Please give your feedback - what do you think
or just vote for the comment with emoji or "up" button.
Beta Was this translation helpful? Give feedback.
All reactions