FHIR Chat · Questionnaire enableWhen with answerString · implementers

Stream: implementers

Topic: Questionnaire enableWhen with answerString


view this post on Zulip Fran del Río (Jul 26 2021 at 15:45):

Hi all. What's the correct JSON format for "enableWhen" with answerString value in Questionnaire resource? Depends it of item type? Can you give an example?

It doesn't work form me:

  "item": [{
    "linkId": "1",
  "text": "Sub-Item",
  "type": "string",
  "enableWhen": [
    {
      "question": "4",
      "operator": "=",
      "answerString": "answerString example"
    }
  ]
  }]

the return through hapi was:

"type": "string",
"enableWhen": [
{
"question": "4",
"operator": "="
}
]

without answerString :(

view this post on Zulip Lloyd McKenzie (Jul 26 2021 at 17:18):

The syntax looks right to me (though using enableWhen with strings seems odd - hopefully you're constraining the allowed values with answerOption? @James Agnew - ideas what HAPI is doing here?

view this post on Zulip James Agnew (Jul 26 2021 at 17:23):

Looks right to me. What happens if you POST it to /Questionnaire/$validate?

view this post on Zulip Fran del Río (Jul 26 2021 at 18:22):

James Agnew said:

Looks right to me. What happens if you POST it to /Questionnaire/$validate?

Hi Lloyd & James. No errors about enableWhen, only some warnings about missing system in valueCodings.
I'm attaching example json used on $validate. Can you see something wrong?

Quest-enableWhen.json

view this post on Zulip James Agnew (Jul 26 2021 at 18:32):

I just uploaded that to the HAPI FHIR public server and it stores it correctly. See: http://hapi.fhir.org/baseR4/Questionnaire/EW#L52

Maybe check that you aren't using an outdated version of HAPI or the wrong version of the FHIR models?

view this post on Zulip Fran del Río (Jul 27 2021 at 15:23):

James Agnew said:

I just uploaded that to the HAPI FHIR public server and it stores it correctly. See: http://hapi.fhir.org/baseR4/Questionnaire/EW#L52

Maybe check that you aren't using an outdated version of HAPI or the wrong version of the FHIR models?

Thanks again.

Solved! I was returning a struct from my app to hapi, instead of a JSON string. Rarely were some labels omitted for this.


Last updated: Apr 12 2022 at 19:14 UTC