@claudebernard/fhir-mapper
Version:
A simple FHIR / BCB resource mapper to help stay interoperable while still using the Claude Bernard intelligence
102 lines (93 loc) • 3.83 kB
TypeScript
import { Dosage, BundleEntry } from 'fhir/r5';
import { CBPatient } from '@claudebernard/types';
interface BCBPosologieStructuree2 {
noPosologie?: number | null;
libellePosologie?: string | null;
codeIndication?: string | null;
libIndication?: string | null;
codeVoie?: number | null;
libVoie?: string | null;
codeUnitePrise?: number | null;
libUnitePrise?: string | null;
quantite1?: number | null;
quantite2?: number | null;
combien1?: number | null;
combien2?: number | null;
tousLes?: number | null;
pendant1?: number | null;
pendant2?: number | null;
codeDuree1?: number | null;
libDuree1?: string | null;
codeDuree2?: number | null;
libDuree2?: string | null;
codeDuree3?: number | null;
libDuree3?: string | null;
maximum?: number | null;
libSpecifPrise1?: string | null;
}
type MappingError = {
field: string;
message: string;
};
interface MappingResponse<T = unknown> {
result: T | undefined;
errors?: MappingError[];
}
type SimpleCodification = {
type?: string;
code: string;
label: string;
};
type Coding = {
system?: string;
code?: string;
display?: string;
};
type CodificationFunction = ((coding: Coding | undefined) => SimpleCodification[] | Promise<SimpleCodification[]>) | undefined;
declare function fhirToBcb$1(dosageInstructions: Dosage[], indicationMapper?: CodificationFunction, routeMapper?: CodificationFunction, intakeMapper?: CodificationFunction): Promise<MappingResponse<BCBPosologieStructuree2>[]>;
declare function mapToBcb(dosageInstructions: Dosage[], indicationMapper?: CodificationFunction, routeMapper?: CodificationFunction, intakeMapper?: CodificationFunction): Promise<MappingResponse<BCBPosologieStructuree2>[]>;
declare function bcbToFhir$1(bcbDosages: BCBPosologieStructuree2[]): MappingResponse<Dosage>[];
declare function mapToFhir(bcbDosages: BCBPosologieStructuree2[]): MappingResponse<Dosage>[];
declare const dosageMapper_d_mapToBcb: typeof mapToBcb;
declare const dosageMapper_d_mapToFhir: typeof mapToFhir;
declare namespace dosageMapper_d {
export {
bcbToFhir$1 as bcbToFhir,
fhirToBcb$1 as fhirToBcb,
dosageMapper_d_mapToBcb as mapToBcb,
dosageMapper_d_mapToFhir as mapToFhir,
};
}
interface BCBPatient {
lstIdComposantAllergie: number[];
lstPathologiesCIM10: string[];
lstPathologiesAMM: string[];
age: number;
poids: number;
taille: number;
grossesse: number;
allaitement: number;
sexe: string;
clairanceCreatinine: number;
creatininemieMol: number;
creatininemieMg: number;
insuffisanceHepatique: string;
}
declare function bcbToFhir(bcbPatient: BCBPatient): MappingResponse<BundleEntry[]>;
declare function fhirToBcb(fhirPatient: BundleEntry[], allergiesMapper?: CodificationFunction, snomedPathologiesMapper?: CodificationFunction): Promise<MappingResponse<BCBPatient>>;
declare function cbToFhir(cbPatient: CBPatient): MappingResponse<BundleEntry[]>;
declare function fhirToCb(fhirPatient: BundleEntry[], allergiesMapper?: CodificationFunction, snomedPathologiesMapper?: CodificationFunction): Promise<MappingResponse<CBPatient>>;
declare const patientMapper_d_bcbToFhir: typeof bcbToFhir;
declare const patientMapper_d_cbToFhir: typeof cbToFhir;
declare const patientMapper_d_fhirToBcb: typeof fhirToBcb;
declare const patientMapper_d_fhirToCb: typeof fhirToCb;
declare namespace patientMapper_d {
export {
patientMapper_d_bcbToFhir as bcbToFhir,
patientMapper_d_cbToFhir as cbToFhir,
patientMapper_d_fhirToBcb as fhirToBcb,
patientMapper_d_fhirToCb as fhirToCb,
};
}
export { dosageMapper_d as dosageMapper, patientMapper_d as patientMapper };
export type { CodificationFunction, Coding, MappingError, MappingResponse, SimpleCodification };