0.5.0 • Published 16 days ago
@synanetics/fhir-transform v0.5.0
FHIR Transform Package
Performs FHIR $transform operations
Features
Interprets FHIR StructureMaps and applies their transformations to the input parameter(s), performing cardinality corrections against a supplied StructureDefinition. The output resource(s) are explicitly not validated against the supplied StructureDefinition(s), as per the FHIR specifications.
Example usage
import transform from '@synanetics/fhir-transform';
const structureMap = {
// structureMap FHIR resource
};
const content = {
// source resource
};
// your structureDefinitionResolver can be as elaborate as you like, perhaps returning from a URL or a cache
const structureDefinitionResolver = async (url: string): Promise<any> => {
switch (url) {
case 'http://example.com/StructureDefinition/CustomResource':
return {
// profile definition
};
// whatever else
}
};
// Your conceptMapResolver can be elaborate too, but needs to return the URL as the key object key.
// This is done so that you can choose to "follow" links to other ConceptMaps that may exist inside the
// first ConceptMap returned by the resolver.
const conceptMapResolver = async (url: string): Promise<Record<string, any>> => {
const record: Record<string, any> = {};
const map = await fetch(url);
record[url] = await map.json();
if (map.group[0].unmapped?.url) {
const otherMap = await fetch(map.group[0].unmapped.url);
record[map.group[0].unmapped.url] = await otherMap.json();
}
};
// the structureMapResolver works exactly the same as the conceptMapResolver, so is not shown here.
const result = await transform({
content,
structureMap,
structureDefinitionResolver,
conceptMapResolver,
});
0.3.0-beta.3
3 months ago
0.5.0
16 days ago
0.3.0-beta.2
7 months ago
0.3.0-beta.0
7 months ago
0.3.0-beta.1
7 months ago
0.2.6
11 months ago
0.2.5
11 months ago
0.2.4
11 months ago
0.2.1
11 months ago
0.2.0
12 months ago
0.1.12
12 months ago
0.1.11
12 months ago
0.1.10
12 months ago
1.0.10-alpha
12 months ago
1.0.9-alpha
12 months ago
1.0.8-alpha
12 months ago
1.0.7-alpha
12 months ago
1.0.6-alpha
12 months ago
1.0.5-alpha
12 months ago
1.0.4-alpha
12 months ago
1.0.3-alpha
12 months ago
1.0.2-alpha
1 year ago
1.0.1-alpha
1 year ago
1.0.0-alpha
1 year ago