FHIR Chat · Supporting Multiple Versions · implementers

Stream: implementers

Topic: Supporting Multiple Versions


view this post on Zulip Lakshmi Bhamidipati (Aug 07 2019 at 13:19):

We are an EHR system with a custom API that returns Model data for various resources like Patient, Appointment, Encounters, Allergies, Medications etc. We am writing a FHIR server (facade) (using HL7 .NET FHIR API) on top of our existing EHR platform to support multiple versions of FHIR resources. I am looking into the best way to convert resources from one version into another. Does anyone have a suggestion? One of the approaches that we are thinking of is to parse a json of a previous version using FhirJsonParser and then populate the new/changed fields instead of mapping all the fields for each of the versions. (var parser = new FhirJsonParser(new ParserSettings { AcceptUnknownMembers = true, AllowUnrecognizedEnums = true });
try
{
previous = parser.Parse<Bundle>(previousVersion.ToString(Formatting.None));
}
) . This approach throws an exception when the field names are the same in both the versions, but the type is different. For instance, in STU3, the verificationStatus and clinicalStatus of an AllergyIntolerance resource is of type Code, however in R4, it is of type CodeableConcept. When I try to parse STU3 resource in R4 environment, I get an exception –
“Type checking the data: Since type CodeableConcept is not a primitive, it cannot have a value"
Is there a better way to handle supporting multiple versions? Or is there another flag in parsersettings to ignore exceptions and setting the fields with exceptions to NULL so that we can map and update just those fields? Thanks!

view this post on Zulip Michele Mottini (Aug 07 2019 at 13:48):

I think you should map your underlying data model separately to each FHIR version you want to support: different FHIR version added / removed elements, so it might well happen that you have something in your data model that can be mapped only for certain specific FHIR versions - and you cannot do that if you go first to a fixed FHIR version

view this post on Zulip Michele Mottini (Aug 07 2019 at 13:48):

(this is what we did in our system that supports DSTU2, STU3 and R4)

view this post on Zulip Lloyd McKenzie (Aug 07 2019 at 14:27):

The FHIR StructureMap resource may be helpful to you if you don't want to do it in code. (Though in practice, the FHIR mapping language is just code in a different language...)


Last updated: Apr 12 2022 at 19:14 UTC