Stream: questionnaire
Topic: ElementDefinition for question pool
Eirik Myklebost (Mar 18 2021 at 09:32):
Hi.
Our use case is to request a practitioner for information regarding a patient. We would like the requester to dynamically build a Questionnaire by selecting from a pre-defined pool of questions (or groups).
After reading the spec. my understanding is that this can be done by implementing the questions as ElementDefinitions in StructureDefinitions, but there are no examples of this and I'm having a hard time understanding how this should be done.
It also seems that defining questions as ElementDefinitions is completely different to defining them inline, and that the definition-reference only represents a global-identifier, since all the question's properties still have to be added to the questionnaire (and can even be different).
Lloyd McKenzie (Mar 18 2021 at 13:29):
SDC is working to develop an operation that will allow a Questionnaire defined only with item.definition values to grab the relevant other metadata (question text, cardinality, etc.) from the associated definition and flesh out a 'full' Questionnaire. Unfortunately it (and the examples that go with it) aren't done yet.
Eirik Myklebost (Mar 18 2021 at 14:02):
I've read the SDC IG and the topics describing auto 'populate' of the QuestionnaireResponse. Auto generation/population of items from definitions in a Questionnaire is not mentioned, but this is being worked on? Do you have any links, threads or info. regarding this?
I understand that we have to implement the generation of 'full' Questionnaires from ElementDefinitions ourselves, as this is not something otherwise understood by the official validator. But I do not understand how a Question/Item should be modelled in a StructureDefinition, the only mentioning of ElementDefinition in the SD is as the type of the snapshot and differential properties, which from my understanding should be autogenerated and not edited manually.
If someone could provide me an example on how to model a question as an ElementDefinition within a StructuereDefinition as described in the spec that would be very much appreciated.
Lloyd McKenzie (Mar 18 2021 at 14:19):
"populate" is different - that's about producing a QuestionnaireResponse. The operation to 'expand' a Questionnaire currently just exists as a Jira ticket.
In terms of how to represent a Question in a structure definition, you have a choice of pointing to an element in an existing resource or profile (using [canonicalUrl]#[elementId] or possibly [canonicalUrl]|[version]#[elementId]) or of defining a logical model - which can contain any arbitrary collection of data elements you like. When you 'expand' the Questionnaire, you map elements as described here.
Eirik Myklebost (Mar 18 2021 at 15:02):
Maybe I worded myself poorly, or there is something fundamental I have misunderstood.
From the spec:
The URL refers to an ElementDefinition in StructureDefinition
Ok, if I look at the structure of the StructureDefinition I only see 2 properties of type ElementDefinition: 'snapshot' and 'differential'. Should the URL point to an entry of one of those?
The spec then goes on to provide a list of URL examples e.g.:
http://hl7.org/fhir/StructureDefinition/Observation#Observation.comment
Ok, I would expect 'comment' to be a property or the id of a property of type ElementDefinition, but it is not even part of the Observation - StructureDefinition, what does it reference?
Lloyd McKenzie (Mar 18 2021 at 15:14):
When you refer to an element, you're generally referring to the snapshot. The differential describes the differences in that element between the current model and the base.
You need to go look at the ElementDefinition data type to see 'comment' - and all of the other properties of an element
Eirik Myklebost (Mar 18 2021 at 15:33):
Ok, so the 'definition' property of an item within a Questionnaire is a reference to an entry of the 'snapshot' property of type ElementDefinition within a StructureDefinition.
But I'm still confused.
Using the provided example; http://hl7.org/fhir/StructureDefinition/Observation#Observation.comment. This would point to the 'comment' property of the Observation's ElementDefinition, which is of type 'markdown' (not ElementDefinition). Is this just a bad example when used in context of Questionnaire items?
image.png
Lloyd McKenzie (Mar 18 2021 at 15:55):
Ah, I see what you're talking about now. Yes, that example is broken. (Observation.comment got renamed to Observation.note late in the process.) Can you submit a change request for us to fix the example?
Eirik Myklebost (Mar 18 2021 at 16:19):
Sure, can do. EDIT: I do not have a Jira user and it says I need to contact an administrator. Is this something you can provide?
Back to mye original question: To create a reusable Question definition I would have to create a StructureDefinition (SD) and generate the Snapshot using e.g. Forge or Shorthand. However, what will this SD consist of? So far I've done profiling of Resources , DataTypes, and Extensions to create SDs, but how would I go about creating a SD which only purpose is to describe a general Question to be used in Questionnaires.
Lloyd McKenzie (Mar 18 2021 at 17:09):
If you go to jira.hl7.org, you should be able to register for an account. A human will review and make sure you seem like a real human being and will then approve your account.
As I said, you have a choice. You could point to an existing profile - e.g. the body temperature one in the core spec, and just refer to the Observation.value element. However, in most cases you'll probably want to define one of your own so that you can have better control over the question text (and maybe other elements). In addition to being used to define and profile resources, data types, and extensions, StructureDefinition also allows the definition of logical models. With a logical model, you're free to define whatever elements you like in what ever order or organization you wish - no need to align with any FHIR-defined data types or resources. Typically you'd define a logical model that contained all of the possible questions and then draw on those with your particular questionnaire. However, having multiple StructureDefinitions with different subsets of questions or even a separate StructureDefinition per question would also be possible.
Eirik Myklebost (Mar 18 2021 at 18:07):
Ok, I guess I will have to read up on how to define and use a LogicalModel, as this is something I am not familiar with. Once I have something representing a question I will probably post it here to maybe get some sort of feedback that I am using the spec. correctly.
Thanks a lot @Lloyd McKenzie , I very much appreciate your feedback.
Paul Lynch (Mar 18 2021 at 18:47):
Lloyd McKenzie said:
When you 'expand' the Questionnaire, you map elements as described here.
That mapping does not seem to include item.text. Where is that pulled in from?
Lloyd McKenzie (Mar 18 2021 at 20:14):
ElementDefinition.label. We have a change request to fix that in the documentation.
Eirik Myklebost (Mar 19 2021 at 09:41):
A couple of questions after having tried to create a LogicalModel and re-read the spec. with new insight.
- The spec. says that the 'item.type' should be deferred from 'ElementDefinition.type'. However, 'item.type' must be from the item-type value-set, while 'ElementDefinition.type' must be a fhir-defined-type. How would someone model e.g. a question-group or open-choice?
- I have come to realize that I probably have misread the spec.. My understanding was that when using the 'item.definition' property it MUST reference an ElementDefinition. However, am I correct to now understand that this is only a suggestion/example? The URL can be a canonical-URL identifying a definition in some proprietary format?
Paul Lynch (Mar 19 2021 at 12:08):
If you go to jira.hl7.org, you can easily request an account, but even without an account it will still let you search and browse issues. If you search for "item.definition", you will see several resolved by unapplied issues-- some might be relevant.
Regarding #2, if you do something proprietary, it won't be interoperable with other systems. (Also if, you are going to do that, it would be better to put it into a custom extension.) Issue FHIR-23765 says item.definition can also point to an ObservationDefinition (though I don't know whether that helps you).
Lloyd McKenzie (Mar 19 2021 at 13:19):
- Question groups would be elements that have child elements rather than a simple type. Choice would be elements of type code/Coding/CodeableConcept. Whether the choice is 'open' or not would be driven by the binding strength
- I don't see any language that says it can be anything else, and lots of language that's pretty clear it must be an ElementDefinition in a StructureDefinition. What are you seeing that suggests otherwise?
Eirik Myklebost (Mar 19 2021 at 14:15):
Ok, so my first interpretation was correct; it MUST be a reference to an ElementDefinition within a StructureDefinition. It is pretty clear that it should be, but I guess what made me uncertain was the examples using LOINC codes which do not directly reference ElementDefinitions.
I mentioned this in my first post, but I believe adding examples of questions defined using ElementDefinitions to the specification would be very helpful.
One more thing; how should 'item' Extensions be modeled in ElementDefinitions? 'http://hl7.org/fhir/StructureDefinition/maxValue' can be deferred from e.g. 'maxValueInteger', but what about 'http://hl7.org/fhir/StructureDefinition/questionnaire-signatureRequired' and others?
Lloyd McKenzie (Mar 19 2021 at 14:18):
At present, we don't have specific guidance on those. Probably the best solution is to allow all extensions that can appear on Questionnaire.item to also be allowed to appear on ElementDefinition. Can you submit a change request for us to update them?
Eirik Myklebost (Mar 19 2021 at 14:32):
Sure
Last updated: Apr 12 2022 at 19:14 UTC