FHIR Chat · Extracting multiple resources (definition-based) · questionnaire

Stream: questionnaire

Topic: Extracting multiple resources (definition-based)


view this post on Zulip Jing Tang (Aug 11 2021 at 14:32):

In a questionnaire we have a multiple choice question with repeated answers. We want to extract a separate Observation resource for each answer selected. For example, the user may select 'cough' and 'high blood pressure' and two Observations should be extracted with the respective codes. We have found this difficult to do using definition-based extraction. 2 ideas: 1) separate each answer option as a single question with a check box with a nested hidden group which has a separate extraction context and includes code to be extracted 2) use enable when to enable separate hidden groups that include separate extraction context and code. Are we on the right track? Any comments / additional ideas? Is structure map recommended for cases like this that are slightly complicated. @Fred Hersch @santosh pingle

view this post on Zulip Lloyd McKenzie (Aug 11 2021 at 15:19):

Why are you having issues with definition-based extraction? It should just be a matter of applying the mechanism once for each answer...

view this post on Zulip Jing Tang (Aug 11 2021 at 17:34):

Because definition-based extraction relies on setting context for each expected resource, when we expect each answer to create a new resource, we need to create the hidden groups to make it work. Is there a better way of doing this? Are 1) and 2) as I mentioned reasonable approaches?

view this post on Zulip Lloyd McKenzie (Aug 11 2021 at 18:21):

The context would presumably be the same for each - same patient, same observation code, same effective time, etc. You'd just instantiate the definition information multiple times - once for each value.

view this post on Zulip Lloyd McKenzie (Aug 11 2021 at 18:22):

It may be that we should make that expectation explicit in the SDC documentation - feel free to submit a change request.

view this post on Zulip Jing Tang (Aug 12 2021 at 07:35):

No the observation code would not be the same -- they are different conditions. Imagine a check box list with different symptoms.

view this post on Zulip Jing Tang (Aug 12 2021 at 07:41):

@Aditya K

view this post on Zulip Lloyd McKenzie (Aug 12 2021 at 14:17):

Well, either the Observation.code would be the same ("diagnosis") or the Observation.value would be the same ("present"), depending on how you break them down.

view this post on Zulip Lloyd McKenzie (Aug 12 2021 at 14:17):

Alternatively use Condition.

view this post on Zulip Jing Tang (Aug 13 2021 at 08:09):

Sorry I'm a bit confused. Because these are different symptoms, we want to use different codes (e.g. cough, shortness of breath, etc) in whatever resource we use (either Observation or Condition). So at the very least we need to have different hidden groups with nested hidden questions with initial answers being set to these different codes. And these hidden groups would only be activated(EDIT: enabled) with certain answers given to the multiple choice question. Are you suggesting something different to this?

view this post on Zulip Lloyd McKenzie (Aug 13 2021 at 14:08):

Are your answer values not the codes themselves?

view this post on Zulip Fred Hersch (Aug 16 2021 at 00:40):

Thanks @Lloyd McKenzie . Here is an example that @Jing Tang is referring too. We want to be able to have a multi-select set of check-boxes to indicate the presence of different symptoms as part of a screener type questionnaire. Here we are following the pattern (for option 3 or 4) here - https://www.hl7.org/fhir/observation.html#code-interop

Here is an example of the Questionnaire Item and the output. We are not sure how to implement the correct definition extraction queries to be able to achieve a situation where if you select multiple choices, for each an Observation resource will be created where:

In this scenario you only create resources for those that have been selected:

  • Observation.code = valueCoding of the answerSelected
  • Observation.value = valueBoolen(true) - to indicate present
"item": [
        {
          "text": "In the past two weeks have you experienced ANY of these symptoms?",
          "type": "choice",
          "linkId": "1.1.0",
          "repeats": true,
          "answerOption": [
            {
              "valueCoding": {
                "code": "386661006",
                "display": "Fever",
                "system": "http://snomed.info/sct"
              }
            },
            {
              "valueCoding": {
                "code": "13645005",
                "display": "Shortness of breath",
                "system": "http://snomed.info/sct"
              }
            },
            {
              "valueCoding": {
                "code": "49727002",
                "display": "Cough",
                "system": "http://snomed.info/sct"
              }
            },
            {
              "valueCoding": {
                "code": "44169009",
                "display": "Loss of smell",
                "system": "http://snomed.info/sct"
              }
            }
          ]
        }
      ]
    },

In this scenario, for each of the symptoms selected, we will create an Observation resource where the Observation.code = [value of the selected valueCoding] and the Observation.value = valueBoolen (to indicate present or not). For cough this would look like:

{
"resourceType": "Observation",
 "id": "78354025-1059-4f0f-8b04-8478d696d234",
  "issued": "1990-03-12T09:04:10.192-05:00",
  "meta": {
    "lastUpdated": "2021-04-01T12:45:31.338652+00:00",
    "versionId": "MTYxNzI4MTEzMTMzODY1MjAwMA"
  },
  "status": "final",
  "category": [
    {
      "coding": [
        {
          "code": "exam",
          "display": "symptoms",
          "system": "http://terminology.hl7.org/CodeSystem/observation-category"
        }
      ]
    }
  ],
  "code": {
    "coding": [
      {
        "code": "49727002",
        "display": "Cough",
        "system": "http://loinc.org"
      }
    ],
    "text": "Cough"
  },
  "effectiveDateTime": "1990-03-12T09:04:10-05:00",
  "encounter": {
    "reference": "Encounter/<encounter_id>"
  },
  "subject": {
    "reference": "Patient/<patient_id>"
  },
  "valueBoolean": {
   "value" : "true"
  }
}

view this post on Zulip Lloyd McKenzie (Aug 16 2021 at 13:22):

Observation-based extraction is not designed for situations where the answer goes in the Observation.code and the Observation.value is fixed to true. Observation.value is used for situations where the Observation.code comes from item.code and Observation.value comes from item.answer.value[x]. To do what you want, you'll have to use definition-based extraction.

view this post on Zulip Jose Costa Teixeira (Aug 16 2021 at 20:10):

I think the question is how can that work with the definition-based extraction.
Observation-based is too limited, which is one reason I presume Jing has gone directly to definition-based extraction

view this post on Zulip Lloyd McKenzie (Aug 16 2021 at 22:18):

@Brian Postlethwaite, have you encountered this?

view this post on Zulip Brian Postlethwaite (Aug 16 2021 at 22:22):

That doesn't feel like definition would be expressive enough for that either.
I've done multiple resources from different sections of a questionnaire, not from one question to multiple.

view this post on Zulip Jing Tang (Aug 17 2021 at 11:21):

thanks @Brian Postlethwaite! the approach we have taken is using enableWhen + hidden groups, so that groups are enabled (but remain hidden) with certain answers being present in the multiple choice question... this requires each hidden group to have a separate context and is slightly fiddly. but seems to work. not sure if there's a better approach -- we can also explore structure map (which we have a prototype) but we will need to author the structure map.


Last updated: Apr 12 2022 at 19:14 UTC