helsenorge / structor

FHIR Questionnaire Form Builder
https://static.helsenorge.no/static_skjemabygger/
MIT License
88 stars 34 forks source link

Codes dont get included in the QuestionnaireResponse #403

Closed tarscher closed 3 years ago

tarscher commented 3 years ago

Describe the bug When adding codes to a question they don't get included in the QuestionnaireResponse

To Reproduce Steps to reproduce the behavior:

  1. Create new questionnaire with a question (eg text answer)
  2. Add one or multiple codes
  3. Click the preview and show questionnaireResponse
  4. JSON doen't contain code(s) added in line 2.

Expected behavior Codes should be included in the QuestionnaireResponse

Screenshots image image

kennethmyhra commented 3 years ago

Hi @tarscher, you are not supposed to use the Code section for your choice options. The code section corresponds to this element in the FHIR specification: http://hl7.org/fhir/questionnaire-definitions.html#Questionnaire.item.code

If you set up your question like this image

Your QuestionnaireResponse should end up with the selected option like this:

{
    "resourceType": "QuestionnaireResponse",
    "status": "in-progress",
    "item": [
        {
            "linkId": "276982e5-061e-4c28-f6d0-4a67e3f0a417",
            "text": "Test",
            "answer": [
                {
                    "valueCoding": {
                        "code": "test_code_2",
                        "display": "test_code_2",
                        "system": "urn:uuid:7eb1089a-dc21-4cfa-8e10-f6e4605e3648"
                    }
                }
            ]
        }
    ]
}
tarscher commented 3 years ago

hi @kennethmyhra , thanks for your reply.

The goal is not to add choice but indicate what the questions (item) concept is. So for example I have a question about allergy and therefor want to add to the items code allergy in both snomed and ICD9.

For clarity this is used for later processing and not to show to the user.

I think this is the proper way to use the code if I understand the documentation correctly?

Regards

kennethmyhra commented 3 years ago

Yes, you are correct, but they will not be moved to QuestionnaireResponse, they are only in Questionnaire

kennethmyhra commented 3 years ago

Just to clarify further. There are no attributes for code in QuestionnaireResponse as per the spec. The QuestionnaireResponse will only contain the answers plus linkId and the text for the answer.

I'll close this now, but feel free to reopen if you do not think this answered your question.