FHIR Chat · OperationOutcome location · questionnaire

Stream: questionnaire

Topic: OperationOutcome location


view this post on Zulip Brian Postlethwaite (Jan 11 2021 at 03:59):

When validating a QuestionnaireResponse, what is the location that is to be used in the output?
My engine has been using a location like linkId="Q1" but know this isn't really right, but since haven't been working with others not really an issue, and is quite easy to process, except where the question (or chain) has a repeating section in it.
And now that there are more players, want to get the value of this field correct, so that all can do the same thing, and when their UI is displaying errors from my server, they will be attached to the correct control(s).
Could this be to the answer, the question or the group, or any of these?
QuestionnaireResponse.item[0].item[0].answer[0].value // a specific value is wrong (e.g. date format etc)
QuestionnaireResponse.item[0].item[0].answer[0] // don't think this one can happen?
QuestionnaireResponse.item[0].item[0].answer // should this be here if there is no answer, or should that be the one below?
QuestionnaireResponse.item[0].item[0] // required field has no answer? (what would happen if the required item wasn't in the response at all?)

e.g.

{
  "resourceType": "OperationOutcome",
  "id": "$validate",
  "issue": [
    {
      "severity": "warning",
      "code": "invariant",
      "details": {
        "coding": [
          {
            "code": "inv3"
          }
        ],
        "text": "Question 3 must be answered with a3"
      },
      "diagnostics": "QuestionnaireResponse.item.item.where(linkId='Q3').answer.value = 'a3'",
      "location": [
        "linkId=\"Q3\"",
        "QuestionnaireResponse.item[0].item[2].answer[0].value"
      ]
    },
    {
      "severity": "error",
      "code": "invariant",
      "details": {
        "coding": [
          {
            "code": "inv2"
          }
        ],
        "text": "Question 2 must be answered with a2"
      },
      "diagnostics": "QuestionnaireResponse.item.item.where(linkId='Q2').answer.value = 'a2'",
      "location": [
        "linkId=\"Q2\"",
        "QuestionnaireResponse.item[0].item[1].answer[0].value"
      ]
    },
    {
      "severity": "error",
      "code": "invariant",
      "details": {
        "coding": [
          {
            "code": "inv1"
          }
        ],
        "text": "Question 1 must be answered with a1"
      },
      "diagnostics": "QuestionnaireResponse.item.item.where(linkId='Q1').answer.value = 'a1'",
      "location": [
        "linkId=\"Q1\"",
        "QuestionnaireResponse.item[0].item[0].answer[0].value"
      ]
    }
  ]
}

view this post on Zulip Brian Postlethwaite (Jan 11 2021 at 03:59):

@Paul Lynch have you attempted this area at all yet?

view this post on Zulip Brian Postlethwaite (Jan 11 2021 at 04:03):

Also we need to clarify how the location field for http://hl7.org/fhir/R4/extension-questionnaire-constraint.html is to be used (since I was using the linkID directly, wasn't an issue, but since this needs to be relative to the QR, then it kinda needs to be "re-evaluated" at some stage.

view this post on Zulip Paul Lynch (Jan 11 2021 at 18:19):

Brian Postlethwaite said:

Paul Lynch have you attempted this area at all yet?

No, I haven't. I was also having trouble finding documentation for that location field. There is one example using it on https://www.hl7.org/fhir/resource-operation-validate.html, but that is all I could find.

view this post on Zulip Brian Postlethwaite (Jan 12 2021 at 10:03):

While I'm here, I've noticed that my paths there don't have answers at all the levels, should they? I don't recall.
I know they are needed where a group repeats to hold the repitition, but otherwise?
@Lloyd McKenzie

view this post on Zulip Lloyd McKenzie (Jan 12 2021 at 16:55):

Not quite following the question...

view this post on Zulip Brian Postlethwaite (Jan 12 2021 at 22:58):

The relationship between Questionnaire and response and the item/answer pairs. (linkID in brackets to help illustration)
Questionniare.item(G1).item(G1-1).item(Q1)
=> QuestionnaireResponse.item(G1).answer.item(G1-1).answer.item(Q1).answer

view this post on Zulip Brian Postlethwaite (Jan 12 2021 at 23:29):

The likes of this example show that it doesn't need to have the extra answers for all groups.
http://hl7.org/fhir/questionnaireresponse-example-f201-lifelines.xml.html
Should we imply that this is only required where a group is repeating?

view this post on Zulip Brian Postlethwaite (Jan 12 2021 at 23:30):

Or should we just repeat the group item again in the QR. in which case, groups don't have answers.

view this post on Zulip Lloyd McKenzie (Jan 13 2021 at 04:36):

Nested items within a question must appear inside an answer. Nested items within a group appear inside the group

view this post on Zulip Brian Postlethwaite (Jan 13 2021 at 04:53):

So repeat the group item itself like this then @Lloyd McKenzie ?

QuestionnaireResponse
  .item(root)
    .item(G1-1)
      .item(Q1).answer: 'Brian'
      .item(Q2).answer: '10'
    .item(G1-1)
      .item(Q1).answer: 'Lloyd'
      .item(Q2).answer: '9'

Where the G1-1 group item is repeated for the 2 rows in the table.

view this post on Zulip Brian Postlethwaite (Jan 13 2021 at 04:55):

(If so, then this is what I've been doing, phew)

view this post on Zulip Lloyd McKenzie (Jan 13 2021 at 05:00):

y

view this post on Zulip Brian Postlethwaite (Jan 13 2021 at 05:14):

Thanks.


Last updated: Apr 12 2022 at 19:14 UTC