@claudebernard/fhir-mapper
Version:
A simple FHIR / BCB resource mapper to help stay interoperable while still using the Claude Bernard intelligence
111 lines (99 loc) • 3.99 kB
TypeScript
import { Coding, Dosage, BundleEntry } from 'fhir/r5';
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 = {
code: string;
label: string;
};
type CodificationFunction = ((coding: Coding | undefined) => SimpleCodification) | undefined;
declare function fhirToBcb$1(dosageInstructions: Dosage[], indicationMapper?: CodificationFunction, routeMapper?: CodificationFunction, intakeMapper?: CodificationFunction): MappingResponse<BCBPosologieStructuree2>[];
declare function mapToBcb(dosageInstructions: Dosage[], indicationMapper?: CodificationFunction, routeMapper?: CodificationFunction, intakeMapper?: CodificationFunction): 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;
}
interface CBPatient {
age: number;
gender: string;
weight: number;
pregnancy: boolean;
breastfeeding: boolean;
ammPathologies: {
type: string;
code: string;
label: string;
}[];
allergies: {
code: number;
label: string;
}[];
hepaticStage: string;
height: number;
weeksOfPregnancy: string;
creatinineClearance: number;
molCreatinine: number;
mglCreatinine: number;
gfr: number;
medicalTeam: any;
}
declare function bcbToFhir(bcbPatient: BCBPatient): MappingResponse<BundleEntry[]>;
declare function fhirToBcb(fhirPatient: BundleEntry[], allergiesMapper?: CodificationFunction, snomedPathologiesMapper?: CodificationFunction): MappingResponse<BCBPatient>;
declare function cbToFhir(cbPatient: CBPatient): MappingResponse<BundleEntry[]>;
declare function fhirToCb(fhirPatient: BundleEntry[], allergiesMapper?: CodificationFunction, snomedPathologiesMapper?: CodificationFunction): 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 };