Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect error thrown when validating references with only an identifier #384

Closed
mmsmits opened this issue Oct 24, 2024 · 0 comments
Closed

Comments

@mmsmits
Copy link
Member

mmsmits commented Oct 24, 2024

During testing another issue I encountered the following error:

"severity": "error",
            "code": "invariant",
            "details": {
                "coding": [
                    {
                        "system": "http://hl7.org/fhir/dotnet-api-operation-outcome",
                        "code": "1012"
                    },
                    {
                        "system": "http://fire.ly/dotnet-sdk-operation-outcome-structdef-reference",
                        "code": "DocumentReference(http://nictiz.nl/fhir/StructureDefinition/IHE.MHD.Minimal.DocumentReference).context.encounter->Reference"
                    }
                ],
                "text": "Instance failed constraint ref-1 \"SHALL have a contained resource if a local reference is provided\""
            },
            "location": [
                "DocumentReference.context[0].encounter[0], element DocumentReference(http://nictiz.nl/fhir/StructureDefinition/IHE.MHD.Minimal.DocumentReference).context.encounter->Reference"
            ],
            "expression": [
                "DocumentReference.context[0].encounter[0], element DocumentReference(http://nictiz.nl/fhir/StructureDefinition/IHE.MHD.Minimal.DocumentReference).context.encounter->Reference"
            ]

On the following resource:

{
    "resourceType": "DocumentReference",
        "id": "59d63cbb-8ba7-4b1d-86d1-dd1997232001",
        "text": {
          "status": "extensions",
          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table><caption>DocumentReference. Subject: De heer H. XXX_Mulders<span style=\"display: block;\">Auteur: Dijklander - Vakgroep Cardiologie (Cardiologie)</span></caption><tbody><tr><th>Type</th><td><span>Specialistenbrief</span></td></tr><tr><th>Geïndexeerd</th><td>2024-02-02T00:00:00+01:00</td></tr></tbody></table></div>"
        },
        "contained": [
          {
            "resourceType": "Organization",
            "id": "author",
            "name": "Dijklander - Vakgroep Cardiologie (Cardiologie)"
          }
        ],
        "masterIdentifier": {
          "system": "urn:oid:2.16.840.1.113883.2.4.3.118.2.71",
          "value": "b26acd82-6ba9-42ce-84dc-89205f65f612"
        },
        "status": "current",
        "type": {
          "text": "Specialistenbrief"
        },
        "class": {
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "52033-8",
              "display": "General correspondence attachment"
            }
          ]
        },
        "subject": {
          "reference": "urn:uuid:c5382b9c-e7f3-4b84-a0e0-53c9cfdec386",
          "display": "De heer H. XXX_Mulders"
        },
        "indexed": "2024-02-02T00:00:00+01:00",
        "author": [
          {
            "reference": "#author",
            "display": "Dijklander - Vakgroep Cardiologie (Cardiologie)"
          }
        ],
        "description": "Cardiologie: Paroxysmale atriumflutter, wv op 22-11-2023 geslaagde cardioversie,\nnadien recidief Atriumflutter met rustige ventrikelrespons, EHRA I,\ncha2ds2vasc2: 2 wv lixiana. Normale QTc na start Sotalol\n\nEr is heden sprake van een succesvolle, electieve, elektrische\ncardioversie.",
        "content": [
          {
            "attachment": {
              "contentType": "application/pdf",
              "url": "/Binary/90000280.R.HL7NL.3.118.2.71.E.b26acd82-6ba9-42ce-84dc-89205f65f612",
              "title": "Specialistenbrief"
            }
          }
        ],
        "context": {
          "encounter": {
            "identifier": {
              "system": "urn:oid:2.16.840.1.113883.2.4.3.118.2.4",
              "value": "0c0eacac-ca20-4f26-ab3b-8cc798cf41e7"
            },
            "display": "Contact: 0c0eacac-ca20-4f26-ab3b-8cc798cf41e7"
          },
          "related": [
            {
              "identifier": {
                "system": "urn:oid:2.16.840.1.113883.2.4.3.118.2.9",
                "value": "242055d4-1668-44e2-95e3-047763286785"
              }
            }
          ]
        }
}

Encounter is of type Reference, but only has an identifier set. The validator sees this as a local reference, and tries to find a contained resource, which is not there, and throws this error.

We should not try to resolve resources with just an identifier.

Note: this resource is in STU3

@mmsmits mmsmits changed the title Incorrect error thrown when validating references, with only an identifier Incorrect error thrown when validating references with only an identifier Oct 24, 2024
@mmsmits mmsmits closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant