gdc-common-utils-ts 2.1.0 → 2.3.0

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 (175) hide show
  1. package/README.md +22 -2
  2. package/dist/claims/claims-helpers-allergy-intolerance.d.ts +8 -0
  3. package/dist/claims/claims-helpers-allergy-intolerance.js +30 -12
  4. package/dist/claims/claims-helpers-condition.d.ts +8 -0
  5. package/dist/claims/claims-helpers-condition.js +30 -12
  6. package/dist/claims/claims-helpers-consent.d.ts +4 -0
  7. package/dist/claims/claims-helpers-consent.js +15 -1
  8. package/dist/claims/claims-helpers-diagnostic-report.d.ts +4 -0
  9. package/dist/claims/claims-helpers-diagnostic-report.js +17 -2
  10. package/dist/claims/claims-helpers-medication-statement.d.ts +10 -2
  11. package/dist/claims/claims-helpers-medication-statement.js +32 -14
  12. package/dist/constants/data-collections.js +0 -1
  13. package/dist/constants/didcomm.d.ts +22 -0
  14. package/dist/constants/didcomm.js +22 -0
  15. package/dist/constants/fhir-resource-types.d.ts +16 -0
  16. package/dist/constants/fhir-resource-types.js +7 -0
  17. package/dist/constants/healthcare.d.ts +348 -193
  18. package/dist/constants/healthcare.js +99 -37
  19. package/dist/constants/hl7-roles.d.ts +38 -4
  20. package/dist/constants/hl7-roles.js +92 -4
  21. package/dist/constants/index.d.ts +1 -0
  22. package/dist/constants/index.js +1 -0
  23. package/dist/constants/lifecycle.d.ts +2 -0
  24. package/dist/constants/lifecycle.js +2 -0
  25. package/dist/constants/verifiable-credentials.d.ts +9 -0
  26. package/dist/constants/verifiable-credentials.js +9 -0
  27. package/dist/examples/bundle-didcomm-payload.js +4 -2
  28. package/dist/examples/communication-attached-bundle-session.js +27 -27
  29. package/dist/examples/communication-didcomm-payload.d.ts +8 -4
  30. package/dist/examples/communication-didcomm-payload.js +17 -11
  31. package/dist/examples/consent-access.js +2 -1
  32. package/dist/examples/employee.d.ts +21 -0
  33. package/dist/examples/employee.js +21 -0
  34. package/dist/examples/individual-controller.d.ts +27 -0
  35. package/dist/examples/individual-controller.js +28 -1
  36. package/dist/examples/inter-tenant-access-contract.js +3 -2
  37. package/dist/examples/ips-bundle.js +17 -16
  38. package/dist/examples/lifecycle.js +13 -11
  39. package/dist/examples/profile-manager-mem.js +2 -1
  40. package/dist/examples/related-person.d.ts +14 -0
  41. package/dist/examples/related-person.js +18 -4
  42. package/dist/examples/shared.d.ts +12 -3
  43. package/dist/examples/shared.js +13 -4
  44. package/dist/examples/vital-signs.js +1 -1
  45. package/dist/examples/wallet-mem.js +4 -2
  46. package/dist/i18n/role-codes.i18n.d.ts +9 -1
  47. package/dist/i18n/role-codes.i18n.js +12 -1
  48. package/dist/models/authority-resolution.d.ts +56 -0
  49. package/dist/models/authority-resolution.js +2 -0
  50. package/dist/models/bundle-editor-types.d.ts +89 -0
  51. package/dist/models/bundle-editor-types.js +45 -0
  52. package/dist/models/bundle.d.ts +5 -0
  53. package/dist/models/communication-attached-bundle-session.d.ts +6 -4
  54. package/dist/models/communication-attached-bundle-session.js +6 -4
  55. package/dist/models/confidential-storage.d.ts +2 -1
  56. package/dist/models/consent-rule.d.ts +11 -1
  57. package/dist/models/consent-rule.js +9 -1
  58. package/dist/models/device-license.d.ts +20 -0
  59. package/dist/models/index.d.ts +2 -0
  60. package/dist/models/index.js +2 -0
  61. package/dist/models/individual-onboarding.d.ts +18 -0
  62. package/dist/models/interoperable-claims/allergy-intolerance-claims.d.ts +12 -1
  63. package/dist/models/interoperable-claims/allergy-intolerance-claims.js +12 -1
  64. package/dist/models/interoperable-claims/condition-claims.d.ts +12 -1
  65. package/dist/models/interoperable-claims/condition-claims.js +12 -1
  66. package/dist/models/interoperable-claims/diagnostic-report-claims.d.ts +13 -2
  67. package/dist/models/interoperable-claims/diagnostic-report-claims.js +12 -1
  68. package/dist/models/interoperable-claims/document-reference-claims.d.ts +1 -0
  69. package/dist/models/interoperable-claims/document-reference-claims.js +3 -0
  70. package/dist/models/interoperable-claims/medication-statement-claims.d.ts +17 -0
  71. package/dist/models/interoperable-claims/medication-statement-claims.js +17 -0
  72. package/dist/models/interoperable-claims/related-person-claims.d.ts +13 -0
  73. package/dist/models/interoperable-claims/related-person-claims.js +16 -0
  74. package/dist/utils/allergy-intolerance-entry-editor.d.ts +51 -0
  75. package/dist/utils/allergy-intolerance-entry-editor.js +55 -0
  76. package/dist/utils/authority-resolution.d.ts +37 -0
  77. package/dist/utils/authority-resolution.js +112 -0
  78. package/dist/utils/backend-message-manager-mem.d.ts +11 -0
  79. package/dist/utils/backend-message-manager-mem.js +11 -0
  80. package/dist/utils/bundle-didcomm-payload.js +3 -2
  81. package/dist/utils/bundle-document-builder.d.ts +36 -0
  82. package/dist/utils/bundle-document-builder.js +310 -14
  83. package/dist/utils/bundle-editor-core.d.ts +181 -0
  84. package/dist/utils/bundle-editor-core.js +467 -0
  85. package/dist/utils/bundle-editor-helpers.d.ts +53 -0
  86. package/dist/utils/bundle-editor-helpers.js +146 -0
  87. package/dist/utils/bundle-editor-registry.d.ts +6 -0
  88. package/dist/utils/bundle-editor-registry.js +14 -0
  89. package/dist/utils/bundle-editor.d.ts +21 -722
  90. package/dist/utils/bundle-editor.js +21 -1601
  91. package/dist/utils/bundle-entry-editor.d.ts +96 -0
  92. package/dist/utils/bundle-entry-editor.js +305 -0
  93. package/dist/utils/bundle-query.d.ts +1 -0
  94. package/dist/utils/bundle-query.js +12 -3
  95. package/dist/utils/bundle-reader.d.ts +48 -0
  96. package/dist/utils/bundle-reader.js +175 -1
  97. package/dist/utils/care-plan-entry-editor.d.ts +43 -0
  98. package/dist/utils/care-plan-entry-editor.js +47 -0
  99. package/dist/utils/client-assertion.d.ts +38 -0
  100. package/dist/utils/client-assertion.js +113 -0
  101. package/dist/utils/clinical-impression-entry-editor.d.ts +43 -0
  102. package/dist/utils/clinical-impression-entry-editor.js +47 -0
  103. package/dist/utils/clinical-resource-entry-editor.d.ts +123 -0
  104. package/dist/utils/clinical-resource-entry-editor.js +296 -0
  105. package/dist/utils/clinical-resource-view.d.ts +16 -0
  106. package/dist/utils/clinical-resource-view.js +267 -33
  107. package/dist/utils/communication-attached-bundle-session-helpers.js +8 -6
  108. package/dist/utils/communication-attached-bundle-session.d.ts +29 -3
  109. package/dist/utils/communication-attached-bundle-session.js +62 -3
  110. package/dist/utils/communication-consent-access-editor.d.ts +8 -4
  111. package/dist/utils/communication-consent-access-editor.js +8 -4
  112. package/dist/utils/communication-didcomm-payload.d.ts +5 -0
  113. package/dist/utils/communication-didcomm-payload.js +28 -18
  114. package/dist/utils/communication-document-reference.d.ts +23 -0
  115. package/dist/utils/communication-document-reference.js +89 -0
  116. package/dist/utils/communication-editor.d.ts +53 -0
  117. package/dist/utils/communication-editor.js +97 -0
  118. package/dist/utils/condition-entry-editor.d.ts +30 -0
  119. package/dist/utils/condition-entry-editor.js +34 -0
  120. package/dist/utils/consent-claim-helpers.d.ts +4 -0
  121. package/dist/utils/consent-claim-helpers.js +15 -1
  122. package/dist/utils/consent-duplicate-rules.js +1 -1
  123. package/dist/utils/coverage-entry-editor.d.ts +51 -0
  124. package/dist/utils/coverage-entry-editor.js +55 -0
  125. package/dist/utils/device-entry-editor.d.ts +59 -0
  126. package/dist/utils/device-entry-editor.js +63 -0
  127. package/dist/utils/device-use-statement-entry-editor.d.ts +43 -0
  128. package/dist/utils/device-use-statement-entry-editor.js +47 -0
  129. package/dist/utils/diagnostic-report-entry-editor.d.ts +74 -0
  130. package/dist/utils/diagnostic-report-entry-editor.js +136 -0
  131. package/dist/utils/did.d.ts +8 -0
  132. package/dist/utils/did.js +22 -0
  133. package/dist/utils/document-reference-entry-editor.d.ts +62 -0
  134. package/dist/utils/document-reference-entry-editor.js +66 -0
  135. package/dist/utils/employee-entry-editor.d.ts +36 -0
  136. package/dist/utils/employee-entry-editor.js +88 -0
  137. package/dist/utils/employee.d.ts +1 -0
  138. package/dist/utils/employee.js +2 -1
  139. package/dist/utils/encounter-entry-editor.d.ts +51 -0
  140. package/dist/utils/encounter-entry-editor.js +55 -0
  141. package/dist/utils/flag-entry-editor.d.ts +47 -0
  142. package/dist/utils/flag-entry-editor.js +51 -0
  143. package/dist/utils/immunization-entry-editor.d.ts +87 -0
  144. package/dist/utils/immunization-entry-editor.js +169 -0
  145. package/dist/utils/index.d.ts +7 -0
  146. package/dist/utils/index.js +7 -0
  147. package/dist/utils/individual-onboarding-acceptance-credential.d.ts +35 -0
  148. package/dist/utils/individual-onboarding-acceptance-credential.js +55 -0
  149. package/dist/utils/individual-smart.d.ts +59 -0
  150. package/dist/utils/individual-smart.js +135 -0
  151. package/dist/utils/license-list-search.d.ts +5 -0
  152. package/dist/utils/license-list-search.js +9 -0
  153. package/dist/utils/license.d.ts +45 -1
  154. package/dist/utils/license.js +86 -2
  155. package/dist/utils/medication-statement-entry-editor.d.ts +90 -0
  156. package/dist/utils/medication-statement-entry-editor.js +94 -0
  157. package/dist/utils/observation-component-entry-editor.d.ts +57 -0
  158. package/dist/utils/observation-component-entry-editor.js +105 -0
  159. package/dist/utils/observation-entry-editor.d.ts +29 -0
  160. package/dist/utils/observation-entry-editor.js +68 -0
  161. package/dist/utils/procedure-entry-editor.d.ts +71 -0
  162. package/dist/utils/procedure-entry-editor.js +75 -0
  163. package/dist/utils/professional-smart.d.ts +87 -0
  164. package/dist/utils/professional-smart.js +118 -4
  165. package/dist/utils/related-person-list.d.ts +4 -0
  166. package/dist/utils/related-person-list.js +26 -6
  167. package/dist/utils/same-as.d.ts +40 -0
  168. package/dist/utils/same-as.js +72 -0
  169. package/dist/utils/unified-health-id.d.ts +51 -0
  170. package/dist/utils/unified-health-id.js +92 -0
  171. package/dist/utils/vital-sign-day-batch.d.ts +25 -0
  172. package/dist/utils/vital-sign-day-batch.js +115 -0
  173. package/dist/utils/vital-sign-entry-editor.d.ts +61 -0
  174. package/dist/utils/vital-sign-entry-editor.js +152 -0
  175. package/package.json +2 -1
@@ -1,7 +1,8 @@
1
1
  import { LOINC_SYSTEM_URL, loincI18nKey } from '../models/clinical-sections.js';
2
2
  import { clinicalWorkbookSummaryLabelI18nEn } from '../models/clinical-workbook-summary.js';
3
- import { HL7_CODING_SYSTEM_PERSONAL_RELATIONSHIP, HL7_CODING_SYSTEM_V3_ROLE_CODE, HL7_PERSONAL_RELATIONSHIP_ROLES, HL7_V3_ROLE_CODE_LEGAL_REPRESENTATIVE, } from './hl7-roles.js';
3
+ import { HL7_CODING_SYSTEM_V3_ROLE_CODE, HL7_PERSONAL_RELATIONSHIP_ROLES, HL7_V3_ROLE_CODE_LEGAL_REPRESENTATIVE, } from './hl7-roles.js';
4
4
  import { DataspaceSectors } from './sectors.js';
5
+ import { ResourceTypesFhirR4, } from './fhir-resource-types.js';
5
6
  /**
6
7
  * Canonical logical identifiers for document types backed by the LOINC
7
8
  * ontology. These keys are stable SDK-facing names; the concrete LOINC token
@@ -63,55 +64,63 @@ function workbookLabel(code) {
63
64
  function buildWorkbookSectionCatalog(codes) {
64
65
  return Object.freeze(Object.fromEntries(codes.map((code) => [code, defineSection(code, workbookLabel(code))])));
65
66
  }
66
- export const HealthcareCoreSections = Object.freeze({
67
- PatientSummaryDocument: defineSection('60591-5', 'Patient summary document'),
67
+ const planOfCareSection = defineSection('18776-5', 'Plan of care');
68
+ const healthcareCoreSections = {
69
+ ProblemList: defineSection('11450-4', 'Problem list'),
68
70
  AllergiesAndIntolerances: defineSection('48765-2', 'Allergies and adverse reactions'),
69
- Alert: defineSection('104605-1', 'Alert'),
70
- DietAndNutrition: defineSection('61144-2', 'Diet and nutrition'),
71
71
  HistoryOfMedicationUse: defineSection('10160-0', 'History of medication use'),
72
- HistoryOfFamilyMemberDiseases: defineSection('10157-6', 'History of family member diseases'),
73
- HistoryOfHospitalizationsAndOutpatientVisits: defineSection('46240-8', 'History of hospitalizations+History of outpatient visits'),
74
- HistoryOfPastIllness: defineSection('11348-0', 'History of past illness'),
75
- HistoryOfPresentIllness: defineSection('10164-2', 'History of present illness'),
76
- PregnancyHistory: defineSection('10162-6', 'Pregnancy History'),
77
- ProblemList: defineSection('11450-4', 'Problem list'),
78
- ProblemListNarrativeReported: defineSection('57852-6', 'Problem list'),
72
+ Immunizations: defineSection('11369-6', 'History of immunization'),
79
73
  Results: defineSection('30954-2', 'Relevant diagnostic tests/laboratory data'),
80
74
  Procedures: defineSection('47519-4', 'History of Procedures'),
81
- Immunizations: defineSection('11369-6', 'History of immunization'),
82
75
  MedicalDevices: defineSection('46264-8', 'History of medical device use'),
83
- FunctionalStatus: defineSection('47420-5', 'Functional status'),
84
- GoalsAndPreferences: defineSection('81338-6', 'Goals / Preferences'),
85
- PlanOfTreatment: defineSection('18776-5', 'Plan of treatment'),
86
- /** @deprecated Use `PlanOfTreatment`. */
87
- PlanOfCare: defineSection('18776-5', 'Plan of treatment'),
88
- SocialHistory: defineSection('29762-2', 'Social history'),
89
76
  VitalSigns: defineSection('8716-3', 'Vital signs'),
77
+ SocialHistory: defineSection('29762-2', 'Social history'),
78
+ Alert: defineSection('104605-1', 'Alert'),
79
+ GoalsAndPreferences: defineSection('81338-6', 'Goals / Preferences'),
90
80
  AdvanceDirectives: defineSection('42348-3', 'Advance directives'),
81
+ FunctionalStatus: defineSection('47420-5', 'Functional status'),
82
+ HistoryOfPastIllness: defineSection('11348-0', 'History of past illness'),
83
+ PregnancyHistory: defineSection('10162-6', 'Pregnancy History'),
84
+ PlanOfCare: planOfCareSection,
85
+ DietAndNutrition: defineSection('61144-2', 'Diet and nutrition'),
86
+ HistoryOfFamilyMemberDiseases: defineSection('10157-6', 'History of family member diseases'),
87
+ HistoryOfHospitalizationsAndOutpatientVisits: defineSection('46240-8', 'History of hospitalizations+History of outpatient visits'),
88
+ HistoryOfPresentIllness: defineSection('10164-2', 'History of present illness'),
89
+ ProblemListNarrativeReported: defineSection('57852-6', 'Problem list'),
91
90
  Instructions: defineSection('69730-0', 'Instructions'),
92
- });
91
+ };
92
+ /**
93
+ * Application healthcare sections: the 16 IPS sections followed by six
94
+ * LOINC-coded extensions. Deprecated aliases remain accessible but are not
95
+ * enumerable, so section pickers and `HealthcareAllSections` do not duplicate
96
+ * the IPS document or plan-of-care entry.
97
+ */
98
+ export const HealthcareCoreSections = Object.freeze(Object.defineProperties(healthcareCoreSections, {
99
+ PatientSummaryDocument: {
100
+ value: defineSection('60591-5', 'Patient summary document'),
101
+ enumerable: false,
102
+ },
103
+ PlanOfTreatment: {
104
+ value: planOfCareSection,
105
+ enumerable: false,
106
+ },
107
+ }));
93
108
  /** @deprecated Use `HealthcareCoreSections`. */
94
109
  export const HealthcareBasicSections = HealthcareCoreSections;
95
110
  /**
96
- * IPS summary-oriented subset aligned with the official HL7 IPS all-sections
97
- * example and intended for "full patient summary / digital twin" flows.
111
+ * The 16 clinical sections from the official HL7 IPS 2.0 all-sections example.
112
+ * Order follows `Composition.section`. The `60591-5` IPS document descriptor
113
+ * is represented by `HealthcareDocumentTypes.IPS`, not as a section.
98
114
  *
99
- * It excludes the broader core sections that are outside that summary example:
100
- * - Diet and Nutrition
101
- * - History of Family Member Diseases
102
- * - History of Hospitalizations and Outpatient Visits
103
- * - History of Present Illness
104
- * - Problem List Narrative Reported
105
- * - Instructions
115
+ * @see https://hl7.org/fhir/uv/ips/STU2/Bundle-bundle-ips-all-sections.html
106
116
  */
107
117
  export const HealthcareSummarySections = Object.freeze({
108
- PatientSummaryDocument: HealthcareCoreSections.PatientSummaryDocument,
118
+ ProblemList: HealthcareCoreSections.ProblemList,
109
119
  AllergiesAndIntolerances: HealthcareCoreSections.AllergiesAndIntolerances,
110
120
  HistoryOfMedicationUse: HealthcareCoreSections.HistoryOfMedicationUse,
111
- ProblemList: HealthcareCoreSections.ProblemList,
121
+ Immunizations: HealthcareCoreSections.Immunizations,
112
122
  Results: HealthcareCoreSections.Results,
113
123
  Procedures: HealthcareCoreSections.Procedures,
114
- Immunizations: HealthcareCoreSections.Immunizations,
115
124
  MedicalDevices: HealthcareCoreSections.MedicalDevices,
116
125
  VitalSigns: HealthcareCoreSections.VitalSigns,
117
126
  SocialHistory: HealthcareCoreSections.SocialHistory,
@@ -122,8 +131,61 @@ export const HealthcareSummarySections = Object.freeze({
122
131
  HistoryOfPastIllness: HealthcareCoreSections.HistoryOfPastIllness,
123
132
  PregnancyHistory: HealthcareCoreSections.PregnancyHistory,
124
133
  PlanOfCare: HealthcareCoreSections.PlanOfCare,
125
- PlanOfTreatment: HealthcareCoreSections.PlanOfTreatment,
126
134
  });
135
+ function defineIpsSectionResourceProfile(section, requirement, expectedResourceTypes, acceptsAnyResource) {
136
+ return Object.freeze({
137
+ section,
138
+ requirement,
139
+ expectedResourceTypes: Object.freeze([...expectedResourceTypes]),
140
+ acceptsOtherSupportingResources: true,
141
+ ...(acceptsAnyResource ? { acceptsAnyResource } : {}),
142
+ });
143
+ }
144
+ /**
145
+ * Resource-profile expectations for the 16 IPS 2.0 sections.
146
+ *
147
+ * Consumers must group a document by `Composition.section.entry` references;
148
+ * they must not infer a section from `resourceType` alone because the same
149
+ * type, especially Observation, is valid in several sections.
150
+ *
151
+ * @see https://hl7.org/fhir/uv/ips/STU2/Structure-of-the-International-Patient-Summary.html
152
+ * @see https://hl7.org/fhir/uv/ips/STU2/profiles.html
153
+ */
154
+ export const HealthcareIpsSectionResourceProfiles = Object.freeze({
155
+ ProblemList: defineIpsSectionResourceProfile(HealthcareSummarySections.ProblemList, 'required', [ResourceTypesFhirR4.Condition]),
156
+ AllergiesAndIntolerances: defineIpsSectionResourceProfile(HealthcareSummarySections.AllergiesAndIntolerances, 'required', [ResourceTypesFhirR4.AllergyIntolerance]),
157
+ HistoryOfMedicationUse: defineIpsSectionResourceProfile(HealthcareSummarySections.HistoryOfMedicationUse, 'required', [
158
+ ResourceTypesFhirR4.MedicationStatement,
159
+ ResourceTypesFhirR4.MedicationRequest,
160
+ ResourceTypesFhirR4.Medication,
161
+ ]),
162
+ Immunizations: defineIpsSectionResourceProfile(HealthcareSummarySections.Immunizations, 'recommended', [ResourceTypesFhirR4.Immunization]),
163
+ Results: defineIpsSectionResourceProfile(HealthcareSummarySections.Results, 'recommended', [
164
+ ResourceTypesFhirR4.DiagnosticReport,
165
+ ResourceTypesFhirR4.Observation,
166
+ ResourceTypesFhirR4.Specimen,
167
+ ResourceTypesFhirR4.Device,
168
+ ResourceTypesFhirR4.ImagingStudy,
169
+ ]),
170
+ Procedures: defineIpsSectionResourceProfile(HealthcareSummarySections.Procedures, 'recommended', [ResourceTypesFhirR4.Procedure, ResourceTypesFhirR4.Device]),
171
+ MedicalDevices: defineIpsSectionResourceProfile(HealthcareSummarySections.MedicalDevices, 'recommended', [ResourceTypesFhirR4.DeviceUseStatement, ResourceTypesFhirR4.Device]),
172
+ VitalSigns: defineIpsSectionResourceProfile(HealthcareSummarySections.VitalSigns, 'optional', [ResourceTypesFhirR4.Observation]),
173
+ SocialHistory: defineIpsSectionResourceProfile(HealthcareSummarySections.SocialHistory, 'optional', [ResourceTypesFhirR4.Observation]),
174
+ Alert: defineIpsSectionResourceProfile(HealthcareSummarySections.Alert, 'optional', [ResourceTypesFhirR4.Flag]),
175
+ GoalsAndPreferences: defineIpsSectionResourceProfile(HealthcareSummarySections.GoalsAndPreferences, 'optional', [], true),
176
+ AdvanceDirectives: defineIpsSectionResourceProfile(HealthcareSummarySections.AdvanceDirectives, 'optional', [ResourceTypesFhirR4.Consent]),
177
+ FunctionalStatus: defineIpsSectionResourceProfile(HealthcareSummarySections.FunctionalStatus, 'optional', [ResourceTypesFhirR4.Condition, ResourceTypesFhirR4.ClinicalImpression]),
178
+ HistoryOfPastIllness: defineIpsSectionResourceProfile(HealthcareSummarySections.HistoryOfPastIllness, 'optional', [ResourceTypesFhirR4.Condition]),
179
+ PregnancyHistory: defineIpsSectionResourceProfile(HealthcareSummarySections.PregnancyHistory, 'optional', [ResourceTypesFhirR4.Observation]),
180
+ PlanOfCare: defineIpsSectionResourceProfile(HealthcareSummarySections.PlanOfCare, 'optional', [ResourceTypesFhirR4.CarePlan, ResourceTypesFhirR4.ImmunizationRecommendation]),
181
+ });
182
+ /** IPS profiles used across sections rather than owned by one section. */
183
+ export const HealthcareIpsSharedResourceTypes = Object.freeze([
184
+ ResourceTypesFhirR4.Organization,
185
+ ResourceTypesFhirR4.Practitioner,
186
+ ResourceTypesFhirR4.PractitionerRole,
187
+ ResourceTypesFhirR4.DocumentReference,
188
+ ]);
127
189
  export const HealthcareDocumentTypes = Object.freeze({
128
190
  [DocumentTypeLoincOntology.IPS]: defineDocumentType(DocumentTypeLoincOntology.IPS, '60591-5', 'International Patient Summary'),
129
191
  });
@@ -413,10 +475,10 @@ function buildPersonalRelationshipRoles() {
413
475
  item.code,
414
476
  Object.freeze({
415
477
  family: HealthcareRoleFamilies.PersonalRelationshipHl7,
416
- codingSystem: HL7_CODING_SYSTEM_PERSONAL_RELATIONSHIP,
478
+ codingSystem: HL7_CODING_SYSTEM_V3_ROLE_CODE,
417
479
  code: item.code,
418
- claim: `v3-PersonalRelationshipRoleType|${item.code}`,
419
- i18nKey: `org.hl7.v3.personalRelationship.${item.code}`,
480
+ claim: `v3-RoleCode|${item.code}`,
481
+ i18nKey: `org.hl7.terminology.CodeSystem.v3-RoleCode.${item.code}`,
420
482
  titleEn: item.display,
421
483
  definition: item.definition,
422
484
  }),
@@ -430,7 +492,7 @@ function buildLegalRepresentativeRoles() {
430
492
  codingSystem: HL7_CODING_SYSTEM_V3_ROLE_CODE,
431
493
  code: item.code,
432
494
  claim: `v3-RoleCode|${item.code}`,
433
- i18nKey: `org.hl7.v3.roleCode.${item.code}`,
495
+ i18nKey: `org.hl7.terminology.CodeSystem.v3-RoleCode.${item.code}`,
434
496
  titleEn: item.display,
435
497
  definition: item.definition,
436
498
  }),
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * HL7 role constants shared across GDC projects.
3
3
  *
4
- * Two distinct value sets are provided:
4
+ * Two curated HL7 role families are exposed:
5
5
  *
6
- * 1. v3-PersonalRelationshipRoleType
6
+ * 1. personal relationship roles
7
7
  * "Who are you in relation to the subject?" (family / social relationship)
8
8
  * Source: http://terminology.hl7.org/ValueSet/v3-PersonalRelationshipRoleType
9
9
  *
10
- * 2. v3-RoleCode — legal / functional representative subset
10
+ * 2. legal / functional representative roles
11
11
  * "What legal role do you exercise over the subject?" (guardian, attorney…)
12
12
  * Source: http://terminology.hl7.org/ValueSet/v3-RoleCode
13
13
  * Used as default for non-human subjects (e.g. animal-care sector).
@@ -19,7 +19,7 @@ export type Hl7RoleEntry = {
19
19
  definition: string;
20
20
  };
21
21
  export declare const HL7_CODING_SYSTEM_PERSONAL_RELATIONSHIP = "http://terminology.hl7.org/CodeSystem/v3-PersonalRelationshipRoleType";
22
- /** Canonical OID alias used in GDC claims (org.hl7.v3.RoleCode covers both sets). */
22
+ /** Canonical GDC compatibility claim namespace used by legacy payloads. */
23
23
  export declare const HL7_CLAIMS_CODING_SYSTEM = "org.hl7.v3.RoleCode";
24
24
  /**
25
25
  * Full ordered list of HL7 v3-PersonalRelationshipRoleType entries.
@@ -27,7 +27,30 @@ export declare const HL7_CLAIMS_CODING_SYSTEM = "org.hl7.v3.RoleCode";
27
27
  * Default role: `ONESELF` (patient represents themselves).
28
28
  */
29
29
  export declare const HL7_PERSONAL_RELATIONSHIP_ROLES: Hl7RoleEntry[];
30
+ /**
31
+ * Small, non-gender-forcing family-role catalog used by individual-member
32
+ * selectors. `FAMMEMB` is the safe fallback when no more specific relationship
33
+ * applies. The generic great-grandparent code is `GGRPRN`; `GGRFTH` means a
34
+ * male great-grandfather and therefore must not be used as its substitute.
35
+ */
36
+ export declare const HL7_INDIVIDUAL_MEMBER_RELATIONSHIP_CODES: readonly ["FAMMEMB", "WIFE", "HUSB", "DOMPART", "SIS", "BRO", "SON", "DAU", "PRN", "GRPRN", "GRNDCHILD", "GGRPRN", "FRND", "NBOR", "ROOM"];
37
+ export type Hl7IndividualMemberRelationshipCode = typeof HL7_INDIVIDUAL_MEMBER_RELATIONSHIP_CODES[number];
38
+ /** Returns whether a code belongs to the intentionally simplified member picker. */
39
+ export declare function isHl7IndividualMemberRelationshipCode(value: unknown): value is Hl7IndividualMemberRelationshipCode;
40
+ /** Ordered descriptors for the individual/family member role selector. */
41
+ export declare const HL7_INDIVIDUAL_MEMBER_RELATIONSHIP_ROLES: readonly Hl7RoleEntry[];
42
+ /**
43
+ * Complete personal-relationship catalog. It is the extended picker surface:
44
+ * every entry from the compact individual-member catalog is included together
45
+ * with all more specific HL7 personal relationship choices.
46
+ */
47
+ export declare const HL7_INDIVIDUAL_MEMBER_RELATIONSHIP_ROLES_FULL: readonly Hl7RoleEntry[];
30
48
  export declare const HL7_CODING_SYSTEM_V3_ROLE_CODE = "http://terminology.hl7.org/CodeSystem/v3-RoleCode";
49
+ /** Canonical system for functional RelatedPerson role-class values. */
50
+ export declare const HL7_CODING_SYSTEM_V3_ROLE_CLASS = "http://terminology.hl7.org/CodeSystem/v3-RoleClass";
51
+ export type Hl7RelatedPersonFunctionalRoleEntry = Hl7RoleEntry & {
52
+ codingSystem: typeof HL7_CODING_SYSTEM_V3_ROLE_CODE | typeof HL7_CODING_SYSTEM_V3_ROLE_CLASS;
53
+ };
31
54
  /**
32
55
  * Legal representative / guardian roles from HL7 v3-RoleCode.
33
56
  *
@@ -38,6 +61,17 @@ export declare const HL7_CODING_SYSTEM_V3_ROLE_CODE = "http://terminology.hl7.or
38
61
  * Default for animal-care sector: `RESPRSN` (Responsible party).
39
62
  */
40
63
  export declare const HL7_V3_ROLE_CODE_LEGAL_REPRESENTATIVE: Hl7RoleEntry[];
64
+ /**
65
+ * Functional tags accepted by the GDC `RelatedPerson.role` flat-claim
66
+ * extension. They do not replace `RelatedPerson.relationship`: kinship belongs
67
+ * in `relationship`, while these comma-separated values describe an explicit
68
+ * operational or legal function. CAREGIVER/ECON/DEPEN use v3-RoleClass;
69
+ * RESPRSN/BILL/POWATT use v3-RoleCode. `POWATT` must only be assigned when a
70
+ * real power of attorney exists; it is never inferred from controller status.
71
+ * The bare CSV is resolved through the descriptors below when a Coding system
72
+ * is required.
73
+ */
74
+ export declare const HL7_RELATED_PERSON_FUNCTIONAL_ROLES: readonly Hl7RelatedPersonFunctionalRoleEntry[];
41
75
  /** Default role code for animal-care and non-human subjects. */
42
76
  export declare const HL7_DEFAULT_ROLE_ANIMAL_CARE = "RESPRSN";
43
77
  /** Default role code for health sector (patient self-represents). */
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * HL7 role constants shared across GDC projects.
3
3
  *
4
- * Two distinct value sets are provided:
4
+ * Two curated HL7 role families are exposed:
5
5
  *
6
- * 1. v3-PersonalRelationshipRoleType
6
+ * 1. personal relationship roles
7
7
  * "Who are you in relation to the subject?" (family / social relationship)
8
8
  * Source: http://terminology.hl7.org/ValueSet/v3-PersonalRelationshipRoleType
9
9
  *
10
- * 2. v3-RoleCode — legal / functional representative subset
10
+ * 2. legal / functional representative roles
11
11
  * "What legal role do you exercise over the subject?" (guardian, attorney…)
12
12
  * Source: http://terminology.hl7.org/ValueSet/v3-RoleCode
13
13
  * Used as default for non-human subjects (e.g. animal-care sector).
@@ -17,9 +17,10 @@
17
17
  // 1. v3-PersonalRelationshipRoleType
18
18
  // ---------------------------------------------------------------------------
19
19
  export const HL7_CODING_SYSTEM_PERSONAL_RELATIONSHIP = 'http://terminology.hl7.org/CodeSystem/v3-PersonalRelationshipRoleType';
20
- /** Canonical OID alias used in GDC claims (org.hl7.v3.RoleCode covers both sets). */
20
+ /** Canonical GDC compatibility claim namespace used by legacy payloads. */
21
21
  export const HL7_CLAIMS_CODING_SYSTEM = 'org.hl7.v3.RoleCode';
22
22
  const PERSONAL_RELATIONSHIP_LIST = [
23
+ { code: 'FAMMEMB', display: 'family member', definition: 'A relationship between two people characterizing their family association.' },
23
24
  { code: 'ONESELF', display: 'self', definition: 'The relationship that a person has with himself or herself.' },
24
25
  { code: 'CHILD', display: 'child', definition: 'The player of the role is a child of the scoping entity.' },
25
26
  { code: 'CHLDADOPT', display: 'adopted child', definition: 'The player of the role is a child taken into a family through legal means and raised by the scoping person as his or her own child.' },
@@ -162,10 +163,53 @@ export const HL7_PERSONAL_RELATIONSHIP_ROLES = [
162
163
  ..._personalPreferred,
163
164
  ..._personalRemaining,
164
165
  ];
166
+ /**
167
+ * Small, non-gender-forcing family-role catalog used by individual-member
168
+ * selectors. `FAMMEMB` is the safe fallback when no more specific relationship
169
+ * applies. The generic great-grandparent code is `GGRPRN`; `GGRFTH` means a
170
+ * male great-grandfather and therefore must not be used as its substitute.
171
+ */
172
+ export const HL7_INDIVIDUAL_MEMBER_RELATIONSHIP_CODES = [
173
+ 'FAMMEMB',
174
+ 'WIFE',
175
+ 'HUSB',
176
+ 'DOMPART',
177
+ 'SIS',
178
+ 'BRO',
179
+ 'SON',
180
+ 'DAU',
181
+ 'PRN',
182
+ 'GRPRN',
183
+ 'GRNDCHILD',
184
+ 'GGRPRN',
185
+ 'FRND',
186
+ 'NBOR',
187
+ 'ROOM',
188
+ ];
189
+ const _individualMemberRelationshipCodeSet = new Set(HL7_INDIVIDUAL_MEMBER_RELATIONSHIP_CODES);
190
+ /** Returns whether a code belongs to the intentionally simplified member picker. */
191
+ export function isHl7IndividualMemberRelationshipCode(value) {
192
+ return _individualMemberRelationshipCodeSet.has(String(value || '').trim().toUpperCase());
193
+ }
194
+ /** Ordered descriptors for the individual/family member role selector. */
195
+ export const HL7_INDIVIDUAL_MEMBER_RELATIONSHIP_ROLES = HL7_INDIVIDUAL_MEMBER_RELATIONSHIP_CODES.map((code) => {
196
+ const descriptor = PERSONAL_RELATIONSHIP_LIST.find((entry) => entry.code === code);
197
+ if (!descriptor)
198
+ throw new Error(`Missing HL7 relationship descriptor for ${code}.`);
199
+ return descriptor;
200
+ });
201
+ /**
202
+ * Complete personal-relationship catalog. It is the extended picker surface:
203
+ * every entry from the compact individual-member catalog is included together
204
+ * with all more specific HL7 personal relationship choices.
205
+ */
206
+ export const HL7_INDIVIDUAL_MEMBER_RELATIONSHIP_ROLES_FULL = HL7_PERSONAL_RELATIONSHIP_ROLES;
165
207
  // ---------------------------------------------------------------------------
166
208
  // 2. v3-RoleCode — legal / functional representative subset
167
209
  // ---------------------------------------------------------------------------
168
210
  export const HL7_CODING_SYSTEM_V3_ROLE_CODE = 'http://terminology.hl7.org/CodeSystem/v3-RoleCode';
211
+ /** Canonical system for functional RelatedPerson role-class values. */
212
+ export const HL7_CODING_SYSTEM_V3_ROLE_CLASS = 'http://terminology.hl7.org/CodeSystem/v3-RoleClass';
169
213
  /**
170
214
  * Legal representative / guardian roles from HL7 v3-RoleCode.
171
215
  *
@@ -202,6 +246,50 @@ export const HL7_V3_ROLE_CODE_LEGAL_REPRESENTATIVE = [
202
246
  definition: 'A relationship between two people in which one person acts on behalf of another even if the grantor becomes incapacitated.',
203
247
  },
204
248
  ];
249
+ /**
250
+ * Functional tags accepted by the GDC `RelatedPerson.role` flat-claim
251
+ * extension. They do not replace `RelatedPerson.relationship`: kinship belongs
252
+ * in `relationship`, while these comma-separated values describe an explicit
253
+ * operational or legal function. CAREGIVER/ECON/DEPEN use v3-RoleClass;
254
+ * RESPRSN/BILL/POWATT use v3-RoleCode. `POWATT` must only be assigned when a
255
+ * real power of attorney exists; it is never inferred from controller status.
256
+ * The bare CSV is resolved through the descriptors below when a Coding system
257
+ * is required.
258
+ */
259
+ export const HL7_RELATED_PERSON_FUNCTIONAL_ROLES = [
260
+ {
261
+ ...HL7_V3_ROLE_CODE_LEGAL_REPRESENTATIVE[0],
262
+ codingSystem: HL7_CODING_SYSTEM_V3_ROLE_CODE,
263
+ },
264
+ {
265
+ code: 'CAREGIVER',
266
+ display: 'Caregiver',
267
+ definition: 'A person responsible for the primary care of a patient at home.',
268
+ codingSystem: HL7_CODING_SYSTEM_V3_ROLE_CLASS,
269
+ },
270
+ {
271
+ code: 'ECON',
272
+ display: 'Emergency contact',
273
+ definition: 'A contact for use in an emergency.',
274
+ codingSystem: HL7_CODING_SYSTEM_V3_ROLE_CLASS,
275
+ },
276
+ {
277
+ code: 'DEPEN',
278
+ display: 'Dependent',
279
+ definition: 'A person covered under a policy or program based on an association with a subscriber.',
280
+ codingSystem: HL7_CODING_SYSTEM_V3_ROLE_CLASS,
281
+ },
282
+ {
283
+ code: 'BILL',
284
+ display: 'Billing contact',
285
+ definition: 'A contact used for billing in the applicable provider-organization context.',
286
+ codingSystem: HL7_CODING_SYSTEM_V3_ROLE_CODE,
287
+ },
288
+ {
289
+ ...HL7_V3_ROLE_CODE_LEGAL_REPRESENTATIVE[3],
290
+ codingSystem: HL7_CODING_SYSTEM_V3_ROLE_CODE,
291
+ },
292
+ ];
205
293
  /** Default role code for animal-care and non-human subjects. */
206
294
  export const HL7_DEFAULT_ROLE_ANIMAL_CARE = 'RESPRSN';
207
295
  /** Default role code for health sector (patient self-represents). */
@@ -6,6 +6,7 @@ export * from './data-collections';
6
6
  export * from './data-capabilities';
7
7
  export * from './dataspace-discovery';
8
8
  export * from './dataspace-protocol';
9
+ export * from './didcomm';
9
10
  export * from './device';
10
11
  export * from './did-services';
11
12
  export * from './eu-countries';
@@ -6,6 +6,7 @@ export * from './data-collections.js';
6
6
  export * from './data-capabilities.js';
7
7
  export * from './dataspace-discovery.js';
8
8
  export * from './dataspace-protocol.js';
9
+ export * from './didcomm.js';
9
10
  export * from './device.js';
10
11
  export * from './did-services.js';
11
12
  export * from './eu-countries.js';
@@ -12,6 +12,8 @@ export declare const InteroperableContext: Readonly<{
12
12
  * adapters for the currently deployed GW CORE contract.
13
13
  */
14
14
  export declare const LifecycleRequestType: Readonly<{
15
+ readonly IndividualOrganizationDisable: "Family-disable-request-v1.0";
16
+ readonly IndividualOrganizationPurge: "Family-purge-request-v1.0";
15
17
  readonly RelatedPersonDisable: "RelatedPerson-disable-request-v1.0";
16
18
  readonly RelatedPersonPurge: "RelatedPerson-purge-request-v1.0";
17
19
  readonly TenantEnable: "Organization-enable-request-v1.0";
@@ -13,6 +13,8 @@ export const InteroperableContext = Object.freeze({
13
13
  * adapters for the currently deployed GW CORE contract.
14
14
  */
15
15
  export const LifecycleRequestType = Object.freeze({
16
+ IndividualOrganizationDisable: 'Family-disable-request-v1.0',
17
+ IndividualOrganizationPurge: 'Family-purge-request-v1.0',
16
18
  RelatedPersonDisable: 'RelatedPerson-disable-request-v1.0',
17
19
  RelatedPersonPurge: 'RelatedPerson-purge-request-v1.0',
18
20
  TenantEnable: 'Organization-enable-request-v1.0',
@@ -36,6 +36,15 @@ export declare const ActivationCredentialTypes: Readonly<{
36
36
  export declare const ProfessionalCredentialTypes: Readonly<{
37
37
  EmployeeCredential: "EmployeeCredential";
38
38
  }>;
39
+ /**
40
+ * Canonical credential subtype names used by individual-controller and
41
+ * subject-side member access flows.
42
+ */
43
+ export declare const IndividualCredentialTypes: Readonly<{
44
+ IndividualControllerCredential: "IndividualControllerCredential";
45
+ IndividualMemberCredential: "IndividualMemberCredential";
46
+ IndividualSubjectCredential: "IndividualSubjectCredential";
47
+ }>;
39
48
  /**
40
49
  * Canonical credential subtype names used by inter-tenant authorization
41
50
  * contracts for cross-organization access.
@@ -38,6 +38,15 @@ export const ActivationCredentialTypes = Object.freeze({
38
38
  export const ProfessionalCredentialTypes = Object.freeze({
39
39
  EmployeeCredential: 'EmployeeCredential',
40
40
  });
41
+ /**
42
+ * Canonical credential subtype names used by individual-controller and
43
+ * subject-side member access flows.
44
+ */
45
+ export const IndividualCredentialTypes = Object.freeze({
46
+ IndividualControllerCredential: 'IndividualControllerCredential',
47
+ IndividualMemberCredential: 'IndividualMemberCredential',
48
+ IndividualSubjectCredential: 'IndividualSubjectCredential',
49
+ });
41
50
  /**
42
51
  * Canonical credential subtype names used by inter-tenant authorization
43
52
  * contracts for cross-organization access.
@@ -1,4 +1,6 @@
1
1
  // Copyright 2026 Conectate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
2
+ import { DidcommMessageTypes } from '../constants/didcomm.js';
3
+ import { BundleDidcommEntryTypes } from '../utils/bundle-didcomm-payload.js';
2
4
  import { EXAMPLE_GATEWAY_PUBLIC_ORIGIN, } from './shared.js';
3
5
  /**
4
6
  * Shared synthetic DIDComm fixtures for direct Bundle payload tests.
@@ -7,7 +9,7 @@ export const EXAMPLE_DIDCOMM_BUNDLE_ISS = 'did:web:portal.example.org';
7
9
  export const EXAMPLE_DIDCOMM_BUNDLE_AUD = `${EXAMPLE_GATEWAY_PUBLIC_ORIGIN}/bundle`;
8
10
  export const EXAMPLE_DIDCOMM_BUNDLE_JTI = 'didcomm-bundle-jti-001';
9
11
  export const EXAMPLE_DIDCOMM_BUNDLE_THID = 'didcomm-bundle-thread-001';
10
- export const EXAMPLE_DIDCOMM_BUNDLE_ENTRY_TYPE = 'Bundle-batch-request-v1.0';
12
+ export const EXAMPLE_DIDCOMM_BUNDLE_ENTRY_TYPE = BundleDidcommEntryTypes.Batch;
11
13
  export const EXAMPLE_DIDCOMM_BUNDLE_REPLY_AUD = `${EXAMPLE_GATEWAY_PUBLIC_ORIGIN}/bundle-reply`;
12
14
  export const EXAMPLE_DIDCOMM_BUNDLE_REPLY_JTI = 'didcomm-bundle-reply-jti-001';
13
- export const EXAMPLE_DIDCOMM_BUNDLE_ACK_TYPE = 'Bundle-ack-v1.0';
15
+ export const EXAMPLE_DIDCOMM_BUNDLE_ACK_TYPE = DidcommMessageTypes.BundleAck;