@medplum/ccda 4.3.12 → 4.3.14

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.
@@ -1,6 +1,16 @@
1
1
  import { Bundle } from '@medplum/fhirtypes';
2
+ import { CareTeam } from '@medplum/fhirtypes';
2
3
  import { CodeableConcept } from '@medplum/fhirtypes';
3
4
  import { Coding } from '@medplum/fhirtypes';
5
+ import { Device } from '@medplum/fhirtypes';
6
+ import { Organization } from '@medplum/fhirtypes';
7
+ import { Patient } from '@medplum/fhirtypes';
8
+ import { Period } from '@medplum/fhirtypes';
9
+ import { Practitioner } from '@medplum/fhirtypes';
10
+ import { PractitionerRole } from '@medplum/fhirtypes';
11
+ import { Reference } from '@medplum/fhirtypes';
12
+ import { RelatedPerson } from '@medplum/fhirtypes';
13
+ import { Resource } from '@medplum/fhirtypes';
4
14
 
5
15
  export declare const ACT_CODE_SYSTEM = "http://terminology.hl7.org/CodeSystem/v3-ActCode";
6
16
 
@@ -39,6 +49,7 @@ export declare interface Ccda {
39
49
  effectiveTime?: CcdaEffectiveTime[];
40
50
  custodian?: CcdaCustodian;
41
51
  informationRecipient?: CcdaInformationRecipient;
52
+ participant?: CcdaParticipant[];
42
53
  documentationOf?: CcdaDocumentationOf;
43
54
  title?: string;
44
55
  code?: CcdaCode;
@@ -61,7 +72,7 @@ export declare const CCDA_TEMPLATE_IDS: ({
61
72
  export declare interface CcdaAct {
62
73
  '@_classCode': string;
63
74
  '@_moodCode': string;
64
- templateId: CcdaTemplateId[];
75
+ templateId?: CcdaTemplateId[];
65
76
  id?: CcdaId[];
66
77
  code: CcdaCode;
67
78
  statusCode?: CcdaCode;
@@ -71,6 +82,7 @@ export declare interface CcdaAct {
71
82
  author?: CcdaAuthor[];
72
83
  text?: CcdaText;
73
84
  performer?: CcdaPerformer[];
85
+ participant?: CcdaParticipant[];
74
86
  }
75
87
 
76
88
  export declare interface CcdaAddr {
@@ -87,6 +99,7 @@ export declare interface CcdaAssignedAuthor {
87
99
  id?: CcdaId[];
88
100
  code?: CcdaCode;
89
101
  assignedPerson?: CcdaAssignedPerson;
102
+ associatedPerson?: CcdaAssignedPerson;
90
103
  addr: CcdaAddr[];
91
104
  telecom: CcdaTelecom[];
92
105
  assignedAuthoringDevice?: CcdaAssignedAuthoringDevice;
@@ -105,6 +118,7 @@ export declare interface CcdaAssignedCustodian {
105
118
 
106
119
  export declare interface CcdaAssignedEntity {
107
120
  id: CcdaId[];
121
+ code?: CcdaCode;
108
122
  addr: CcdaAddr[];
109
123
  telecom: CcdaTelecom[];
110
124
  assignedPerson?: CcdaAssignedPerson;
@@ -184,6 +198,7 @@ export declare interface CcdaEntry {
184
198
  export declare interface CcdaEntryRelationship {
185
199
  '@_typeCode': string;
186
200
  '@_inversionInd'?: string;
201
+ sequenceNumber?: CcdaInteger;
187
202
  observation?: CcdaObservation[];
188
203
  act?: CcdaAct[];
189
204
  substanceAdministration?: CcdaSubstanceAdministration[];
@@ -211,6 +226,11 @@ export declare interface CcdaInnerComponent {
211
226
  section: CcdaSection[];
212
227
  }
213
228
 
229
+ export declare interface CcdaInteger {
230
+ '@_xsi:type': 'INT';
231
+ '@_value': string;
232
+ }
233
+
214
234
  export declare interface CcdaIntendedRecipient {
215
235
  informationRecipient: CcdaInformationRecipientEntry;
216
236
  }
@@ -281,7 +301,7 @@ export declare interface CcdaOrganization {
281
301
  }
282
302
 
283
303
  export declare interface CcdaOrganizer {
284
- '@_classCode': 'CLUSTER';
304
+ '@_classCode': 'CLUSTER' | 'OBS';
285
305
  '@_moodCode': 'EVN';
286
306
  templateId: CcdaTemplateId[];
287
307
  id: CcdaId[];
@@ -303,7 +323,9 @@ export declare interface CcdaOuterComponent {
303
323
  export declare interface CcdaParticipant {
304
324
  '@_classCode'?: string;
305
325
  '@_typeCode'?: string;
326
+ templateId?: CcdaTemplateId[];
306
327
  participantRole?: CcdaParticipantRole;
328
+ associatedEntity?: CcdaAssignedAuthor;
307
329
  }
308
330
 
309
331
  export declare interface CcdaParticipantRole {
@@ -338,6 +360,7 @@ export declare interface CcdaPatientRole {
338
360
 
339
361
  export declare interface CcdaPerformer {
340
362
  '@_typeCode'?: string;
363
+ templateId?: CcdaTemplateId[];
341
364
  assignedEntity: CcdaAssignedEntity;
342
365
  functionCode?: CcdaCode;
343
366
  }
@@ -359,7 +382,7 @@ export declare interface CcdaPlayingEntity {
359
382
  '@_classCode'?: string;
360
383
  '@_typeCode'?: string;
361
384
  code?: CcdaCode;
362
- name?: string[];
385
+ name?: CcdaName[] | string[];
363
386
  }
364
387
 
365
388
  export declare interface CcdaProcedure {
@@ -368,7 +391,7 @@ export declare interface CcdaProcedure {
368
391
  templateId: CcdaTemplateId[];
369
392
  id?: CcdaId[];
370
393
  code: CcdaCode;
371
- statusCode: CcdaCode<'completed' | 'aborted' | 'cancelled' | 'new' | 'unknown'>;
394
+ statusCode: CcdaCode<'completed' | 'active' | 'aborted' | 'cancelled' | 'new' | 'unknown'>;
372
395
  effectiveTime?: CcdaEffectiveTime[];
373
396
  methodCode?: CcdaCode;
374
397
  targetSiteCode?: CcdaCode;
@@ -472,7 +495,7 @@ export declare interface CcdaToFhirOptions {
472
495
  ignoreUnsupportedSections?: boolean;
473
496
  }
474
497
 
475
- export declare type CcdaValue = CcdaCode | CcdaText | CcdaQuantity | CcdaReference;
498
+ export declare type CcdaValue = CcdaCode | CcdaText | CcdaQuantity | CcdaReference | CcdaInteger;
476
499
 
477
500
  export declare const CLINICAL_CONDITION_CODE_SYSTEM = "http://terminology.hl7.org/CodeSystem/condition-clinical";
478
501
 
@@ -534,13 +557,11 @@ export declare interface EnumEntry<TFhirValue extends string = string, TCcdaValu
534
557
  }
535
558
 
536
559
  export declare class EnumMapper<TFhirValue extends string, TCcdaValue extends string> {
537
- readonly systemName: string;
538
- readonly ccdaSystemOid: string;
539
- readonly fhirSystemUrl: string;
560
+ readonly details: EnumMapperDetails;
540
561
  readonly entries: EnumEntry<TFhirValue, TCcdaValue>[];
541
562
  readonly ccdaToFhirMap: Record<TCcdaValue, EnumEntry<TFhirValue, TCcdaValue>>;
542
563
  readonly fhirToCcdaMap: Record<TFhirValue, EnumEntry<TFhirValue, TCcdaValue>>;
543
- constructor(systemName: string, ccdaSystemOid: string, fhirSystemUrl: string, entries: EnumEntry<TFhirValue, TCcdaValue>[]);
564
+ constructor(details: EnumMapperDetails, entries: EnumEntry<TFhirValue, TCcdaValue>[]);
544
565
  getEntryByFhir(fhir: TFhirValue): EnumEntry<TFhirValue, TCcdaValue> | undefined;
545
566
  getEntryByCcda(ccda: TCcdaValue): EnumEntry<TFhirValue, TCcdaValue> | undefined;
546
567
  mapCcdaToFhir(ccda: TCcdaValue): TFhirValue | undefined;
@@ -551,8 +572,92 @@ export declare class EnumMapper<TFhirValue extends string, TCcdaValue extends st
551
572
  mapFhirToCcdaCode(fhir: TFhirValue | undefined): CcdaCode<TCcdaValue> | undefined;
552
573
  }
553
574
 
575
+ export declare interface EnumMapperDetails {
576
+ readonly ccdaSystemOid?: string;
577
+ readonly fhirSystemUrl?: string;
578
+ }
579
+
554
580
  export declare const FHIR_CVX_URL = "http://hl7.org/fhir/sid/cvx";
555
581
 
582
+ export declare const FHIR_ICF_URL = "http://hl7.org/fhir/sid/icf";
583
+
584
+ /**
585
+ * The FhirToCcdaConverter class is responsible for converting a FHIR bundle to a C-CDA document.
586
+ */
587
+ export declare class FhirToCcdaConverter {
588
+ private readonly bundle;
589
+ private readonly options;
590
+ private readonly composition;
591
+ private readonly patient;
592
+ /**
593
+ * Creates a new FhirToCcdaConverter for the given FHIR bundle.
594
+ * @param bundle - The FHIR bundle to convert.
595
+ * @param options - Optional options.
596
+ */
597
+ constructor(bundle: Bundle, options?: FhirToCcdaOptions);
598
+ /**
599
+ * Convert the FHIR bundle to a C-CDA document.
600
+ * @returns The C-CDA document.
601
+ */
602
+ convert(): Ccda;
603
+ /**
604
+ * Find a resource in the FHIR bundle by resource type.
605
+ * @param resourceType - The type of resource to find.
606
+ * @returns The resource if found, otherwise undefined.
607
+ */
608
+ private findResource;
609
+ /**
610
+ * Find a resource in the FHIR bundle by reference.
611
+ * @param reference - The reference to the resource.
612
+ * @returns The resource if found, otherwise undefined.
613
+ */
614
+ findResourceByReference<T extends Resource>(reference: Reference<T> | undefined): T | undefined;
615
+ /**
616
+ * Find resources in the FHIR bundle by references.
617
+ * @param references - The references to the resources.
618
+ * @returns The resources if found, otherwise undefined.
619
+ */
620
+ private findResourcesByReferences;
621
+ /**
622
+ * Create the record target for the C-CDA document.
623
+ * @returns The record target.
624
+ */
625
+ private createRecordTarget;
626
+ /**
627
+ * Create the sections for the C-CDA document.
628
+ * @returns The sections.
629
+ */
630
+ private createSections;
631
+ private createSection;
632
+ private createEntry;
633
+ /**
634
+ * Map the FHIR author to the C-CDA author.
635
+ * @param author - The author to map.
636
+ * @param time - The time to map.
637
+ * @param includeDevice - Whether to include device information.
638
+ * @returns The C-CDA author.
639
+ */
640
+ mapAuthor(author: Reference<CareTeam | Device | Organization | Patient | Practitioner | PractitionerRole | RelatedPerson> | undefined, time?: string, includeDevice?: boolean): CcdaAuthor[] | undefined;
641
+ private mapCustodian;
642
+ private mapRecipient;
643
+ private createParticipants;
644
+ /**
645
+ * Handles the ClinicalImpression special case.
646
+ * Unlike most other sections, the "Assessments" section can skip the `<entry>` elements and directly contain the `<text>` element.
647
+ * @param section - The Composition section to create the C-CDA section for.
648
+ * @param resource - The ClinicalImpression resource to create the C-CDA section for.
649
+ * @returns The C-CDA section for the ClinicalImpression resource.
650
+ */
651
+ private createClinicalImpressionSection;
652
+ /**
653
+ * Handles the Reason for Referral special case.
654
+ * @param section - The Composition section to create the C-CDA section for.
655
+ * @param resource - The ClinicalImpression resource to create the C-CDA section for.
656
+ * @returns The C-CDA section for the ClinicalImpression resource.
657
+ */
658
+ private createReasonForReferralSection;
659
+ }
660
+
556
661
  export declare interface FhirToCcdaOptions {
557
662
  /**
558
663
  * Type of C-CDA document to generate.
@@ -560,6 +665,8 @@ export declare interface FhirToCcdaOptions {
560
665
  type?: 'referral' | 'discharge' | 'summary';
561
666
  }
562
667
 
668
+ export declare const FUNCTIONAL_STATUS_TEMPLATE_IDS: CcdaTemplateId[];
669
+
563
670
  export declare const GENDER_MAPPER: EnumMapper<"unknown" | "female" | "male" | "other", "M" | "F" | "UN">;
564
671
 
565
672
  export declare const GOALS_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
@@ -579,6 +686,8 @@ export declare const IMMUNIZATION_STATUS_MAPPER: EnumMapper<"completed" | "enter
579
686
 
580
687
  export declare const IMMUNIZATIONS_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
581
688
 
689
+ export declare const INSURANCE_COVERAGE_TYPE_MAPPER: EnumMapper<string, string>;
690
+
582
691
  export declare const INSURANCE_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
583
692
 
584
693
  export declare const LAB_TESTS_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
@@ -601,16 +710,30 @@ export declare const LOINC_BIRTH_SEX = "76689-9";
601
710
 
602
711
  export declare const LOINC_CARE_TEAM_SECTION = "85847-2";
603
712
 
713
+ export declare const LOINC_CLINICAL_FINDING = "75321-0";
714
+
604
715
  export declare const LOINC_CONDITION = "75323-6";
605
716
 
606
717
  export declare const LOINC_DEVICES_SECTION = "46264-8";
607
718
 
719
+ export declare const LOINC_DISABILITY_STATUS = "89571-4";
720
+
608
721
  export declare const LOINC_ENCOUNTERS_SECTION = "46240-8";
609
722
 
723
+ export declare const LOINC_FUNCTIONAL_STATUS_ASSESSMENT_NOTE = "47420-5";
724
+
725
+ export declare const LOINC_FUNCTIONAL_STATUS_SECTION = "47420-5";
726
+
610
727
  export declare const LOINC_GOALS_SECTION = "61146-7";
611
728
 
612
729
  export declare const LOINC_HEALTH_CONCERNS_SECTION = "75310-3";
613
730
 
731
+ export declare const LOINC_HISTORY_OF_OCCUPATION = "11341-5";
732
+
733
+ export declare const LOINC_HISTORY_OF_OCCUPATION_INDUSTRY = "86188-0";
734
+
735
+ export declare const LOINC_HISTORY_OF_SOCIAL_FUNCTION = "8689-2";
736
+
614
737
  export declare const LOINC_HISTORY_OF_TOBACCO_USE = "11367-0";
615
738
 
616
739
  export declare const LOINC_IMMUNIZATIONS_SECTION = "11369-6";
@@ -633,6 +756,8 @@ export declare const LOINC_PATIENT_SUMMARY_DOCUMENT = "60591-5";
633
756
 
634
757
  export declare const LOINC_PLAN_OF_TREATMENT_SECTION = "18776-5";
635
758
 
759
+ export declare const LOINC_PREGNANCY_STATUS = "82810-3";
760
+
636
761
  export declare const LOINC_PROBLEMS_SECTION = "11450-4";
637
762
 
638
763
  export declare const LOINC_PROCEDURES_SECTION = "47519-4";
@@ -651,8 +776,17 @@ export declare const LOINC_TO_TEMPLATE_IDS: Record<string, CcdaTemplateId[]>;
651
776
 
652
777
  export declare const LOINC_TOBACCO_SMOKING_STATUS = "72166-2";
653
778
 
779
+ export declare const LOINC_TRIBAL_AFFILIATION = "95370-3";
780
+
654
781
  export declare const LOINC_VITAL_SIGNS_SECTION = "8716-3";
655
782
 
783
+ /**
784
+ * Maps a C-CDA code to a FHIR CodeableConcept.
785
+ * @param ccdaCode - The C-CDA code to map.
786
+ * @returns The FHIR CodeableConcept.
787
+ */
788
+ export declare function mapCcdaCodeToCodeableConcept(ccdaCode: CcdaCode | undefined): CodeableConcept | undefined;
789
+
656
790
  /**
657
791
  * Map the C-CDA system to the FHIR system.
658
792
  * @param ccda - The C-CDA system to map.
@@ -695,6 +829,8 @@ export declare function mapCodeableConceptToCcdaValue(codeableConcept: CodeableC
695
829
  */
696
830
  export declare function mapCodingToCcdaCode(coding: Coding): CcdaCode;
697
831
 
832
+ export declare function mapFhirPeriodOrDateTimeToCcda(period: Period | undefined, dateTime: string | undefined): CcdaEffectiveTime;
833
+
698
834
  /**
699
835
  * Map the FHIR system to the C-CDA system.
700
836
  * @param system - The system to map.
@@ -748,7 +884,7 @@ export declare const PROBLEM_STATUS_MAPPER: EnumMapper<string, string>;
748
884
 
749
885
  export declare const PROBLEMS_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
750
886
 
751
- export declare const PROCEDURE_STATUS_MAPPER: EnumMapper<"completed" | "unknown" | "not-done" | "stopped", "completed" | "aborted" | "cancelled" | "unknown" | "new">;
887
+ export declare const PROCEDURE_STATUS_MAPPER: EnumMapper<"active" | "completed" | "unknown" | "not-done" | "stopped", "active" | "completed" | "aborted" | "cancelled" | "unknown" | "new">;
752
888
 
753
889
  export declare const PROCEDURES_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
754
890
 
@@ -766,6 +902,8 @@ export declare const REFERRAL_TEMPLATE_IDS: ({
766
902
 
767
903
  export declare const RESULTS_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
768
904
 
905
+ export declare const ROLE_CODE_CODE_SYSTEM = "http://terminology.hl7.org/CodeSystem/v3-RoleCode";
906
+
769
907
  export declare const SOCIAL_HISTORY_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
770
908
 
771
909
  export declare const SYSTEM_MAPPER: EnumMapper<string, string>;
@@ -1,6 +1,16 @@
1
1
  import { Bundle } from '@medplum/fhirtypes';
2
+ import { CareTeam } from '@medplum/fhirtypes';
2
3
  import { CodeableConcept } from '@medplum/fhirtypes';
3
4
  import { Coding } from '@medplum/fhirtypes';
5
+ import { Device } from '@medplum/fhirtypes';
6
+ import { Organization } from '@medplum/fhirtypes';
7
+ import { Patient } from '@medplum/fhirtypes';
8
+ import { Period } from '@medplum/fhirtypes';
9
+ import { Practitioner } from '@medplum/fhirtypes';
10
+ import { PractitionerRole } from '@medplum/fhirtypes';
11
+ import { Reference } from '@medplum/fhirtypes';
12
+ import { RelatedPerson } from '@medplum/fhirtypes';
13
+ import { Resource } from '@medplum/fhirtypes';
4
14
 
5
15
  export declare const ACT_CODE_SYSTEM = "http://terminology.hl7.org/CodeSystem/v3-ActCode";
6
16
 
@@ -39,6 +49,7 @@ export declare interface Ccda {
39
49
  effectiveTime?: CcdaEffectiveTime[];
40
50
  custodian?: CcdaCustodian;
41
51
  informationRecipient?: CcdaInformationRecipient;
52
+ participant?: CcdaParticipant[];
42
53
  documentationOf?: CcdaDocumentationOf;
43
54
  title?: string;
44
55
  code?: CcdaCode;
@@ -61,7 +72,7 @@ export declare const CCDA_TEMPLATE_IDS: ({
61
72
  export declare interface CcdaAct {
62
73
  '@_classCode': string;
63
74
  '@_moodCode': string;
64
- templateId: CcdaTemplateId[];
75
+ templateId?: CcdaTemplateId[];
65
76
  id?: CcdaId[];
66
77
  code: CcdaCode;
67
78
  statusCode?: CcdaCode;
@@ -71,6 +82,7 @@ export declare interface CcdaAct {
71
82
  author?: CcdaAuthor[];
72
83
  text?: CcdaText;
73
84
  performer?: CcdaPerformer[];
85
+ participant?: CcdaParticipant[];
74
86
  }
75
87
 
76
88
  export declare interface CcdaAddr {
@@ -87,6 +99,7 @@ export declare interface CcdaAssignedAuthor {
87
99
  id?: CcdaId[];
88
100
  code?: CcdaCode;
89
101
  assignedPerson?: CcdaAssignedPerson;
102
+ associatedPerson?: CcdaAssignedPerson;
90
103
  addr: CcdaAddr[];
91
104
  telecom: CcdaTelecom[];
92
105
  assignedAuthoringDevice?: CcdaAssignedAuthoringDevice;
@@ -105,6 +118,7 @@ export declare interface CcdaAssignedCustodian {
105
118
 
106
119
  export declare interface CcdaAssignedEntity {
107
120
  id: CcdaId[];
121
+ code?: CcdaCode;
108
122
  addr: CcdaAddr[];
109
123
  telecom: CcdaTelecom[];
110
124
  assignedPerson?: CcdaAssignedPerson;
@@ -184,6 +198,7 @@ export declare interface CcdaEntry {
184
198
  export declare interface CcdaEntryRelationship {
185
199
  '@_typeCode': string;
186
200
  '@_inversionInd'?: string;
201
+ sequenceNumber?: CcdaInteger;
187
202
  observation?: CcdaObservation[];
188
203
  act?: CcdaAct[];
189
204
  substanceAdministration?: CcdaSubstanceAdministration[];
@@ -211,6 +226,11 @@ export declare interface CcdaInnerComponent {
211
226
  section: CcdaSection[];
212
227
  }
213
228
 
229
+ export declare interface CcdaInteger {
230
+ '@_xsi:type': 'INT';
231
+ '@_value': string;
232
+ }
233
+
214
234
  export declare interface CcdaIntendedRecipient {
215
235
  informationRecipient: CcdaInformationRecipientEntry;
216
236
  }
@@ -281,7 +301,7 @@ export declare interface CcdaOrganization {
281
301
  }
282
302
 
283
303
  export declare interface CcdaOrganizer {
284
- '@_classCode': 'CLUSTER';
304
+ '@_classCode': 'CLUSTER' | 'OBS';
285
305
  '@_moodCode': 'EVN';
286
306
  templateId: CcdaTemplateId[];
287
307
  id: CcdaId[];
@@ -303,7 +323,9 @@ export declare interface CcdaOuterComponent {
303
323
  export declare interface CcdaParticipant {
304
324
  '@_classCode'?: string;
305
325
  '@_typeCode'?: string;
326
+ templateId?: CcdaTemplateId[];
306
327
  participantRole?: CcdaParticipantRole;
328
+ associatedEntity?: CcdaAssignedAuthor;
307
329
  }
308
330
 
309
331
  export declare interface CcdaParticipantRole {
@@ -338,6 +360,7 @@ export declare interface CcdaPatientRole {
338
360
 
339
361
  export declare interface CcdaPerformer {
340
362
  '@_typeCode'?: string;
363
+ templateId?: CcdaTemplateId[];
341
364
  assignedEntity: CcdaAssignedEntity;
342
365
  functionCode?: CcdaCode;
343
366
  }
@@ -359,7 +382,7 @@ export declare interface CcdaPlayingEntity {
359
382
  '@_classCode'?: string;
360
383
  '@_typeCode'?: string;
361
384
  code?: CcdaCode;
362
- name?: string[];
385
+ name?: CcdaName[] | string[];
363
386
  }
364
387
 
365
388
  export declare interface CcdaProcedure {
@@ -368,7 +391,7 @@ export declare interface CcdaProcedure {
368
391
  templateId: CcdaTemplateId[];
369
392
  id?: CcdaId[];
370
393
  code: CcdaCode;
371
- statusCode: CcdaCode<'completed' | 'aborted' | 'cancelled' | 'new' | 'unknown'>;
394
+ statusCode: CcdaCode<'completed' | 'active' | 'aborted' | 'cancelled' | 'new' | 'unknown'>;
372
395
  effectiveTime?: CcdaEffectiveTime[];
373
396
  methodCode?: CcdaCode;
374
397
  targetSiteCode?: CcdaCode;
@@ -472,7 +495,7 @@ export declare interface CcdaToFhirOptions {
472
495
  ignoreUnsupportedSections?: boolean;
473
496
  }
474
497
 
475
- export declare type CcdaValue = CcdaCode | CcdaText | CcdaQuantity | CcdaReference;
498
+ export declare type CcdaValue = CcdaCode | CcdaText | CcdaQuantity | CcdaReference | CcdaInteger;
476
499
 
477
500
  export declare const CLINICAL_CONDITION_CODE_SYSTEM = "http://terminology.hl7.org/CodeSystem/condition-clinical";
478
501
 
@@ -534,13 +557,11 @@ export declare interface EnumEntry<TFhirValue extends string = string, TCcdaValu
534
557
  }
535
558
 
536
559
  export declare class EnumMapper<TFhirValue extends string, TCcdaValue extends string> {
537
- readonly systemName: string;
538
- readonly ccdaSystemOid: string;
539
- readonly fhirSystemUrl: string;
560
+ readonly details: EnumMapperDetails;
540
561
  readonly entries: EnumEntry<TFhirValue, TCcdaValue>[];
541
562
  readonly ccdaToFhirMap: Record<TCcdaValue, EnumEntry<TFhirValue, TCcdaValue>>;
542
563
  readonly fhirToCcdaMap: Record<TFhirValue, EnumEntry<TFhirValue, TCcdaValue>>;
543
- constructor(systemName: string, ccdaSystemOid: string, fhirSystemUrl: string, entries: EnumEntry<TFhirValue, TCcdaValue>[]);
564
+ constructor(details: EnumMapperDetails, entries: EnumEntry<TFhirValue, TCcdaValue>[]);
544
565
  getEntryByFhir(fhir: TFhirValue): EnumEntry<TFhirValue, TCcdaValue> | undefined;
545
566
  getEntryByCcda(ccda: TCcdaValue): EnumEntry<TFhirValue, TCcdaValue> | undefined;
546
567
  mapCcdaToFhir(ccda: TCcdaValue): TFhirValue | undefined;
@@ -551,8 +572,92 @@ export declare class EnumMapper<TFhirValue extends string, TCcdaValue extends st
551
572
  mapFhirToCcdaCode(fhir: TFhirValue | undefined): CcdaCode<TCcdaValue> | undefined;
552
573
  }
553
574
 
575
+ export declare interface EnumMapperDetails {
576
+ readonly ccdaSystemOid?: string;
577
+ readonly fhirSystemUrl?: string;
578
+ }
579
+
554
580
  export declare const FHIR_CVX_URL = "http://hl7.org/fhir/sid/cvx";
555
581
 
582
+ export declare const FHIR_ICF_URL = "http://hl7.org/fhir/sid/icf";
583
+
584
+ /**
585
+ * The FhirToCcdaConverter class is responsible for converting a FHIR bundle to a C-CDA document.
586
+ */
587
+ export declare class FhirToCcdaConverter {
588
+ private readonly bundle;
589
+ private readonly options;
590
+ private readonly composition;
591
+ private readonly patient;
592
+ /**
593
+ * Creates a new FhirToCcdaConverter for the given FHIR bundle.
594
+ * @param bundle - The FHIR bundle to convert.
595
+ * @param options - Optional options.
596
+ */
597
+ constructor(bundle: Bundle, options?: FhirToCcdaOptions);
598
+ /**
599
+ * Convert the FHIR bundle to a C-CDA document.
600
+ * @returns The C-CDA document.
601
+ */
602
+ convert(): Ccda;
603
+ /**
604
+ * Find a resource in the FHIR bundle by resource type.
605
+ * @param resourceType - The type of resource to find.
606
+ * @returns The resource if found, otherwise undefined.
607
+ */
608
+ private findResource;
609
+ /**
610
+ * Find a resource in the FHIR bundle by reference.
611
+ * @param reference - The reference to the resource.
612
+ * @returns The resource if found, otherwise undefined.
613
+ */
614
+ findResourceByReference<T extends Resource>(reference: Reference<T> | undefined): T | undefined;
615
+ /**
616
+ * Find resources in the FHIR bundle by references.
617
+ * @param references - The references to the resources.
618
+ * @returns The resources if found, otherwise undefined.
619
+ */
620
+ private findResourcesByReferences;
621
+ /**
622
+ * Create the record target for the C-CDA document.
623
+ * @returns The record target.
624
+ */
625
+ private createRecordTarget;
626
+ /**
627
+ * Create the sections for the C-CDA document.
628
+ * @returns The sections.
629
+ */
630
+ private createSections;
631
+ private createSection;
632
+ private createEntry;
633
+ /**
634
+ * Map the FHIR author to the C-CDA author.
635
+ * @param author - The author to map.
636
+ * @param time - The time to map.
637
+ * @param includeDevice - Whether to include device information.
638
+ * @returns The C-CDA author.
639
+ */
640
+ mapAuthor(author: Reference<CareTeam | Device | Organization | Patient | Practitioner | PractitionerRole | RelatedPerson> | undefined, time?: string, includeDevice?: boolean): CcdaAuthor[] | undefined;
641
+ private mapCustodian;
642
+ private mapRecipient;
643
+ private createParticipants;
644
+ /**
645
+ * Handles the ClinicalImpression special case.
646
+ * Unlike most other sections, the "Assessments" section can skip the `<entry>` elements and directly contain the `<text>` element.
647
+ * @param section - The Composition section to create the C-CDA section for.
648
+ * @param resource - The ClinicalImpression resource to create the C-CDA section for.
649
+ * @returns The C-CDA section for the ClinicalImpression resource.
650
+ */
651
+ private createClinicalImpressionSection;
652
+ /**
653
+ * Handles the Reason for Referral special case.
654
+ * @param section - The Composition section to create the C-CDA section for.
655
+ * @param resource - The ClinicalImpression resource to create the C-CDA section for.
656
+ * @returns The C-CDA section for the ClinicalImpression resource.
657
+ */
658
+ private createReasonForReferralSection;
659
+ }
660
+
556
661
  export declare interface FhirToCcdaOptions {
557
662
  /**
558
663
  * Type of C-CDA document to generate.
@@ -560,6 +665,8 @@ export declare interface FhirToCcdaOptions {
560
665
  type?: 'referral' | 'discharge' | 'summary';
561
666
  }
562
667
 
668
+ export declare const FUNCTIONAL_STATUS_TEMPLATE_IDS: CcdaTemplateId[];
669
+
563
670
  export declare const GENDER_MAPPER: EnumMapper<"unknown" | "female" | "male" | "other", "M" | "F" | "UN">;
564
671
 
565
672
  export declare const GOALS_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
@@ -579,6 +686,8 @@ export declare const IMMUNIZATION_STATUS_MAPPER: EnumMapper<"completed" | "enter
579
686
 
580
687
  export declare const IMMUNIZATIONS_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
581
688
 
689
+ export declare const INSURANCE_COVERAGE_TYPE_MAPPER: EnumMapper<string, string>;
690
+
582
691
  export declare const INSURANCE_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
583
692
 
584
693
  export declare const LAB_TESTS_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
@@ -601,16 +710,30 @@ export declare const LOINC_BIRTH_SEX = "76689-9";
601
710
 
602
711
  export declare const LOINC_CARE_TEAM_SECTION = "85847-2";
603
712
 
713
+ export declare const LOINC_CLINICAL_FINDING = "75321-0";
714
+
604
715
  export declare const LOINC_CONDITION = "75323-6";
605
716
 
606
717
  export declare const LOINC_DEVICES_SECTION = "46264-8";
607
718
 
719
+ export declare const LOINC_DISABILITY_STATUS = "89571-4";
720
+
608
721
  export declare const LOINC_ENCOUNTERS_SECTION = "46240-8";
609
722
 
723
+ export declare const LOINC_FUNCTIONAL_STATUS_ASSESSMENT_NOTE = "47420-5";
724
+
725
+ export declare const LOINC_FUNCTIONAL_STATUS_SECTION = "47420-5";
726
+
610
727
  export declare const LOINC_GOALS_SECTION = "61146-7";
611
728
 
612
729
  export declare const LOINC_HEALTH_CONCERNS_SECTION = "75310-3";
613
730
 
731
+ export declare const LOINC_HISTORY_OF_OCCUPATION = "11341-5";
732
+
733
+ export declare const LOINC_HISTORY_OF_OCCUPATION_INDUSTRY = "86188-0";
734
+
735
+ export declare const LOINC_HISTORY_OF_SOCIAL_FUNCTION = "8689-2";
736
+
614
737
  export declare const LOINC_HISTORY_OF_TOBACCO_USE = "11367-0";
615
738
 
616
739
  export declare const LOINC_IMMUNIZATIONS_SECTION = "11369-6";
@@ -633,6 +756,8 @@ export declare const LOINC_PATIENT_SUMMARY_DOCUMENT = "60591-5";
633
756
 
634
757
  export declare const LOINC_PLAN_OF_TREATMENT_SECTION = "18776-5";
635
758
 
759
+ export declare const LOINC_PREGNANCY_STATUS = "82810-3";
760
+
636
761
  export declare const LOINC_PROBLEMS_SECTION = "11450-4";
637
762
 
638
763
  export declare const LOINC_PROCEDURES_SECTION = "47519-4";
@@ -651,8 +776,17 @@ export declare const LOINC_TO_TEMPLATE_IDS: Record<string, CcdaTemplateId[]>;
651
776
 
652
777
  export declare const LOINC_TOBACCO_SMOKING_STATUS = "72166-2";
653
778
 
779
+ export declare const LOINC_TRIBAL_AFFILIATION = "95370-3";
780
+
654
781
  export declare const LOINC_VITAL_SIGNS_SECTION = "8716-3";
655
782
 
783
+ /**
784
+ * Maps a C-CDA code to a FHIR CodeableConcept.
785
+ * @param ccdaCode - The C-CDA code to map.
786
+ * @returns The FHIR CodeableConcept.
787
+ */
788
+ export declare function mapCcdaCodeToCodeableConcept(ccdaCode: CcdaCode | undefined): CodeableConcept | undefined;
789
+
656
790
  /**
657
791
  * Map the C-CDA system to the FHIR system.
658
792
  * @param ccda - The C-CDA system to map.
@@ -695,6 +829,8 @@ export declare function mapCodeableConceptToCcdaValue(codeableConcept: CodeableC
695
829
  */
696
830
  export declare function mapCodingToCcdaCode(coding: Coding): CcdaCode;
697
831
 
832
+ export declare function mapFhirPeriodOrDateTimeToCcda(period: Period | undefined, dateTime: string | undefined): CcdaEffectiveTime;
833
+
698
834
  /**
699
835
  * Map the FHIR system to the C-CDA system.
700
836
  * @param system - The system to map.
@@ -748,7 +884,7 @@ export declare const PROBLEM_STATUS_MAPPER: EnumMapper<string, string>;
748
884
 
749
885
  export declare const PROBLEMS_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
750
886
 
751
- export declare const PROCEDURE_STATUS_MAPPER: EnumMapper<"completed" | "unknown" | "not-done" | "stopped", "completed" | "aborted" | "cancelled" | "unknown" | "new">;
887
+ export declare const PROCEDURE_STATUS_MAPPER: EnumMapper<"active" | "completed" | "unknown" | "not-done" | "stopped", "active" | "completed" | "aborted" | "cancelled" | "unknown" | "new">;
752
888
 
753
889
  export declare const PROCEDURES_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
754
890
 
@@ -766,6 +902,8 @@ export declare const REFERRAL_TEMPLATE_IDS: ({
766
902
 
767
903
  export declare const RESULTS_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
768
904
 
905
+ export declare const ROLE_CODE_CODE_SYSTEM = "http://terminology.hl7.org/CodeSystem/v3-RoleCode";
906
+
769
907
  export declare const SOCIAL_HISTORY_SECTION_TEMPLATE_IDS: CcdaTemplateId[];
770
908
 
771
909
  export declare const SYSTEM_MAPPER: EnumMapper<string, string>;