FHIR Chat · validation of QRs against Questionnaires that have populate · questionnaire

Stream: questionnaire

Topic: validation of QRs against Questionnaires that have populate


view this post on Zulip Diane (Mar 15 2022 at 21:29):

Lloyd,

Can the topic of validation of QRs against Questionnaires that have populate and enableWhen expressions be added to the SDC call agenda for Thursday? I also think the topic suggested by @Eric Haas will be interesting.

I have more than enableWhen's. I also have answerExpressions for dropdowns coming from the parent Questionnaire Response which are creating messages from the IG validator.

I understand that the IG validator cannot look at the parent Questionnaire nor the parent QuestionnaireResponse. I still want to explore ideas other than the workaround of hard-coding every populate or enableWhen expression question with an initial value in order for the example QRs to meet the test of the IG validator.

If the IG validator validates the child QRs against their respective child Questionnaire, couldn't the example data be hard-coded into a variable in the child Questionnaire? Or can the IG validation code running on the child QR not see any variables in its respective Questionnaire?

Even if I have to use your workaround for the IG to be published, I think SDC needs to look at options for possible resolution because now that SDC 3.0 is published, more implementers will be using expressions in their Questionnaires and their IGs could run up against this same issue.

view this post on Zulip Paul Lynch (Mar 15 2022 at 21:39):

Is the issue that the IG validator is complaining that questions with answerExpression do not have a list?

view this post on Zulip Lloyd McKenzie (Mar 15 2022 at 22:26):

We can certainly talk about that on Thursday.
AnswerExpression is similarly not something you typically want to depend on launch context.

view this post on Zulip Diane (Mar 30 2022 at 05:51):

I am still unable to get the list of sites from the drop-down to copy from the parent questionnaire to a local questionnaire question and then from the local questionnaire question to another local question. (See Tests C1-C9 in the TestResults1 screen shot.)

I was able to get the drop down list from a local question to populate into another local question's drop down list using:

answerExpression: %questionnaire.descendants().where(linkId='mae10.1.1').answerOption.valueCoding or answerExpression: %questionnaire.descendants().where(linkId='mae10.1.1').answerOption.value

It seems that initialExpression: %questionnaire.descendants().where(linkId='mae10.1.1').answerOption.valueCoding seems to just copy in the one value "Yes" but not the whole coding.

initialExpression: %resource.descendants().where(linkId='mae10.1.1').answerOption.value doesn't work at all (Test K5)

calculatedExpression: %resource.descendants().where(linkId='mae10.1.1').answer.valueCoding only returns the value selected in the dropdown "No" but not the whole coding. (TestE3)

(See screen shots TestResults2 and TestResults3).

Ultimately, I was able to get a Yes/No drop down list to copy from the parent questionnaire to a local questionnaire questionnaire and then from a local questionnaire question to another local question.

I used answerExpression: %questionnaire.descendants().where(linkId='mae1.4').answerOption.valueCoding. answerExpression: %questionnaire.descendants().where(linkId='mae1.4').answerOption.value works as well.

See Tests R1 and R4 in the TestResults3 screen shot.

Using that same syntax for Test S1 and S4 did not result in a drop down list.

%questionnaire.descendants().where(linkId='mae4.1.1').answerOption.valueCoding.

I think that the problem is trying to bring in data from the site list from the parent questionnaire vs trying to bring in data from a Yes/No question.

Tests R1 and R4 are based on mae1.4 which gets data from the parent questionnaire via %lookupInitiateStudy.descendants().where(linkId = 'in9.1').answer.valueCoding.

Link ID in9.1 in the parent questionnaire looks very basic:

"item": [ {
"extension": [ {
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
"valueCodeableConcept": {
"coding": [ {
"system": "http://hl7.org/fhir/questionnaire-item-control",
"code": "drop-down",
"display": "Drop down"
} ],
"text": "Drop down"
}
} ],
"linkId": "in9.1",
"text": "Does this study require a FDA exemption?",
"type": "choice",
"answerOption": [ {
"valueCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0532",
"code": "Y",
"display": "Yes"
}
}, {
"valueCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0532",
"code": "N",
"display": "No"
}
} ]
}

But, the test questions like S1 and S2 and C1-C9 are based on question mae4.1.1 which gets data from the parent questionnaire via %lookupInitiateStudy.descendants().where(linkId = 'in8.9').answer.value

LinkId in8.9 in the parent questionnaire is part of a repeating group. I have attached the questionnaire definitions for link ID in8.9.

Although the child questionnaire doesn't have a problem with making an open-choice question from the parent questionnaire using answerExpression %lookupInitiateStudy.descendants().where(linkId = 'in8.9').answer.value, it doesn't seem like the local question in the child questionnaire knows what to do with a question based on this type of dynamic pick list.

The answer in the QR for link ID mae4.1.1 looks like this:

 "linkId": "mae4.1.1",
        "text": "LinkID: mae4.1.1  [Getting data from parent questionnnaire]  answerExpression:  %lookupInitiateStudy.descendants().where(linkId = 'in8.9').answer.value",
        "answer": [ {
          "valueCoding": {
            "display": "University of Nebraska Medical Center  |  Gastroenterology  |  George Garcia, MD  |  Omaha, NE"
          }
        } ]
      },

Could there be a problem with using data from mae4.1.1 in a subsequent question because there is no answer.valueCoding.code?

What do I do now?

test-questions-for-copying-answer-to-next-question.json TestResults1.png TestResults2.png TestResults3.png questionnaire-definitions-for-linkId-in8.9.txt

view this post on Zulip Lloyd McKenzie (Mar 30 2022 at 16:40):

You don't want to populate the drop-down-list from the parent into the drop-down-list for the child. You want to populate the answers of the child with the list of information from the parent. There won't be a drop-down-list for the child - it'll be open to everything. That's step one. So you need to be using the initial-value extension (not answerExpression) on the question. Once that works, we can then work on using the answers for question 1 as a dropdown for question 2.

view this post on Zulip Diane (Mar 30 2022 at 20:53):

Two questions:

  1. Does the attached Step1 Diagram.png depict what I am supposed to be doing in Step 1?

  2. Is TestA1 in Step1 Results.png initialExpression: %lookupInitiateStudy.descendants().where(linkId = 'in8.9').answer.value how a correct Step 1 will look? The form will have a blank where the answer and the drop down should be? Step1-Diagram.png Step1-Results.png

view this post on Zulip Paul Lynch (Mar 30 2022 at 20:58):

I am confused about the diagram, which seems to indicate that the list of a question in the parent questionnaire is being used in the child questionnaire. I thought it was that the answers from a question the parent questionnaire were being used as a list for a question in the child questionnaire.

view this post on Zulip Paul Lynch (Mar 30 2022 at 21:02):

Also, where you have initialExpression and the expression might provide more than one value, you probably want to set "repeats" to true.

view this post on Zulip Paul Lynch (Mar 30 2022 at 21:05):

You can remove the test cases where the expressions end in ".answer". It should be "answer.value", though LHC-Forms also handles "answer.valueCoding".

view this post on Zulip Paul Lynch (Mar 30 2022 at 21:09):

I tried replace the launchContext as the source of the parent QR with a "contained" QR with one question answered with "blue" and "green", and that seems to be working in the way I would expect:
image.png

view this post on Zulip Diane (Mar 30 2022 at 21:42):

Lloyd says:

You don't want to populate the drop-down-list from the parent into the drop-down-list for the child. You want to populate the answers of the child with the list of information from the parent.

So, I think that I need to put the site list into the answers in the child questionnaire (and not use the answerExpression). I am also not sure if I need an interim question between the question in the parent questionnaire that collects the site details to this workaround. The interim question would put the site list into a drop down list. I have attached a new diagram without an interim question. Step-1-Diagram-Version-2.png

view this post on Zulip Paul Lynch (Mar 30 2022 at 23:02):

That diagram looks like it will work, but I thought your goal was to have people select from a list of those answers in the child questionnaire. In that case, you would want a second question in the child questionnaire that uses answerExpression to create a list based on the answers from the purple question in your diagram.

view this post on Zulip Paul Lynch (Mar 31 2022 at 00:05):

I'm attaching an example based on your test form, in case that is what you meant to do. It works in the latest LHC-Forms. (https://jsfiddle.net/jp1bwouc/)
test-questions-edit.json

view this post on Zulip Paul Lynch (Mar 31 2022 at 00:10):

BTW, you might notice the example uses descendants() in the expressions rather than repeat(item) which we noted on last week's call would be more efficient. Unfortunately, while making that example, I found that fhirpath.js currently has a bug which causes an expression like %someVar.repeat(item) to destroy the value of %someVar, so descendants() is a work-around. I hope we can get a fix for that out soon.

view this post on Zulip Diane (Mar 31 2022 at 19:55):

Paul,

This helps A LOT! Many thanks!

I have taken your contained resource and replaced it with my parent questionnaire response (just item in8 which is the repeating group of sites).

See https://jsfiddle.net/o053rsdh/ which is not working.

I tested the fhirpath. See fhirpath js screen shot.png, from my page which runs fhirpath js and the fhirpath syntax seems to work. I don't know why LinkID: answersFromParentQR in the fiddle is not working.

I haven't tried to convert to repeat(item) yet. I wanted to wait until I got the syntax for this problem fixed first. fhirpath-js-screen-shot.png

view this post on Zulip Paul Lynch (Mar 31 2022 at 20:24):

The difference seems to be that your "in8.9" questions have answer.valueString instead of answer.valueCoding as in my example. I think valueString should be usable with answerExpression in a question of type open-choice, so I think is probably an LHC-Forms bug. In the parent questionnaire, what is the type of question linkId = "in8.9", and how did it come to have a valueString answer?

view this post on Zulip Diane (Mar 31 2022 at 20:49):

in8.9 is a derived (and hidden) field. It is a concatenation of the questions for the institution name. the department, the PI first name, PI last name, PI degrees, PI city and PI state, with pipe separators. It is not a code because it doesn't originate from a choice question. It comes from the repeating group (in8) where the user inputs all of the potential sites for the study being originated.

Then, in8.9 is used in all of the child forms to make the drop-down where the user selects the site that the child questionnaire pertains to.

In a future state, the candidateExpression extension would be used to list the site choices in the child questionnaires.

repeating-group-in-parent.png

child-drop-down-select-site.png

view this post on Zulip Diane (Mar 31 2022 at 21:01):

I might need an extra interim hidden question somewhere to put the sites into a dropdown using answerExpression so that they can be used in the initialExpression answersFromParentQR hidden question?

view this post on Zulip Lloyd McKenzie (Mar 31 2022 at 21:03):

No. You shouldn't have to have an initialExpression for the answers from parent. Key is that it needs to function as an 'extensible' list, or alternatively, that the expression just evaluates to what's already there.


Last updated: Apr 12 2022 at 19:14 UTC