Written by

Developer at NestorIT GmbH
Question Sebastian Thiele · May 31, 2023

Serialize FHIR Json content to ISC model class

Hi all,

I am looking for a way to serialize fhir content received via interoperability adapter into it´s corresponding ISC model class (e.g. HS.FHIR.DTL.vR4.Model.Resource.DiagnosticReport) for later use. In my opinion the outline to accomplish this would be something like

1) Receive the FHIR data
2) Get quick stream containing the JSON data
3) Examine if bundle or single ressource
4) For resource serialize to coressponding model class (HS.FHIR.DTL.vR4.Model.Resource.*)
5) further use of newly created object of type HS.FHIR.DTL.vR4.Model.Resource.*

Of course something like set tObj = {}.%FromJSON(stream) would create a dynamic but untyped object.

Has anyone an idea on how to implement this?

best regards,
Sebastian

Product version: IRIS 2022.1

Comments

Thembelani Mlalazi · Jun 1, 2023

I will do it like so:

set tObj = {}.%FromJSON(stream)

set newObj=##class(HS.FHIR.DTL.vR4.Model.Resource.*).%New()

set newObj.Property=tObj.SameProperty

do newObj.%Save()

0
Steve Pisani  Jun 2, 2023 to Thembelani Mlalazi

Hi,

My understanding is that these classes: HS.FHIR.DTL.vR4.Model.Resource.*

Are internal for DTL purposes only, and not to be used for serialisation or creation of some type of repository of resources. For that, one should use the FHIR Repository, (and FHIR SQL Builder for SQL query of resources).

Happy for product management/developers to chip in here and confirm.

Steve

0
Sebastian Thiele · Jun 2, 2023

Hi,

solution in my case was to use HS.FHIR.DTL.Util.JSON.Adapter with method FromJSON(stream, fhirVersion) which returns me the filled in model for my fhir resource data.

best regards,
Sebastian

0