0.5.0 • Published 2 months 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
4 months ago
0.5.0
2 months ago
0.3.0-beta.2
8 months ago
0.3.0-beta.0
8 months ago
0.3.0-beta.1
8 months ago
0.2.6
12 months ago
0.2.5
12 months ago
0.2.4
12 months ago
0.2.1
1 year ago
0.2.0
1 year ago
0.1.12
1 year ago
0.1.11
1 year ago
0.1.10
1 year ago
1.0.10-alpha
1 year ago
1.0.9-alpha
1 year ago
1.0.8-alpha
1 year ago
1.0.7-alpha
1 year ago
1.0.6-alpha
1 year ago
1.0.5-alpha
1 year ago
1.0.4-alpha
1 year ago
1.0.3-alpha
1 year ago
1.0.2-alpha
1 year ago
1.0.1-alpha
1 year ago
1.0.0-alpha
1 year ago