gdc-common-utils-ts 2.3.26 → 2.3.28

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 (58) hide show
  1. package/README.md +5 -0
  2. package/dist/claims/claims-helpers-related-person.js +0 -1
  3. package/dist/convert/convert-care-plan.js +25 -1
  4. package/dist/convert/convert-condition.js +12 -0
  5. package/dist/convert/convert-consent.js +59 -13
  6. package/dist/convert/convert-device-use-statement.js +3 -1
  7. package/dist/convert/convert-immunization.js +12 -2
  8. package/dist/convert/convert-medication-statement.js +35 -1
  9. package/dist/convert/convert-observation.js +43 -2
  10. package/dist/convert/convert-practitioner-role.d.ts +1 -1
  11. package/dist/convert/convert-practitioner-role.js +41 -13
  12. package/dist/convert/convert-shared.js +1 -1
  13. package/dist/examples/communication-didcomm-payload.d.ts +2 -2
  14. package/dist/examples/related-person.d.ts +9 -9
  15. package/dist/models/consent-rule.d.ts +8 -1
  16. package/dist/models/consent-rule.js +8 -1
  17. package/dist/models/indexing.d.ts +5 -5
  18. package/dist/models/interoperable-claims/appointment-claims.d.ts +57 -57
  19. package/dist/models/interoperable-claims/appointment-claims.js +31 -32
  20. package/dist/models/interoperable-claims/appointment-response-claims.d.ts +11 -11
  21. package/dist/models/interoperable-claims/appointment-response-claims.js +11 -11
  22. package/dist/models/interoperable-claims/care-plan-claims.d.ts +11 -0
  23. package/dist/models/interoperable-claims/care-plan-claims.js +11 -0
  24. package/dist/models/interoperable-claims/clinical-impression-claims.d.ts +1 -1
  25. package/dist/models/interoperable-claims/clinical-impression-claims.js +1 -1
  26. package/dist/models/interoperable-claims/condition-claims.d.ts +2 -0
  27. package/dist/models/interoperable-claims/condition-claims.js +2 -0
  28. package/dist/models/interoperable-claims/device-use-statement-claims.d.ts +3 -2
  29. package/dist/models/interoperable-claims/device-use-statement-claims.js +3 -2
  30. package/dist/models/interoperable-claims/document-reference-claims.d.ts +1 -1
  31. package/dist/models/interoperable-claims/document-reference-claims.js +1 -1
  32. package/dist/models/interoperable-claims/immunization-claims.d.ts +4 -0
  33. package/dist/models/interoperable-claims/immunization-claims.js +4 -0
  34. package/dist/models/interoperable-claims/medication-statement-claims.d.ts +6 -0
  35. package/dist/models/interoperable-claims/medication-statement-claims.js +6 -0
  36. package/dist/models/interoperable-claims/observation-claims.d.ts +12 -4
  37. package/dist/models/interoperable-claims/observation-claims.js +10 -2
  38. package/dist/models/interoperable-claims/practitioner-role-claims.d.ts +9 -0
  39. package/dist/models/interoperable-claims/practitioner-role-claims.js +9 -0
  40. package/dist/models/interoperable-claims/related-person-claims.d.ts +3 -2
  41. package/dist/models/interoperable-claims/related-person-claims.js +3 -2
  42. package/dist/models/params.d.ts +1 -1
  43. package/dist/utils/bundle-document-builder.js +37 -16
  44. package/dist/utils/bundle-entry-editor.d.ts +13 -0
  45. package/dist/utils/bundle-entry-editor.js +18 -0
  46. package/dist/utils/clinical-resource-converters.js +6 -4
  47. package/dist/utils/clinical-resource-view.d.ts +55 -0
  48. package/dist/utils/clinical-resource-view.js +137 -1
  49. package/dist/utils/communication-bundle-document-request.js +1 -1
  50. package/dist/utils/communication-fhir-r4.js +1 -1
  51. package/dist/utils/fhir-api-claim-helpers.d.ts +2 -0
  52. package/dist/utils/fhir-api-claim-helpers.js +16 -0
  53. package/dist/utils/ips-bundle-claims.d.ts +3 -4
  54. package/dist/utils/ips-bundle-claims.js +7 -7
  55. package/dist/utils/medication-statement-entry-editor.js +10 -10
  56. package/dist/utils/observation-component-entry-editor.d.ts +2 -2
  57. package/dist/utils/observation-component-entry-editor.js +2 -2
  58. package/package.json +1 -1
@@ -17,10 +17,9 @@ export type FhirMetaTagCoding = Readonly<{
17
17
  display?: string;
18
18
  }>;
19
19
  /**
20
- * Removes the versioned/contextualized FHIR prefix from a flattened claim key.
20
+ * Removes the version-independent FHIR API context from a flattened claim key.
21
21
  *
22
22
  * Examples:
23
- * - `org.hl7.fhir.r4.Immunization.vaccine-code` -> `Immunization.vaccine-code`
24
23
  * - `org.hl7.fhir.api.MedicationStatement.subject` -> `MedicationStatement.subject`
25
24
  * - `Consent.identifier` -> `Consent.identifier`
26
25
  */
@@ -35,8 +34,8 @@ export declare function extractResourceMetaClaimsFromBundle(bundle: BundleLike):
35
34
  /**
36
35
  * Builds FHIR `meta.tag[]` codings from a flat claims record.
37
36
  *
38
- * The generated `code` is version-agnostic so UI/frontends can use the same
39
- * tag keys across `org.hl7.fhir.r4.*` and `org.hl7.fhir.api.*` payloads.
37
+ * The generated `code` removes the sole valid FHIR claims context,
38
+ * `org.hl7.fhir.api`, so UI/frontends receive the canonical short key.
40
39
  */
41
40
  export declare function createFhirMetaTagsFromClaims(claims: Record<string, unknown>, options?: Readonly<{
42
41
  system?: string;
@@ -1,10 +1,9 @@
1
1
  // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
2
  export const DEFAULT_META_CLAIM_TAG_SYSTEM = 'urn:gdc:fhir:meta-claim';
3
3
  /**
4
- * Removes the versioned/contextualized FHIR prefix from a flattened claim key.
4
+ * Removes the version-independent FHIR API context from a flattened claim key.
5
5
  *
6
6
  * Examples:
7
- * - `org.hl7.fhir.r4.Immunization.vaccine-code` -> `Immunization.vaccine-code`
8
7
  * - `org.hl7.fhir.api.MedicationStatement.subject` -> `MedicationStatement.subject`
9
8
  * - `Consent.identifier` -> `Consent.identifier`
10
9
  */
@@ -12,9 +11,10 @@ export function toVersionAgnosticMetaClaimKey(claimKey) {
12
11
  const raw = String(claimKey || '').trim();
13
12
  if (!raw)
14
13
  return '';
15
- return raw
16
- .replace(/^org\.hl7\.fhir\.[a-z0-9]+\./i, '')
17
- .replace(/^org\.hl7\.fhir\.api\./i, '');
14
+ if (raw.startsWith('org.hl7.fhir.') && !raw.startsWith('org.hl7.fhir.api.')) {
15
+ throw new Error('FHIR claims require @context org.hl7.fhir.api.');
16
+ }
17
+ return raw.replace(/^org\.hl7\.fhir\.api\./i, '');
18
18
  }
19
19
  /**
20
20
  * Extracts all `resource.meta.claims` blocks from a FHIR/JSON:API bundle.
@@ -35,8 +35,8 @@ export function extractResourceMetaClaimsFromBundle(bundle) {
35
35
  /**
36
36
  * Builds FHIR `meta.tag[]` codings from a flat claims record.
37
37
  *
38
- * The generated `code` is version-agnostic so UI/frontends can use the same
39
- * tag keys across `org.hl7.fhir.r4.*` and `org.hl7.fhir.api.*` payloads.
38
+ * The generated `code` removes the sole valid FHIR claims context,
39
+ * `org.hl7.fhir.api`, so UI/frontends receive the canonical short key.
40
40
  */
41
41
  export function createFhirMetaTagsFromClaims(claims, options) {
42
42
  const system = String(options?.system || DEFAULT_META_CLAIM_TAG_SYSTEM).trim();
@@ -63,25 +63,25 @@ export class MedicationStatementEntryEditor extends ClinicalResourceEntryEditor
63
63
  /** Returns the medication category/section tags. */
64
64
  getCategoryList() { return this.getCsvClaimList(MedicationStatementClaim.Category); }
65
65
  /** Sets the numeric dose quantity value. */
66
- setDoseQuantityValue(value) { return this.setNumberClaim(MedicationStatementClaimsFhirApiExtended.DoseQuantityValue, value); }
66
+ setDoseQuantityValue(value) { return this.setNumberClaim(MedicationStatementClaim.DoseQuantityValue, value); }
67
67
  /** Returns the numeric dose quantity value. */
68
- getDoseQuantityValue() { return this.getNumberClaim(MedicationStatementClaimsFhirApiExtended.DoseQuantityValue); }
68
+ getDoseQuantityValue() { return this.getNumberClaim(MedicationStatementClaim.DoseQuantityValue); }
69
69
  /** Sets the dose quantity unit token. */
70
- setDoseQuantityUnit(value) { return this.setScalarClaim(MedicationStatementClaimsFhirApiExtended.DoseQuantityUnit, value); }
70
+ setDoseQuantityUnit(value) { return this.setScalarClaim(MedicationStatementClaim.DoseQuantityUnit, value); }
71
71
  /** Returns the dose quantity unit token. */
72
- getDoseQuantityUnit() { return this.getScalarClaim(MedicationStatementClaimsFhirApiExtended.DoseQuantityUnit); }
72
+ getDoseQuantityUnit() { return this.getScalarClaim(MedicationStatementClaim.DoseQuantityUnit); }
73
73
  /** Sets the timing frequency for structured dosage authoring. */
74
- setTimingFrequency(value) { return this.setNumberClaim(MedicationStatementClaimsFhirApiExtended.TimingFrequency, value); }
74
+ setTimingFrequency(value) { return this.setNumberClaim(MedicationStatementClaim.TimingFrequency, value); }
75
75
  /** Returns the timing frequency. */
76
- getTimingFrequency() { return this.getNumberClaim(MedicationStatementClaimsFhirApiExtended.TimingFrequency); }
76
+ getTimingFrequency() { return this.getNumberClaim(MedicationStatementClaim.TimingFrequency); }
77
77
  /** Sets the timing period for structured dosage authoring. */
78
- setTimingPeriod(value) { return this.setNumberClaim(MedicationStatementClaimsFhirApiExtended.TimingPeriod, value); }
78
+ setTimingPeriod(value) { return this.setNumberClaim(MedicationStatementClaim.TimingPeriod, value); }
79
79
  /** Returns the timing period. */
80
- getTimingPeriod() { return this.getNumberClaim(MedicationStatementClaimsFhirApiExtended.TimingPeriod); }
80
+ getTimingPeriod() { return this.getNumberClaim(MedicationStatementClaim.TimingPeriod); }
81
81
  /** Sets the timing period unit token. */
82
- setTimingPeriodUnit(value) { return this.setScalarClaim(MedicationStatementClaimsFhirApiExtended.TimingPeriodUnit, value); }
82
+ setTimingPeriodUnit(value) { return this.setScalarClaim(MedicationStatementClaim.TimingPeriodUnit, value); }
83
83
  /** Returns the timing period unit token. */
84
- getTimingPeriodUnit() { return this.getScalarClaim(MedicationStatementClaimsFhirApiExtended.TimingPeriodUnit); }
84
+ getTimingPeriodUnit() { return this.getScalarClaim(MedicationStatementClaim.TimingPeriodUnit); }
85
85
  /** Marks whether this dosage is `as needed`. */
86
86
  setDosageAsNeeded(value) { return this.setBooleanClaim(MedicationStatementClaimsFhirApiExtended.DosageAsNeeded, value); }
87
87
  /** Returns whether this dosage is `as needed`. */
@@ -6,14 +6,14 @@
6
6
  * - Move shared helpers to reusable helper/base modules instead of duplicating logic here.
7
7
  */
8
8
  import { type CodingDescriptor } from '../constants/vital-signs';
9
- import { BundleEntryEditor } from './bundle-entry-editor';
9
+ import { ClinicalResourceEntryEditor } from './clinical-resource-entry-editor';
10
10
  /**
11
11
  * Typed editor for one staged ObservationComponent resource entry.
12
12
  *
13
13
  * Keep this surface thin and claim-focused so 101 tests can teach one
14
14
  * resource at a time without exposing bundle-internal plumbing.
15
15
  */
16
- export declare class ObservationComponentEntryEditor extends BundleEntryEditor {
16
+ export declare class ObservationComponentEntryEditor extends ClinicalResourceEntryEditor {
17
17
  setCode(code: CodingDescriptor | string): this;
18
18
  getCode(): string | undefined;
19
19
  setCodeSystem(system: string): this;
@@ -1,13 +1,13 @@
1
1
  import { ObservationClaim } from '../models/interoperable-claims/observation-claims.js';
2
2
  import { normalizeOptionalIdentifier } from './bundle-editor-helpers.js';
3
- import { BundleEntryEditor } from './bundle-entry-editor.js';
3
+ import { ClinicalResourceEntryEditor } from './clinical-resource-entry-editor.js';
4
4
  /**
5
5
  * Typed editor for one staged ObservationComponent resource entry.
6
6
  *
7
7
  * Keep this surface thin and claim-focused so 101 tests can teach one
8
8
  * resource at a time without exposing bundle-internal plumbing.
9
9
  */
10
- export class ObservationComponentEntryEditor extends BundleEntryEditor {
10
+ export class ObservationComponentEntryEditor extends ClinicalResourceEntryEditor {
11
11
  setCode(code) {
12
12
  const token = typeof code === 'string' ? code.trim() : code.claim;
13
13
  this.setClaim(ObservationClaim.Code, token);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdc-common-utils-ts",
3
- "version": "2.3.26",
3
+ "version": "2.3.28",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },