FHIR Chat · Representing Complex DataTypes in defintion-based extraction · implementers

Stream: implementers

Topic: Representing Complex DataTypes in defintion-based extraction


view this post on Zulip Gabriela Brown (Nov 20 2019 at 00:00):

Definition-based extraction directs us to "fill in the Questionnaire.definition to point to the resource or profile element that Questionnaire item corresponds to ... The definition SHALL have the full canonical URL of the resource (or profile) followed by '#' followed by the snapshot.path of the element the Questionnaire item corresponds to."

This makes sense to me with Patient.active, for example:

{
  "resourceType": "Questionnaire",
  "extension": [
    {
      "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext",
      "valueExpression": {
            "expression": "Patient",
            "language": "application/x-fhir-query"
          }
    }
  ],
  "item": [
    {
      "linkId": "patient-active",
      "definition": "http://hl7.org/fhir/StructureDefinition/Patient#Patient.active",
      "type": "boolean",
      "required": false,
      "repeats": false
    }
  ]
}

But I'm not sure what to do in the case of Patient.name. The complex data type HumanName doesn't have a direct mapping to an available item.type, and would require several pieces of information to answer anyways. But the snapshot.path on Patient doesn't go into the fields of HumanName, so we shouldn't (?) reference these from a Patient definition path:

{
  "id" : "Patient.name",
  "path" : "Patient.name",
    ...
  "min" : 0,
  "max" : "*",
  "base" : {
    "path" : "Patient.name",
    "min" : 0,
    "max" : "*"
  },
  "type" : [{
    "code" : "HumanName"
  }],
    ...
}

Does it make sense to do something like map the complex type to a "group", and then have the nested questions specify definitions on the complex type definition? e.g.

{
  "resourceType": "Questionnaire",
  "extension": [
    {
      "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemContext",
      "valueExpression": {
            "expression": "Patient",
            "language": "application/x-fhir-query"
          }
    }
  ],
  "item": [
    {
      "linkId": "patient-name",
      "definition": "http://hl7.org/fhir/StructureDefinition/Patient#Patient.name",
      "type": "group",
      "repeats": false,
      "item": [
        {
          "linkId": "humanname-given",
          "definition": "http://hl7.org/fhir/StructureDefinition/HumanName#HumanName.given",
              "type": "string",
              "required": "false",
              "repeats": "true
        },
        ...
      ]
    }
  ]
}

It's still unclear how you would designate a complex type element as required with this set up, because what does it mean for a group to be "required"?

Thoughts?

view this post on Zulip Grahame Grieve (Nov 20 2019 at 04:50):

if you want to pre-populate like this, I think you need to use the SDC facilities around variables

view this post on Zulip Gabriela Brown (Nov 20 2019 at 18:27):

In this case I'm not trying to pre-populate a QuestionnaireResponse item with initialValue or initialExpression, I still want the user to supply the information that goes into the Patient.name element. I guess another way of phrasing is, "how would I write a Questionnaire such that when definition-based extraction is run on a completed QuestionnaireResponse, an element with a complex type like Patient.name can be captured?"

view this post on Zulip Lloyd McKenzie (Nov 20 2019 at 18:56):

You'd have to break it into multiple questions and the population process would map those into the individual elements

view this post on Zulip Gabriela Brown (Nov 21 2019 at 03:15):

What definition path would you put on the item that's collecting a value for Patient.name.family?

view this post on Zulip Grahame Grieve (Nov 21 2019 at 05:21):

that path

view this post on Zulip Gabriela Brown (Nov 21 2019 at 19:17):

Right, this totally makes sense as a way to refer to that element, but it's not a snapshot path, is it? Or if it is, where is snapshot path defined? I'm taking it to mean a path that exists on a snapshot element of a resource StructureDefinition, which Patient.name.family is not.

Thank you for being patient with me :)

view this post on Zulip Grahame Grieve (Nov 22 2019 at 05:45):

@Lloyd McKenzie why did we say 'snapshot' path? I can't think that this is useful - all it can do is confuse people like this?

view this post on Zulip Lloyd McKenzie (Nov 22 2019 at 06:23):

Perhaps to reflect that you have access to all of the paths in the snapshot, not just the differential? Given you can drill deeper than the snapshot, agree it's confusing.

view this post on Zulip Grahame Grieve (Nov 22 2019 at 08:12):

guess we should make a task to clarify that then

view this post on Zulip Lloyd McKenzie (Nov 22 2019 at 11:28):

@Gabriela Brown Are you able to submit a change request asking us to clarify the current language?

view this post on Zulip Gabriela Brown (Nov 22 2019 at 19:19):

yep, will do! Thanks, this is helpful.

view this post on Zulip Gabriela Brown (Nov 22 2019 at 19:44):

Hm, so I was just reading https://www.hl7.org/fhir/questionnaire.html#definition, which has some relevant info that I'll include in the ticket but think is worth posting here too:

"The url refers to an ElementDefinition in StructureDefinition, and always starts with the canonical URL for the target resource. When referring to a StructureDefinition, a fragment identifier is used to specify the element definition by its id (Element.id). E.g. http://hl7.org/fhir/StructureDefinition/Observation#Observation.value[x]. In the absence of a fragment identifier, the first/root element definition in the target is the matching element definition."

This "fragment identifier" isn't really mentioned anywhere else in the specification that I can find, but suggests constraining to the "snapshot path" as well.


Last updated: Apr 12 2022 at 19:14 UTC