Question Thembelani Mlalazi · Jun 3, 2024

FHIR Deserialize JSON FHIR to object Model

I am trying to work with the FHIR Object Model where I convert an incoming  HL7v2 to SDA then FHIR. From here I would like to be able to process the FHIR Object by deserializing it to a Bundle object using the following code my problem is I keep on getting an error  which is not explaining much about what is wrong with what I am doing any help will be appreciated  thanks.

Property FHIRAdapter As HS.JSON.AdaptorFHIR;

Method OnRequest(pRequest As HS.Message.FHIR.Request, Output pResponse As HS.Message.FHIR.Response) As %Status
{

            set pmReqFHIRobj=##class(HS.FHIR.Model.Resource.Bundle).%New()
            do ..FHIRAdapter.%FromFHIRJSON(pRequest.Payload.Read(),.pmReqFHIRobj,"HS.FHIR.Model.Resource.Bundle")

}

Product version: Caché 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.4 (Build 505_1U) Thu May 28 2020 10:01:40 EDT [HealthShare Modules:Core:15.032.9035 + Linkage Engine:15.032.9035]

Comments

Enrico Parisi · Jun 3, 2024

I'd suggest to check the returned %Status from the %FromFHIRJSON() method.

Instead of:

do ..FHIRAdapter.%FromFHIRJSON(pRequest.Payload.Read(),.pmReqFHIRobj,"HS.FHIR.Model.Resource.Bundle")

Use:

set sc=..FHIRAdapter.%FromFHIRJSON(pRequest.Payload.Read(),.pmReqFHIRobj,"HS.FHIR.Model.Resource.Bundle")

Then check the status.

0
Thembelani Mlalazi  Jun 4, 2024 to Enrico Parisi

I have tried what you suggested but still getting the same error <INVALID OREF> have also checked to see if the JSON string is present and checked on the instantiated object can not pin point where the error is coming from had look here they had the same problem but my guess is we are using different versions as I don't have this class in my version  HS.FHIR.Validation.ResourceValidator

0
Enrico Parisi  Jun 4, 2024 to Thembelani Mlalazi

Does the returned sc status contains the <INVALID OREF> error?

Add this line following the one I suggested:

if $$$ISERR(sc) $$$LOGERROR($system.Status.GetErrorText(sc)

Then check the event log after calling your component and post here what you find in the event log.

0