Referential Integrity from Procedure to Observation in bundle.

44 views
Skip to first unread message

Michal Kormaňák

unread,
Feb 25, 2021, 9:12:16 AM2/25/21
to HAPI FHIR
Hi guys,

I attached example bundle with wrong Observation reference in Procedure resource. I tried to upload this attached bundle to the public Fhir hapi server. 
For version DSTU2 and DSTU3 is possible upload Procedure which reference non-existing Observation, but for version R4 upload fail like expected.

{
    "resourceType": "OperationOutcome",
    "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>Resource Observation/O40NonExist not found, specified in path: Procedure.reasonReference</pre></td>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
    },
    "issue": [
        {
            "severity": "error",
            "code": "processing",
            "diagnostics": "Resource Observation/O40NonExist not found, specified in path: Procedure.reasonReference"
        }
    ]
}


I also tried running hapi-server locally but the result was same.

Enviroment:

Hapi version: 5.3.0

OS: W10


Do you know why is possible upload bundle in version Dstu2 and Dstu3 with non-existing Observation reference in Procedure resource ? 

It should fail like in version R4.


With Regards & Thanks

Michal,


Bundle_NonExist_Observation_Ref.txt

Michal Kormaňák

unread,
Mar 1, 2021, 10:51:59 AM3/1/21
to HAPI FHIR
Hi guys,

 I am little confused how to work "reference" properties in fhir resources because sometimes when I try reference non-existing resource fhir server check if referenced resource exist and if not return suitable response. This is correct.
However I found cases when referential integrity is not check.

For example:
Work incorrectly
Bundle was uploaded but referential integrity rules were violated because Organization doesn't exist.
 "contact": [
          {
            "organization": {
              "reference": "Organization/NonExist45"
            }
          }
        ]

Work properly
Upload fail like expected because we reference non-existing Organization resource.
"managingOrganization": [
          {
            "reference": "Organization/NonExist45"
          }
        ]

Testing enviroment:

Result
In my assumption current implementation of Hapi server doesn't check referential integrity for each possible cross references that FHIR standard support.

Michal,

Dátum: štvrtok 25. februára 2021, čas: 15:12:16 UTC+1, odosielateľ: Michal Kormaňák
Reply all
Reply to author
Forward
0 new messages