0.0.38 • Published 1 year ago

fhir-kit-mapping-language v0.0.38

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

FHIR Mapping Language for JavaScript

see: https://www.hl7.org/fhir/mapping-language.html

Install

npm install fhir-kit-mapping-language

Usage

const Engine = require('./lib/engine');

or

import Engine from 'fhir-kit-mapping-language'
// Make 2 maps
const map1 = `map "http://test.com/1" = test1

imports "http://test.com/2"

group example(source src, target tgt) {
  src.name as vn -> tgt.name as tn then {
    vn.firstName as g -> tn.firstName = g;
    vn.lastName as ln -> tn.familyName = ln;
  };
  src.address as sa -> tgt.address as ta then address(sa, ta);
}
`;

const map2 = `map "http://test.com/2" = test2

group address(source src, target tgt) {
  src.street as s -> tgt.street = s;
}
`;


const maps = [ map1, map2 ];

// Create a new engine with two maps
const engine = new Engine(maps);

// Setup inputs and execute with the specified map
const inputs = [
  {
    name: { firstName: 'bob', lastName: 'smith' },
    address: { street: '123 Main St' }
  }
];
const targets = engine.execute('http://test.com', inputs); // [
                                  //   {
                                  //     name: { firstName: 'bob', familyName: 'smith' }
                                  //     address: { street: '123 Main St' }
                                  //   }
                                  // ]

Features

Very early library, currently supporting:

  • copy (concrete syntax)
  • literal assignment
  • dependent rules
  • dependent invocations
  • imports with wildcards

See test/engine for examples of current functionality.

0.0.38

1 year ago

0.0.37

1 year ago

0.0.35

1 year ago

0.0.34

1 year ago

0.0.33

1 year ago

0.0.32

1 year ago

0.0.31

1 year ago

0.0.30

1 year ago

0.0.29

1 year ago

0.0.28

1 year ago

0.0.27

1 year ago

0.0.26

1 year ago

0.0.25

1 year ago

0.0.24

1 year ago

0.0.23

1 year ago

0.0.22

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago