FHIR Chat · Resource conversion · javascript

Stream: javascript

Topic: Resource conversion


view this post on Zulip Patrick Narkinsky (Jul 13 2021 at 11:53):

Has anybody tried to do FHIR resource conversions (e.g. from dstu2 to r4) in Javascript? I've found this npm that could perhaps be used together with the version mappings in the specs (https://github.com/Vermonster/fhir-kit-mapping-language/blob/master/README.md) but was wondering if there was anything that would be more of a drop-in module for converting dstu2 and stu3 resources to r4?

view this post on Zulip Brian Kaney (Jul 13 2021 at 16:47):

Hi @Patrick Narkinsky - This was an early prototype, and was a bit misguided. Instead of using actual FHIR StructureMap as the abstract syntax, this attempted to directly use the generated AST from the mapping concrete syntax, to evaluate mappings.

I think it could be useful to have a JS/Typescript Mapping Engine (using FHIR StructureMap as the abstract syntax), but re-written from the ground up. In the meantime, we have been using and building our own more template-based approaches -- such as https://github.com/microsoft/FHIR-Converter

view this post on Zulip Brian Kaney (Jul 13 2021 at 16:49):

(such an engine would also be useful for apps needing to support more advanced SDC and $apply translations)

view this post on Zulip Abbie Watson (Sep 13 2021 at 16:31):

Patrick Narkinsky said:

Has anybody tried to do FHIR resource conversions (e.g. from dstu2 to r4) in Javascript?

The fhir-starter library has a FhirDehydrator object that does FHIR resource conversions from any resource version into a flattened display object for UI rendering.
https://github.com/symptomatic/fhir-starter/blob/master/src/FhirDehydrator.js

While it's not precisely the DSTU2 to R4 conversation that you're asking about, the structure of the library deploys via NPM and supports multiple build pipelines; the import/export pattern for the FhirDehydrator object would be the same for a FhirVersionConverter object, the get/has/set pattern would be the same, etc.

StructureMap could probably work, but I'd want to land on its use after coding things by hand over a few resources, and then doing a refactor.

I'll be happy to stub out a FhirVersionConverter object to get everything started. The problems I see are a) how to handle missing elements, and b) awareness of profiles and extensions.


Last updated: Apr 12 2022 at 19:14 UTC