· Sep 2

How to convert JSON data to FHIR Object


Here are the requirements for implementing a new project using FHIR and JSON.

The FHIR JSON resource types - Patient, Encounter, etc. - need to be converted to HL7 messages using DTL.

Does %JSONImport() allow direct conversion of JSON into HS.SDA3.Patient objects?

Could anyone suggest an easy way to convert FHIR objects for DTL use?

Product version: IRIS 2020.1
Discussion (6)5
Log in or sign up to continue

AFAIK No. There is no straightforward way to import JSON from FHIR discrete resources to SDA3 objects by %JSONImport(). Basically, there are various stages involved in converting the FHIR to HL7 and vice versa. To achieve this, Intersystems created an intermediary format called SDA. However, there are more processes involved whenever convert the bundle or discrete resource.
for example

  1. In some instances, the FHIR resource data element name (property) is not the same as the SDA property.
  2. Lots of internal DTL's are invoked or invoked at the conversion time, and an SDA object is created based on that output. Typically it's common for SDA to FHIR and vice versa. 
  3. DTL's are crucial to accomplish this conversion. Some of the data elements are not mapped in the standard FHIR to SDA or SDA to FHIR DTL transformation. HS.FHIR.DTL.vR4.SDA3.AllergyIntolerance.Allergy in this DTL the "criticality" data element is not mapped with SDA object In this case you should create your custom DTL from the already implemented DTL to convert the values to object. So If you haven't added this type of additional properties in the SDA extension class, it won't work.
  4. Metadata values and lookup tables vary from SDA to FHIR. SDA has 'A' in the lookup tables for some fields, while FHIR has 'Active'. There is a internal validation runs against every data element to verify the generated FHIR resource Every time