@precisa-saude/fhir 0.34.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/biomarkers.cjs +4 -2
- package/dist/biomarkers.cjs.map +1 -1
- package/dist/biomarkers.d.cts +34 -1
- package/dist/biomarkers.d.ts +34 -1
- package/dist/biomarkers.js +3 -1
- package/dist/{chunk-NJM45WAH.js → chunk-3UCY4HPJ.js} +5 -3
- package/dist/chunk-3UCY4HPJ.js.map +1 -0
- package/dist/{chunk-P4G534AQ.js → chunk-7TDZX5HO.js} +9 -2
- package/dist/chunk-7TDZX5HO.js.map +1 -0
- package/dist/{chunk-5RC7C7HJ.cjs → chunk-AQTHAZLK.cjs} +3 -3
- package/dist/{chunk-5RC7C7HJ.cjs.map → chunk-AQTHAZLK.cjs.map} +1 -1
- package/dist/{chunk-376KM7IL.cjs → chunk-F7CC4SV5.cjs} +11 -9
- package/dist/chunk-F7CC4SV5.cjs.map +1 -0
- package/dist/{chunk-VKLWTTUO.cjs → chunk-H64L6SOV.cjs} +10 -3
- package/dist/chunk-H64L6SOV.cjs.map +1 -0
- package/dist/{chunk-T75NZM56.cjs → chunk-JES2ZLH5.cjs} +47 -5
- package/dist/chunk-JES2ZLH5.cjs.map +1 -0
- package/dist/{chunk-4FKZG5GZ.js → chunk-KTV4H2QQ.js} +44 -2
- package/dist/chunk-KTV4H2QQ.js.map +1 -0
- package/dist/{chunk-Q3H5C6UR.js → chunk-LWSKO7UV.js} +2 -2
- package/dist/{chunk-K3VZ3F5Z.js → chunk-M6AYGD7P.js} +8 -6
- package/dist/chunk-M6AYGD7P.js.map +1 -0
- package/dist/{chunk-OAFAERDY.cjs → chunk-RPGJK7ZM.cjs} +3 -3
- package/dist/{chunk-OAFAERDY.cjs.map → chunk-RPGJK7ZM.cjs.map} +1 -1
- package/dist/{chunk-NKDUVSDK.cjs → chunk-WKTDMR5P.cjs} +11 -9
- package/dist/chunk-WKTDMR5P.cjs.map +1 -0
- package/dist/{chunk-E6MXDQXW.js → chunk-YI5WYZCP.js} +2 -2
- package/dist/cli.js +53 -3
- package/dist/{converter-UygMzWlL.d.ts → converter-CTj83kPz.d.ts} +6 -0
- package/dist/{converter-DP8VkkO3.d.cts → converter-Dlwb6OfB.d.cts} +6 -0
- package/dist/converter.cjs +5 -5
- package/dist/converter.d.cts +1 -1
- package/dist/converter.d.ts +1 -1
- package/dist/converter.js +4 -4
- package/dist/importer.cjs +5 -5
- package/dist/importer.d.cts +2 -0
- package/dist/importer.d.ts +2 -0
- package/dist/importer.js +4 -4
- package/dist/index.cjs +12 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/reference-ranges.cjs +4 -4
- package/dist/reference-ranges.d.cts +12 -0
- package/dist/reference-ranges.d.ts +12 -0
- package/dist/reference-ranges.js +3 -3
- package/dist/units.cjs +3 -3
- package/dist/units.js +2 -2
- package/dist/validators.cjs +4 -4
- package/dist/validators.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-376KM7IL.cjs.map +0 -1
- package/dist/chunk-4FKZG5GZ.js.map +0 -1
- package/dist/chunk-K3VZ3F5Z.js.map +0 -1
- package/dist/chunk-NJM45WAH.js.map +0 -1
- package/dist/chunk-NKDUVSDK.cjs.map +0 -1
- package/dist/chunk-P4G534AQ.js.map +0 -1
- package/dist/chunk-T75NZM56.cjs.map +0 -1
- package/dist/chunk-VKLWTTUO.cjs.map +0 -1
- /package/dist/{chunk-Q3H5C6UR.js.map → chunk-LWSKO7UV.js.map} +0 -0
- /package/dist/{chunk-E6MXDQXW.js.map → chunk-YI5WYZCP.js.map} +0 -0
|
@@ -4,14 +4,15 @@ import {
|
|
|
4
4
|
} from "./chunk-A6HR4XDK.js";
|
|
5
5
|
import {
|
|
6
6
|
referenceRangeMeaning
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7TDZX5HO.js";
|
|
8
8
|
import {
|
|
9
9
|
getDefaultUnit,
|
|
10
10
|
resolveUcum
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LWSKO7UV.js";
|
|
12
12
|
import {
|
|
13
|
-
codeToLoinc
|
|
14
|
-
|
|
13
|
+
codeToLoinc,
|
|
14
|
+
methodVariantOf
|
|
15
|
+
} from "./chunk-KTV4H2QQ.js";
|
|
15
16
|
|
|
16
17
|
// src/bundle-urls.ts
|
|
17
18
|
var BUNDLE_BASE_URL = "https://precisa-saude.com.br/fhir";
|
|
@@ -68,7 +69,8 @@ var buildReferenceRanges = (observation, quantity) => {
|
|
|
68
69
|
);
|
|
69
70
|
};
|
|
70
71
|
function labObservationToFHIR(observation, patientId, laboratoryName) {
|
|
71
|
-
const
|
|
72
|
+
const methodLoinc = observation.methodLoinc && methodVariantOf(observation.biomarkerCode, observation.methodLoinc) ? observation.methodLoinc : void 0;
|
|
73
|
+
const loincCode = methodLoinc ?? codeToLoinc(observation.biomarkerCode);
|
|
72
74
|
const sourceUnit = observation.unit || getDefaultUnit(observation.biomarkerCode) || observation.unit;
|
|
73
75
|
const ucumUnit = resolveUcum(sourceUnit, observation.biomarkerCode);
|
|
74
76
|
const quantity = (value) => ({
|
|
@@ -271,4 +273,4 @@ export {
|
|
|
271
273
|
userProfileToFHIR,
|
|
272
274
|
labResultToFHIRBundle
|
|
273
275
|
};
|
|
274
|
-
//# sourceMappingURL=chunk-
|
|
276
|
+
//# sourceMappingURL=chunk-M6AYGD7P.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bundle-urls.ts","../src/converter.ts"],"sourcesContent":["/**\n * Endereço das entradas de um Bundle.\n *\n * O `fullUrl` identifica a entrada, e é contra ele que o validador resolve as\n * referências entre os recursos. Um Bundle com `subject.reference` valendo\n * `Patient/abc` só resolve se alguma entrada tiver `fullUrl` terminando em\n * `/Patient/abc`: a referência relativa é lida contra a base do `fullUrl` da\n * entrada, que é como os exemplos da própria HL7 montam Bundle de coleção.\n *\n * Antes o `fullUrl` era `urn:uuid:observation-<laudo>-<código>`, que erra duas\n * vezes. `urn:uuid:` exige a sintaxe de UUID e aquilo não era um UUID, e num\n * Bundle de entradas `urn:uuid:` a referência precisa repetir a URN inteira,\n * então nenhuma das relativas resolvia. Um laudo de 22 marcadores saía com 24\n * erros de URN e 22 referências perdidas.\n */\n/**\n * Recurso que já tem id, e por isso pode ser endereçado numa entrada.\n *\n * No FHIR o `id` é opcional, porque um recurso pode viajar sem identidade\n * própria. Numa entrada de Bundle ele não pode: sem id não há `fullUrl`, e sem\n * `fullUrl` nenhuma referência chega ao recurso. Os conversores daqui sempre\n * atribuem um, e o tipo passa a dizer isso em vez de deixar `undefined` chegar\n * até a montagem da URL.\n */\nexport type Addressable<T> = T & { id: string };\n\n/**\n * Base dos `fullUrl`.\n *\n * Não precisa responder a uma requisição: no FHIR o `fullUrl` é identidade, não\n * endereço de download. Fica sob um domínio nosso para não colidir com a\n * identidade de recurso de outra instituição, que é o risco real de usar\n * `example.org` em dado que sai da máquina.\n */\nexport const BUNDLE_BASE_URL = 'https://precisa-saude.com.br/fhir';\n\n/**\n * Monta o `fullUrl` a partir do próprio recurso.\n *\n * Recebe o recurso em vez do tipo e do id soltos de propósito. O defeito que\n * isto substitui nasceu de montar os dois lados em separado: o `fullUrl` dizia\n * `observation-demo-Hgb` enquanto o recurso tinha id `demo-Hgb`, e ninguém\n * percebeu porque nada obrigava os dois a concordarem.\n *\n * O parâmetro pede o mínimo que a URL consome, e não a união de recursos que\n * este pacote converte. Um Bundle pode carregar qualquer recurso do R4, e quem\n * acrescenta uma entrada de um tipo que não está nessa união (um `Specimen`,\n * por exemplo) precisa do mesmo endereço, senão monta o dele e as duas formas\n * divergem outra vez.\n */\nexport const entryFullUrl = (resource: Addressable<{ resourceType: string }>): string =>\n `${BUNDLE_BASE_URL}/${resource.resourceType}/${resource.id}`;\n","/**\n * FHIR Converter\n *\n * Converts lab results to FHIR R4 DiagnosticReport and Observation resources.\n * See: https://hl7.org/fhir/diagnosticreport.html\n */\n\nimport { codeToLoinc, methodVariantOf } from './biomarkers';\nimport { type Addressable, entryFullUrl } from './bundle-urls';\nimport { BIOMARKER_CODE_SYSTEM, LOINC_SYSTEM } from './code-systems';\nimport type {\n FHIRBundle,\n FHIRDiagnosticReport,\n FHIRObservation,\n FHIRPatient,\n FHIRQuantity,\n FHIRReferenceRange,\n} from './fhir-types';\nimport { referenceRangeMeaning } from './reference-ranges';\nimport type { Flag, LabObservationData, LabReportData, UserProfileData } from './types';\nimport { getDefaultUnit, resolveUcum } from './units';\n\n// Re-export all types and functions\nexport * from './fhir-types';\n\n/**\n * Convert Flag to FHIR interpretation code\n */\nfunction interpretationCode(flag: Flag): string {\n switch (flag) {\n case 'H':\n return 'H'; // High\n case 'L':\n return 'L'; // Low\n default:\n return 'N'; // Normal\n }\n}\n\n/**\n * Convert Flag to FHIR interpretation display\n */\nfunction interpretationDisplay(flag: Flag): string {\n switch (flag) {\n case 'H':\n return 'High';\n case 'L':\n return 'Low';\n default:\n return 'Normal';\n }\n}\n\n/**\n * O `coding` do sexo, que vai **dentro** do CodeableConcept do `appliesTo`.\n *\n * O nome diz `CODING` e não `APPLIES_TO` de propósito: isto não é o valor do\n * campo, é uma entrada da lista de codificações dele. O embrulho acontece no\n * uso, em `{ coding: [SEX_CODING[sex]] }`.\n *\n * É o `AdministrativeGender`, e não o v3-ObservationInterpretation nem um\n * sistema nosso: um consumidor que já lê `Patient.gender` compara os dois sem\n * tabela de tradução no meio.\n */\nconst SEX_CODING = {\n female: {\n code: 'female',\n display: 'Female',\n system: 'http://hl7.org/fhir/administrative-gender',\n },\n male: { code: 'male', display: 'Male', system: 'http://hl7.org/fhir/administrative-gender' },\n} as const;\n\n/**\n * Monta as faixas de referência do `Observation`.\n *\n * Duas mudanças em relação ao que existia, e as duas são sobre não perder o que\n * o laudo imprimiu.\n *\n * **Um limite só já basta.** Antes a faixa só saía com os dois, e um laudo que\n * publica \"inferior a 190 mg/dL\" ou \"superior a 60 mL/min/1,73m²\" perdia o\n * campo inteiro. O R4 trata `low` e `high` como opcionais independentes e\n * documenta o caso de um lado só, e o importador deste mesmo pacote já lia\n * `low?.value` e `high?.value` com acesso opcional: a assimetria era só do\n * escritor. Ver PRE-430.\n *\n * **Mais de uma faixa, anotada.** Laudo com uma coluna de referência por sexo\n * passa a sair com as duas, cada uma com o seu `appliesTo`, em vez de o\n * pipeline escolher uma sem saber de quem é o exame. Ver PRE-424 e PRE-425.\n */\nconst buildReferenceRanges = (\n observation: LabObservationData,\n quantity: (value: number) => FHIRQuantity,\n): FHIRReferenceRange[] => {\n // Devolve lista, e não uma faixa: o caso sem limite nenhum vira lista vazia\n // em vez de `undefined`, e aí os dois caminhos abaixo se compõem com\n // `flatMap` sem ninguém precisar filtrar nada depois.\n const toRanges = (low?: number, high?: number, sex?: 'female' | 'male'): FHIRReferenceRange[] => {\n if (low === undefined && high === undefined) return [];\n\n return [\n {\n ...(sex === undefined ? {} : { appliesTo: [{ coding: [SEX_CODING[sex]] }] }),\n ...(high === undefined ? {} : { high: quantity(high) }),\n ...(low === undefined ? {} : { low: quantity(low) }),\n },\n ];\n };\n\n // A lista anotada tem precedência: quando ela existe, o par simples é o\n // resumo de uma das colunas e repeti-lo publicaria a mesma faixa duas vezes,\n // uma delas sem dizer a quem se aplica.\n //\n // Lista vazia cai no par simples, igual a ausente, e isso é escolha: as duas\n // dizem \"não tenho faixa anotada\", e tratá-las diferente faria um `[]` vindo\n // de um `.filter()` apagar em silêncio a faixa que o chamador também mandou\n // em `referenceMin` e `referenceMax`.\n if (observation.referenceRanges && observation.referenceRanges.length > 0) {\n return observation.referenceRanges.flatMap((r) => toRanges(r.low, r.high, r.appliesTo));\n }\n\n const meaning = observation.referenceKind && referenceRangeMeaning(observation.referenceKind);\n return toRanges(observation.referenceMin, observation.referenceMax).map((range) =>\n meaning ? { ...range, type: { coding: [meaning] } } : range,\n );\n};\n\n/**\n * Convert generic lab observation to FHIR Observation\n */\nexport function labObservationToFHIR(\n observation: LabObservationData,\n patientId: string,\n laboratoryName?: string,\n): Addressable<FHIRObservation> {\n // O código por método só sai quando é variante declarada do biomarcador. Um\n // `methodLoinc` qualquer viraria afirmação sob `http://loinc.org` que o\n // catálogo não conferiu.\n const methodLoinc =\n observation.methodLoinc && methodVariantOf(observation.biomarkerCode, observation.methodLoinc)\n ? observation.methodLoinc\n : undefined;\n const loincCode = methodLoinc ?? codeToLoinc(observation.biomarkerCode);\n // Use default unit if source unit is empty\n const sourceUnit =\n observation.unit || getDefaultUnit(observation.biomarkerCode) || observation.unit;\n // `system` + `code` só saem quando a unidade resolve em UCUM. Unidade que o\n // pacote não sabe traduzir fica só em `unit`, como texto: afirmar\n // `http://unitsofmeasure.org` sobre `x10^3/mm3` era publicar um código\n // falso, e quem consome o Bundle confiando no system trataria aquilo como\n // UCUM de verdade.\n const ucumUnit = resolveUcum(sourceUnit, observation.biomarkerCode);\n const quantity = (value: number): FHIRQuantity => ({\n ...(ucumUnit ? { code: ucumUnit, system: 'http://unitsofmeasure.org' } : {}),\n ...(sourceUnit ? { unit: sourceUnit } : {}),\n value,\n });\n const isQualitative = observation.isQualitative || typeof observation.value === 'string';\n\n // Base observation structure\n const fhirObs: Addressable<FHIRObservation> = {\n category: [\n {\n coding: [\n {\n code: 'laboratory',\n display: 'Laboratory',\n system: 'http://terminology.hl7.org/CodeSystem/observation-category',\n },\n ],\n },\n ],\n code: {\n // Sem LOINC, o coding LOINC simplesmente não sai. Antes ia `99999-9`,\n // que não é código LOINC nenhum: publicava sob `http://loinc.org` uma\n // afirmação falsa, e quem consumisse o bundle confiando no system\n // trataria aquilo como código de verdade. Composição corporal, densidade\n // óssea e escore de cálcio não têm LOINC, e o certo é a lacuna explícita.\n coding: [\n ...(loincCode\n ? [\n {\n code: loincCode,\n display: observation.biomarkerName,\n system: LOINC_SYSTEM,\n },\n ]\n : []),\n {\n code: observation.biomarkerCode,\n display: observation.biomarkerName,\n system: BIOMARKER_CODE_SYSTEM,\n },\n ],\n text: observation.biomarkerName,\n },\n effectiveDateTime: observation.collectionDate,\n id: `${observation.reportId}-${observation.biomarkerCode}`,\n interpretation: [\n {\n coding: [\n {\n code: interpretationCode(observation.flag),\n display: interpretationDisplay(observation.flag),\n system: 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation',\n },\n ],\n },\n ],\n performer: laboratoryName ? [{ display: laboratoryName }] : undefined,\n resourceType: 'Observation',\n status: 'final',\n subject: {\n reference: `Patient/${patientId}`,\n },\n };\n\n // Add value based on type (qualitative = string, quantitative = number)\n if (isQualitative) {\n fhirObs.valueString = String(observation.value);\n } else {\n fhirObs.valueQuantity = quantity(observation.value as number);\n\n // Reference range only applies to quantitative values\n const referenceRange = buildReferenceRanges(observation, quantity);\n if (referenceRange.length > 0) fhirObs.referenceRange = referenceRange;\n }\n\n return fhirObs;\n}\n\n/**\n * Convert generic lab report to FHIR DiagnosticReport\n */\nexport function labReportToFHIR(\n report: LabReportData,\n patientId: string,\n observationIds: string[],\n): Addressable<FHIRDiagnosticReport> {\n // Map processing status to FHIR status\n let status: FHIRDiagnosticReport['status'];\n switch (report.processingStatus) {\n case 'complete':\n status = 'final';\n break;\n case 'partial':\n status = 'partial';\n break;\n case 'pending_review':\n status = 'preliminary';\n break;\n default:\n status = 'final';\n }\n\n return {\n category: [\n {\n coding: [\n {\n code: 'LAB',\n display: 'Laboratory',\n system: 'http://terminology.hl7.org/CodeSystem/v2-0074',\n },\n ],\n },\n ],\n code: {\n coding: [\n {\n code: '11502-2', // Laboratory report\n display: 'Laboratory report',\n system: 'http://loinc.org',\n },\n ],\n text: 'Laboratory Results',\n },\n conclusion:\n report.overallStatus === 'NORMAL'\n ? 'All results within normal limits'\n : 'One or more abnormal results detected',\n conclusionCode:\n report.overallStatus === 'ANORMAL'\n ? [\n {\n coding: [\n {\n code: 'A',\n display: 'Abnormal',\n system: 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation',\n },\n ],\n },\n ]\n : undefined,\n effectiveDateTime: report.collectionDate,\n id: report.reportId,\n issued: report.createdAt,\n performer: report.laboratoryName ? [{ display: report.laboratoryName }] : undefined,\n resourceType: 'DiagnosticReport',\n result: observationIds.map((id) => ({ reference: `Observation/${id}` })),\n status,\n subject: {\n reference: `Patient/${patientId}`,\n },\n };\n}\n\n/**\n * Convert user profile to FHIR Patient\n * NOTE: CPF is intentionally excluded for privacy (LGPD compliance)\n */\nexport function userProfileToFHIR(profile: UserProfileData): Addressable<FHIRPatient> {\n const nameParts = profile.name.split(' ');\n const given = nameParts.slice(0, -1);\n const family = nameParts[nameParts.length - 1] || '';\n\n return {\n address: profile.address\n ? [\n {\n city: profile.address.city,\n country: profile.address.country || 'BR',\n line: [\n profile.address.street && profile.address.number\n ? `${profile.address.street}, ${profile.address.number}`\n : profile.address.street,\n profile.address.complement,\n ].filter(Boolean) as string[],\n postalCode: profile.address.postalCode,\n state: profile.address.state,\n },\n ]\n : undefined,\n birthDate: profile.birthDate,\n gender: profile.gender,\n id: profile.userId,\n name: [\n {\n family,\n given: given.length > 0 ? given : undefined,\n text: profile.name,\n },\n ],\n resourceType: 'Patient',\n telecom:\n [\n ...(profile.email ? [{ system: 'email' as const, value: profile.email }] : []),\n ...(profile.phone ? [{ system: 'phone' as const, value: profile.phone }] : []),\n ].length > 0\n ? [\n ...(profile.email ? [{ system: 'email' as const, value: profile.email }] : []),\n ...(profile.phone ? [{ system: 'phone' as const, value: profile.phone }] : []),\n ]\n : undefined,\n };\n}\n\n/**\n * Convert complete lab result to FHIR Bundle\n * This is the main function for exporting lab results to FHIR R4 format\n */\nexport function labResultToFHIRBundle(\n report: LabReportData,\n observations: LabObservationData[],\n userProfile: UserProfileData,\n): FHIRBundle {\n const patientId = userProfile.userId;\n\n // Convert observations\n const fhirObservations = observations.map((obs) => {\n const resource = labObservationToFHIR(\n { ...obs, collectionDate: report.collectionDate },\n patientId,\n report.laboratoryName,\n );\n\n return { fullUrl: entryFullUrl(resource), resource };\n });\n\n // Os ids vêm dos recursos já montados, e não de uma segunda montagem da mesma\n // regra. O `DiagnosticReport.result` aponta para eles, e era aqui que a\n // referência se separava do recurso.\n const observationIds = fhirObservations.map((entry) => entry.resource.id);\n\n // Convert report\n const diagnosticReport = labReportToFHIR(report, patientId, observationIds);\n\n // Convert patient\n const fhirPatient = userProfileToFHIR(userProfile);\n\n return {\n entry: [\n { fullUrl: entryFullUrl(fhirPatient), resource: fhirPatient },\n { fullUrl: entryFullUrl(diagnosticReport), resource: diagnosticReport },\n ...fhirObservations,\n ],\n resourceType: 'Bundle',\n type: 'collection',\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCO,IAAM,kBAAkB;AAgBxB,IAAM,eAAe,CAAC,aAC3B,GAAG,eAAe,IAAI,SAAS,YAAY,IAAI,SAAS,EAAE;;;ACvB5D,SAAS,mBAAmB,MAAoB;AAC9C,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA;AAAA,IACT,KAAK;AACH,aAAO;AAAA;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAKA,SAAS,sBAAsB,MAAoB;AACjD,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAaA,IAAM,aAAa;AAAA,EACjB,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,EACV;AAAA,EACA,MAAM,EAAE,MAAM,QAAQ,SAAS,QAAQ,QAAQ,4CAA4C;AAC7F;AAmBA,IAAM,uBAAuB,CAC3B,aACA,aACyB;AAIzB,QAAM,WAAW,CAAC,KAAc,MAAe,QAAkD;AAC/F,QAAI,QAAQ,UAAa,SAAS,OAAW,QAAO,CAAC;AAErD,WAAO;AAAA,MACL;AAAA,QACE,GAAI,QAAQ,SAAY,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,Q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B,IAAI,CAAC,UAAU,MAAM,SAAS,EAAE;AAGxE,QAAM,mBAAmB,gBAAgB,QAAQ,WAAW,cAAc;AAG1E,QAAM,cAAc,kBAAkB,WAAW;AAEjD,SAAO;AAAA,IACL,OAAO;AAAA,MACL,EAAE,SAAS,aAAa,WAAW,GAAG,UAAU,YAAY;AAAA,MAC5D,EAAE,SAAS,aAAa,gBAAgB,GAAG,UAAU,iBAAiB;AAAA,MACtE,GAAG;AAAA,IACL;AAAA,IACA,cAAc;AAAA,IACd,MAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkAQTHAZLKcjs = require('./chunk-AQTHAZLK.cjs');
|
|
4
4
|
|
|
5
5
|
// src/validators.ts
|
|
6
6
|
var UCUM_SYSTEM = "http://unitsofmeasure.org";
|
|
7
7
|
function ucumErrors(quantity, where) {
|
|
8
8
|
if (!quantity || quantity.system !== UCUM_SYSTEM) return [];
|
|
9
9
|
if (!quantity.code) return [`${where}: UCUM system declared without a code`];
|
|
10
|
-
if (!
|
|
10
|
+
if (!_chunkAQTHAZLKcjs.isUcumCode.call(void 0, quantity.code)) {
|
|
11
11
|
return [`${where}: "${quantity.code}" is not a UCUM code`];
|
|
12
12
|
}
|
|
13
13
|
return [];
|
|
@@ -78,4 +78,4 @@ function validateFHIRImportBundle(data) {
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
exports.validateFHIRDiagnosticReport = validateFHIRDiagnosticReport; exports.validateFHIRObservation = validateFHIRObservation; exports.validateFHIRImportBundle = validateFHIRImportBundle;
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-RPGJK7ZM.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/fhir-brasil/fhir-brasil/packages/core/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/fhir-brasil/fhir-brasil/packages/core/dist/chunk-RPGJK7ZM.cjs","../src/validators.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACMA,IAAM,YAAA,EAAc,2BAAA;AAYpB,SAAS,UAAA,CAAW,QAAA,EAAoC,KAAA,EAAyB;AAC/E,EAAA,GAAA,CAAI,CAAC,SAAA,GAAY,QAAA,CAAS,OAAA,IAAW,WAAA,EAAa,OAAO,CAAC,CAAA;AAC1D,EAAA,GAAA,CAAI,CAAC,QAAA,CAAS,IAAA,EAAM,OAAO,CAAC,CAAA,EAAA;AACC,EAAA;AACL,IAAA;AACxB,EAAA;AACQ,EAAA;AACV;AAKgB;AACY,EAAA;AAEE,EAAA;AACd,IAAA;AACd,EAAA;AAEoB,EAAA;AACN,IAAA;AACd,EAAA;AAE4B,EAAA;AACd,IAAA;AACd,EAAA;AAEwB,EAAA;AACV,IAAA;AACd,EAAA;AAEO,EAAA;AACT;AAKgB;AACY,EAAA;AAET,EAAA;AACH,IAAA;AACd,EAAA;AAEyB,EAAA;AACX,IAAA;AACd,EAAA;AAE0B,EAAA;AACZ,IAAA;AACd,EAAA;AAE6B,EAAA;AACf,IAAA;AACd,EAAA;AAEiB,EAAA;AACH,IAAA;AACd,EAAA;AAE0B,EAAA;AACA,EAAA;AACE,IAAA;AACA,IAAA;AAC5B,EAAA;AAEO,EAAA;AACT;AAKgB;AACiB,EAAA;AAEF,EAAA;AACJ,IAAA;AAChB,IAAA;AACT,EAAA;AAEe,EAAA;AAEa,EAAA;AACd,IAAA;AACD,MAAA;AACF,MAAA;AACR,IAAA;AACH,EAAA;AAE0B,EAAA;AACD,IAAA;AACD,EAAA;AACC,IAAA;AACzB,EAAA;AAEO,EAAA;AACT;AD5C+B;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/fhir-brasil/fhir-brasil/packages/core/dist/chunk-RPGJK7ZM.cjs","sourcesContent":[null,"/**\n * FHIR Validators\n *\n * Validation functions for FHIR R4 resources.\n */\n\nimport type { FHIRDiagnosticReport, FHIRObservation, FHIRQuantity } from './fhir-types';\nimport type { ImportError } from './importer';\nimport { isUcumCode } from './units';\n\nconst UCUM_SYSTEM = 'http://unitsofmeasure.org';\n\n/**\n * Um `Quantity` que afirma o system do UCUM precisa de um `code` que seja\n * UCUM. Sem `code` a afirmação está vazia; com `code` que não é UCUM ela está\n * errada, e foi o caso durante meses: `uIU/mL`, `K/uL` e `razão` saíam sob\n * `http://unitsofmeasure.org` porque o conversor devolvia a grafia do laudo\n * intacta quando não a conhecia.\n *\n * `Quantity` sem `system` passa: unidade só em texto é legítima, e é o que o\n * conversor emite quando não sabe traduzir.\n */\nfunction ucumErrors(quantity: FHIRQuantity | undefined, where: string): string[] {\n if (!quantity || quantity.system !== UCUM_SYSTEM) return [];\n if (!quantity.code) return [`${where}: UCUM system declared without a code`];\n if (!isUcumCode(quantity.code)) {\n return [`${where}: \"${quantity.code}\" is not a UCUM code`];\n }\n return [];\n}\n\n/**\n * Validate FHIR DiagnosticReport\n */\nexport function validateFHIRDiagnosticReport(report: FHIRDiagnosticReport): string[] {\n const errors: string[] = [];\n\n if (!report.resourceType || report.resourceType !== 'DiagnosticReport') {\n errors.push('Invalid resourceType');\n }\n\n if (!report.status) {\n errors.push('Missing status');\n }\n\n if (!report.code || !report.code.coding || report.code.coding.length === 0) {\n errors.push('Missing or invalid code');\n }\n\n if (!report.subject || !report.subject.reference) {\n errors.push('Missing subject reference');\n }\n\n return errors;\n}\n\n/**\n * Validate FHIR Observation\n */\nexport function validateFHIRObservation(observation: FHIRObservation): string[] {\n const errors: string[] = [];\n\n if (!observation.resourceType || observation.resourceType !== 'Observation') {\n errors.push('Invalid resourceType');\n }\n\n if (!observation.status) {\n errors.push('Missing status');\n }\n\n if (!observation.code || !observation.code.coding || observation.code.coding.length === 0) {\n errors.push('Missing or invalid code');\n }\n\n if (!observation.subject || !observation.subject.reference) {\n errors.push('Missing subject reference');\n }\n\n if (!observation.valueQuantity && !observation.valueString) {\n errors.push('Missing value (valueQuantity or valueString)');\n }\n\n errors.push(...ucumErrors(observation.valueQuantity, 'valueQuantity'));\n for (const [i, range] of (observation.referenceRange ?? []).entries()) {\n errors.push(...ucumErrors(range.low, `referenceRange[${i}].low`));\n errors.push(...ucumErrors(range.high, `referenceRange[${i}].high`));\n }\n\n return errors;\n}\n\n/**\n * Validate that the input is a structurally valid FHIR Bundle\n */\nexport function validateFHIRImportBundle(data: unknown): ImportError[] {\n const errors: ImportError[] = [];\n\n if (!data || typeof data !== 'object') {\n errors.push({ details: 'Input must be a JSON object', field: 'root' });\n return errors;\n }\n\n const bundle = data as Record<string, unknown>;\n\n if (bundle.resourceType !== 'Bundle') {\n errors.push({\n details: `Expected resourceType \"Bundle\", got \"${String(bundle.resourceType)}\"`,\n field: 'resourceType',\n });\n }\n\n if (!Array.isArray(bundle.entry)) {\n errors.push({ details: 'Bundle must contain an \"entry\" array', field: 'entry' });\n } else if (bundle.entry.length === 0) {\n errors.push({ details: 'Bundle entry array is empty', field: 'entry' });\n }\n\n return errors;\n}\n"]}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
var _chunkOR67NJDZcjs = require('./chunk-OR67NJDZ.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkH64L6SOVcjs = require('./chunk-H64L6SOV.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkAQTHAZLKcjs = require('./chunk-AQTHAZLK.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
var _chunkJES2ZLH5cjs = require('./chunk-JES2ZLH5.cjs');
|
|
15
16
|
|
|
16
17
|
// src/bundle-urls.ts
|
|
17
18
|
var BUNDLE_BASE_URL = "https://precisa-saude.com.br/fhir";
|
|
@@ -62,15 +63,16 @@ var buildReferenceRanges = (observation, quantity) => {
|
|
|
62
63
|
if (observation.referenceRanges && observation.referenceRanges.length > 0) {
|
|
63
64
|
return observation.referenceRanges.flatMap((r) => toRanges(r.low, r.high, r.appliesTo));
|
|
64
65
|
}
|
|
65
|
-
const meaning = observation.referenceKind &&
|
|
66
|
+
const meaning = observation.referenceKind && _chunkH64L6SOVcjs.referenceRangeMeaning.call(void 0, observation.referenceKind);
|
|
66
67
|
return toRanges(observation.referenceMin, observation.referenceMax).map(
|
|
67
68
|
(range) => meaning ? { ...range, type: { coding: [meaning] } } : range
|
|
68
69
|
);
|
|
69
70
|
};
|
|
70
71
|
function labObservationToFHIR(observation, patientId, laboratoryName) {
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
const
|
|
72
|
+
const methodLoinc = observation.methodLoinc && _chunkJES2ZLH5cjs.methodVariantOf.call(void 0, observation.biomarkerCode, observation.methodLoinc) ? observation.methodLoinc : void 0;
|
|
73
|
+
const loincCode = _nullishCoalesce(methodLoinc, () => ( _chunkJES2ZLH5cjs.codeToLoinc.call(void 0, observation.biomarkerCode)));
|
|
74
|
+
const sourceUnit = observation.unit || _chunkAQTHAZLKcjs.getDefaultUnit.call(void 0, observation.biomarkerCode) || observation.unit;
|
|
75
|
+
const ucumUnit = _chunkAQTHAZLKcjs.resolveUcum.call(void 0, sourceUnit, observation.biomarkerCode);
|
|
74
76
|
const quantity = (value) => ({
|
|
75
77
|
...ucumUnit ? { code: ucumUnit, system: "http://unitsofmeasure.org" } : {},
|
|
76
78
|
...sourceUnit ? { unit: sourceUnit } : {},
|
|
@@ -271,4 +273,4 @@ function labResultToFHIRBundle(report, observations, userProfile) {
|
|
|
271
273
|
|
|
272
274
|
|
|
273
275
|
exports.BUNDLE_BASE_URL = BUNDLE_BASE_URL; exports.entryFullUrl = entryFullUrl; exports.labObservationToFHIR = labObservationToFHIR; exports.labReportToFHIR = labReportToFHIR; exports.userProfileToFHIR = userProfileToFHIR; exports.labResultToFHIRBundle = labResultToFHIRBundle;
|
|
274
|
-
//# sourceMappingURL=chunk-
|
|
276
|
+
//# sourceMappingURL=chunk-WKTDMR5P.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/fhir-brasil/fhir-brasil/packages/core/dist/chunk-WKTDMR5P.cjs","../src/bundle-urls.ts","../src/converter.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACkBO,IAAM,gBAAA,EAAkB,mCAAA;AAgBxB,IAAM,aAAA,EAAe,CAAC,QAAA,EAAA,GAC3B,CAAA,EAAA;ADhCgC;AACA;AEQc;AAChC,EAAA;AACP,IAAA;AACI,MAAA;AAAA;AACJ,IAAA;AACI,MAAA;AAAA;AACT,IAAA;AACS,MAAA;AACX,EAAA;AACF;AAK+B;AACf,EAAA;AACP,IAAA;AACI,MAAA;AACJ,IAAA;AACI,MAAA;AACT,IAAA;AACS,MAAA;AACX,EAAA;AACF;AAamB;AACT,EAAA;AACA,IAAA;AACG,IAAA;AACD,IAAA;AACV,EAAA;AAC+B,EAAA;AACjC;AAoBE;AAM+C,EAAA;AACpB,IAAA;AAElB,IAAA;AACL,MAAA;AAC+B,QAAA;AACC,QAAA;AACD,QAAA;AAC/B,MAAA;AACF,IAAA;AACF,EAAA;AAUgB,EAAA;AACK,IAAA;AACrB,EAAA;AAE4B,EAAA;AACA,EAAA;AACX,IAAA;AACjB,EAAA;AACF;AAME;AAQc,EAAA;AAGI,EAAA;AAGJ,EAAA;A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AA;AACG,YAAA;AACD,YAAA;AACV,UAAA;AACF,QAAA;AACF,MAAA;AAEF,IAAA;AACoB,IAAA;AACf,IAAA;AACI,IAAA;AACG,IAAA;AACJ,IAAA;AACc,IAAA;AAC5B,IAAA;AACS,IAAA;AACe,MAAA;AACxB,IAAA;AACF,EAAA;AACF;AAMkC;AACD,EAAA;AACD,EAAA;AACL,EAAA;AAElB,EAAA;AAED,IAAA;AACE,MAAA;AACwB,QAAA;AACG,QAAA;AACnB,QAAA;AACY,UAAA;AAGA,UAAA;AACF,QAAA;AACI,QAAA;AACG,QAAA;AACzB,MAAA;AAEF,IAAA;AACe,IAAA;AACH,IAAA;AACJ,IAAA;AACN,IAAA;AACJ,MAAA;AACE,QAAA;AAC0B,QAAA;AACZ,QAAA;AAChB,MAAA;AACF,IAAA;AACc,IAAA;AAEZ,IAAA;AACyB,MAAA;AACA,MAAA;AAErB,IAAA;AACyB,MAAA;AACA,MAAA;AAEzB,IAAA;AACR,EAAA;AACF;AAOE;AAI8B,EAAA;AAGL,EAAA;AACN,IAAA;AACW,MAAA;AAC1B,MAAA;AACO,MAAA;AACT,IAAA;AAEkB,IAAA;AACnB,EAAA;AAKsB,EAAA;AAGE,EAAA;AAGL,EAAA;AAEb,EAAA;AACE,IAAA;AACmB,MAAA;AACA,MAAA;AACrB,MAAA;AACL,IAAA;AACc,IAAA;AACR,IAAA;AACR,EAAA;AACF;AFtIkC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/fhir-brasil/fhir-brasil/packages/core/dist/chunk-WKTDMR5P.cjs","sourcesContent":[null,"/**\n * Endereço das entradas de um Bundle.\n *\n * O `fullUrl` identifica a entrada, e é contra ele que o validador resolve as\n * referências entre os recursos. Um Bundle com `subject.reference` valendo\n * `Patient/abc` só resolve se alguma entrada tiver `fullUrl` terminando em\n * `/Patient/abc`: a referência relativa é lida contra a base do `fullUrl` da\n * entrada, que é como os exemplos da própria HL7 montam Bundle de coleção.\n *\n * Antes o `fullUrl` era `urn:uuid:observation-<laudo>-<código>`, que erra duas\n * vezes. `urn:uuid:` exige a sintaxe de UUID e aquilo não era um UUID, e num\n * Bundle de entradas `urn:uuid:` a referência precisa repetir a URN inteira,\n * então nenhuma das relativas resolvia. Um laudo de 22 marcadores saía com 24\n * erros de URN e 22 referências perdidas.\n */\n/**\n * Recurso que já tem id, e por isso pode ser endereçado numa entrada.\n *\n * No FHIR o `id` é opcional, porque um recurso pode viajar sem identidade\n * própria. Numa entrada de Bundle ele não pode: sem id não há `fullUrl`, e sem\n * `fullUrl` nenhuma referência chega ao recurso. Os conversores daqui sempre\n * atribuem um, e o tipo passa a dizer isso em vez de deixar `undefined` chegar\n * até a montagem da URL.\n */\nexport type Addressable<T> = T & { id: string };\n\n/**\n * Base dos `fullUrl`.\n *\n * Não precisa responder a uma requisição: no FHIR o `fullUrl` é identidade, não\n * endereço de download. Fica sob um domínio nosso para não colidir com a\n * identidade de recurso de outra instituição, que é o risco real de usar\n * `example.org` em dado que sai da máquina.\n */\nexport const BUNDLE_BASE_URL = 'https://precisa-saude.com.br/fhir';\n\n/**\n * Monta o `fullUrl` a partir do próprio recurso.\n *\n * Recebe o recurso em vez do tipo e do id soltos de propósito. O defeito que\n * isto substitui nasceu de montar os dois lados em separado: o `fullUrl` dizia\n * `observation-demo-Hgb` enquanto o recurso tinha id `demo-Hgb`, e ninguém\n * percebeu porque nada obrigava os dois a concordarem.\n *\n * O parâmetro pede o mínimo que a URL consome, e não a união de recursos que\n * este pacote converte. Um Bundle pode carregar qualquer recurso do R4, e quem\n * acrescenta uma entrada de um tipo que não está nessa união (um `Specimen`,\n * por exemplo) precisa do mesmo endereço, senão monta o dele e as duas formas\n * divergem outra vez.\n */\nexport const entryFullUrl = (resource: Addressable<{ resourceType: string }>): string =>\n `${BUNDLE_BASE_URL}/${resource.resourceType}/${resource.id}`;\n","/**\n * FHIR Converter\n *\n * Converts lab results to FHIR R4 DiagnosticReport and Observation resources.\n * See: https://hl7.org/fhir/diagnosticreport.html\n */\n\nimport { codeToLoinc, methodVariantOf } from './biomarkers';\nimport { type Addressable, entryFullUrl } from './bundle-urls';\nimport { BIOMARKER_CODE_SYSTEM, LOINC_SYSTEM } from './code-systems';\nimport type {\n FHIRBundle,\n FHIRDiagnosticReport,\n FHIRObservation,\n FHIRPatient,\n FHIRQuantity,\n FHIRReferenceRange,\n} from './fhir-types';\nimport { referenceRangeMeaning } from './reference-ranges';\nimport type { Flag, LabObservationData, LabReportData, UserProfileData } from './types';\nimport { getDefaultUnit, resolveUcum } from './units';\n\n// Re-export all types and functions\nexport * from './fhir-types';\n\n/**\n * Convert Flag to FHIR interpretation code\n */\nfunction interpretationCode(flag: Flag): string {\n switch (flag) {\n case 'H':\n return 'H'; // High\n case 'L':\n return 'L'; // Low\n default:\n return 'N'; // Normal\n }\n}\n\n/**\n * Convert Flag to FHIR interpretation display\n */\nfunction interpretationDisplay(flag: Flag): string {\n switch (flag) {\n case 'H':\n return 'High';\n case 'L':\n return 'Low';\n default:\n return 'Normal';\n }\n}\n\n/**\n * O `coding` do sexo, que vai **dentro** do CodeableConcept do `appliesTo`.\n *\n * O nome diz `CODING` e não `APPLIES_TO` de propósito: isto não é o valor do\n * campo, é uma entrada da lista de codificações dele. O embrulho acontece no\n * uso, em `{ coding: [SEX_CODING[sex]] }`.\n *\n * É o `AdministrativeGender`, e não o v3-ObservationInterpretation nem um\n * sistema nosso: um consumidor que já lê `Patient.gender` compara os dois sem\n * tabela de tradução no meio.\n */\nconst SEX_CODING = {\n female: {\n code: 'female',\n display: 'Female',\n system: 'http://hl7.org/fhir/administrative-gender',\n },\n male: { code: 'male', display: 'Male', system: 'http://hl7.org/fhir/administrative-gender' },\n} as const;\n\n/**\n * Monta as faixas de referência do `Observation`.\n *\n * Duas mudanças em relação ao que existia, e as duas são sobre não perder o que\n * o laudo imprimiu.\n *\n * **Um limite só já basta.** Antes a faixa só saía com os dois, e um laudo que\n * publica \"inferior a 190 mg/dL\" ou \"superior a 60 mL/min/1,73m²\" perdia o\n * campo inteiro. O R4 trata `low` e `high` como opcionais independentes e\n * documenta o caso de um lado só, e o importador deste mesmo pacote já lia\n * `low?.value` e `high?.value` com acesso opcional: a assimetria era só do\n * escritor. Ver PRE-430.\n *\n * **Mais de uma faixa, anotada.** Laudo com uma coluna de referência por sexo\n * passa a sair com as duas, cada uma com o seu `appliesTo`, em vez de o\n * pipeline escolher uma sem saber de quem é o exame. Ver PRE-424 e PRE-425.\n */\nconst buildReferenceRanges = (\n observation: LabObservationData,\n quantity: (value: number) => FHIRQuantity,\n): FHIRReferenceRange[] => {\n // Devolve lista, e não uma faixa: o caso sem limite nenhum vira lista vazia\n // em vez de `undefined`, e aí os dois caminhos abaixo se compõem com\n // `flatMap` sem ninguém precisar filtrar nada depois.\n const toRanges = (low?: number, high?: number, sex?: 'female' | 'male'): FHIRReferenceRange[] => {\n if (low === undefined && high === undefined) return [];\n\n return [\n {\n ...(sex === undefined ? {} : { appliesTo: [{ coding: [SEX_CODING[sex]] }] }),\n ...(high === undefined ? {} : { high: quantity(high) }),\n ...(low === undefined ? {} : { low: quantity(low) }),\n },\n ];\n };\n\n // A lista anotada tem precedência: quando ela existe, o par simples é o\n // resumo de uma das colunas e repeti-lo publicaria a mesma faixa duas vezes,\n // uma delas sem dizer a quem se aplica.\n //\n // Lista vazia cai no par simples, igual a ausente, e isso é escolha: as duas\n // dizem \"não tenho faixa anotada\", e tratá-las diferente faria um `[]` vindo\n // de um `.filter()` apagar em silêncio a faixa que o chamador também mandou\n // em `referenceMin` e `referenceMax`.\n if (observation.referenceRanges && observation.referenceRanges.length > 0) {\n return observation.referenceRanges.flatMap((r) => toRanges(r.low, r.high, r.appliesTo));\n }\n\n const meaning = observation.referenceKind && referenceRangeMeaning(observation.referenceKind);\n return toRanges(observation.referenceMin, observation.referenceMax).map((range) =>\n meaning ? { ...range, type: { coding: [meaning] } } : range,\n );\n};\n\n/**\n * Convert generic lab observation to FHIR Observation\n */\nexport function labObservationToFHIR(\n observation: LabObservationData,\n patientId: string,\n laboratoryName?: string,\n): Addressable<FHIRObservation> {\n // O código por método só sai quando é variante declarada do biomarcador. Um\n // `methodLoinc` qualquer viraria afirmação sob `http://loinc.org` que o\n // catálogo não conferiu.\n const methodLoinc =\n observation.methodLoinc && methodVariantOf(observation.biomarkerCode, observation.methodLoinc)\n ? observation.methodLoinc\n : undefined;\n const loincCode = methodLoinc ?? codeToLoinc(observation.biomarkerCode);\n // Use default unit if source unit is empty\n const sourceUnit =\n observation.unit || getDefaultUnit(observation.biomarkerCode) || observation.unit;\n // `system` + `code` só saem quando a unidade resolve em UCUM. Unidade que o\n // pacote não sabe traduzir fica só em `unit`, como texto: afirmar\n // `http://unitsofmeasure.org` sobre `x10^3/mm3` era publicar um código\n // falso, e quem consome o Bundle confiando no system trataria aquilo como\n // UCUM de verdade.\n const ucumUnit = resolveUcum(sourceUnit, observation.biomarkerCode);\n const quantity = (value: number): FHIRQuantity => ({\n ...(ucumUnit ? { code: ucumUnit, system: 'http://unitsofmeasure.org' } : {}),\n ...(sourceUnit ? { unit: sourceUnit } : {}),\n value,\n });\n const isQualitative = observation.isQualitative || typeof observation.value === 'string';\n\n // Base observation structure\n const fhirObs: Addressable<FHIRObservation> = {\n category: [\n {\n coding: [\n {\n code: 'laboratory',\n display: 'Laboratory',\n system: 'http://terminology.hl7.org/CodeSystem/observation-category',\n },\n ],\n },\n ],\n code: {\n // Sem LOINC, o coding LOINC simplesmente não sai. Antes ia `99999-9`,\n // que não é código LOINC nenhum: publicava sob `http://loinc.org` uma\n // afirmação falsa, e quem consumisse o bundle confiando no system\n // trataria aquilo como código de verdade. Composição corporal, densidade\n // óssea e escore de cálcio não têm LOINC, e o certo é a lacuna explícita.\n coding: [\n ...(loincCode\n ? [\n {\n code: loincCode,\n display: observation.biomarkerName,\n system: LOINC_SYSTEM,\n },\n ]\n : []),\n {\n code: observation.biomarkerCode,\n display: observation.biomarkerName,\n system: BIOMARKER_CODE_SYSTEM,\n },\n ],\n text: observation.biomarkerName,\n },\n effectiveDateTime: observation.collectionDate,\n id: `${observation.reportId}-${observation.biomarkerCode}`,\n interpretation: [\n {\n coding: [\n {\n code: interpretationCode(observation.flag),\n display: interpretationDisplay(observation.flag),\n system: 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation',\n },\n ],\n },\n ],\n performer: laboratoryName ? [{ display: laboratoryName }] : undefined,\n resourceType: 'Observation',\n status: 'final',\n subject: {\n reference: `Patient/${patientId}`,\n },\n };\n\n // Add value based on type (qualitative = string, quantitative = number)\n if (isQualitative) {\n fhirObs.valueString = String(observation.value);\n } else {\n fhirObs.valueQuantity = quantity(observation.value as number);\n\n // Reference range only applies to quantitative values\n const referenceRange = buildReferenceRanges(observation, quantity);\n if (referenceRange.length > 0) fhirObs.referenceRange = referenceRange;\n }\n\n return fhirObs;\n}\n\n/**\n * Convert generic lab report to FHIR DiagnosticReport\n */\nexport function labReportToFHIR(\n report: LabReportData,\n patientId: string,\n observationIds: string[],\n): Addressable<FHIRDiagnosticReport> {\n // Map processing status to FHIR status\n let status: FHIRDiagnosticReport['status'];\n switch (report.processingStatus) {\n case 'complete':\n status = 'final';\n break;\n case 'partial':\n status = 'partial';\n break;\n case 'pending_review':\n status = 'preliminary';\n break;\n default:\n status = 'final';\n }\n\n return {\n category: [\n {\n coding: [\n {\n code: 'LAB',\n display: 'Laboratory',\n system: 'http://terminology.hl7.org/CodeSystem/v2-0074',\n },\n ],\n },\n ],\n code: {\n coding: [\n {\n code: '11502-2', // Laboratory report\n display: 'Laboratory report',\n system: 'http://loinc.org',\n },\n ],\n text: 'Laboratory Results',\n },\n conclusion:\n report.overallStatus === 'NORMAL'\n ? 'All results within normal limits'\n : 'One or more abnormal results detected',\n conclusionCode:\n report.overallStatus === 'ANORMAL'\n ? [\n {\n coding: [\n {\n code: 'A',\n display: 'Abnormal',\n system: 'http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation',\n },\n ],\n },\n ]\n : undefined,\n effectiveDateTime: report.collectionDate,\n id: report.reportId,\n issued: report.createdAt,\n performer: report.laboratoryName ? [{ display: report.laboratoryName }] : undefined,\n resourceType: 'DiagnosticReport',\n result: observationIds.map((id) => ({ reference: `Observation/${id}` })),\n status,\n subject: {\n reference: `Patient/${patientId}`,\n },\n };\n}\n\n/**\n * Convert user profile to FHIR Patient\n * NOTE: CPF is intentionally excluded for privacy (LGPD compliance)\n */\nexport function userProfileToFHIR(profile: UserProfileData): Addressable<FHIRPatient> {\n const nameParts = profile.name.split(' ');\n const given = nameParts.slice(0, -1);\n const family = nameParts[nameParts.length - 1] || '';\n\n return {\n address: profile.address\n ? [\n {\n city: profile.address.city,\n country: profile.address.country || 'BR',\n line: [\n profile.address.street && profile.address.number\n ? `${profile.address.street}, ${profile.address.number}`\n : profile.address.street,\n profile.address.complement,\n ].filter(Boolean) as string[],\n postalCode: profile.address.postalCode,\n state: profile.address.state,\n },\n ]\n : undefined,\n birthDate: profile.birthDate,\n gender: profile.gender,\n id: profile.userId,\n name: [\n {\n family,\n given: given.length > 0 ? given : undefined,\n text: profile.name,\n },\n ],\n resourceType: 'Patient',\n telecom:\n [\n ...(profile.email ? [{ system: 'email' as const, value: profile.email }] : []),\n ...(profile.phone ? [{ system: 'phone' as const, value: profile.phone }] : []),\n ].length > 0\n ? [\n ...(profile.email ? [{ system: 'email' as const, value: profile.email }] : []),\n ...(profile.phone ? [{ system: 'phone' as const, value: profile.phone }] : []),\n ]\n : undefined,\n };\n}\n\n/**\n * Convert complete lab result to FHIR Bundle\n * This is the main function for exporting lab results to FHIR R4 format\n */\nexport function labResultToFHIRBundle(\n report: LabReportData,\n observations: LabObservationData[],\n userProfile: UserProfileData,\n): FHIRBundle {\n const patientId = userProfile.userId;\n\n // Convert observations\n const fhirObservations = observations.map((obs) => {\n const resource = labObservationToFHIR(\n { ...obs, collectionDate: report.collectionDate },\n patientId,\n report.laboratoryName,\n );\n\n return { fullUrl: entryFullUrl(resource), resource };\n });\n\n // Os ids vêm dos recursos já montados, e não de uma segunda montagem da mesma\n // regra. O `DiagnosticReport.result` aponta para eles, e era aqui que a\n // referência se separava do recurso.\n const observationIds = fhirObservations.map((entry) => entry.resource.id);\n\n // Convert report\n const diagnosticReport = labReportToFHIR(report, patientId, observationIds);\n\n // Convert patient\n const fhirPatient = userProfileToFHIR(userProfile);\n\n return {\n entry: [\n { fullUrl: entryFullUrl(fhirPatient), resource: fhirPatient },\n { fullUrl: entryFullUrl(diagnosticReport), resource: diagnosticReport },\n ...fhirObservations,\n ],\n resourceType: 'Bundle',\n type: 'collection',\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isUcumCode
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LWSKO7UV.js";
|
|
4
4
|
|
|
5
5
|
// src/validators.ts
|
|
6
6
|
var UCUM_SYSTEM = "http://unitsofmeasure.org";
|
|
@@ -78,4 +78,4 @@ export {
|
|
|
78
78
|
validateFHIRObservation,
|
|
79
79
|
validateFHIRImportBundle
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-YI5WYZCP.js.map
|
package/dist/cli.js
CHANGED
|
@@ -115,6 +115,32 @@ var BIOMARKER_DEFINITIONS = [
|
|
|
115
115
|
category: "coracao",
|
|
116
116
|
code: "LDL",
|
|
117
117
|
loinc: "2089-1",
|
|
118
|
+
// Os três irmãos de 2089-1 no eixo Method, conferidos ativos em out/2026.
|
|
119
|
+
// Medido em três dezenas de laudos reais, a única pista escrita foi a
|
|
120
|
+
// nota de rodapé de um laboratório norte-americano que declara o cálculo de
|
|
121
|
+
// Martin-Hopkins. Nenhum laudo brasileiro do corpus imprimiu "calculado",
|
|
122
|
+
// "direto" ou "Método:" perto do LDL, e por isso as outras duas variantes
|
|
123
|
+
// ficam sem pista até aparecer laudo que as afirme.
|
|
124
|
+
methodVariants: [
|
|
125
|
+
{
|
|
126
|
+
cues: { en: ["calculated using the Martin-Hopkins"], pt: [] },
|
|
127
|
+
loinc: "96259-7",
|
|
128
|
+
method: "Calculated.Martin-Hopkins",
|
|
129
|
+
note: 'Rodap\xE9 "LDL-C is now calculated using the Martin-Hopkins calculation", que menciona Friedewald s\xF3 para comparar. Por isso a pista \xE9 a frase afirmativa, e n\xE3o o nome do m\xE9todo.'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
cues: { en: [], pt: [] },
|
|
133
|
+
loinc: "13457-7",
|
|
134
|
+
method: "Calculated",
|
|
135
|
+
note: "Friedewald. Sem pista: nenhum laudo do corpus afirmou o c\xE1lculo por escrito."
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
cues: { en: [], pt: [] },
|
|
139
|
+
loinc: "18262-6",
|
|
140
|
+
method: "Direct assay",
|
|
141
|
+
note: "Dosagem direta. Sem pista: nenhum laudo do corpus afirmou o m\xE9todo por escrito."
|
|
142
|
+
}
|
|
143
|
+
],
|
|
118
144
|
names: {
|
|
119
145
|
en: ["LDL Cholesterol", "LDL", "Low-Density Lipoprotein"],
|
|
120
146
|
pt: ["Colesterol LDL", "LDL", "LDL-Colesterol"]
|
|
@@ -3121,7 +3147,15 @@ var BIOMARKER_DEFINITIONS = [
|
|
|
3121
3147
|
{
|
|
3122
3148
|
category: "sangue",
|
|
3123
3149
|
code: "DDimer",
|
|
3124
|
-
|
|
3150
|
+
// 48065-7 é "Fibrin D-dimer FEU [Mass/volume] in Platelet poor plasma".
|
|
3151
|
+
// Até out/2026 apontava para 48066-5, o mesmo analito em DDU (unidades de
|
|
3152
|
+
// D-dímero), que vale cerca de metade do FEU. A faixa do catálogo (500
|
|
3153
|
+
// ng/mL, com o corte por idade de idade × 10) é da convenção FEU, e um
|
|
3154
|
+
// resultado em DDU avaliado contra ela deixaria passar metade dos
|
|
3155
|
+
// anormais. Sem alias: DDU é outra grandeza. Quando o laudo imprime só
|
|
3156
|
+
// "ng/mL", não há como saber a convenção pelo texto; o FEU é o que a
|
|
3157
|
+
// faixa pressupõe.
|
|
3158
|
+
loinc: "48065-7",
|
|
3125
3159
|
names: {
|
|
3126
3160
|
en: ["D-Dimer", "D Dimer", "Fibrin D-Dimer"],
|
|
3127
3161
|
pt: ["D\xEDmero-D", "D\xEDmero D", "D-D\xEDmero"]
|
|
@@ -3313,6 +3347,10 @@ for (const def of BIOMARKER_DEFINITIONS) {
|
|
|
3313
3347
|
validLoincSet.add(alias);
|
|
3314
3348
|
}
|
|
3315
3349
|
}
|
|
3350
|
+
for (const variant of def.methodVariants ?? []) {
|
|
3351
|
+
loincToCodeMap.set(variant.loinc, def.code);
|
|
3352
|
+
validLoincSet.add(variant.loinc);
|
|
3353
|
+
}
|
|
3316
3354
|
if (def.codeAliases) {
|
|
3317
3355
|
for (const alias of def.codeAliases) {
|
|
3318
3356
|
codeAliasToCanonicalMap.set(alias, def.code);
|
|
@@ -3324,6 +3362,9 @@ for (const def of BIOMARKER_DEFINITIONS) {
|
|
|
3324
3362
|
function loincToCode(loinc) {
|
|
3325
3363
|
return loincToCodeMap.get(loinc);
|
|
3326
3364
|
}
|
|
3365
|
+
function methodVariantOf(code, loinc) {
|
|
3366
|
+
return codeToDefinitionMap.get(code)?.methodVariants?.find((v) => v.loinc === loinc);
|
|
3367
|
+
}
|
|
3327
3368
|
function codeToLoinc(code) {
|
|
3328
3369
|
return codeToLoincMap.get(code);
|
|
3329
3370
|
}
|
|
@@ -4865,10 +4906,15 @@ var biomarkerRangeDefinitions = {
|
|
|
4865
4906
|
// representada por zonas verde/amarela. Em pacientes > 50 anos,
|
|
4866
4907
|
// diretrizes (ESC 2019, ACEP) recomendam corte ajustado pela idade:
|
|
4867
4908
|
// idade × 10 ng/mL (até 750 ng/mL aos 75+).
|
|
4909
|
+
//
|
|
4910
|
+
// Todos os valores são em FEU (unidades equivalentes de fibrinogênio), e o
|
|
4911
|
+
// código do catálogo é o do FEU (48065-7). Em DDU os cortes caem pela
|
|
4912
|
+
// metade; não existe faixa DDU aqui.
|
|
4868
4913
|
DDimer: {
|
|
4869
4914
|
default: { max: 500, min: 0, unit: "ng/mL" },
|
|
4870
4915
|
direction: "lower-better",
|
|
4871
4916
|
kind: "decision-threshold",
|
|
4917
|
+
loinc: "48065-7",
|
|
4872
4918
|
source: "wells-ddimer-2003",
|
|
4873
4919
|
variants: [
|
|
4874
4920
|
// Corte ajustado por idade — ESC 2019 (Konstantinides et al.) e
|
|
@@ -5514,6 +5560,7 @@ var biomarkerRangeDefinitions = {
|
|
|
5514
5560
|
default: { max: 125, min: 0, optimalMax: 75, optimalMin: 0, unit: "nmol/L" },
|
|
5515
5561
|
direction: "lower-better",
|
|
5516
5562
|
kind: "decision-threshold",
|
|
5563
|
+
loinc: "43583-4",
|
|
5517
5564
|
source: "sbc-lipids-2025"
|
|
5518
5565
|
},
|
|
5519
5566
|
// `Lymphocytes` (%) fica sem faixa de propósito e `Lymphocytes_Abs` usa os limites da
|
|
@@ -5980,6 +6027,7 @@ var biomarkerRangeDefinitions = {
|
|
|
5980
6027
|
TroponinI: {
|
|
5981
6028
|
default: { max: 0.04, min: 0, optimalMax: 0.02, optimalMin: 0, unit: "ng/mL" },
|
|
5982
6029
|
kind: "reference-interval",
|
|
6030
|
+
loinc: "49563-0",
|
|
5983
6031
|
source: "keller-tni-2013"
|
|
5984
6032
|
},
|
|
5985
6033
|
// TroponinT: 14 ng/L = percentil 99 hs-cTnT (ensaio Roche Elecsys 5ª geração)
|
|
@@ -6831,7 +6879,8 @@ var buildReferenceRanges = (observation, quantity) => {
|
|
|
6831
6879
|
);
|
|
6832
6880
|
};
|
|
6833
6881
|
function labObservationToFHIR(observation, patientId, laboratoryName) {
|
|
6834
|
-
const
|
|
6882
|
+
const methodLoinc = observation.methodLoinc && methodVariantOf(observation.biomarkerCode, observation.methodLoinc) ? observation.methodLoinc : void 0;
|
|
6883
|
+
const loincCode = methodLoinc ?? codeToLoinc(observation.biomarkerCode);
|
|
6835
6884
|
const sourceUnit = observation.unit || getDefaultUnit(observation.biomarkerCode) || observation.unit;
|
|
6836
6885
|
const ucumUnit = resolveUcum(sourceUnit, observation.biomarkerCode);
|
|
6837
6886
|
const quantity = (value) => ({
|
|
@@ -7179,6 +7228,7 @@ function mapFHIRObservationToInternal(observation, index) {
|
|
|
7179
7228
|
flag: extractFlag(observation),
|
|
7180
7229
|
isQualitative,
|
|
7181
7230
|
loincCode,
|
|
7231
|
+
...loincCode && methodVariantOf(internalCode, loincCode) && { methodLoinc: loincCode },
|
|
7182
7232
|
...referenceKind && { referenceKind },
|
|
7183
7233
|
referenceMax,
|
|
7184
7234
|
referenceMin,
|
|
@@ -7877,7 +7927,7 @@ var COMMANDS = {
|
|
|
7877
7927
|
async function main() {
|
|
7878
7928
|
const { command, help, json, resto, version } = dividirArgv(process.argv.slice(2));
|
|
7879
7929
|
if (version) {
|
|
7880
|
-
process.stdout.write(`${"0.
|
|
7930
|
+
process.stdout.write(`${"0.35.1"}
|
|
7881
7931
|
`);
|
|
7882
7932
|
return;
|
|
7883
7933
|
}
|
|
@@ -101,6 +101,12 @@ interface LabObservationData {
|
|
|
101
101
|
collectionDate?: string;
|
|
102
102
|
flag: Flag;
|
|
103
103
|
isQualitative?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* O LOINC por método, quando o laudo afirmou o método por escrito. Só vale
|
|
106
|
+
* se for uma das `methodVariants` declaradas para o biomarcador; qualquer
|
|
107
|
+
* outro valor é ignorado e sai o código sem método.
|
|
108
|
+
*/
|
|
109
|
+
methodLoinc?: string;
|
|
104
110
|
/**
|
|
105
111
|
* Tipo da faixa simples (`referenceMin`/`referenceMax`), quando quem chama
|
|
106
112
|
* sabe. Sai como `referenceRange.type`. Faixa impressa pelo laboratório
|
|
@@ -101,6 +101,12 @@ interface LabObservationData {
|
|
|
101
101
|
collectionDate?: string;
|
|
102
102
|
flag: Flag;
|
|
103
103
|
isQualitative?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* O LOINC por método, quando o laudo afirmou o método por escrito. Só vale
|
|
106
|
+
* se for uma das `methodVariants` declaradas para o biomarcador; qualquer
|
|
107
|
+
* outro valor é ignorado e sai o código sem método.
|
|
108
|
+
*/
|
|
109
|
+
methodLoinc?: string;
|
|
104
110
|
/**
|
|
105
111
|
* Tipo da faixa simples (`referenceMin`/`referenceMax`), quando quem chama
|
|
106
112
|
* sabe. Sai como `referenceRange.type`. Faixa impressa pelo laboratório
|
package/dist/converter.cjs
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkWKTDMR5Pcjs = require('./chunk-WKTDMR5P.cjs');
|
|
7
7
|
require('./chunk-OR67NJDZ.cjs');
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
10
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-H64L6SOV.cjs');
|
|
9
|
+
require('./chunk-AQTHAZLK.cjs');
|
|
10
|
+
require('./chunk-JES2ZLH5.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.labObservationToFHIR =
|
|
16
|
+
exports.labObservationToFHIR = _chunkWKTDMR5Pcjs.labObservationToFHIR; exports.labReportToFHIR = _chunkWKTDMR5Pcjs.labReportToFHIR; exports.labResultToFHIRBundle = _chunkWKTDMR5Pcjs.labResultToFHIRBundle; exports.userProfileToFHIR = _chunkWKTDMR5Pcjs.userProfileToFHIR;
|
|
17
17
|
//# sourceMappingURL=converter.cjs.map
|
package/dist/converter.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { l as labObservationToFHIR, b as labReportToFHIR, c as labResultToFHIRBundle, u as userProfileToFHIR } from './converter-
|
|
1
|
+
export { l as labObservationToFHIR, b as labReportToFHIR, c as labResultToFHIRBundle, u as userProfileToFHIR } from './converter-Dlwb6OfB.cjs';
|
|
2
2
|
export { e as FHIRAddress, f as FHIRAnnotation, g as FHIRAttachment, b as FHIRBundle, h as FHIRBundleEntry, i as FHIRCodeableConcept, d as FHIRCoding, j as FHIRContactPoint, k as FHIRDiagnosticReport, l as FHIRHumanName, c as FHIRIdentifier, F as FHIRMedicationStatement, a as FHIRObservation, m as FHIRPatient, n as FHIRPeriod, o as FHIRQuantity, p as FHIRReference, q as FHIRReferenceRange } from './fhir-types-Cn5WFbOI.cjs';
|
|
3
3
|
import './reference-ranges.cjs';
|
package/dist/converter.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { l as labObservationToFHIR, b as labReportToFHIR, c as labResultToFHIRBundle, u as userProfileToFHIR } from './converter-
|
|
1
|
+
export { l as labObservationToFHIR, b as labReportToFHIR, c as labResultToFHIRBundle, u as userProfileToFHIR } from './converter-CTj83kPz.js';
|
|
2
2
|
export { e as FHIRAddress, f as FHIRAnnotation, g as FHIRAttachment, b as FHIRBundle, h as FHIRBundleEntry, i as FHIRCodeableConcept, d as FHIRCoding, j as FHIRContactPoint, k as FHIRDiagnosticReport, l as FHIRHumanName, c as FHIRIdentifier, F as FHIRMedicationStatement, a as FHIRObservation, m as FHIRPatient, n as FHIRPeriod, o as FHIRQuantity, p as FHIRReference, q as FHIRReferenceRange } from './fhir-types-Cn5WFbOI.js';
|
|
3
3
|
import './reference-ranges.js';
|
package/dist/converter.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
labReportToFHIR,
|
|
4
4
|
labResultToFHIRBundle,
|
|
5
5
|
userProfileToFHIR
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-M6AYGD7P.js";
|
|
7
7
|
import "./chunk-A6HR4XDK.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-7TDZX5HO.js";
|
|
9
|
+
import "./chunk-LWSKO7UV.js";
|
|
10
|
+
import "./chunk-KTV4H2QQ.js";
|
|
11
11
|
export {
|
|
12
12
|
labObservationToFHIR,
|
|
13
13
|
labReportToFHIR,
|
package/dist/importer.cjs
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
7
|
+
var _chunkF7CC4SV5cjs = require('./chunk-F7CC4SV5.cjs');
|
|
8
|
+
require('./chunk-RPGJK7ZM.cjs');
|
|
9
9
|
require('./chunk-OR67NJDZ.cjs');
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
10
|
+
require('./chunk-AQTHAZLK.cjs');
|
|
11
|
+
require('./chunk-JES2ZLH5.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.MAX_FILE_SIZE =
|
|
18
|
+
exports.MAX_FILE_SIZE = _chunkF7CC4SV5cjs.MAX_FILE_SIZE; exports.MAX_OBSERVATIONS = _chunkF7CC4SV5cjs.MAX_OBSERVATIONS; exports.extractObservationsFromBundle = _chunkF7CC4SV5cjs.extractObservationsFromBundle; exports.mapFHIRObservationToInternal = _chunkF7CC4SV5cjs.mapFHIRObservationToInternal; exports.processImportBundle = _chunkF7CC4SV5cjs.processImportBundle;
|
|
19
19
|
//# sourceMappingURL=importer.cjs.map
|
package/dist/importer.d.cts
CHANGED
|
@@ -15,6 +15,8 @@ interface ImportedObservation {
|
|
|
15
15
|
isQualitative: boolean;
|
|
16
16
|
/** Ausente nos biomarcadores sem LOINC publicado, como composição corporal. */
|
|
17
17
|
loincCode?: string;
|
|
18
|
+
/** O `loincCode` quando ele é uma das variantes por método do biomarcador. */
|
|
19
|
+
methodLoinc?: string;
|
|
18
20
|
/** Lido do `referenceRange.type`, quando o Bundle o traz. */
|
|
19
21
|
referenceKind?: 'decision-threshold' | 'reference-interval';
|
|
20
22
|
referenceMax?: number;
|
package/dist/importer.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ interface ImportedObservation {
|
|
|
15
15
|
isQualitative: boolean;
|
|
16
16
|
/** Ausente nos biomarcadores sem LOINC publicado, como composição corporal. */
|
|
17
17
|
loincCode?: string;
|
|
18
|
+
/** O `loincCode` quando ele é uma das variantes por método do biomarcador. */
|
|
19
|
+
methodLoinc?: string;
|
|
18
20
|
/** Lido do `referenceRange.type`, quando o Bundle o traz. */
|
|
19
21
|
referenceKind?: 'decision-threshold' | 'reference-interval';
|
|
20
22
|
referenceMax?: number;
|
package/dist/importer.js
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
extractObservationsFromBundle,
|
|
5
5
|
mapFHIRObservationToInternal,
|
|
6
6
|
processImportBundle
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-3UCY4HPJ.js";
|
|
8
|
+
import "./chunk-YI5WYZCP.js";
|
|
9
9
|
import "./chunk-A6HR4XDK.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-LWSKO7UV.js";
|
|
11
|
+
import "./chunk-KTV4H2QQ.js";
|
|
12
12
|
export {
|
|
13
13
|
MAX_FILE_SIZE,
|
|
14
14
|
MAX_OBSERVATIONS,
|
package/dist/index.cjs
CHANGED
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkWKTDMR5Pcjs = require('./chunk-WKTDMR5P.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkF7CC4SV5cjs = require('./chunk-F7CC4SV5.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkRPGJK7ZMcjs = require('./chunk-RPGJK7ZM.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -31,7 +31,7 @@ var _chunkOR67NJDZcjs = require('./chunk-OR67NJDZ.cjs');
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var
|
|
34
|
+
var _chunkH64L6SOVcjs = require('./chunk-H64L6SOV.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -47,7 +47,7 @@ var _chunk5FMR2U7Pcjs = require('./chunk-5FMR2U7P.cjs');
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkAQTHAZLKcjs = require('./chunk-AQTHAZLK.cjs');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
@@ -80,7 +80,8 @@ var _chunk5RC7C7HJcjs = require('./chunk-5RC7C7HJ.cjs');
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
|
|
84
|
+
var _chunkJES2ZLH5cjs = require('./chunk-JES2ZLH5.cjs');
|
|
84
85
|
|
|
85
86
|
// src/category-groups.ts
|
|
86
87
|
var CATEGORY_GROUPS = {
|
|
@@ -242,14 +243,14 @@ function interventionToFHIRObservation(intervention, patientId) {
|
|
|
242
243
|
}
|
|
243
244
|
function interventionsToFHIRBundle(interventions, userProfile) {
|
|
244
245
|
const patientId = userProfile.userId;
|
|
245
|
-
const fhirPatient =
|
|
246
|
+
const fhirPatient = _chunkWKTDMR5Pcjs.userProfileToFHIR.call(void 0, userProfile);
|
|
246
247
|
const entries = interventions.map((intervention) => {
|
|
247
248
|
const isMedication = intervention.type === "medication" || intervention.type === "supplement";
|
|
248
249
|
const resource = isMedication ? interventionToFHIRMedicationStatement(intervention, patientId) : interventionToFHIRObservation(intervention, patientId);
|
|
249
|
-
return { fullUrl:
|
|
250
|
+
return { fullUrl: _chunkWKTDMR5Pcjs.entryFullUrl.call(void 0, resource), resource };
|
|
250
251
|
});
|
|
251
252
|
return {
|
|
252
|
-
entry: [{ fullUrl:
|
|
253
|
+
entry: [{ fullUrl: _chunkWKTDMR5Pcjs.entryFullUrl.call(void 0, fhirPatient), resource: fhirPatient }, ...entries],
|
|
253
254
|
resourceType: "Bundle",
|
|
254
255
|
type: "collection"
|
|
255
256
|
};
|
|
@@ -752,5 +753,6 @@ var specimenTypeCoding = (text) => BY_NORMALIZED_TEXT.get(normalize(text));
|
|
|
752
753
|
|
|
753
754
|
|
|
754
755
|
|
|
755
|
-
|
|
756
|
+
|
|
757
|
+
exports.AGE_BRACKETS = AGE_BRACKETS; exports.BIOMARKER_CODE_SYSTEM = _chunkOR67NJDZcjs.BIOMARKER_CODE_SYSTEM; exports.BIOMARKER_DEFAULT_UNIT = _chunkAQTHAZLKcjs.BIOMARKER_DEFAULT_UNIT; exports.BIOMARKER_DEFINITIONS = _chunkJES2ZLH5cjs.BIOMARKER_DEFINITIONS; exports.BIOMARKER_UNITS = _chunkAQTHAZLKcjs.BIOMARKER_UNITS; exports.BODY_FAT_ZONES = BODY_FAT_ZONES; exports.BR_TIPO_AMOSTRA_VALUESET = BR_TIPO_AMOSTRA_VALUESET; exports.BUNDLE_BASE_URL = _chunkWKTDMR5Pcjs.BUNDLE_BASE_URL; exports.CAC_INDICATOR_CODES = _chunkJES2ZLH5cjs.CAC_INDICATOR_CODES; exports.CATEGORY_GROUPS = CATEGORY_GROUPS; exports.CATEGORY_SCREENING_INTERVALS = CATEGORY_SCREENING_INTERVALS; exports.DEXA_CATEGORIES = _chunkJES2ZLH5cjs.DEXA_CATEGORIES; exports.DEXA_INDICATOR_CODES = _chunkJES2ZLH5cjs.DEXA_INDICATOR_CODES; exports.FHIR_BRASIL_EXTENSIONS = FHIR_BRASIL_EXTENSIONS; exports.HL7_SPECIMEN_TYPE_SYSTEM = HL7_SPECIMEN_TYPE_SYSTEM; exports.IG_CANONICAL = IG_CANONICAL; exports.LOINC_SYSTEM = _chunkOR67NJDZcjs.LOINC_SYSTEM; exports.MAX_FILE_SIZE = _chunkF7CC4SV5cjs.MAX_FILE_SIZE; exports.MAX_OBSERVATIONS = _chunkF7CC4SV5cjs.MAX_OBSERVATIONS; exports.SOURCE_REGISTRY = _chunk5FMR2U7Pcjs.SOURCE_REGISTRY; exports.T_SCORE_ZONES = T_SCORE_ZONES; exports.UNIT_TO_UCUM = _chunkAQTHAZLKcjs.UNIT_TO_UCUM; exports.ZONE_DEFS = ZONE_DEFS; exports.applyFallbackReferenceRanges = _chunkH64L6SOVcjs.applyFallbackReferenceRanges; exports.biomarkerRangeDefinitions = _chunkH64L6SOVcjs.biomarkerRangeDefinitions; exports.calculateNextScreeningDate = calculateNextScreeningDate; exports.cnsToFHIRIdentifier = cnsToFHIRIdentifier; exports.codeToLoinc = _chunkJES2ZLH5cjs.codeToLoinc; exports.convertUnit = _chunkAQTHAZLKcjs.convertUnit; exports.cpfToFHIRIdentifier = cpfToFHIRIdentifier; exports.defaultReferenceRanges = _chunkH64L6SOVcjs.defaultReferenceRanges; exports.entryFullUrl = _chunkWKTDMR5Pcjs.entryFullUrl; exports.extractObservationsFromBundle = _chunkF7CC4SV5cjs.extractObservationsFromBundle; exports.extractSourceKey = _chunk5FMR2U7Pcjs.extractSourceKey; exports.filterVisibleBiomarkers = _chunkJES2ZLH5cjs.filterVisibleBiomarkers; exports.findCodeByName = _chunkJES2ZLH5cjs.findCodeByName; exports.flagAgainstCatalogRange = _chunkH64L6SOVcjs.flagAgainstCatalogRange; exports.formatCNS = formatCNS; exports.formatCPF = formatCPF; exports.generateCacFullReference = _chunkJES2ZLH5cjs.generateCacFullReference; exports.generateDexaFullReference = _chunkJES2ZLH5cjs.generateDexaFullReference; exports.generateFilteredLLMReference = _chunkJES2ZLH5cjs.generateFilteredLLMReference; exports.generateLLMReference = _chunkJES2ZLH5cjs.generateLLMReference; exports.getAllCodes = _chunkJES2ZLH5cjs.getAllCodes; exports.getAllDefinitions = _chunkJES2ZLH5cjs.getAllDefinitions; exports.getAllLoincCodes = _chunkJES2ZLH5cjs.getAllLoincCodes; exports.getAllSearchPatterns = _chunkJES2ZLH5cjs.getAllSearchPatterns; exports.getBiomarkersByCategory = _chunkJES2ZLH5cjs.getBiomarkersByCategory; exports.getBiomarkersForCategories = _chunkJES2ZLH5cjs.getBiomarkersForCategories; exports.getCanonicalUnit = _chunkAQTHAZLKcjs.getCanonicalUnit; exports.getCategoriesByInterval = getCategoriesByInterval; exports.getCategoryGroup = getCategoryGroup; exports.getDaysUntilScreening = getDaysUntilScreening; exports.getDefaultUnit = _chunkAQTHAZLKcjs.getDefaultUnit; exports.getDefinitionByCode = _chunkJES2ZLH5cjs.getDefinitionByCode; exports.getDefinitionByLoinc = _chunkJES2ZLH5cjs.getDefinitionByLoinc; exports.getDefinitionsBySex = _chunkJES2ZLH5cjs.getDefinitionsBySex; exports.getDueCategories = getDueCategories; exports.getFallbackReferenceRange = _chunkH64L6SOVcjs.getFallbackReferenceRange; exports.getRangeDirection = _chunkH64L6SOVcjs.getRangeDirection; exports.getReferenceRange = _chunkH64L6SOVcjs.getReferenceRange; exports.getSIUnit = _chunkAQTHAZLKcjs.getSIUnit; exports.getScreeningInterval = getScreeningInterval; exports.getSexForCode = _chunkJES2ZLH5cjs.getSexForCode; exports.getVisibleDefinitions = _chunkJES2ZLH5cjs.getVisibleDefinitions; exports.interventionToFHIRMedicationStatement = interventionToFHIRMedicationStatement; exports.interventionToFHIRObservation = interventionToFHIRObservation; exports.interventionsToFHIRBundle = interventionsToFHIRBundle; exports.isBiomarkerVisible = _chunkJES2ZLH5cjs.isBiomarkerVisible; exports.isCacDocument = _chunkJES2ZLH5cjs.isCacDocument; exports.isDexaDocument = _chunkJES2ZLH5cjs.isDexaDocument; exports.isScreeningDue = isScreeningDue; exports.isUcumCode = _chunkAQTHAZLKcjs.isUcumCode; exports.isValidCode = _chunkJES2ZLH5cjs.isValidCode; exports.isValidLoinc = _chunkJES2ZLH5cjs.isValidLoinc; exports.labObservationToFHIR = _chunkWKTDMR5Pcjs.labObservationToFHIR; exports.labReportToFHIR = _chunkWKTDMR5Pcjs.labReportToFHIR; exports.labResultToFHIRBundle = _chunkWKTDMR5Pcjs.labResultToFHIRBundle; exports.listMappedSubcategories = listMappedSubcategories; exports.loincToCode = _chunkJES2ZLH5cjs.loincToCode; exports.mapFHIRObservationToInternal = _chunkF7CC4SV5cjs.mapFHIRObservationToInternal; exports.methodVariantOf = _chunkJES2ZLH5cjs.methodVariantOf; exports.normalizeCode = _chunkJES2ZLH5cjs.normalizeCode; exports.plural = plural; exports.pluralCount = pluralCount; exports.pluralPhrase = pluralPhrase; exports.pluralPhraseCount = pluralPhraseCount; exports.processImportBundle = _chunkF7CC4SV5cjs.processImportBundle; exports.referenceRangeMeaning = _chunkH64L6SOVcjs.referenceRangeMeaning; exports.resolveUcum = _chunkAQTHAZLKcjs.resolveUcum; exports.specimenTypeCoding = specimenTypeCoding; exports.toBiomarkerTests = _chunkJES2ZLH5cjs.toBiomarkerTests; exports.unitToUCUM = _chunkAQTHAZLKcjs.unitToUCUM; exports.userProfileToFHIR = _chunkWKTDMR5Pcjs.userProfileToFHIR; exports.validateCNS = validateCNS; exports.validateCPF = validateCPF; exports.validateFHIRDiagnosticReport = _chunkRPGJK7ZMcjs.validateFHIRDiagnosticReport; exports.validateFHIRImportBundle = _chunkRPGJK7ZMcjs.validateFHIRImportBundle; exports.validateFHIRObservation = _chunkRPGJK7ZMcjs.validateFHIRObservation; exports.validateLoincNameMatch = _chunkJES2ZLH5cjs.validateLoincNameMatch;
|
|
756
758
|
//# sourceMappingURL=index.cjs.map
|