gdc-common-utils-ts 2.3.7 → 2.3.9

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.
Files changed (33) hide show
  1. package/dist/constants/healthcare.d.ts +6 -3
  2. package/dist/constants/healthcare.js +17 -0
  3. package/dist/convert/convert-allergy-intolerance.js +15 -1
  4. package/dist/convert/convert-condition.js +15 -1
  5. package/dist/convert/convert-diagnostic-report.js +9 -1
  6. package/dist/convert/convert-flag.js +9 -1
  7. package/dist/convert/convert-medication-statement.js +11 -3
  8. package/dist/models/interoperable-claims/allergy-intolerance-claims.d.ts +12 -0
  9. package/dist/models/interoperable-claims/allergy-intolerance-claims.js +16 -0
  10. package/dist/models/interoperable-claims/condition-claims.d.ts +12 -0
  11. package/dist/models/interoperable-claims/condition-claims.js +16 -0
  12. package/dist/models/interoperable-claims/diagnostic-report-claims.d.ts +3 -0
  13. package/dist/models/interoperable-claims/diagnostic-report-claims.js +5 -0
  14. package/dist/models/interoperable-claims/flag-claims.d.ts +3 -0
  15. package/dist/models/interoperable-claims/flag-claims.js +5 -0
  16. package/dist/models/interoperable-claims/medication-statement-claims.d.ts +2 -0
  17. package/dist/models/interoperable-claims/medication-statement-claims.js +2 -0
  18. package/dist/utils/allergy-intolerance-entry-editor.d.ts +8 -0
  19. package/dist/utils/allergy-intolerance-entry-editor.js +8 -0
  20. package/dist/utils/bundle-document-builder.js +5 -0
  21. package/dist/utils/clinical-resource-converters.js +7 -0
  22. package/dist/utils/clinical-resource-view.d.ts +22 -4
  23. package/dist/utils/clinical-resource-view.js +179 -18
  24. package/dist/utils/condition-entry-editor.d.ts +8 -0
  25. package/dist/utils/condition-entry-editor.js +8 -0
  26. package/dist/utils/diagnostic-report-entry-editor.d.ts +8 -0
  27. package/dist/utils/diagnostic-report-entry-editor.js +16 -0
  28. package/dist/utils/flag-entry-editor.d.ts +8 -0
  29. package/dist/utils/flag-entry-editor.js +8 -0
  30. package/dist/utils/medication-statement-entry-editor.d.ts +8 -0
  31. package/dist/utils/medication-statement-entry-editor.js +8 -0
  32. package/fixtures/fhir-ips-bundle-all-sections.json +2381 -0
  33. package/package.json +6 -2
@@ -1724,6 +1724,8 @@ export declare const HealthcareActorRoles: Readonly<{
1724
1724
  readonly MidwiferyProfessional: "ISCO-08|2222";
1725
1725
  readonly Paramedic: "ISCO-08|2240";
1726
1726
  readonly Veterinarian: "ISCO-08|2250";
1727
+ /** Administrative health occupation; it does not imply clinical authority. */
1728
+ readonly MedicalSecretary: "ISCO-08|3344";
1727
1729
  }>;
1728
1730
  export declare const HealthcareActorRoleCodes: Readonly<{
1729
1731
  readonly Controller: "1120";
@@ -1744,6 +1746,7 @@ export declare const HealthcareActorRoleCodes: Readonly<{
1744
1746
  readonly MidwiferyProfessional: "2222";
1745
1747
  readonly Paramedic: "2240";
1746
1748
  readonly Veterinarian: "2250";
1749
+ readonly MedicalSecretary: "3344";
1747
1750
  }>;
1748
1751
  export declare const HealthcareRolesByFamily: Readonly<{
1749
1752
  readonly professionalOccupationIsco08: Readonly<Record<string, Readonly<{
@@ -1776,15 +1779,15 @@ export declare const HealthcareRolesByFamily: Readonly<{
1776
1779
  }>;
1777
1780
  export declare const HealthcareAllRolesByClaim: Readonly<Record<string, HealthcareActorRoleDescriptor>>;
1778
1781
  export declare const HealthcareProfessionalRoleCodesBySector: Readonly<{
1779
- readonly "health-care": readonly ("1120" | "221" | "2211" | "2212" | "2221" | "2222" | "2240")[];
1780
- readonly "health-research": readonly ("1120" | "221" | "2211" | "2212")[];
1782
+ readonly "health-care": readonly ("1120" | "221" | "2211" | "2212" | "2221" | "2222" | "2240" | "3344")[];
1783
+ readonly "health-research": readonly ("1120" | "221" | "2211" | "2212" | "3344")[];
1781
1784
  readonly "health-tech": readonly "1120"[];
1782
1785
  readonly "health-insurance": readonly "1120"[];
1783
1786
  readonly "animal-care": readonly ("1120" | "2250")[];
1784
1787
  readonly "animal-research": readonly ("1120" | "2250")[];
1785
1788
  readonly "animal-insurance": readonly "1120"[];
1786
1789
  readonly "animal-tech": readonly "1120"[];
1787
- readonly "onehealth-research": readonly ("1120" | "221" | "2211" | "2212" | "2250")[];
1790
+ readonly "onehealth-research": readonly ("1120" | "221" | "2211" | "2212" | "2250" | "3344")[];
1788
1791
  readonly "onehealth-tech": readonly "1120"[];
1789
1792
  }>;
1790
1793
  export declare const HealthcareProfessionalRolesBySector: Readonly<{
@@ -356,6 +356,8 @@ export const HealthcareActorRoles = Object.freeze({
356
356
  MidwiferyProfessional: 'ISCO-08|2222',
357
357
  Paramedic: 'ISCO-08|2240',
358
358
  Veterinarian: 'ISCO-08|2250',
359
+ /** Administrative health occupation; it does not imply clinical authority. */
360
+ MedicalSecretary: 'ISCO-08|3344',
359
361
  });
360
362
  export const HealthcareActorRoleCodes = Object.freeze({
361
363
  Controller: '1120',
@@ -376,6 +378,7 @@ export const HealthcareActorRoleCodes = Object.freeze({
376
378
  MidwiferyProfessional: '2222',
377
379
  Paramedic: '2240',
378
380
  Veterinarian: '2250',
381
+ MedicalSecretary: '3344',
379
382
  });
380
383
  function buildProfessionalIscoRoles() {
381
384
  const entries = [
@@ -467,6 +470,17 @@ function buildProfessionalIscoRoles() {
467
470
  titleEn: 'Veterinarian',
468
471
  }),
469
472
  ],
473
+ [
474
+ HealthcareActorRoleCodes.MedicalSecretary,
475
+ Object.freeze({
476
+ family: HealthcareRoleFamilies.ProfessionalOccupationIsco08,
477
+ codingSystem: ISCO08_CODING_SYSTEM,
478
+ code: HealthcareActorRoleCodes.MedicalSecretary,
479
+ claim: HealthcareActorRoles.MedicalSecretary,
480
+ i18nKey: `${ISCO08_I18N_NAMESPACE}.${HealthcareActorRoleCodes.MedicalSecretary}`,
481
+ titleEn: 'Medical secretary',
482
+ }),
483
+ ],
470
484
  ];
471
485
  return Object.freeze(Object.fromEntries(entries));
472
486
  }
@@ -523,12 +537,14 @@ export const HealthcareProfessionalRoleCodesBySector = Object.freeze({
523
537
  HealthcareActorRoleCodes.NursingProfessional,
524
538
  HealthcareActorRoleCodes.MidwiferyProfessional,
525
539
  HealthcareActorRoleCodes.Paramedic,
540
+ HealthcareActorRoleCodes.MedicalSecretary,
526
541
  ]),
527
542
  [DataspaceSectors.HealthResearch]: Object.freeze([
528
543
  HealthcareActorRoleCodes.Controller,
529
544
  HealthcareActorRoleCodes.MedicalDoctors,
530
545
  HealthcareActorRoleCodes.GeneralistMedicalPractitioner,
531
546
  HealthcareActorRoleCodes.SpecialistMedicalPractitioner,
547
+ HealthcareActorRoleCodes.MedicalSecretary,
532
548
  ]),
533
549
  [DataspaceSectors.HealthTech]: Object.freeze([HealthcareActorRoleCodes.Controller]),
534
550
  [DataspaceSectors.HealthInsurance]: Object.freeze([HealthcareActorRoleCodes.Controller]),
@@ -548,6 +564,7 @@ export const HealthcareProfessionalRoleCodesBySector = Object.freeze({
548
564
  HealthcareActorRoleCodes.GeneralistMedicalPractitioner,
549
565
  HealthcareActorRoleCodes.SpecialistMedicalPractitioner,
550
566
  HealthcareActorRoleCodes.Veterinarian,
567
+ HealthcareActorRoleCodes.MedicalSecretary,
551
568
  ]),
552
569
  [DataspaceSectors.OneHealthTech]: Object.freeze([HealthcareActorRoleCodes.Controller]),
553
570
  });
@@ -14,7 +14,19 @@ export function allergyIntoleranceFlatToFhirR4(claims) {
14
14
  resourceType: 'AllergyIntolerance',
15
15
  identifier: claims[AllergyIntoleranceClaim.Identifier] ? [{ value: claims[AllergyIntoleranceClaim.Identifier] }] : undefined,
16
16
  patient: { reference: patient },
17
- code: claims[AllergyIntoleranceClaim.Code] ? { coding: codingFromValue(claims[AllergyIntoleranceClaim.Code]) } : undefined,
17
+ code: claims[AllergyIntoleranceClaim.Code]
18
+ ? {
19
+ coding: codingFromValue(claims[AllergyIntoleranceClaim.Code])?.map((coding) => ({
20
+ ...coding,
21
+ ...(claims[AllergyIntoleranceClaim.CodeDisplay]
22
+ ? { display: claims[AllergyIntoleranceClaim.CodeDisplay] }
23
+ : {}),
24
+ })),
25
+ ...(claims[AllergyIntoleranceClaim.CodeText]
26
+ ? { text: claims[AllergyIntoleranceClaim.CodeText] }
27
+ : {}),
28
+ }
29
+ : undefined,
18
30
  clinicalStatus: claims[AllergyIntoleranceClaim.ClinicalStatus] ? { coding: [{ code: claims[AllergyIntoleranceClaim.ClinicalStatus] }] } : undefined,
19
31
  verificationStatus: claims[AllergyIntoleranceClaim.VerificationStatus] ? { coding: [{ code: claims[AllergyIntoleranceClaim.VerificationStatus] }] } : undefined,
20
32
  category: claims[AllergyIntoleranceClaim.Category] ? [claims[AllergyIntoleranceClaim.Category]] : undefined,
@@ -31,6 +43,8 @@ export function allergyIntoleranceFhirR4ToFlat(resource) {
31
43
  [AllergyIntoleranceClaim.Subject]: subject,
32
44
  [AllergyIntoleranceClaim.Patient]: subject,
33
45
  [AllergyIntoleranceClaim.Code]: codingToValue(code?.coding?.[0]) || code?.text,
46
+ [AllergyIntoleranceClaim.CodeText]: code?.text,
47
+ [AllergyIntoleranceClaim.CodeDisplay]: code?.coding?.[0]?.display,
34
48
  [AllergyIntoleranceClaim.ClinicalStatus]: resource.clinicalStatus?.coding?.[0]?.code,
35
49
  [AllergyIntoleranceClaim.VerificationStatus]: resource.verificationStatus?.coding?.[0]?.code,
36
50
  [AllergyIntoleranceClaim.Category]: resource.category?.[0],
@@ -8,7 +8,19 @@ export function conditionFlatToFhirR4(claims) {
8
8
  resourceType: 'Condition',
9
9
  identifier: claims[ConditionClaim.Identifier] ? [{ value: claims[ConditionClaim.Identifier] }] : undefined,
10
10
  subject: { reference: subject },
11
- code: claims[ConditionClaim.Code] ? { coding: codingFromValue(claims[ConditionClaim.Code]) } : undefined,
11
+ code: claims[ConditionClaim.Code]
12
+ ? {
13
+ coding: codingFromValue(claims[ConditionClaim.Code])?.map((coding) => ({
14
+ ...coding,
15
+ ...(claims[ConditionClaim.CodeDisplay]
16
+ ? { display: claims[ConditionClaim.CodeDisplay] }
17
+ : {}),
18
+ })),
19
+ ...(claims[ConditionClaim.CodeText]
20
+ ? { text: claims[ConditionClaim.CodeText] }
21
+ : {}),
22
+ }
23
+ : undefined,
12
24
  clinicalStatus: claims[ConditionClaim.ClinicalStatus] ? { coding: [{ code: claims[ConditionClaim.ClinicalStatus] }] } : undefined,
13
25
  verificationStatus: claims[ConditionClaim.VerificationStatus] ? { coding: [{ code: claims[ConditionClaim.VerificationStatus] }] } : undefined,
14
26
  };
@@ -19,6 +31,8 @@ export function conditionFhirR4ToFlat(resource) {
19
31
  [ConditionClaim.Identifier]: resource.identifier?.[0]?.value,
20
32
  [ConditionClaim.Subject]: resource.subject?.reference,
21
33
  [ConditionClaim.Code]: codingToValue(code?.coding?.[0]) || code?.text,
34
+ [ConditionClaim.CodeText]: code?.text,
35
+ [ConditionClaim.CodeDisplay]: code?.coding?.[0]?.display,
22
36
  [ConditionClaim.ClinicalStatus]: resource.clinicalStatus?.coding?.[0]?.code,
23
37
  [ConditionClaim.VerificationStatus]: resource.verificationStatus?.coding?.[0]?.code,
24
38
  };
@@ -9,7 +9,13 @@ export function diagnosticReportFlatToFhirR4(claims) {
9
9
  identifier: claims[DiagnosticReportClaim.Identifier] ? [{ value: claims[DiagnosticReportClaim.Identifier] }] : undefined,
10
10
  status: claims[DiagnosticReportClaim.Status],
11
11
  category: claims[DiagnosticReportClaim.Category] ? [{ coding: codingFromValue(claims[DiagnosticReportClaim.Category]) }] : undefined,
12
- code: claims[DiagnosticReportClaim.Code] ? { coding: codingFromValue(claims[DiagnosticReportClaim.Code]) } : undefined,
12
+ code: claims[DiagnosticReportClaim.Code] ? {
13
+ coding: codingFromValue(claims[DiagnosticReportClaim.Code])?.map((coding) => ({
14
+ ...coding,
15
+ ...(claims[DiagnosticReportClaim.CodeDisplay] ? { display: claims[DiagnosticReportClaim.CodeDisplay] } : {}),
16
+ })),
17
+ ...(claims[DiagnosticReportClaim.CodeText] ? { text: claims[DiagnosticReportClaim.CodeText] } : {}),
18
+ } : undefined,
13
19
  subject: subject ? { reference: subject } : undefined,
14
20
  encounter: claims[DiagnosticReportClaim.Encounter] ? { reference: claims[DiagnosticReportClaim.Encounter] } : undefined,
15
21
  effectiveDateTime: claims[DiagnosticReportClaim.Date],
@@ -37,6 +43,8 @@ export function diagnosticReportFhirR4ToFlat(resource) {
37
43
  [DiagnosticReportClaim.BasedOn]: referenceListToCsv(resource.basedOn),
38
44
  [DiagnosticReportClaim.Category]: codingToValue(resource.category?.[0]?.coding?.[0]),
39
45
  [DiagnosticReportClaim.Code]: codingToValue(resource.code?.coding?.[0]),
46
+ [DiagnosticReportClaim.CodeText]: resource.code?.text,
47
+ [DiagnosticReportClaim.CodeDisplay]: resource.code?.coding?.[0]?.display,
40
48
  [DiagnosticReportClaim.Date]: resource.effectiveDateTime || resource.issued,
41
49
  [DiagnosticReportClaim.Encounter]: referenceToValue(resource.encounter),
42
50
  [DiagnosticReportClaim.Identifier]: resource.identifier?.[0]?.value,
@@ -9,7 +9,13 @@ export function flagFlatToFhirR4(claims) {
9
9
  identifier: claims[FlagClaim.Identifier] ? [{ value: claims[FlagClaim.Identifier] }] : undefined,
10
10
  status: claims[FlagClaim.Status],
11
11
  category: claims[FlagClaim.Category] ? { coding: codingFromValue(claims[FlagClaim.Category]) } : undefined,
12
- code: claims[FlagClaim.Code] ? { coding: codingFromValue(claims[FlagClaim.Code]) } : undefined,
12
+ code: claims[FlagClaim.Code] ? {
13
+ coding: codingFromValue(claims[FlagClaim.Code])?.map((coding) => ({
14
+ ...coding,
15
+ ...(claims[FlagClaim.CodeDisplay] ? { display: claims[FlagClaim.CodeDisplay] } : {}),
16
+ })),
17
+ ...(claims[FlagClaim.CodeText] ? { text: claims[FlagClaim.CodeText] } : {}),
18
+ } : undefined,
13
19
  subject: subject ? { reference: subject } : undefined,
14
20
  author: claims[FlagClaim.Author] ? { reference: claims[FlagClaim.Author] } : undefined,
15
21
  encounter: claims[FlagClaim.Encounter] ? { reference: claims[FlagClaim.Encounter] } : undefined,
@@ -28,6 +34,8 @@ export function flagFhirR4ToFlat(resource) {
28
34
  [FlagClaim.Status]: resource.status,
29
35
  [FlagClaim.Category]: codingToValue(resource.category?.coding?.[0]),
30
36
  [FlagClaim.Code]: codingToValue(resource.code?.coding?.[0]),
37
+ [FlagClaim.CodeText]: resource.code?.text,
38
+ [FlagClaim.CodeDisplay]: resource.code?.coding?.[0]?.display,
31
39
  [FlagClaim.PeriodStart]: period?.start,
32
40
  [FlagClaim.PeriodEnd]: period?.end,
33
41
  };
@@ -29,7 +29,13 @@ export function medicationStatementFlatToFhirR4(claims) {
29
29
  subject: { reference: subject },
30
30
  effectiveDateTime,
31
31
  medicationCodeableConcept: claims[MedicationStatementClaim.Code]
32
- ? { coding: codingFromValue(claims[MedicationStatementClaim.Code]) }
32
+ ? {
33
+ coding: codingFromValue(claims[MedicationStatementClaim.Code])?.map((coding) => ({
34
+ ...coding,
35
+ ...(claims[MedicationStatementClaim.CodeDisplay] ? { display: claims[MedicationStatementClaim.CodeDisplay] } : {}),
36
+ })),
37
+ ...(medicationText ? { text: medicationText } : {}),
38
+ }
33
39
  : (!hasContainedMedication && medicationText ? { text: medicationText } : undefined),
34
40
  medicationReference: hasContainedMedication ? { reference: `#${containedMedicationId}` } : undefined,
35
41
  contained: containedMedication ? [containedMedication] : undefined,
@@ -46,8 +52,9 @@ export function medicationStatementFhirR4ToFlat(resource) {
46
52
  const containedMedicationIdentifier = containedMedication?.identifier?.[0]?.value;
47
53
  const containedMedicationText = containedMedication?.code?.text;
48
54
  const batch = containedMedication?.batch;
49
- const medicationCode = codingToValue(resource.medicationCodeableConcept?.coding?.[0]);
50
- const medicationText = containedMedicationText || resource.medicationCodeableConcept?.text || undefined;
55
+ const medicationConcept = resource.medicationCodeableConcept;
56
+ const medicationCode = codingToValue(medicationConcept?.coding?.[0]);
57
+ const medicationText = containedMedicationText || medicationConcept?.text || undefined;
51
58
  return {
52
59
  [MedicationStatementClaim.Identifier]: resource.identifier?.[0]?.value,
53
60
  [MedicationStatementClaim.Subject]: resource.subject?.reference,
@@ -55,6 +62,7 @@ export function medicationStatementFhirR4ToFlat(resource) {
55
62
  [MedicationStatementClaim.Effective]: resource.effectiveDateTime,
56
63
  [MedicationStatementClaim.Code]: medicationCode,
57
64
  [MedicationStatementClaim.MedicationText]: medicationText,
65
+ [MedicationStatementClaim.CodeDisplay]: medicationConcept?.coding?.[0]?.display,
58
66
  [MedicationStatementClaim.Note]: resource.note?.[0]?.text,
59
67
  [MedicationStatementClaim.DosageInstruction]: resource.dosage?.[0]?.text,
60
68
  [MedicationStatementClaim.MedicationIdentifier]: containedMedicationIdentifier,
@@ -8,6 +8,12 @@ export declare const AllergyIntoleranceClaim: {
8
8
  */
9
9
  readonly Patient: "AllergyIntolerance.patient";
10
10
  readonly Code: "AllergyIntolerance.code";
11
+ /** Local-language label projected to FHIR `AllergyIntolerance.code.text`. */
12
+ readonly CodeText: "AllergyIntolerance.code-text";
13
+ /** Alias that makes the local-language purpose explicit to UI authors. */
14
+ readonly CodeTextLocal: "AllergyIntolerance.code-text";
15
+ /** English/international terminology label projected to `code.coding.display`. */
16
+ readonly CodeDisplay: "AllergyIntolerance.code-display";
11
17
  readonly ClinicalStatus: "AllergyIntolerance.clinical-status";
12
18
  readonly VerificationStatus: "AllergyIntolerance.verification-status";
13
19
  readonly Category: "AllergyIntolerance.category";
@@ -37,6 +43,8 @@ export declare enum AllergyIntoleranceClaimsFhirApi {
37
43
  Subject = "org.hl7.fhir.api.AllergyIntolerance.subject",
38
44
  Patient = "org.hl7.fhir.api.AllergyIntolerance.patient",
39
45
  Code = "org.hl7.fhir.api.AllergyIntolerance.code",
46
+ CodeText = "org.hl7.fhir.api.AllergyIntolerance.code-text",
47
+ CodeDisplay = "org.hl7.fhir.api.AllergyIntolerance.code-display",
40
48
  ClinicalStatus = "org.hl7.fhir.api.AllergyIntolerance.clinical-status",
41
49
  VerificationStatus = "org.hl7.fhir.api.AllergyIntolerance.verification-status",
42
50
  Category = "org.hl7.fhir.api.AllergyIntolerance.category",
@@ -49,6 +57,8 @@ export declare const AllergyIntoleranceSearchParamNames: {
49
57
  readonly Subject: "subject";
50
58
  readonly Patient: "patient";
51
59
  readonly Code: "code";
60
+ readonly CodeText: "code-text";
61
+ readonly CodeDisplay: "code-display";
52
62
  readonly ClinicalStatus: "clinical-status";
53
63
  readonly VerificationStatus: "verification-status";
54
64
  readonly Category: "category";
@@ -63,6 +73,8 @@ export declare const AllergyIntoleranceClaimsFhirApiMap: {
63
73
  "org.hl7.fhir.api.AllergyIntolerance.subject": StringConstructor;
64
74
  "org.hl7.fhir.api.AllergyIntolerance.patient": StringConstructor;
65
75
  "org.hl7.fhir.api.AllergyIntolerance.code": StringConstructor;
76
+ "org.hl7.fhir.api.AllergyIntolerance.code-text": StringConstructor;
77
+ "org.hl7.fhir.api.AllergyIntolerance.code-display": StringConstructor;
66
78
  "org.hl7.fhir.api.AllergyIntolerance.clinical-status": StringConstructor;
67
79
  "org.hl7.fhir.api.AllergyIntolerance.verification-status": StringConstructor;
68
80
  "org.hl7.fhir.api.AllergyIntolerance.category": StringConstructor;
@@ -10,6 +10,12 @@ export const AllergyIntoleranceClaim = {
10
10
  */
11
11
  Patient: 'AllergyIntolerance.patient',
12
12
  Code: 'AllergyIntolerance.code',
13
+ /** Local-language label projected to FHIR `AllergyIntolerance.code.text`. */
14
+ CodeText: 'AllergyIntolerance.code-text',
15
+ /** Alias that makes the local-language purpose explicit to UI authors. */
16
+ CodeTextLocal: 'AllergyIntolerance.code-text',
17
+ /** English/international terminology label projected to `code.coding.display`. */
18
+ CodeDisplay: 'AllergyIntolerance.code-display',
13
19
  ClinicalStatus: 'AllergyIntolerance.clinical-status',
14
20
  VerificationStatus: 'AllergyIntolerance.verification-status',
15
21
  Category: 'AllergyIntolerance.category',
@@ -39,6 +45,8 @@ export var AllergyIntoleranceClaimsFhirApi;
39
45
  AllergyIntoleranceClaimsFhirApi["Subject"] = "org.hl7.fhir.api.AllergyIntolerance.subject";
40
46
  AllergyIntoleranceClaimsFhirApi["Patient"] = "org.hl7.fhir.api.AllergyIntolerance.patient";
41
47
  AllergyIntoleranceClaimsFhirApi["Code"] = "org.hl7.fhir.api.AllergyIntolerance.code";
48
+ AllergyIntoleranceClaimsFhirApi["CodeText"] = "org.hl7.fhir.api.AllergyIntolerance.code-text";
49
+ AllergyIntoleranceClaimsFhirApi["CodeDisplay"] = "org.hl7.fhir.api.AllergyIntolerance.code-display";
42
50
  AllergyIntoleranceClaimsFhirApi["ClinicalStatus"] = "org.hl7.fhir.api.AllergyIntolerance.clinical-status";
43
51
  AllergyIntoleranceClaimsFhirApi["VerificationStatus"] = "org.hl7.fhir.api.AllergyIntolerance.verification-status";
44
52
  AllergyIntoleranceClaimsFhirApi["Category"] = "org.hl7.fhir.api.AllergyIntolerance.category";
@@ -51,6 +59,8 @@ export const AllergyIntoleranceSearchParamNames = {
51
59
  Subject: 'subject',
52
60
  Patient: 'patient',
53
61
  Code: 'code',
62
+ CodeText: 'code-text',
63
+ CodeDisplay: 'code-display',
54
64
  ClinicalStatus: 'clinical-status',
55
65
  VerificationStatus: 'verification-status',
56
66
  Category: 'category',
@@ -63,6 +73,8 @@ export const AllergyIntoleranceSearchParamToClaimKey = {
63
73
  [AllergyIntoleranceSearchParamNames.Subject]: AllergyIntoleranceClaimsFhirApi.Subject,
64
74
  [AllergyIntoleranceSearchParamNames.Patient]: AllergyIntoleranceClaimsFhirApi.Patient,
65
75
  [AllergyIntoleranceSearchParamNames.Code]: AllergyIntoleranceClaimsFhirApi.Code,
76
+ [AllergyIntoleranceSearchParamNames.CodeText]: AllergyIntoleranceClaimsFhirApi.CodeText,
77
+ [AllergyIntoleranceSearchParamNames.CodeDisplay]: AllergyIntoleranceClaimsFhirApi.CodeDisplay,
66
78
  [AllergyIntoleranceSearchParamNames.ClinicalStatus]: AllergyIntoleranceClaimsFhirApi.ClinicalStatus,
67
79
  [AllergyIntoleranceSearchParamNames.VerificationStatus]: AllergyIntoleranceClaimsFhirApi.VerificationStatus,
68
80
  [AllergyIntoleranceSearchParamNames.Category]: AllergyIntoleranceClaimsFhirApi.Category,
@@ -75,6 +87,8 @@ export const AllergyIntoleranceClaimsFhirApiMap = {
75
87
  [AllergyIntoleranceClaimsFhirApi.Subject]: String,
76
88
  [AllergyIntoleranceClaimsFhirApi.Patient]: String,
77
89
  [AllergyIntoleranceClaimsFhirApi.Code]: String,
90
+ [AllergyIntoleranceClaimsFhirApi.CodeText]: String,
91
+ [AllergyIntoleranceClaimsFhirApi.CodeDisplay]: String,
78
92
  [AllergyIntoleranceClaimsFhirApi.ClinicalStatus]: String,
79
93
  [AllergyIntoleranceClaimsFhirApi.VerificationStatus]: String,
80
94
  [AllergyIntoleranceClaimsFhirApi.Category]: String,
@@ -92,6 +106,8 @@ export const AllergyIntoleranceClaimSpecs = [
92
106
  { key: AllergyIntoleranceClaim.Subject, meaning: 'Canonical subject reference (maps to FHIR AllergyIntolerance.patient.reference).', example: 'urn:uuid:<UUID-V4>' },
93
107
  { key: AllergyIntoleranceClaim.Patient, meaning: 'Deprecated alias of subject for compatibility.', example: 'urn:uuid:<UUID-V4>' },
94
108
  { key: AllergyIntoleranceClaim.Code, meaning: 'Allergy or intolerance code.', example: 'http://snomed.info/sct|227493005' },
109
+ { key: AllergyIntoleranceClaim.CodeText, meaning: 'Local-language allergy label matching the resource language.', example: 'Penicilina' },
110
+ { key: AllergyIntoleranceClaim.CodeDisplay, meaning: 'English/international terminology display.', example: 'Penicillin' },
95
111
  { key: AllergyIntoleranceClaim.ClinicalStatus, meaning: 'Clinical status code.', example: 'active' },
96
112
  { key: AllergyIntoleranceClaim.VerificationStatus, meaning: 'Verification status code.', example: 'confirmed' },
97
113
  { key: AllergyIntoleranceClaim.Category, meaning: 'Category value.', example: 'food' },
@@ -6,6 +6,12 @@ export declare const ConditionClaim: {
6
6
  readonly VerificationStatus: "Condition.verification-status";
7
7
  readonly Category: "Condition.category";
8
8
  readonly Code: "Condition.code";
9
+ /** Local-language label projected to FHIR `Condition.code.text`. */
10
+ readonly CodeText: "Condition.code-text";
11
+ /** Alias that makes the local-language purpose explicit to UI authors. */
12
+ readonly CodeTextLocal: "Condition.code-text";
13
+ /** English/international terminology label projected to `code.coding.display`. */
14
+ readonly CodeDisplay: "Condition.code-display";
9
15
  /**
10
16
  * Canonical CSV/list of related contained resource references or identifiers.
11
17
  */
@@ -34,6 +40,8 @@ export declare enum ConditionClaimsFhirApi {
34
40
  VerificationStatus = "org.hl7.fhir.api.Condition.verification-status",
35
41
  Category = "org.hl7.fhir.api.Condition.category",
36
42
  Code = "org.hl7.fhir.api.Condition.code",
43
+ CodeText = "org.hl7.fhir.api.Condition.code-text",
44
+ CodeDisplay = "org.hl7.fhir.api.Condition.code-display",
37
45
  Severity = "org.hl7.fhir.api.Condition.severity",
38
46
  OnsetDateTime = "org.hl7.fhir.api.Condition.onset-datetime",
39
47
  Recorder = "org.hl7.fhir.api.Condition.recorder"
@@ -45,6 +53,8 @@ export declare const ConditionSearchParamNames: {
45
53
  readonly VerificationStatus: "verification-status";
46
54
  readonly Category: "category";
47
55
  readonly Code: "code";
56
+ readonly CodeText: "code-text";
57
+ readonly CodeDisplay: "code-display";
48
58
  readonly Severity: "severity";
49
59
  readonly OnsetDateTime: "onset-datetime";
50
60
  readonly Recorder: "recorder";
@@ -58,6 +68,8 @@ export declare const ConditionClaimsFhirApiMap: {
58
68
  "org.hl7.fhir.api.Condition.verification-status": StringConstructor;
59
69
  "org.hl7.fhir.api.Condition.category": StringConstructor;
60
70
  "org.hl7.fhir.api.Condition.code": StringConstructor;
71
+ "org.hl7.fhir.api.Condition.code-text": StringConstructor;
72
+ "org.hl7.fhir.api.Condition.code-display": StringConstructor;
61
73
  "org.hl7.fhir.api.Condition.severity": StringConstructor;
62
74
  "org.hl7.fhir.api.Condition.onset-datetime": StringConstructor;
63
75
  "org.hl7.fhir.api.Condition.recorder": StringConstructor;
@@ -8,6 +8,12 @@ export const ConditionClaim = {
8
8
  VerificationStatus: 'Condition.verification-status',
9
9
  Category: 'Condition.category',
10
10
  Code: 'Condition.code',
11
+ /** Local-language label projected to FHIR `Condition.code.text`. */
12
+ CodeText: 'Condition.code-text',
13
+ /** Alias that makes the local-language purpose explicit to UI authors. */
14
+ CodeTextLocal: 'Condition.code-text',
15
+ /** English/international terminology label projected to `code.coding.display`. */
16
+ CodeDisplay: 'Condition.code-display',
11
17
  /**
12
18
  * Canonical CSV/list of related contained resource references or identifiers.
13
19
  */
@@ -36,6 +42,8 @@ export var ConditionClaimsFhirApi;
36
42
  ConditionClaimsFhirApi["VerificationStatus"] = "org.hl7.fhir.api.Condition.verification-status";
37
43
  ConditionClaimsFhirApi["Category"] = "org.hl7.fhir.api.Condition.category";
38
44
  ConditionClaimsFhirApi["Code"] = "org.hl7.fhir.api.Condition.code";
45
+ ConditionClaimsFhirApi["CodeText"] = "org.hl7.fhir.api.Condition.code-text";
46
+ ConditionClaimsFhirApi["CodeDisplay"] = "org.hl7.fhir.api.Condition.code-display";
39
47
  ConditionClaimsFhirApi["Severity"] = "org.hl7.fhir.api.Condition.severity";
40
48
  ConditionClaimsFhirApi["OnsetDateTime"] = "org.hl7.fhir.api.Condition.onset-datetime";
41
49
  ConditionClaimsFhirApi["Recorder"] = "org.hl7.fhir.api.Condition.recorder";
@@ -47,6 +55,8 @@ export const ConditionSearchParamNames = {
47
55
  VerificationStatus: 'verification-status',
48
56
  Category: 'category',
49
57
  Code: 'code',
58
+ CodeText: 'code-text',
59
+ CodeDisplay: 'code-display',
50
60
  Severity: 'severity',
51
61
  OnsetDateTime: 'onset-datetime',
52
62
  Recorder: 'recorder',
@@ -58,6 +68,8 @@ export const ConditionSearchParamToClaimKey = {
58
68
  [ConditionSearchParamNames.VerificationStatus]: ConditionClaimsFhirApi.VerificationStatus,
59
69
  [ConditionSearchParamNames.Category]: ConditionClaimsFhirApi.Category,
60
70
  [ConditionSearchParamNames.Code]: ConditionClaimsFhirApi.Code,
71
+ [ConditionSearchParamNames.CodeText]: ConditionClaimsFhirApi.CodeText,
72
+ [ConditionSearchParamNames.CodeDisplay]: ConditionClaimsFhirApi.CodeDisplay,
61
73
  [ConditionSearchParamNames.Severity]: ConditionClaimsFhirApi.Severity,
62
74
  [ConditionSearchParamNames.OnsetDateTime]: ConditionClaimsFhirApi.OnsetDateTime,
63
75
  [ConditionSearchParamNames.Recorder]: ConditionClaimsFhirApi.Recorder,
@@ -69,6 +81,8 @@ export const ConditionClaimsFhirApiMap = {
69
81
  [ConditionClaimsFhirApi.VerificationStatus]: String,
70
82
  [ConditionClaimsFhirApi.Category]: String,
71
83
  [ConditionClaimsFhirApi.Code]: String,
84
+ [ConditionClaimsFhirApi.CodeText]: String,
85
+ [ConditionClaimsFhirApi.CodeDisplay]: String,
72
86
  [ConditionClaimsFhirApi.Severity]: String,
73
87
  [ConditionClaimsFhirApi.OnsetDateTime]: String,
74
88
  [ConditionClaimsFhirApi.Recorder]: String,
@@ -80,6 +94,8 @@ export const ConditionClaimSpecs = [
80
94
  { key: ConditionClaim.VerificationStatus, meaning: 'Verification status code.', example: 'confirmed' },
81
95
  { key: ConditionClaim.Category, meaning: 'Condition category code.', example: 'problem-list-item' },
82
96
  { key: ConditionClaim.Code, meaning: 'Condition code.', example: 'http://snomed.info/sct|44054006' },
97
+ { key: ConditionClaim.CodeText, meaning: 'Local-language condition label matching the resource language.', example: 'Diabetes mellitus tipo 2' },
98
+ { key: ConditionClaim.CodeDisplay, meaning: 'English/international terminology display.', example: 'Type 2 diabetes mellitus' },
83
99
  { key: ConditionClaim.Severity, meaning: 'Condition severity code.', example: 'http://snomed.info/sct|24484000' },
84
100
  { key: ConditionClaim.OnsetDateTime, meaning: 'Onset date/time.', example: '2026-01-03T09:30:00Z' },
85
101
  { key: ConditionClaim.Recorder, meaning: 'Recorder reference.', example: 'Practitioner/prac-2' },
@@ -3,6 +3,9 @@ export declare const DiagnosticReportClaim: {
3
3
  readonly BasedOn: "DiagnosticReport.based-on";
4
4
  readonly Category: "DiagnosticReport.category";
5
5
  readonly Code: "DiagnosticReport.code";
6
+ readonly CodeText: "DiagnosticReport.code-text";
7
+ readonly CodeTextLocal: "DiagnosticReport.code-text";
8
+ readonly CodeDisplay: "DiagnosticReport.code-display";
6
9
  readonly Date: "DiagnosticReport.date";
7
10
  readonly Encounter: "DiagnosticReport.encounter";
8
11
  readonly Identifier: "DiagnosticReport.identifier";
@@ -4,6 +4,9 @@ export const DiagnosticReportClaim = {
4
4
  BasedOn: 'DiagnosticReport.based-on',
5
5
  Category: 'DiagnosticReport.category',
6
6
  Code: 'DiagnosticReport.code',
7
+ CodeText: 'DiagnosticReport.code-text',
8
+ CodeTextLocal: 'DiagnosticReport.code-text',
9
+ CodeDisplay: 'DiagnosticReport.code-display',
7
10
  Date: 'DiagnosticReport.date',
8
11
  Encounter: 'DiagnosticReport.encounter',
9
12
  Identifier: 'DiagnosticReport.identifier',
@@ -35,6 +38,8 @@ export const DiagnosticReportClaimSpecs = [
35
38
  { key: DiagnosticReportClaim.BasedOn, meaning: 'Request or order that originated the report.', example: 'ServiceRequest/sr-1' },
36
39
  { key: DiagnosticReportClaim.Category, meaning: 'Diagnostic service section/category.', example: 'http://terminology.hl7.org/CodeSystem/v2-0074|LAB' },
37
40
  { key: DiagnosticReportClaim.Code, meaning: 'Main diagnostic report code.', example: 'http://loinc.org|58410-2' },
41
+ { key: DiagnosticReportClaim.CodeText, meaning: 'Local-language report name matching resource language.', example: 'Hemograma completo' },
42
+ { key: DiagnosticReportClaim.CodeDisplay, meaning: 'English/international terminology display.', example: 'Complete blood count panel' },
38
43
  { key: DiagnosticReportClaim.Date, meaning: 'Report issuance date/time.', example: '2026-06-12T10:00:00Z' },
39
44
  { key: DiagnosticReportClaim.Encounter, meaning: 'Encounter reference.', example: 'Encounter/enc-1' },
40
45
  { key: DiagnosticReportClaim.Identifier, meaning: 'Business identifier for the report.', example: 'diag-report-001' },
@@ -9,6 +9,9 @@ export declare const FlagClaim: {
9
9
  readonly Status: "Flag.status";
10
10
  readonly Category: "Flag.category";
11
11
  readonly Code: "Flag.code";
12
+ readonly CodeText: "Flag.code-text";
13
+ readonly CodeTextLocal: "Flag.code-text";
14
+ readonly CodeDisplay: "Flag.code-display";
12
15
  readonly PeriodStart: "Flag.period-start";
13
16
  readonly PeriodEnd: "Flag.period-end";
14
17
  };
@@ -10,6 +10,9 @@ export const FlagClaim = {
10
10
  Status: 'Flag.status',
11
11
  Category: 'Flag.category',
12
12
  Code: 'Flag.code',
13
+ CodeText: 'Flag.code-text',
14
+ CodeTextLocal: 'Flag.code-text',
15
+ CodeDisplay: 'Flag.code-display',
13
16
  PeriodStart: 'Flag.period-start',
14
17
  PeriodEnd: 'Flag.period-end',
15
18
  };
@@ -23,6 +26,8 @@ export const FlagClaimSpecs = [
23
26
  { key: FlagClaim.Status, meaning: 'Flag status.', example: 'active' },
24
27
  { key: FlagClaim.Category, meaning: 'Flag category token.', example: 'http://terminology.hl7.org/CodeSystem/flag-category|safety' },
25
28
  { key: FlagClaim.Code, meaning: 'Flag code token.', example: 'http://loinc.org|104605-1' },
29
+ { key: FlagClaim.CodeText, meaning: 'Local-language alert name matching resource language.', example: 'Dieta sin marisco' },
30
+ { key: FlagClaim.CodeDisplay, meaning: 'English/international terminology display.', example: 'Shellfish free diet' },
26
31
  { key: FlagClaim.PeriodStart, meaning: 'Flag period start.', example: '2026-06-01T10:00:00Z' },
27
32
  { key: FlagClaim.PeriodEnd, meaning: 'Flag period end.', example: '2026-07-01T10:00:00Z' },
28
33
  ];
@@ -14,6 +14,8 @@ export declare const MedicationStatementClaim: {
14
14
  readonly PartOf: "MedicationStatement.part-of";
15
15
  readonly Source: "MedicationStatement.source";
16
16
  readonly MedicationText: "MedicationStatement.medication-text";
17
+ /** English/international display for the coded medication. */
18
+ readonly CodeDisplay: "MedicationStatement.code-display";
17
19
  readonly UserSelected: "MedicationStatement.user-selected";
18
20
  /**
19
21
  * Free-text clinical note.
@@ -16,6 +16,8 @@ export const MedicationStatementClaim = {
16
16
  PartOf: 'MedicationStatement.part-of',
17
17
  Source: 'MedicationStatement.source',
18
18
  MedicationText: 'MedicationStatement.medication-text',
19
+ /** English/international display for the coded medication. */
20
+ CodeDisplay: 'MedicationStatement.code-display',
19
21
  UserSelected: 'MedicationStatement.user-selected',
20
22
  /**
21
23
  * Free-text clinical note.
@@ -20,6 +20,14 @@ export declare class AllergyIntoleranceEntryEditor extends ClinicalResourceEntry
20
20
  setCode(code?: string | null): this;
21
21
  /** Reads the coded allergy substance. */
22
22
  getCode(): string | undefined;
23
+ /** Writes the local-language allergy name projected to FHIR `code.text`. */
24
+ setCodeTextLocal(text?: string | null): this;
25
+ /** Reads the local-language allergy name. */
26
+ getCodeTextLocal(): string | undefined;
27
+ /** Writes the English/international terminology display. */
28
+ setCodeDisplay(display?: string | null): this;
29
+ /** Reads the English/international terminology display. */
30
+ getCodeDisplay(): string | undefined;
23
31
  /** Writes the clinical status. */
24
32
  setClinicalStatus(status?: string | null): this;
25
33
  /** Reads the clinical status. */
@@ -23,6 +23,14 @@ export class AllergyIntoleranceEntryEditor extends ClinicalResourceEntryEditor {
23
23
  setCode(code) { return this.setScalarClaim(AllergyIntoleranceClaim.Code, code); }
24
24
  /** Reads the coded allergy substance. */
25
25
  getCode() { return this.getScalarClaim(AllergyIntoleranceClaim.Code); }
26
+ /** Writes the local-language allergy name projected to FHIR `code.text`. */
27
+ setCodeTextLocal(text) { return this.setScalarClaim(AllergyIntoleranceClaim.CodeText, text); }
28
+ /** Reads the local-language allergy name. */
29
+ getCodeTextLocal() { return this.getScalarClaim(AllergyIntoleranceClaim.CodeText); }
30
+ /** Writes the English/international terminology display. */
31
+ setCodeDisplay(display) { return this.setScalarClaim(AllergyIntoleranceClaim.CodeDisplay, display); }
32
+ /** Reads the English/international terminology display. */
33
+ getCodeDisplay() { return this.getScalarClaim(AllergyIntoleranceClaim.CodeDisplay); }
26
34
  /** Writes the clinical status. */
27
35
  setClinicalStatus(status) { return this.setScalarClaim(AllergyIntoleranceClaim.ClinicalStatus, status); }
28
36
  /** Reads the clinical status. */
@@ -334,6 +334,11 @@ export function convertClaimsToFhirResource(claims, version = 'r4') {
334
334
  void version;
335
335
  const flatClaims = claimsToFlatStrings(claims);
336
336
  const resourceType = detectClaimsResourceType(claims);
337
+ const resource = convertClaimsToFhirResourceByType(flatClaims, resourceType);
338
+ const language = resourceType ? asTrimmedString(claims[`${resourceType}.language`]) : '';
339
+ return language ? { ...resource, language } : resource;
340
+ }
341
+ function convertClaimsToFhirResourceByType(flatClaims, resourceType) {
337
342
  switch (resourceType) {
338
343
  case ResourceTypesFhirR4.MedicationStatement:
339
344
  return medicationStatementFlatToFhirR4(flatClaims);
@@ -92,6 +92,13 @@ export const clinicalImpressionFhirToFlat = clinicalImpressionFhirR4ToFlat;
92
92
  * generic structural flattening.
93
93
  */
94
94
  export function convertFhirResourceToClaims(resource, context = 'org.hl7.fhir.r4') {
95
+ const claims = convertFhirResourceToClaimsByType(resource, context);
96
+ const language = typeof resource.language === 'string' ? resource.language.trim() : '';
97
+ return language
98
+ ? { ...claims, [`${resource.resourceType}.language`]: language }
99
+ : claims;
100
+ }
101
+ function convertFhirResourceToClaimsByType(resource, context) {
95
102
  switch (resource.resourceType) {
96
103
  case 'MedicationStatement':
97
104
  return medicationStatementFhirR4ToFlat(resource);
@@ -24,6 +24,24 @@ export type ClinicalResourceCardView = Readonly<{
24
24
  fullUrl?: string;
25
25
  actorsCount: number;
26
26
  }>;
27
+ export type ClinicalTerminologyTranslationInput = Readonly<{
28
+ resourceType: string;
29
+ system?: string;
30
+ code: string;
31
+ token: string;
32
+ locale: string;
33
+ }>;
34
+ export type ClinicalResourceDisplayOptions = Readonly<{
35
+ /** UI language requested by the current user, for example `es` or `es-ES`. */
36
+ locale?: string;
37
+ /**
38
+ * Product terminology lookup keyed by canonical `system|code`.
39
+ *
40
+ * Return `undefined` when the product has no translation so the shared
41
+ * reader can fall back to the international `Coding.display`.
42
+ */
43
+ translateCode?: (input: ClinicalTerminologyTranslationInput) => string | undefined;
44
+ }>;
27
45
  export type ClinicalResourceExpandedView = Readonly<{
28
46
  common: ClinicalResourceCommonView;
29
47
  xhtml?: string;
@@ -74,19 +92,19 @@ export type ClinicalResourceBundleLike = Readonly<{
74
92
  /**
75
93
  * Maps one bundle entry to a UI-friendly common clinical view contract.
76
94
  */
77
- export declare function toClinicalResourceCommonView(entry: ClinicalResourceEntryLike): ClinicalResourceCommonView;
95
+ export declare function toClinicalResourceCommonView(entry: ClinicalResourceEntryLike, options?: ClinicalResourceDisplayOptions): ClinicalResourceCommonView;
78
96
  /**
79
97
  * Maps all entries from a Bundle into common clinical views.
80
98
  */
81
- export declare function toClinicalResourceCommonViews(bundle: ClinicalResourceBundleLike): ClinicalResourceCommonView[];
99
+ export declare function toClinicalResourceCommonViews(bundle: ClinicalResourceBundleLike, options?: ClinicalResourceDisplayOptions): ClinicalResourceCommonView[];
82
100
  /**
83
101
  * Maps one bundle entry to a minimal card view for section counters/list cards.
84
102
  */
85
- export declare function toClinicalResourceCardView(entry: ClinicalResourceEntryLike): ClinicalResourceCardView;
103
+ export declare function toClinicalResourceCardView(entry: ClinicalResourceEntryLike, options?: ClinicalResourceDisplayOptions): ClinicalResourceCardView;
86
104
  /**
87
105
  * Maps all entries from a Bundle into minimal card views.
88
106
  */
89
- export declare function toClinicalResourceCardViews(bundle: ClinicalResourceBundleLike): ClinicalResourceCardView[];
107
+ export declare function toClinicalResourceCardViews(bundle: ClinicalResourceBundleLike, options?: ClinicalResourceDisplayOptions): ClinicalResourceCardView[];
90
108
  /**
91
109
  * Maps one bundle entry to an expanded view that includes XHTML and notes array.
92
110
  */