Function: mapCodesCommand()
mapCodesCommand(
args,deps):Promise<RunResult>
Run the map-codes command.
Parameters
args
string[]
The arguments after the map-codes subcommand token.
deps
Injected input readers (RunDeps); the positional argument (or -) is the BYO
ConceptMap document.
Returns
Promise<RunResult>
A RunResult: the translation result on stdout (matched target coding(s) or the
value-free unmapped signal), a value-free note on stderr (unless --quiet), and an exit code
carrying the outcome: 0 mapped · 1 unmapped · 65 unloadable ConceptMap · 66 no input ·
2 usage.
Throws
Never CliError; may propagate a truly unexpected error for the dispatcher to map to
CLI_INTERNAL.
Example
import { mapCodesCommand } from "@cosyte/cli";
const cm = JSON.stringify({
resourceType: "ConceptMap",
group: [
{
source: "http://hl7.org/fhir/administrative-gender",
target: "http://terminology.hl7.org/CodeSystem/v2-0001",
element: [{ code: "male", target: [{ code: "M", equivalence: "equivalent" }] }],
},
],
});
const deps = {
readFile: async () => new TextEncoder().encode(cm),
readStdin: async () => new Uint8Array(),
};
const r = await mapCodesCommand(
["gender.json", "--system", "http://hl7.org/fhir/administrative-gender", "--code", "male"],
deps,
);
r.exit; // => 0