npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@claudebernard/fhir-mapper

v1.1.1

Published

A simple FHIR / BCB resource mapper to help stay interoperable while still using the Claude Bernard intelligence

Downloads

497

Readme

@claudebernard/fhir-mapper

This library will be composed of several bidirectional mapping entities between Claude Bernard (alias BCB) interfaces and FHIR specifications.

Each mapper will contain at the very least a mapToBcb and a mapToFhir functions, will return a MappingResponse object and is expected to work offline.

interface MappingResponse<T = unknown> {
    result: T | undefined;
    errors?: MappingError[];
}
type MappingError = {
    field: string;
    message: string;
}

Dependencies

The library uses the @types/fhir lib to gain access to fhir r5 objects and methods.

Installation

npm install --save @claudebernard/fhir-mapper

Mappers list

Below the list of all mappers currently comprised in this library :

  • A Dosage mapper exported as dosageMapper.

Mappers details

Dosage mapper : functions

mapToBcb

function mapToBcb(
    dosageInstructions: Dosage[],
    indicationMapper?: CodificationFunction,
    routeMapper?: CodificationFunction,
    intakeMapper?: CodificationFunction
) : MappingResponse<BCBPosologieStructuree2>[] {} 

The function takes 4 parameters :

  • 1 mandatory parameter 'dosageInstructions' which will be the fhir r5 Dosage resources that need to be mapped.
  • 3 optional parameters of type CodificationFunction.

Those optional parameters are meant to provide a way for the user to be able to choose how the mapping between the fhir resource's Coding fields (asNeededFor, route, doseAndRate) and the Claude Bernard BCBPosologieStructuree2 class properties (codeIndication, codeVoie, codeUnitePrise) is done.

Of course, if the value of the respective fields is not provided or if they use the Claude Bernard codification already, those parameters should be omitted.

CodificationFunction type :

type CodificationFunction = ((coding : Coding) => SimpleCodification) | undefined;

type SimpleCodification = {
    code: string;
    label: string;
};

The CodificationFunction type expects a fhir r5 Coding resource as input and a SimpleCodification object as output.

Usage
import { dosageMapper } from '@claudebernard/fhir-mapper';
// other imports ... 

const fhirDosages = [];
const routeMapper = (coding : Coding) => {
    // some api call or logic implemented by yourself ...
    return {
        code : routeCode,
        label : routeLabel
    }
}

// ...

const bcbDosages = dosageMapper.mapToBcb(fhirDosages, undefined, routeMapper, undefined);

// ...

mapToFhir

function mapToFhir(bcbDosages: BCBPosologieStructuree2[]): MappingResponse<Dosage>[] {} 

This function takes only one parameter, an array of BCBPosologieStructuree2 objects and returns a MappingResponse containing the corresponding fhir Dosage resources.

It will for now by default keep the Claude Bernard codification for the Coding fields in the output fhir Dosage resources.

Usage
import { dosageMapper } from '@claudebernard/fhir-mapper';
// other imports ... 

const bcbDosages = [];

// ...

const fhirDosages = dosageMapper.mapToFhir(bcbDosages);

// ...

Dosage mapper : current limitations

Even though the mapper works and allows us to transform Dosage resources in Claude Bernard resources, there are some caveats : - some fields are currently unmapped due to a lack of overlap between the two structures.

  • some fields are only partially mapped due to the fact that on one side (fhir) they are arrays and on the other (claude bernard), they are unitary values.

Claude Bernard codifications

Below is listed the different Claude Bernard coding systems that will be used internally by the mappers.

  • https://platform.claudebernard.fr/fhir/ValueSet/routes
  • https://platform.claudebernard.fr/fhir/ValueSet/intake-units
  • https://platform.claudebernard.fr/fhir/ValueSet/indications

Browser support

  • [x] Chrome
  • [x] Firefox
  • [x] Safari
  • [x] Microsoft Edge

License

Copyright of Cegedim. See LICENSE for details.