gdc-common-utils-ts 2.3.9 → 2.3.11

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.
@@ -110,6 +110,20 @@ export declare class ClinicalResourceEntryEditor extends BundleEntryEditor {
110
110
  setLanguage(value?: string | null): this;
111
111
  /** Returns the generic `<ResourceType>.language` flat claim when present. */
112
112
  getLanguage(): string | undefined;
113
+ /**
114
+ * Assigns the resource to one or more Composition sections.
115
+ *
116
+ * Section placement is document structure, not the resource's clinical
117
+ * category. `BundleEditor.buildDocument()` consumes this
118
+ * `<ResourceType>.section` claim to create `Composition.section.entry`
119
+ * references without overloading fields such as
120
+ * `AllergyIntolerance.category`.
121
+ */
122
+ setSectionList(sectionCodes: readonly string[]): this;
123
+ /** Returns the explicit Composition section codes staged for this resource. */
124
+ getSectionList(): string[];
125
+ /** Adds one Composition section code while preserving existing assignments. */
126
+ addSection(sectionCode: string): this;
113
127
  /** Stores the generic `<ResourceType>.user-selected` flag used by self-managed user flows. */
114
128
  setUserSelected(value?: boolean | null): this;
115
129
  /** Returns the generic `<ResourceType>.user-selected` flag when present. */
@@ -279,6 +279,29 @@ export class ClinicalResourceEntryEditor extends BundleEntryEditor {
279
279
  getLanguage() {
280
280
  return this.getScalarClaim(this.getResourceScopedClaimKey('language'));
281
281
  }
282
+ /**
283
+ * Assigns the resource to one or more Composition sections.
284
+ *
285
+ * Section placement is document structure, not the resource's clinical
286
+ * category. `BundleEditor.buildDocument()` consumes this
287
+ * `<ResourceType>.section` claim to create `Composition.section.entry`
288
+ * references without overloading fields such as
289
+ * `AllergyIntolerance.category`.
290
+ */
291
+ setSectionList(sectionCodes) {
292
+ return this.setCsvClaimList(this.getResourceScopedClaimKey('section'), sectionCodes);
293
+ }
294
+ /** Returns the explicit Composition section codes staged for this resource. */
295
+ getSectionList() {
296
+ return this.getCsvClaimList(this.getResourceScopedClaimKey('section'));
297
+ }
298
+ /** Adds one Composition section code while preserving existing assignments. */
299
+ addSection(sectionCode) {
300
+ const normalized = String(sectionCode || '').trim();
301
+ return normalized
302
+ ? this.setSectionList([...new Set([...this.getSectionList(), normalized])])
303
+ : this;
304
+ }
282
305
  /** Stores the generic `<ResourceType>.user-selected` flag used by self-managed user flows. */
283
306
  setUserSelected(value) {
284
307
  return this.setBooleanClaim(this.getResourceScopedClaimKey('user-selected'), value);
@@ -118,9 +118,10 @@ export declare function toClinicalResourceExpandedViews(bundle: ClinicalResource
118
118
  *
119
119
  * The Composition is authoritative for grouping. Resource type is deliberately
120
120
  * not used to guess a section because Observation and supporting resources can
121
- * be referenced from several IPS sections.
121
+ * be referenced from several IPS sections. Display options are propagated to
122
+ * every generated card.
122
123
  */
123
- export declare function toClinicalSectionViews(bundle: ClinicalResourceBundleLike): ClinicalSectionView[];
124
+ export declare function toClinicalSectionViews(bundle: ClinicalResourceBundleLike, options?: ClinicalResourceDisplayOptions): ClinicalSectionView[];
124
125
  /**
125
126
  * Returns the most useful local text plus international display pair that can
126
127
  * be inferred from one FHIR-like resource and its `meta.claims`.
@@ -78,9 +78,10 @@ export function toClinicalResourceExpandedViews(bundle) {
78
78
  *
79
79
  * The Composition is authoritative for grouping. Resource type is deliberately
80
80
  * not used to guess a section because Observation and supporting resources can
81
- * be referenced from several IPS sections.
81
+ * be referenced from several IPS sections. Display options are propagated to
82
+ * every generated card.
82
83
  */
83
- export function toClinicalSectionViews(bundle) {
84
+ export function toClinicalSectionViews(bundle, options = {}) {
84
85
  const entries = readBundleEntries(bundle);
85
86
  const composition = entries.find((entry) => entry.resource?.resourceType === ResourceTypesFhirR4.Composition);
86
87
  if (!composition?.resource) {
@@ -113,7 +114,7 @@ export function toClinicalSectionViews(bundle) {
113
114
  ...(resolveCodeableConceptLabel(section.emptyReason)
114
115
  ? { emptyReason: resolveCodeableConceptLabel(section.emptyReason) }
115
116
  : {}),
116
- resources: resolvedEntries.map((entry) => toClinicalResourceCardView(entry)),
117
+ resources: resolvedEntries.map((entry) => toClinicalResourceCardView(entry, options)),
117
118
  unresolvedReferences,
118
119
  };
119
120
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdc-common-utils-ts",
3
- "version": "2.3.9",
3
+ "version": "2.3.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },