FHIR Chat · Validation issues with Contained resources · implementers

Stream: implementers

Topic: Validation issues with Contained resources


view this post on Zulip Nadis Suraweera (Oct 02 2019 at 13:39):

Hi All,
When i am validating a resource against the standard profile it gives the following error which is not clear for me. seems the rule is from the Domain resource.
"If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource"

as i interpret the rule description, the contained resource should be used/referred from the container resource or Contained resource should have a reference to the container resource. In my case i have a reference ("#1") from the Container resource to the Contained resource

Simply it is a QuestionnaireResponse which refer a contained resource(PractitionerRole) as the author.
following is part from the payload that i am validating. It would be great if you can explain whether is this a bug in the FHIR validator or whether something wrong with the request body that i am sending.
Thanks for the support!

{
    "resourceType": "QuestionnaireResponse",
    "meta": {
        "profile": [
            "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"
        ]
    },
    "contained": [
        {
            "resourceType": "PractitionerRole",
            "id": "1",
            "practitioner": {
                "reference": "Practitioner/76147"
            },
            "organization": {
                "reference": "Organization/1077"
            }
        }
    ],
    "questionnaire": "http://xxxx.com/journal/template/1571",
    "status": "completed",
    "subject": {
        "reference": "Patient/1436"
    },
    "authored": "2019-10-01T14:12:00+02:00",
    "author": {
        "reference": "#1"
    },
    "item": [
        {

view this post on Zulip Lloyd McKenzie (Oct 02 2019 at 14:36):

That should work. Are you using the most recent version of the validator? What version of the spec are you validating against?

view this post on Zulip Nadis Suraweera (Oct 02 2019 at 15:12):

Hi Lloyd,
I am using R4 and i am using latest HAPI FHIR 4.0.0
then may be i should try to validate this against fhir validator released by fhir.org to see how it goes and thanks!.. i will post the result here when i am done that..

view this post on Zulip Nadis Suraweera (Oct 02 2019 at 15:57):

Thanks @Lloyd McKenzie !.. i tried the validator published by the fhir.org and it works fine and thanks for the direction.. i will report this to the hapi fhir group since it can be an issue with hapi fhir library.
Best Regards,
Nadis Suraweera


Last updated: Apr 12 2022 at 19:14 UTC