FHIR Chat · contained value set validation fails · questionnaire

Stream: questionnaire

Topic: contained value set validation fails


view this post on Zulip Christian Nau (Apr 27 2021 at 13:57):

Hello!
I was trying to follow the questionnaire example here https://www.hl7.org/fhir/questionnaire-example-gcs.json.html because it defines "contained Value Sets". This is exactly what I need.
Unfortunately if I try to validate an example response against this questionnaire, it fails with the errors:
ValueSet #verbal not found by validator
ValueSet #motor not found by validator
ValueSet #eye not found by validator

Here is the example response I tried to validate:

{
    "resourceType": "QuestionnaireResponse",
    "questionnaire": "http://hl7.org/fhir/Questionnaire/gcs",
    "status": "completed",
    "subject": {
        "reference": "Patient/some-id"
    },
    "authored": "2021-04-27T13:56:24.307Z",
    "item": [
        {
            "linkId": "1.1",
            "answer": [
                {
                    "valueCoding": {
                        "system": "http://loinc.org",
                        "code": "LA6557-8"
                    }
                }
            ]
        },
        {
            "linkId": "1.2",
            "answer": [
                {
                    "valueCoding": {
                        "system": "http://loinc.org",
                        "code": "LA6563-6"
                    }
                }
            ]
        },
        {
            "linkId": "1.3",
            "answer": [
                {
                    "valueCoding": {
                        "system": "http://loinc.org",
                        "code": "LA6556-0"
                    }
                }
            ]
        }
    ]
}

What is wrong here?

view this post on Zulip Lloyd McKenzie (Apr 27 2021 at 14:05):

@Grahame Grieve

view this post on Zulip Morten Ernebjerg (Apr 27 2021 at 14:09):

I have seen smt. similar but slightly different using the validation code in HAPI (5.2. and 5.3, didn't try earlier versions): if one specifies a value set for a Questionnaire answer and make it a contained resource in the Questionnaire, the code in the QuestionnaireResponse are not checked against it (codes not in value set do not generate errors). I suppose the difference to the case above could be that HAPI only classifies the inability to find the contained value set as a warning, not an error.

view this post on Zulip Christian Nau (Apr 27 2021 at 14:15):

I'm using HAPI (Smile CDR) as well and tested Validation using {{fhir-base-url}}/QuestionnaireResponse/$validate with the above example request-body.
@Morten Ernebjerg Do I understand you correctly, that you think HAPI isn't capable of validation contained Value-Sets and therefore returns a warning?
This would not be so great, because this would mean I cannot use this approach without loosing validation for correct answers.

view this post on Zulip Christian Nau (Apr 27 2021 at 14:16):

A workaround would be to use answer-options :thinking:

view this post on Zulip Lloyd McKenzie (Apr 27 2021 at 14:27):

It should be capable.

view this post on Zulip Morten Ernebjerg (Apr 27 2021 at 14:29):

What I know is that the attached Questionnaire/QuestionnaireResponse pair (see below) does not cause a validation error in HAPI 5.2. and 5.3, though it should (I have a test that checks for this behavior so I will at least know if it starts working in later HAPI versions :smile: ). It works if the value sets are loaded separately, so that is what I do in my case (could, perhaps also be done on-the-fly).

I also asked about it in the HAPI stream (see this thread), but didn't get an answer and forgot about it again.

view this post on Zulip Christian Nau (Apr 27 2021 at 14:32):

Good to know. I will follow this thread.

Any ideas from HAPI Power-Users? @Patrick Werner :)

view this post on Zulip Oliver Egger (Apr 27 2021 at 14:36):

we had a year ago an issue that contained valuesets get dropped when they were not referenced from the questionnaire itself in hapi, could that be the issue you have? see this discussion

view this post on Zulip Christian Nau (Apr 27 2021 at 15:12):

Thank you @Oliver Egger for this share. This looked like a not-to-bad workaround. Unfortunately this didn't work for me either. Still the same error message.
Just to be clear: I used the extension only for the Questionnaire definition, not within the Response, correct?

view this post on Zulip Grahame Grieve (Apr 28 2021 at 00:09):

how do you get this error?

view this post on Zulip Grahame Grieve (Apr 28 2021 at 00:09):

e.g. what is the full validator output?

view this post on Zulip Christian Nau (Apr 28 2021 at 05:17):

@Grahame Grieve
I'm using the build in validator of HAPI (SmileCDR) which is executed when doing a POST request to this endpoint {{fhir-base-url}}/QuestionnaireResponse/$validate

The full response body looks like this (removed other warnings for clarity):

{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "warning",
            "code": "processing",
            "diagnostics": "ValueSet #verbal not found by validator",
            "location": [
                "QuestionnaireResponse.item[0].answer[0]",
                "Line 16, Col 54"
            ]
        },
        {
            "severity": "warning",
            "code": "processing",
            "diagnostics": "ValueSet #motor not found by validator",
            "location": [
                "QuestionnaireResponse.item[0].answer[0]",
                "Line 27, Col 54"
            ]
        },
        {
            "severity": "warning",
            "code": "processing",
            "diagnostics": "ValueSet #eye not found by validator",
            "location": [
                "QuestionnaireResponse.item[0].answer[0]",
                "Line 38, Col 54"
            ]
        }
    ]
}

view this post on Zulip Grahame Grieve (Apr 29 2021 at 03:07):

then you need to ask on the HAPI stream; this works as expected on the command line validator, so it has to do with how the validator is hosted in HAPI

view this post on Zulip Christian Nau (Apr 29 2021 at 07:06):

Yes, @Morten Ernebjerg already linked to this HAPI thread (see above).


Last updated: Apr 12 2022 at 19:14 UTC