@imranq2/fhirpatientsummary 1.0.16 → 1.0.18

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/index.d.cts CHANGED
@@ -630,37 +630,101 @@ type TBundle = {
630
630
  signature?: TSignature;
631
631
  };
632
632
 
633
+ type TCompositionAttester = {
634
+ id?: string;
635
+ extension?: TExtension[];
636
+ modifierExtension?: TExtension[];
637
+ mode: string;
638
+ time?: TDateTime;
639
+ party?: TReference;
640
+ };
641
+
642
+ type TCompositionRelatesTo = {
643
+ id?: string;
644
+ extension?: TExtension[];
645
+ modifierExtension?: TExtension[];
646
+ code: string;
647
+ targetIdentifier?: TIdentifier;
648
+ targetReference?: TReference;
649
+ };
650
+
651
+ type TCompositionEvent = {
652
+ id?: string;
653
+ extension?: TExtension[];
654
+ modifierExtension?: TExtension[];
655
+ code?: TCodeableConcept[];
656
+ period?: TPeriod;
657
+ detail?: TReference[];
658
+ };
659
+
660
+ type TComposition = {
661
+ resourceType?: string;
662
+ id?: string;
663
+ meta?: TMeta;
664
+ implicitRules?: TUri;
665
+ language?: string;
666
+ text?: TNarrative;
667
+ contained?: TResourceContainer[];
668
+ extension?: TExtension[];
669
+ modifierExtension?: TExtension[];
670
+ identifier?: TIdentifier;
671
+ status: string;
672
+ type: TCodeableConcept;
673
+ category?: TCodeableConcept[];
674
+ subject?: TReference;
675
+ encounter?: TReference;
676
+ date: TDateTime;
677
+ author: TReference[];
678
+ title: string;
679
+ confidentiality?: string;
680
+ attester?: TCompositionAttester[];
681
+ custodian?: TReference;
682
+ relatesTo?: TCompositionRelatesTo[];
683
+ event?: TCompositionEvent[];
684
+ section?: TCompositionSection[];
685
+ };
686
+
633
687
  declare class ComprehensiveIPSCompositionBuilder {
634
- private patient;
688
+ private patients;
635
689
  private sections;
636
690
  private resources;
637
691
  /**
638
692
  * sets the patient resource for the IPS Composition.
639
693
  * This is not needed if you are calling read_bundle, but can be used to set the patient resource directly.
640
- * @param patient - FHIR Patient resource to set
694
+ * @param patients - FHIR Patient resource to set
641
695
  */
642
- setPatient(patient: TPatient): this;
696
+ setPatient(patients: TPatient | TPatient[]): this;
643
697
  /**
644
698
  * Adds a section to the composition with async HTML minification
699
+ * @param narrative - Narrative content for the section
700
+ * @param sectionType - IPS section type
701
+ * @param validResources - Array of domain resources
702
+ */
703
+ addSectionAsync<T extends TDomainResource>(narrative: TNarrative, sectionType: IPSSections, validResources: T[]): this;
704
+ /**
705
+ * Make and adds a section to the composition with async HTML minification
645
706
  * @param sectionType - IPS section type
646
707
  * @param validResources - Array of domain resources
647
708
  * @param timezone - Optional timezone to use for date formatting
648
709
  */
649
- addSectionAsync<T extends TDomainResource>(sectionType: IPSSections, validResources: T[], timezone: string | undefined): Promise<this>;
710
+ makeSectionAsync<T extends TDomainResource>(sectionType: IPSSections, validResources: T[], timezone: string | undefined): Promise<this>;
711
+ makeSectionFromSummaryAsync(sectionType: IPSSections, summaryCompositions: TComposition[], resources: TDomainResource[], timezone: string | undefined): Promise<this>;
650
712
  /**
651
713
  * Reads a FHIR Bundle and extracts resources for each section defined in IPSSections.
652
714
  * @param bundle - FHIR Bundle containing resources
653
715
  * @param timezone - Optional timezone to use for date formatting
716
+ * @param useSummaryCompositions - Whether to use summary compositions (default: false)
654
717
  */
655
- readBundleAsync(bundle: TBundle, timezone: string | undefined): Promise<this>;
718
+ readBundleAsync(bundle: TBundle, timezone: string | undefined, useSummaryCompositions?: boolean): Promise<this>;
656
719
  /**
657
720
  * Builds a complete FHIR Bundle containing the Composition and all resources.
658
721
  * @param authorOrganizationId - ID of the authoring organization (e.g., hospital or clinic)
659
722
  * @param authorOrganizationName - Name of the authoring organization
660
723
  * @param baseUrl - Base URL for the FHIR server (e.g., 'https://example.com/fhir')
661
724
  * @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
725
+ * @param patientId - Optional patient ID to use as primary patient for composition reference
662
726
  */
663
- buildBundleAsync(authorOrganizationId: string, authorOrganizationName: string, baseUrl: string, timezone: string | undefined): Promise<TBundle>;
727
+ buildBundleAsync(authorOrganizationId: string, authorOrganizationName: string, baseUrl: string, timezone: string | undefined, patientId?: string): Promise<TBundle>;
664
728
  /**
665
729
  * Returns the Composition sections without creating a full bundle.
666
730
  * @returns Array of TCompositionSection
@@ -682,9 +746,10 @@ declare class NarrativeGenerator {
682
746
  * @param section - IPS section type
683
747
  * @param resources - Array of domain resources
684
748
  * @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
749
+ * @param useSectionSummary - Whether to use section summary for narrative generation (default: false)
685
750
  * @returns Generated HTML content or undefined if no resources
686
751
  */
687
- static generateNarrativeContentAsync<T extends TDomainResource>(section: IPSSections, resources: T[], timezone: string | undefined): Promise<string | undefined>;
752
+ static generateNarrativeContentAsync<T extends TDomainResource>(section: IPSSections, resources: T[], timezone: string | undefined, useSectionSummary?: boolean): Promise<string | undefined>;
688
753
  /**
689
754
  * Minifies HTML content asynchronously using html-minifier-terser
690
755
  * @param html - HTML content to minify
@@ -705,9 +770,10 @@ declare class NarrativeGenerator {
705
770
  * @param resources - Array of domain resources
706
771
  * @param timezone - Optional timezone to use for date formatting
707
772
  * @param minify - Whether to minify the HTML content (default: true)
773
+ * @param useSectionSummary - Whether to use section summary for narrative generation (default: false)
708
774
  * @returns Promise that resolves to a FHIR Narrative object or undefined if no resources
709
775
  */
710
- static generateNarrativeAsync<T extends TDomainResource>(section: IPSSections, resources: T[], timezone: string | undefined, minify?: boolean): Promise<Narrative | undefined>;
776
+ static generateNarrativeAsync<T extends TDomainResource>(section: IPSSections, resources: T[], timezone: string | undefined, minify?: boolean, useSectionSummary?: boolean): Promise<Narrative | undefined>;
711
777
  }
712
778
 
713
779
  declare const myPackage: (taco?: string) => string;
package/dist/index.d.ts CHANGED
@@ -630,37 +630,101 @@ type TBundle = {
630
630
  signature?: TSignature;
631
631
  };
632
632
 
633
+ type TCompositionAttester = {
634
+ id?: string;
635
+ extension?: TExtension[];
636
+ modifierExtension?: TExtension[];
637
+ mode: string;
638
+ time?: TDateTime;
639
+ party?: TReference;
640
+ };
641
+
642
+ type TCompositionRelatesTo = {
643
+ id?: string;
644
+ extension?: TExtension[];
645
+ modifierExtension?: TExtension[];
646
+ code: string;
647
+ targetIdentifier?: TIdentifier;
648
+ targetReference?: TReference;
649
+ };
650
+
651
+ type TCompositionEvent = {
652
+ id?: string;
653
+ extension?: TExtension[];
654
+ modifierExtension?: TExtension[];
655
+ code?: TCodeableConcept[];
656
+ period?: TPeriod;
657
+ detail?: TReference[];
658
+ };
659
+
660
+ type TComposition = {
661
+ resourceType?: string;
662
+ id?: string;
663
+ meta?: TMeta;
664
+ implicitRules?: TUri;
665
+ language?: string;
666
+ text?: TNarrative;
667
+ contained?: TResourceContainer[];
668
+ extension?: TExtension[];
669
+ modifierExtension?: TExtension[];
670
+ identifier?: TIdentifier;
671
+ status: string;
672
+ type: TCodeableConcept;
673
+ category?: TCodeableConcept[];
674
+ subject?: TReference;
675
+ encounter?: TReference;
676
+ date: TDateTime;
677
+ author: TReference[];
678
+ title: string;
679
+ confidentiality?: string;
680
+ attester?: TCompositionAttester[];
681
+ custodian?: TReference;
682
+ relatesTo?: TCompositionRelatesTo[];
683
+ event?: TCompositionEvent[];
684
+ section?: TCompositionSection[];
685
+ };
686
+
633
687
  declare class ComprehensiveIPSCompositionBuilder {
634
- private patient;
688
+ private patients;
635
689
  private sections;
636
690
  private resources;
637
691
  /**
638
692
  * sets the patient resource for the IPS Composition.
639
693
  * This is not needed if you are calling read_bundle, but can be used to set the patient resource directly.
640
- * @param patient - FHIR Patient resource to set
694
+ * @param patients - FHIR Patient resource to set
641
695
  */
642
- setPatient(patient: TPatient): this;
696
+ setPatient(patients: TPatient | TPatient[]): this;
643
697
  /**
644
698
  * Adds a section to the composition with async HTML minification
699
+ * @param narrative - Narrative content for the section
700
+ * @param sectionType - IPS section type
701
+ * @param validResources - Array of domain resources
702
+ */
703
+ addSectionAsync<T extends TDomainResource>(narrative: TNarrative, sectionType: IPSSections, validResources: T[]): this;
704
+ /**
705
+ * Make and adds a section to the composition with async HTML minification
645
706
  * @param sectionType - IPS section type
646
707
  * @param validResources - Array of domain resources
647
708
  * @param timezone - Optional timezone to use for date formatting
648
709
  */
649
- addSectionAsync<T extends TDomainResource>(sectionType: IPSSections, validResources: T[], timezone: string | undefined): Promise<this>;
710
+ makeSectionAsync<T extends TDomainResource>(sectionType: IPSSections, validResources: T[], timezone: string | undefined): Promise<this>;
711
+ makeSectionFromSummaryAsync(sectionType: IPSSections, summaryCompositions: TComposition[], resources: TDomainResource[], timezone: string | undefined): Promise<this>;
650
712
  /**
651
713
  * Reads a FHIR Bundle and extracts resources for each section defined in IPSSections.
652
714
  * @param bundle - FHIR Bundle containing resources
653
715
  * @param timezone - Optional timezone to use for date formatting
716
+ * @param useSummaryCompositions - Whether to use summary compositions (default: false)
654
717
  */
655
- readBundleAsync(bundle: TBundle, timezone: string | undefined): Promise<this>;
718
+ readBundleAsync(bundle: TBundle, timezone: string | undefined, useSummaryCompositions?: boolean): Promise<this>;
656
719
  /**
657
720
  * Builds a complete FHIR Bundle containing the Composition and all resources.
658
721
  * @param authorOrganizationId - ID of the authoring organization (e.g., hospital or clinic)
659
722
  * @param authorOrganizationName - Name of the authoring organization
660
723
  * @param baseUrl - Base URL for the FHIR server (e.g., 'https://example.com/fhir')
661
724
  * @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
725
+ * @param patientId - Optional patient ID to use as primary patient for composition reference
662
726
  */
663
- buildBundleAsync(authorOrganizationId: string, authorOrganizationName: string, baseUrl: string, timezone: string | undefined): Promise<TBundle>;
727
+ buildBundleAsync(authorOrganizationId: string, authorOrganizationName: string, baseUrl: string, timezone: string | undefined, patientId?: string): Promise<TBundle>;
664
728
  /**
665
729
  * Returns the Composition sections without creating a full bundle.
666
730
  * @returns Array of TCompositionSection
@@ -682,9 +746,10 @@ declare class NarrativeGenerator {
682
746
  * @param section - IPS section type
683
747
  * @param resources - Array of domain resources
684
748
  * @param timezone - Optional timezone to use for date formatting (e.g., 'America/New_York', 'Europe/London')
749
+ * @param useSectionSummary - Whether to use section summary for narrative generation (default: false)
685
750
  * @returns Generated HTML content or undefined if no resources
686
751
  */
687
- static generateNarrativeContentAsync<T extends TDomainResource>(section: IPSSections, resources: T[], timezone: string | undefined): Promise<string | undefined>;
752
+ static generateNarrativeContentAsync<T extends TDomainResource>(section: IPSSections, resources: T[], timezone: string | undefined, useSectionSummary?: boolean): Promise<string | undefined>;
688
753
  /**
689
754
  * Minifies HTML content asynchronously using html-minifier-terser
690
755
  * @param html - HTML content to minify
@@ -705,9 +770,10 @@ declare class NarrativeGenerator {
705
770
  * @param resources - Array of domain resources
706
771
  * @param timezone - Optional timezone to use for date formatting
707
772
  * @param minify - Whether to minify the HTML content (default: true)
773
+ * @param useSectionSummary - Whether to use section summary for narrative generation (default: false)
708
774
  * @returns Promise that resolves to a FHIR Narrative object or undefined if no resources
709
775
  */
710
- static generateNarrativeAsync<T extends TDomainResource>(section: IPSSections, resources: T[], timezone: string | undefined, minify?: boolean): Promise<Narrative | undefined>;
776
+ static generateNarrativeAsync<T extends TDomainResource>(section: IPSSections, resources: T[], timezone: string | undefined, minify?: boolean, useSectionSummary?: boolean): Promise<Narrative | undefined>;
711
777
  }
712
778
 
713
779
  declare const myPackage: (taco?: string) => string;