FHIR Chat · content for the answer in the hidden item · questionnaire

Stream: questionnaire

Topic: content for the answer in the hidden item


view this post on Zulip Diane (Mar 18 2022 at 16:45):

When I am setting up a hidden question for the IG validator, what specifically should I be putting in the item?

When I create a QR (outside of the IG) for the dropdown question (created by the answerExpression), the answer in the QR is:

{
    "linkId" : "mae4.1.1",
    "text" : "If the Adverse Medical Event occurred at one of the relying sites, select the relying site in order to pre-populate the the relying institution and relying site principal investigator details below.",
    "answer" : [
        {
        "valueCoding" : {
            "display" : "Example research institution"
            }
        }
    ]
},

Am I trying to store answer.valueCoding in the hidden field?

It doesn't have the answer options, so is that going to still make the error about the answer options not being available?

Am I also supposed to put an answerExpression on the hidden question?

view this post on Zulip Lloyd McKenzie (Mar 18 2022 at 16:54):

If it gives a warning about there not being answerOptions, then you can try using an answerExpression that essentially allows anything

view this post on Zulip Diane (Mar 18 2022 at 17:15):

An answerExpression that essentially allows anything would be a regular expression that permits any type of character?

view this post on Zulip Paul Lynch (Mar 18 2022 at 18:40):

@Lloyd McKenzie A question hidden with questionnaire-hidden will still show up in the QR if it has answers. So, moving the answerExpression to a question with questionnaire-hidden will still have the same validation issue. A question hidden by skip logic (e.g. , enableWhenExpression with the expression "false") will not show in the QR, and might avoid that problem.

view this post on Zulip Lloyd McKenzie (Mar 18 2022 at 18:51):

If it's hidden by skip logic, then the answer must be removed when the QR is marked as 'complete'. I think if you set the answerExpression to be "whatever the current answers for this question are", that might work...

view this post on Zulip Paul Lynch (Mar 18 2022 at 18:54):

@Diane It would be interesting to see what the validator does without the launchContext being used by the answerExpression. You could try setting the answerExpression to pick up the answers from one of the other questions in the questionnaire (or the answerOptions), and see if that makes the warning go away. If the warning is still there, then the rearranging of the launchContext reference into a hidden question won't help (at least not with that issue).

view this post on Zulip Lloyd McKenzie (Mar 18 2022 at 19:39):

It'll help, in that it's one necessary step. But it might not make the problem go away

view this post on Zulip Diane (Mar 18 2022 at 20:44):

I think that Paul's idea is a really good test. Unfortunately, I have never had any luck getting either values or answerOptions to populate from other questions. In the past, I just gave up (see https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/answerOption.20as.20an.20expression.20result).

I know that there must be some syntax that works. Attached are my most recent tries.
The only thing that I have ever been able to get to work is converting the answer from a different question to a string via .display. But, that is not going to give me the answer choices. And, the validator is not going to like switching the item type.

trying-to-get-hidden-question-populated.png

view this post on Zulip Paul Lynch (Mar 18 2022 at 20:45):

Just to summarize the solution I think @Lloyd McKenzie is proposing:

  • launchContext variable %parentQR has the "parent" questionnaire response
  • Question A
    • hidden by skip logic so it doens't output anything in the QR and cause the same issue with the IG validator
    • initialExpression (or calculatedExpression)- copies answers from a question in %parentQR
  • Question B
    • answerExpression - gets the answers from Question A

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

Diane said:

Unfortunately, I have never had any luck getting either values or answerOptions to populate from other questions.

LHC-Forms made an assumption that if an question of type open-choice would have answers that are either Codings in the answer list, or off-list string values. We never thought there would be a way to have an off-list Coding, because, how would a user enter such a thing? I think it should NOT be difficult to support that, though.

view this post on Zulip Diane (Mar 18 2022 at 22:19):

Yes, I am following the approach recommended by Lloyd as summarized by @Paul Lynch . However, I thought that I was supposed to be hiding both the Question A getting the data from the QR via the launch Context (Question A) and the question B that gets its data locally from Question A. For now, I am not hiding anything because I need to see what is working and what is not.

Given that LHC-Forms is not currently able to get answers that are not codings, should I make Question B a string and use my one and only expression that works?

view this post on Zulip Paul Lynch (Mar 18 2022 at 23:17):

Diane said:

Given that LHC-Forms is not currently able to get answers that are not codings, should I make Question B a string and use my one and only expression that works?

I am hoping we can get a fix for this out next week. In the meantime, I am not sure what to suggest. If you can find a workaround that will make the validator happy, go for it.

view this post on Zulip Diane (Mar 18 2022 at 23:18):

Thank you!

view this post on Zulip Paul Lynch (Mar 24 2022 at 18:41):

Paul Lynch said:

Diane said:

Given that LHC-Forms is not currently able to get answers that are not codings, should I make Question B a string and use my one and only expression that works?

I am hoping we can get a fix for this out next week. In the meantime, I am not sure what to suggest. If you can find a workaround that will make the validator happy, go for it.

This should now be fixed in version 30.0.1.


Last updated: Apr 12 2022 at 19:14 UTC