# fhir-kit-mapping-language

> JS implementation of the HL7 FHIR Mapping Language

Latest version **0.0.38** (published 2022-11-16) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install fhir-kit-mapping-language
pnpm add fhir-kit-mapping-language
yarn add fhir-kit-mapping-language
bun add fhir-kit-mapping-language
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.38 |
| Published | 2022-11-16 |
| First published | 2022-11-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 187.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | shihjay2 |

## Links

- npm: https://www.npmjs.com/package/fhir-kit-mapping-language
- npm.io page: https://npm.io/package/fhir-kit-mapping-language

## Dependencies (4)

- [antlr4](https://npm.io/package/antlr4.md) ^4.7.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [moment](https://npm.io/package/moment.md) ^2.24.0
- [micromatch](https://npm.io/package/micromatch.md) ^4.0.2

## Recent versions

- 0.0.38 (latest) — 2022-11-16
- 0.0.37 — 2022-11-16
- 0.0.35 — 2022-11-16
- 0.0.34 — 2022-11-16
- 0.0.33 — 2022-11-16
- 0.0.32 — 2022-11-16
- 0.0.31 — 2022-11-16
- 0.0.30 — 2022-11-15
- 0.0.29 — 2022-11-15
- 0.0.28 — 2022-11-15
- 0.0.27 — 2022-11-15
- 0.0.26 — 2022-11-15
- 0.0.25 — 2022-11-15
- 0.0.24 — 2022-11-15
- 0.0.23 — 2022-11-15
- … 22 more at https://npm.io/package/fhir-kit-mapping-language/versions

## README

# FHIR Mapping Language for JavaScript

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

## Install
```javascript
npm install fhir-kit-mapping-language

```

## Usage

```javascript
const Engine = require('./lib/engine');
```
or
```javascript
import Engine from 'fhir-kit-mapping-language'
```

```javascript
// 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.

---
_Source: https://npm.io/package/fhir-kit-mapping-language · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
