gdc-common-utils-ts 2.0.12 → 2.0.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.
- package/README.md +6 -2
- package/dist/examples/employee.d.ts +9 -1
- package/dist/examples/employee.js +7 -4
- package/dist/examples/shared.d.ts +1 -1
- package/dist/examples/shared.js +6 -2
- package/dist/utils/actor.d.ts +3 -1
- package/dist/utils/medication-claim-helpers.d.ts +5 -85
- package/dist/utils/medication-claim-helpers.js +5 -255
- package/package.json +1 -5
- package/dist/examples/communication-bundle-session.d.ts +0 -22
- package/dist/examples/communication-bundle-session.js +0 -79
- package/dist/interfaces/IWallet.d.ts +0 -55
- package/dist/interfaces/IWallet.js +0 -3
- package/dist/models/fhir-related-person.d.ts +0 -61
- package/dist/models/fhir-related-person.js +0 -108
- package/dist/models/related-profile.d.ts +0 -42
- package/dist/models/related-profile.js +0 -16
- package/dist/utils/allergy-intolerance-claim-helpers.d.ts +0 -10
- package/dist/utils/allergy-intolerance-claim-helpers.js +0 -47
- package/dist/utils/appointment-claim-helpers.d.ts +0 -10
- package/dist/utils/appointment-claim-helpers.js +0 -26
- package/dist/utils/appointment-response-claim-helpers.d.ts +0 -8
- package/dist/utils/appointment-response-claim-helpers.js +0 -20
- package/dist/utils/claim-list-helpers.d.ts +0 -21
- package/dist/utils/claim-list-helpers.js +0 -50
- package/dist/utils/clinical-impression-claim-helpers.d.ts +0 -10
- package/dist/utils/clinical-impression-claim-helpers.js +0 -26
- package/dist/utils/communication-bundle-session.d.ts +0 -175
- package/dist/utils/communication-bundle-session.js +0 -524
- package/dist/utils/composition-claim-helpers.d.ts +0 -12
- package/dist/utils/composition-claim-helpers.js +0 -32
- package/dist/utils/condition-claim-helpers.d.ts +0 -10
- package/dist/utils/condition-claim-helpers.js +0 -47
- package/dist/utils/convert-allergy-intolerance.d.ts +0 -3
- package/dist/utils/convert-allergy-intolerance.js +0 -34
- package/dist/utils/convert-appointment-response.d.ts +0 -3
- package/dist/utils/convert-appointment-response.js +0 -32
- package/dist/utils/convert-appointment.d.ts +0 -3
- package/dist/utils/convert-appointment.js +0 -61
- package/dist/utils/convert-care-plan.d.ts +0 -3
- package/dist/utils/convert-care-plan.js +0 -58
- package/dist/utils/convert-clinical-impression.d.ts +0 -3
- package/dist/utils/convert-clinical-impression.js +0 -42
- package/dist/utils/convert-composition.d.ts +0 -3
- package/dist/utils/convert-composition.js +0 -35
- package/dist/utils/convert-condition.d.ts +0 -3
- package/dist/utils/convert-condition.js +0 -24
- package/dist/utils/convert-coverage.d.ts +0 -3
- package/dist/utils/convert-coverage.js +0 -51
- package/dist/utils/convert-device-use-statement.d.ts +0 -3
- package/dist/utils/convert-device-use-statement.js +0 -28
- package/dist/utils/convert-device.d.ts +0 -3
- package/dist/utils/convert-device.js +0 -37
- package/dist/utils/convert-diagnostic-report.d.ts +0 -3
- package/dist/utils/convert-diagnostic-report.js +0 -55
- package/dist/utils/convert-document-reference.d.ts +0 -3
- package/dist/utils/convert-document-reference.js +0 -35
- package/dist/utils/convert-encounter.d.ts +0 -3
- package/dist/utils/convert-encounter.js +0 -68
- package/dist/utils/convert-flag.d.ts +0 -3
- package/dist/utils/convert-flag.js +0 -34
- package/dist/utils/convert-immunization.d.ts +0 -3
- package/dist/utils/convert-immunization.js +0 -56
- package/dist/utils/convert-medication-statement.d.ts +0 -3
- package/dist/utils/convert-medication-statement.js +0 -64
- package/dist/utils/convert-observation.d.ts +0 -3
- package/dist/utils/convert-observation.js +0 -57
- package/dist/utils/convert-procedure.d.ts +0 -3
- package/dist/utils/convert-procedure.js +0 -50
- package/dist/utils/convert-related-person.d.ts +0 -3
- package/dist/utils/convert-related-person.js +0 -31
- package/dist/utils/convert-shared.d.ts +0 -34
- package/dist/utils/convert-shared.js +0 -179
- package/dist/utils/coverage-claim-helpers.d.ts +0 -10
- package/dist/utils/coverage-claim-helpers.js +0 -26
- package/dist/utils/diagnostic-report-claim-helpers.d.ts +0 -12
- package/dist/utils/diagnostic-report-claim-helpers.js +0 -32
- package/dist/utils/employee-editor.d.ts +0 -24
- package/dist/utils/employee-editor.js +0 -41
- package/dist/utils/encounter-claim-helpers.d.ts +0 -10
- package/dist/utils/encounter-claim-helpers.js +0 -26
- package/dist/utils/gateway-index-params.d.ts +0 -44
- package/dist/utils/gateway-index-params.js +0 -80
- package/dist/utils/normalize-subject-uuid.d.ts +0 -1
- package/dist/utils/normalize-subject-uuid.js +0 -24
- package/dist/utils/related-person-claim-helpers.d.ts +0 -8
- package/dist/utils/related-person-claim-helpers.js +0 -20
- package/dist/utils/search-parameter-catalog.d.ts +0 -31
- package/dist/utils/search-parameter-catalog.js +0 -81
package/README.md
CHANGED
|
@@ -601,15 +601,19 @@ These helpers are the shared base for consent claim construction across GW and S
|
|
|
601
601
|
|
|
602
602
|
### Interfaces
|
|
603
603
|
|
|
604
|
-
The `interfaces` export contains the shared type contracts and cryptography types, including:
|
|
604
|
+
The `interfaces` export contains the shared low-level type contracts and cryptography types, including:
|
|
605
605
|
|
|
606
606
|
- `ICryptography`
|
|
607
607
|
- `ICryptoHelper`
|
|
608
|
-
- `IWallet`
|
|
609
608
|
- `Cryptography.types`
|
|
610
609
|
- `MlDsa`
|
|
611
610
|
- `MlKem`
|
|
612
611
|
|
|
612
|
+
Wallet contracts and runtime adapters live in higher layers:
|
|
613
|
+
|
|
614
|
+
- `gdc-sdk-core-ts` owns the runtime-neutral `IWallet` contract
|
|
615
|
+
- `gdc-sdk-node-ts` owns concrete Node wallet/runtime adapters
|
|
616
|
+
|
|
613
617
|
Example:
|
|
614
618
|
|
|
615
619
|
```ts
|
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
* Canonical employee directory fixture shared by docs and tests.
|
|
3
3
|
*
|
|
4
4
|
* Semantics:
|
|
5
|
-
* - `
|
|
5
|
+
* - `resourceId` is the current internal GW profile id
|
|
6
|
+
* - `resourceId` is a transport/runtime locator and should remain one
|
|
7
|
+
* `urn:uuid:*` technical anchor
|
|
8
|
+
* - `identifier` is the exportable/interoperable employee identity and may be
|
|
9
|
+
* public, DID-based, or another stable external identifier
|
|
6
10
|
* - `email` can map to multiple active roles
|
|
7
11
|
* - a purged profile remains historically addressable by `identifier`
|
|
8
12
|
*/
|
|
9
13
|
export type ExampleEmployeeRecord = Readonly<{
|
|
14
|
+
resourceId: string;
|
|
10
15
|
identifier: string;
|
|
11
16
|
email: string;
|
|
12
17
|
role: string;
|
|
@@ -23,16 +28,19 @@ export declare const EXAMPLE_EMPLOYEE_CONTROLLER_ACTIVE: ExampleEmployeeRecord;
|
|
|
23
28
|
export declare const EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE: ExampleEmployeeRecord;
|
|
24
29
|
export declare const EXAMPLE_EMPLOYEE_DOCTOR_PURGED_HISTORICAL: ExampleEmployeeRecord;
|
|
25
30
|
export declare const EXAMPLE_EMPLOYEE_DIRECTORY_RECORDS: readonly [Readonly<{
|
|
31
|
+
resourceId: string;
|
|
26
32
|
identifier: string;
|
|
27
33
|
email: string;
|
|
28
34
|
role: string;
|
|
29
35
|
status: "active" | "inactive" | "purged";
|
|
30
36
|
}>, Readonly<{
|
|
37
|
+
resourceId: string;
|
|
31
38
|
identifier: string;
|
|
32
39
|
email: string;
|
|
33
40
|
role: string;
|
|
34
41
|
status: "active" | "inactive" | "purged";
|
|
35
42
|
}>, Readonly<{
|
|
43
|
+
resourceId: string;
|
|
36
44
|
identifier: string;
|
|
37
45
|
email: string;
|
|
38
46
|
role: string;
|
|
@@ -7,19 +7,22 @@ export const ExampleEmployeeRoles = Object.freeze({
|
|
|
7
7
|
Doctor: 'ISCO-08|2211',
|
|
8
8
|
});
|
|
9
9
|
export const EXAMPLE_EMPLOYEE_CONTROLLER_ACTIVE = Object.freeze({
|
|
10
|
-
|
|
10
|
+
resourceId: 'urn:uuid:11111111-1111-4111-8111-111111111111',
|
|
11
|
+
identifier: 'did:web:api.example.org:employee:shared.professional@example.org:ISCO-08|1120',
|
|
11
12
|
email: ExampleEmployeeEmails.SharedProfessional,
|
|
12
13
|
role: ExampleEmployeeRoles.Controller,
|
|
13
14
|
status: 'active',
|
|
14
15
|
});
|
|
15
16
|
export const EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE = Object.freeze({
|
|
16
|
-
|
|
17
|
+
resourceId: 'urn:uuid:22222222-2222-4222-8222-222222222222',
|
|
18
|
+
identifier: 'did:web:api.example.org:employee:shared.professional@example.org:ISCO-08|2211',
|
|
17
19
|
email: ExampleEmployeeEmails.SharedProfessional,
|
|
18
20
|
role: ExampleEmployeeRoles.Doctor,
|
|
19
21
|
status: 'active',
|
|
20
22
|
});
|
|
21
23
|
export const EXAMPLE_EMPLOYEE_DOCTOR_PURGED_HISTORICAL = Object.freeze({
|
|
22
|
-
|
|
24
|
+
resourceId: 'urn:uuid:33333333-3333-4333-8333-333333333333',
|
|
25
|
+
identifier: 'did:web:api.example.org:employee:shared.professional@example.org:ISCO-08|2211:historical:000',
|
|
23
26
|
email: ExampleEmployeeEmails.SharedProfessional,
|
|
24
27
|
role: ExampleEmployeeRoles.Doctor,
|
|
25
28
|
status: 'purged',
|
|
@@ -45,7 +48,7 @@ export function buildExampleEmployeeClaims(record) {
|
|
|
45
48
|
*/
|
|
46
49
|
export const EXAMPLE_EMPLOYEE_SEARCH_RESPONSE_BODY = Object.freeze({
|
|
47
50
|
data: EXAMPLE_EMPLOYEE_DIRECTORY_RECORDS.map((record) => ({
|
|
48
|
-
id: record.
|
|
51
|
+
id: record.resourceId,
|
|
49
52
|
meta: {
|
|
50
53
|
status: record.status,
|
|
51
54
|
claims: buildExampleEmployeeClaims(record),
|
|
@@ -105,7 +105,7 @@ export declare const EXAMPLE_CONTROLLER_EMAIL: "controller@acme.org";
|
|
|
105
105
|
export declare const EXAMPLE_CONTROLLER_SAME_AS: "mailto:controller@acme.org";
|
|
106
106
|
export declare const EXAMPLE_API_ORGANIZATION_DID: "did:web:api.acme.org";
|
|
107
107
|
export declare const EXAMPLE_SERVICE_PUBLIC_DID: "did:web:public.acme.org";
|
|
108
|
-
export declare const EXAMPLE_PROFESSIONAL_DID:
|
|
108
|
+
export declare const EXAMPLE_PROFESSIONAL_DID: string;
|
|
109
109
|
export declare const EXAMPLE_PROVIDER_ORGANIZATION_DID: "did:web:hospital.acme.org";
|
|
110
110
|
export declare const EXAMPLE_PROVIDER_ORGANIZATION_URL: "https://hospital.acme.org";
|
|
111
111
|
export declare const EXAMPLE_GATEWAY_PUBLIC_ORIGIN: "https://gateway.example.com";
|
package/dist/examples/shared.js
CHANGED
|
@@ -11,7 +11,7 @@ import { HealthcareActorRoles, HealthcareBasicSections, HealthcareConsentPurpose
|
|
|
11
11
|
import { CommunicationCategoryCodes } from '../constants/communication.js';
|
|
12
12
|
import { LOINC_SYSTEM_URL } from '../models/clinical-sections.js';
|
|
13
13
|
import { CommunicationClaim } from '../models/interoperable-claims/communication-claims.js';
|
|
14
|
-
import { buildHostedProviderDidWeb, buildIndividualDidWeb, buildIndividualMemberDidWeb, buildProviderSectorDidWeb, } from '../utils/did.js';
|
|
14
|
+
import { buildHostedProviderDidWeb, buildIndividualDidWeb, buildIndividualMemberDidWeb, buildProfessionalDidWeb, buildProviderSectorDidWeb, } from '../utils/did.js';
|
|
15
15
|
import { encodeHexToMultibase58btc } from '../utils/multibase58.js';
|
|
16
16
|
import { MedicationStatementClaim, MedicationStatementClaimsFhirApiExtended, } from '../models/interoperable-claims/medication-statement-claims.js';
|
|
17
17
|
import { medicationStatementFlatToFhirR4 } from '../utils/clinical-resource-converters.js';
|
|
@@ -120,7 +120,11 @@ export const EXAMPLE_CONTROLLER_EMAIL = EXAMPLE_EMAIL_CONTROLLER_ORG;
|
|
|
120
120
|
export const EXAMPLE_CONTROLLER_SAME_AS = `mailto:${EXAMPLE_CONTROLLER_EMAIL}`;
|
|
121
121
|
export const EXAMPLE_API_ORGANIZATION_DID = 'did:web:api.acme.org';
|
|
122
122
|
export const EXAMPLE_SERVICE_PUBLIC_DID = 'did:web:public.acme.org';
|
|
123
|
-
export const EXAMPLE_PROFESSIONAL_DID =
|
|
123
|
+
export const EXAMPLE_PROFESSIONAL_DID = buildProfessionalDidWeb({
|
|
124
|
+
organizationDidWeb: 'did:web:api.acme.org',
|
|
125
|
+
email: 'doctor.oncall@example.org',
|
|
126
|
+
role: HealthcareActorRoles.Physician,
|
|
127
|
+
});
|
|
124
128
|
export const EXAMPLE_PROVIDER_ORGANIZATION_DID = 'did:web:hospital.acme.org';
|
|
125
129
|
export const EXAMPLE_PROVIDER_ORGANIZATION_URL = 'https://hospital.acme.org';
|
|
126
130
|
export const EXAMPLE_GATEWAY_PUBLIC_ORIGIN = 'https://gateway.example.com';
|
package/dist/utils/actor.d.ts
CHANGED
|
@@ -2,13 +2,15 @@ export type ParsedActor = {
|
|
|
2
2
|
/**
|
|
3
3
|
* The token subject / authenticated actor identifier (as provided in the token request).
|
|
4
4
|
* Examples:
|
|
5
|
+
* - did:web:api.acme.org:employee:z6MksExampleHashedEmployeeId:ISCO-08|2211
|
|
6
|
+
* - did:web:api.acme.org:employee:z6MksExampleHashedEmployeeId:ISCO-08|2211:<device-uuid>
|
|
5
7
|
* - did:web:api.acme.org:employee:doctor1@acme.org:ISCO-08|2211
|
|
6
8
|
* - did:web:api.acme.org:employee:doctor1@acme.org:ISCO-08|2211:<device-uuid>
|
|
7
9
|
* - did:web:api.acme.org:family:<id>:v3-RoleCode|ONESELF
|
|
8
10
|
* - did:web:api.acme.org:family:<id>:v3-RoleCode|CHILD:<device-uuid>
|
|
9
11
|
*/
|
|
10
12
|
sub: string;
|
|
11
|
-
/** The actor identifier (employee email, familyId, or raw email). */
|
|
13
|
+
/** The actor identifier (employee hashed-id/email token, familyId, or raw email). */
|
|
12
14
|
identifier?: string;
|
|
13
15
|
/** The employee role code if present (e.g. "ISCO-08|2211"). */
|
|
14
16
|
role?: string;
|
|
@@ -1,88 +1,8 @@
|
|
|
1
|
-
import { type GenericInteroperableClaims } from './claim-list-helpers.js';
|
|
2
|
-
export type MedicationInteroperableClaims = GenericInteroperableClaims;
|
|
3
|
-
export declare function getMedicationIdentifier(claims: MedicationInteroperableClaims): string;
|
|
4
|
-
export declare function setMedicationIdentifier(claims: MedicationInteroperableClaims, value: string): MedicationInteroperableClaims;
|
|
5
|
-
export declare function getMedicationSubject(claims: MedicationInteroperableClaims): string;
|
|
6
|
-
export declare function setMedicationSubject(claims: MedicationInteroperableClaims, value: string): MedicationInteroperableClaims;
|
|
7
|
-
export declare function getMedicationStatus(claims: MedicationInteroperableClaims): string;
|
|
8
|
-
export declare function setMedicationStatus(claims: MedicationInteroperableClaims, value: string): MedicationInteroperableClaims;
|
|
9
|
-
export declare function getMedicationEffective(claims: MedicationInteroperableClaims): string;
|
|
10
|
-
export declare function setMedicationEffective(claims: MedicationInteroperableClaims, value: string): MedicationInteroperableClaims;
|
|
11
|
-
export declare function getMedicationText(claims: MedicationInteroperableClaims): string;
|
|
12
|
-
export declare function setMedicationText(claims: MedicationInteroperableClaims, value: string): MedicationInteroperableClaims;
|
|
13
|
-
export declare function getMedicationDoseQuantityValue(claims: MedicationInteroperableClaims): number | undefined;
|
|
14
|
-
export declare function setMedicationDoseQuantityValue(claims: MedicationInteroperableClaims, value: number): MedicationInteroperableClaims;
|
|
15
|
-
export declare function getMedicationDoseQuantityUnit(claims: MedicationInteroperableClaims): string;
|
|
16
|
-
export declare function setMedicationDoseQuantityUnit(claims: MedicationInteroperableClaims, value: string): MedicationInteroperableClaims;
|
|
17
|
-
export declare function getMedicationTimingFrequency(claims: MedicationInteroperableClaims): number | undefined;
|
|
18
|
-
export declare function setMedicationTimingFrequency(claims: MedicationInteroperableClaims, value: number): MedicationInteroperableClaims;
|
|
19
|
-
export declare function getMedicationTimingPeriod(claims: MedicationInteroperableClaims): number | undefined;
|
|
20
|
-
export declare function setMedicationTimingPeriod(claims: MedicationInteroperableClaims, value: number): MedicationInteroperableClaims;
|
|
21
|
-
export declare function getMedicationTimingPeriodUnit(claims: MedicationInteroperableClaims): string;
|
|
22
|
-
export declare function setMedicationTimingPeriodUnit(claims: MedicationInteroperableClaims, value: string): MedicationInteroperableClaims;
|
|
23
|
-
export declare function getMedicationDosageAsNeeded(claims: MedicationInteroperableClaims): boolean | undefined;
|
|
24
|
-
export declare function setMedicationDosageAsNeeded(claims: MedicationInteroperableClaims, value: boolean): MedicationInteroperableClaims;
|
|
25
1
|
/**
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
export declare function getMedicationClaimList(claims: MedicationInteroperableClaims, claimKey: string): string[];
|
|
29
|
-
/**
|
|
30
|
-
* Replaces a medication claim list from array/string input and stores canonical CSV.
|
|
31
|
-
*/
|
|
32
|
-
export declare function setMedicationClaimList(claims: MedicationInteroperableClaims, claimKey: string, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
33
|
-
/**
|
|
34
|
-
* Adds values to a medication claim list preserving uniqueness.
|
|
35
|
-
*/
|
|
36
|
-
export declare function addMedicationClaimList(claims: MedicationInteroperableClaims, claimKey: string, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
37
|
-
/**
|
|
38
|
-
* Removes values from a medication claim list while preserving uniqueness.
|
|
39
|
-
*/
|
|
40
|
-
export declare function removeMedicationClaimList(claims: MedicationInteroperableClaims, claimKey: string, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
41
|
-
/**
|
|
42
|
-
* Medication category list getter/setter/add.
|
|
43
|
-
*/
|
|
44
|
-
export declare function getMedicationCategoryList(claims: MedicationInteroperableClaims): string[];
|
|
45
|
-
export declare function setMedicationCategoryList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
46
|
-
export declare function addMedicationCategoryList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
47
|
-
export declare function removeMedicationCategoryList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
48
|
-
/**
|
|
49
|
-
* Medication part-of list getter/setter/add.
|
|
50
|
-
*/
|
|
51
|
-
export declare function getMedicationPartOfList(claims: MedicationInteroperableClaims): string[];
|
|
52
|
-
export declare function setMedicationPartOfList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
53
|
-
export declare function addMedicationPartOfList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
54
|
-
export declare function removeMedicationPartOfList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
55
|
-
/**
|
|
56
|
-
* Medication code list getter/setter/add.
|
|
2
|
+
* Compatibility re-export for the historical medication claim-helper subpath.
|
|
57
3
|
*
|
|
58
|
-
*
|
|
59
|
-
* -
|
|
60
|
-
*
|
|
61
|
-
*/
|
|
62
|
-
export declare function getMedicationCodeList(claims: MedicationInteroperableClaims): string[];
|
|
63
|
-
export declare function setMedicationCodeList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
64
|
-
export declare function addMedicationCodeList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
65
|
-
export declare function removeMedicationCodeList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
66
|
-
/**
|
|
67
|
-
* Medication source list getter/setter/add.
|
|
68
|
-
*/
|
|
69
|
-
export declare function getMedicationSourceList(claims: MedicationInteroperableClaims): string[];
|
|
70
|
-
export declare function setMedicationSourceList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
71
|
-
export declare function addMedicationSourceList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
72
|
-
export declare function removeMedicationSourceList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
73
|
-
/**
|
|
74
|
-
* Medication subject list getter/setter/add.
|
|
75
|
-
*/
|
|
76
|
-
export declare function getMedicationSubjectList(claims: MedicationInteroperableClaims): string[];
|
|
77
|
-
export declare function setMedicationSubjectList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
78
|
-
export declare function addMedicationSubjectList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
79
|
-
export declare function removeMedicationSubjectList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
80
|
-
/**
|
|
81
|
-
* Linked DocumentReference identifiers associated to the medication statement.
|
|
82
|
-
* Canonical claim key: `MedicationStatement.contained-documents`.
|
|
83
|
-
* Legacy alias accepted on read: `MedicationStatement.attachment-content-ids`.
|
|
4
|
+
* `gdc-sdk-core-ts` and older consumers still import
|
|
5
|
+
* `gdc-common-utils-ts/utils/medication-claim-helpers`, while the canonical
|
|
6
|
+
* implementation file is `claims-helpers-medication-statement`.
|
|
84
7
|
*/
|
|
85
|
-
export
|
|
86
|
-
export declare function setMedicationContainedDocumentIdentifierList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
87
|
-
export declare function addMedicationContainedDocumentIdentifierList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
88
|
-
export declare function removeMedicationContainedDocumentIdentifierList(claims: MedicationInteroperableClaims, values: string | readonly string[]): MedicationInteroperableClaims;
|
|
8
|
+
export * from './claims-helpers-medication-statement';
|
|
@@ -1,259 +1,9 @@
|
|
|
1
1
|
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
-
import { MedicationStatementClaim, MedicationStatementClaimsFhirApiExtended, } from '../models/interoperable-claims/medication-statement-claims.js';
|
|
3
|
-
import { addClaimValues, getClaimValues, normalizeClaimScalar, removeClaimValues, setClaimValues, } from './claim-list-helpers.js';
|
|
4
|
-
export function getMedicationIdentifier(claims) {
|
|
5
|
-
return getMedicationScalar(claims, MedicationStatementClaim.Identifier);
|
|
6
|
-
}
|
|
7
|
-
export function setMedicationIdentifier(claims, value) {
|
|
8
|
-
return setMedicationScalar(claims, MedicationStatementClaim.Identifier, value);
|
|
9
|
-
}
|
|
10
|
-
export function getMedicationSubject(claims) {
|
|
11
|
-
return getMedicationScalar(claims, MedicationStatementClaim.Subject);
|
|
12
|
-
}
|
|
13
|
-
export function setMedicationSubject(claims, value) {
|
|
14
|
-
return setMedicationScalar(claims, MedicationStatementClaim.Subject, value);
|
|
15
|
-
}
|
|
16
|
-
export function getMedicationStatus(claims) {
|
|
17
|
-
return getMedicationScalar(claims, MedicationStatementClaim.Status);
|
|
18
|
-
}
|
|
19
|
-
export function setMedicationStatus(claims, value) {
|
|
20
|
-
return setMedicationScalar(claims, MedicationStatementClaim.Status, value);
|
|
21
|
-
}
|
|
22
|
-
export function getMedicationEffective(claims) {
|
|
23
|
-
return getMedicationScalar(claims, MedicationStatementClaim.Effective);
|
|
24
|
-
}
|
|
25
|
-
export function setMedicationEffective(claims, value) {
|
|
26
|
-
return setMedicationScalar(claims, MedicationStatementClaim.Effective, value);
|
|
27
|
-
}
|
|
28
|
-
export function getMedicationText(claims) {
|
|
29
|
-
return getMedicationScalar(claims, MedicationStatementClaim.MedicationText);
|
|
30
|
-
}
|
|
31
|
-
export function setMedicationText(claims, value) {
|
|
32
|
-
return setMedicationScalar(claims, MedicationStatementClaim.MedicationText, value);
|
|
33
|
-
}
|
|
34
|
-
export function getMedicationDoseQuantityValue(claims) {
|
|
35
|
-
return getMedicationNumber(claims, MedicationStatementClaimsFhirApiExtended.DoseQuantityValue);
|
|
36
|
-
}
|
|
37
|
-
export function setMedicationDoseQuantityValue(claims, value) {
|
|
38
|
-
return setMedicationNumber(claims, MedicationStatementClaimsFhirApiExtended.DoseQuantityValue, value);
|
|
39
|
-
}
|
|
40
|
-
export function getMedicationDoseQuantityUnit(claims) {
|
|
41
|
-
return getMedicationScalar(claims, MedicationStatementClaimsFhirApiExtended.DoseQuantityUnit);
|
|
42
|
-
}
|
|
43
|
-
export function setMedicationDoseQuantityUnit(claims, value) {
|
|
44
|
-
return setMedicationScalar(claims, MedicationStatementClaimsFhirApiExtended.DoseQuantityUnit, value);
|
|
45
|
-
}
|
|
46
|
-
export function getMedicationTimingFrequency(claims) {
|
|
47
|
-
return getMedicationNumber(claims, MedicationStatementClaimsFhirApiExtended.TimingFrequency);
|
|
48
|
-
}
|
|
49
|
-
export function setMedicationTimingFrequency(claims, value) {
|
|
50
|
-
return setMedicationNumber(claims, MedicationStatementClaimsFhirApiExtended.TimingFrequency, value);
|
|
51
|
-
}
|
|
52
|
-
export function getMedicationTimingPeriod(claims) {
|
|
53
|
-
return getMedicationNumber(claims, MedicationStatementClaimsFhirApiExtended.TimingPeriod);
|
|
54
|
-
}
|
|
55
|
-
export function setMedicationTimingPeriod(claims, value) {
|
|
56
|
-
return setMedicationNumber(claims, MedicationStatementClaimsFhirApiExtended.TimingPeriod, value);
|
|
57
|
-
}
|
|
58
|
-
export function getMedicationTimingPeriodUnit(claims) {
|
|
59
|
-
return getMedicationScalar(claims, MedicationStatementClaimsFhirApiExtended.TimingPeriodUnit);
|
|
60
|
-
}
|
|
61
|
-
export function setMedicationTimingPeriodUnit(claims, value) {
|
|
62
|
-
return setMedicationScalar(claims, MedicationStatementClaimsFhirApiExtended.TimingPeriodUnit, value);
|
|
63
|
-
}
|
|
64
|
-
export function getMedicationDosageAsNeeded(claims) {
|
|
65
|
-
return getMedicationBoolean(claims, MedicationStatementClaimsFhirApiExtended.DosageAsNeeded);
|
|
66
|
-
}
|
|
67
|
-
export function setMedicationDosageAsNeeded(claims, value) {
|
|
68
|
-
return setMedicationBoolean(claims, MedicationStatementClaimsFhirApiExtended.DosageAsNeeded, value);
|
|
69
|
-
}
|
|
70
2
|
/**
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
|
-
export function getMedicationClaimList(claims, claimKey) {
|
|
74
|
-
return getClaimValues(claims, claimKey);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Replaces a medication claim list from array/string input and stores canonical CSV.
|
|
78
|
-
*/
|
|
79
|
-
export function setMedicationClaimList(claims, claimKey, values) {
|
|
80
|
-
return setClaimValues(claims, claimKey, values);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Adds values to a medication claim list preserving uniqueness.
|
|
84
|
-
*/
|
|
85
|
-
export function addMedicationClaimList(claims, claimKey, values) {
|
|
86
|
-
return addClaimValues(claims, claimKey, values);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Removes values from a medication claim list while preserving uniqueness.
|
|
90
|
-
*/
|
|
91
|
-
export function removeMedicationClaimList(claims, claimKey, values) {
|
|
92
|
-
return removeClaimValues(claims, claimKey, values);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Medication category list getter/setter/add.
|
|
96
|
-
*/
|
|
97
|
-
export function getMedicationCategoryList(claims) {
|
|
98
|
-
return getMedicationClaimList(claims, MedicationStatementClaim.Category);
|
|
99
|
-
}
|
|
100
|
-
export function setMedicationCategoryList(claims, values) {
|
|
101
|
-
return setMedicationClaimList(claims, MedicationStatementClaim.Category, values);
|
|
102
|
-
}
|
|
103
|
-
export function addMedicationCategoryList(claims, values) {
|
|
104
|
-
return addMedicationClaimList(claims, MedicationStatementClaim.Category, values);
|
|
105
|
-
}
|
|
106
|
-
export function removeMedicationCategoryList(claims, values) {
|
|
107
|
-
return removeMedicationClaimList(claims, MedicationStatementClaim.Category, values);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Medication part-of list getter/setter/add.
|
|
111
|
-
*/
|
|
112
|
-
export function getMedicationPartOfList(claims) {
|
|
113
|
-
return getMedicationClaimList(claims, MedicationStatementClaim.PartOf);
|
|
114
|
-
}
|
|
115
|
-
export function setMedicationPartOfList(claims, values) {
|
|
116
|
-
return setMedicationClaimList(claims, MedicationStatementClaim.PartOf, values);
|
|
117
|
-
}
|
|
118
|
-
export function addMedicationPartOfList(claims, values) {
|
|
119
|
-
return addMedicationClaimList(claims, MedicationStatementClaim.PartOf, values);
|
|
120
|
-
}
|
|
121
|
-
export function removeMedicationPartOfList(claims, values) {
|
|
122
|
-
return removeMedicationClaimList(claims, MedicationStatementClaim.PartOf, values);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Medication code list getter/setter/add.
|
|
3
|
+
* Compatibility re-export for the historical medication claim-helper subpath.
|
|
126
4
|
*
|
|
127
|
-
*
|
|
128
|
-
* -
|
|
129
|
-
*
|
|
130
|
-
*/
|
|
131
|
-
export function getMedicationCodeList(claims) {
|
|
132
|
-
return getMedicationClaimList(claims, MedicationStatementClaim.Code);
|
|
133
|
-
}
|
|
134
|
-
export function setMedicationCodeList(claims, values) {
|
|
135
|
-
return setMedicationClaimList(claims, MedicationStatementClaim.Code, values);
|
|
136
|
-
}
|
|
137
|
-
export function addMedicationCodeList(claims, values) {
|
|
138
|
-
return addMedicationClaimList(claims, MedicationStatementClaim.Code, values);
|
|
139
|
-
}
|
|
140
|
-
export function removeMedicationCodeList(claims, values) {
|
|
141
|
-
return removeMedicationClaimList(claims, MedicationStatementClaim.Code, values);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Medication source list getter/setter/add.
|
|
145
|
-
*/
|
|
146
|
-
export function getMedicationSourceList(claims) {
|
|
147
|
-
return getMedicationClaimList(claims, MedicationStatementClaim.Source);
|
|
148
|
-
}
|
|
149
|
-
export function setMedicationSourceList(claims, values) {
|
|
150
|
-
return setMedicationClaimList(claims, MedicationStatementClaim.Source, values);
|
|
151
|
-
}
|
|
152
|
-
export function addMedicationSourceList(claims, values) {
|
|
153
|
-
return addMedicationClaimList(claims, MedicationStatementClaim.Source, values);
|
|
154
|
-
}
|
|
155
|
-
export function removeMedicationSourceList(claims, values) {
|
|
156
|
-
return removeMedicationClaimList(claims, MedicationStatementClaim.Source, values);
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Medication subject list getter/setter/add.
|
|
160
|
-
*/
|
|
161
|
-
export function getMedicationSubjectList(claims) {
|
|
162
|
-
return getMedicationClaimList(claims, MedicationStatementClaim.Subject);
|
|
163
|
-
}
|
|
164
|
-
export function setMedicationSubjectList(claims, values) {
|
|
165
|
-
return setMedicationClaimList(claims, MedicationStatementClaim.Subject, values);
|
|
166
|
-
}
|
|
167
|
-
export function addMedicationSubjectList(claims, values) {
|
|
168
|
-
return addMedicationClaimList(claims, MedicationStatementClaim.Subject, values);
|
|
169
|
-
}
|
|
170
|
-
export function removeMedicationSubjectList(claims, values) {
|
|
171
|
-
return removeMedicationClaimList(claims, MedicationStatementClaim.Subject, values);
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Linked DocumentReference identifiers associated to the medication statement.
|
|
175
|
-
* Canonical claim key: `MedicationStatement.contained-documents`.
|
|
176
|
-
* Legacy alias accepted on read: `MedicationStatement.attachment-content-ids`.
|
|
5
|
+
* `gdc-sdk-core-ts` and older consumers still import
|
|
6
|
+
* `gdc-common-utils-ts/utils/medication-claim-helpers`, while the canonical
|
|
7
|
+
* implementation file is `claims-helpers-medication-statement`.
|
|
177
8
|
*/
|
|
178
|
-
export
|
|
179
|
-
return uniqueCsvLists([
|
|
180
|
-
getMedicationClaimList(claims, MedicationStatementClaim.ContainedDocuments),
|
|
181
|
-
getMedicationClaimList(claims, MedicationStatementClaim.AttachmentContentIds),
|
|
182
|
-
]);
|
|
183
|
-
}
|
|
184
|
-
export function setMedicationContainedDocumentIdentifierList(claims, values) {
|
|
185
|
-
return setContainedDocuments(claims, values);
|
|
186
|
-
}
|
|
187
|
-
export function addMedicationContainedDocumentIdentifierList(claims, values) {
|
|
188
|
-
return setContainedDocuments(claims, uniqueCsvLists([
|
|
189
|
-
getMedicationContainedDocumentIdentifierList(claims),
|
|
190
|
-
Array.isArray(values) ? [...values] : getMedicationClaimList({ [MedicationStatementClaim.ContainedDocuments]: values }, MedicationStatementClaim.ContainedDocuments),
|
|
191
|
-
]));
|
|
192
|
-
}
|
|
193
|
-
export function removeMedicationContainedDocumentIdentifierList(claims, values) {
|
|
194
|
-
const toRemove = new Set((Array.isArray(values) ? values : getMedicationClaimList({ [MedicationStatementClaim.ContainedDocuments]: values }, MedicationStatementClaim.ContainedDocuments))
|
|
195
|
-
.map((item) => String(item || '').trim())
|
|
196
|
-
.filter(Boolean));
|
|
197
|
-
return setContainedDocuments(claims, getMedicationContainedDocumentIdentifierList(claims).filter((item) => !toRemove.has(item)));
|
|
198
|
-
}
|
|
199
|
-
function setContainedDocuments(claims, values) {
|
|
200
|
-
const next = setMedicationClaimList(claims, MedicationStatementClaim.ContainedDocuments, values);
|
|
201
|
-
const cleaned = {
|
|
202
|
-
...next,
|
|
203
|
-
};
|
|
204
|
-
delete cleaned[MedicationStatementClaim.AttachmentContentIds];
|
|
205
|
-
return cleaned;
|
|
206
|
-
}
|
|
207
|
-
function uniqueCsvLists(lists) {
|
|
208
|
-
return [...new Set(lists.flatMap((list) => list.map((item) => String(item || '').trim()).filter(Boolean)))];
|
|
209
|
-
}
|
|
210
|
-
function getMedicationScalar(claims, claimKey) {
|
|
211
|
-
return normalizeClaimScalar(claims[claimKey]);
|
|
212
|
-
}
|
|
213
|
-
function setMedicationScalar(claims, claimKey, value) {
|
|
214
|
-
return {
|
|
215
|
-
...claims,
|
|
216
|
-
[claimKey]: normalizeClaimScalar(value),
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
function getMedicationNumber(claims, claimKey) {
|
|
220
|
-
const raw = claims[claimKey];
|
|
221
|
-
if (typeof raw === 'number' && Number.isFinite(raw)) {
|
|
222
|
-
return raw;
|
|
223
|
-
}
|
|
224
|
-
const normalized = normalizeClaimScalar(raw);
|
|
225
|
-
if (!normalized) {
|
|
226
|
-
return undefined;
|
|
227
|
-
}
|
|
228
|
-
const parsed = Number(normalized);
|
|
229
|
-
return Number.isFinite(parsed) ? parsed : undefined;
|
|
230
|
-
}
|
|
231
|
-
function setMedicationNumber(claims, claimKey, value) {
|
|
232
|
-
return {
|
|
233
|
-
...claims,
|
|
234
|
-
[claimKey]: value,
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
function getMedicationBoolean(claims, claimKey) {
|
|
238
|
-
const raw = claims[claimKey];
|
|
239
|
-
if (typeof raw === 'boolean') {
|
|
240
|
-
return raw;
|
|
241
|
-
}
|
|
242
|
-
const normalized = normalizeClaimScalar(raw).toLowerCase();
|
|
243
|
-
if (!normalized) {
|
|
244
|
-
return undefined;
|
|
245
|
-
}
|
|
246
|
-
if (normalized === 'true') {
|
|
247
|
-
return true;
|
|
248
|
-
}
|
|
249
|
-
if (normalized === 'false') {
|
|
250
|
-
return false;
|
|
251
|
-
}
|
|
252
|
-
return undefined;
|
|
253
|
-
}
|
|
254
|
-
function setMedicationBoolean(claims, claimKey, value) {
|
|
255
|
-
return {
|
|
256
|
-
...claims,
|
|
257
|
-
[claimKey]: value,
|
|
258
|
-
};
|
|
259
|
-
}
|
|
9
|
+
export * from './claims-helpers-medication-statement.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdc-common-utils-ts",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -102,10 +102,6 @@
|
|
|
102
102
|
"./storage/*": {
|
|
103
103
|
"types": "./dist/storage/*.d.ts",
|
|
104
104
|
"default": "./dist/storage/*.js"
|
|
105
|
-
},
|
|
106
|
-
"./adapters/node/crypto": {
|
|
107
|
-
"types": "./dist/adapters/node/crypto.d.ts",
|
|
108
|
-
"default": "./dist/adapters/node/crypto.js"
|
|
109
105
|
}
|
|
110
106
|
},
|
|
111
107
|
"files": [
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BundleEntry, BundleJsonApi } from '../models/bundle';
|
|
2
|
-
/**
|
|
3
|
-
* First developer use case:
|
|
4
|
-
* - edit a Consent entry inside a Communication-attached Bundle
|
|
5
|
-
* - keep active entry in memory
|
|
6
|
-
* - serialize full Bundle to Communication.content-attachment-data on save
|
|
7
|
-
* - release active entry memory when finished
|
|
8
|
-
*/
|
|
9
|
-
export declare function buildConsentEditingCommunicationSessionExample(): {
|
|
10
|
-
communicationClaims: Record<string, unknown>;
|
|
11
|
-
bundleInMemory: BundleJsonApi<BundleEntry>;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Second developer use case:
|
|
15
|
-
* - edit MedicationStatement claims to drive a health view
|
|
16
|
-
* - keep bundle attached to Communication as base64 payload
|
|
17
|
-
* - apply save/release lifecycle consistently
|
|
18
|
-
*/
|
|
19
|
-
export declare function buildMedicationEditingCommunicationSessionExample(): {
|
|
20
|
-
communicationClaims: Record<string, unknown>;
|
|
21
|
-
bundleInMemory: BundleJsonApi<BundleEntry>;
|
|
22
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Conectate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
|
|
2
|
-
// Always create JSDoc, do not use strings inline in keys nor values, use types instead, and reuse the data test examples.
|
|
3
|
-
import { HealthcareBasicSections } from '../constants/healthcare.js';
|
|
4
|
-
import { CommunicationCategoryCodes } from '../constants/communication.js';
|
|
5
|
-
import { MedicationStatementClaim } from '../models/interoperable-claims/medication-statement-claims.js';
|
|
6
|
-
import { EXAMPLE_COMMUNICATION_IDENTIFIER, EXAMPLE_CONSENT_DATE, EXAMPLE_CONSENT_IDENTIFIER, EXAMPLE_CONSENT_PERIOD_END, EXAMPLE_CONSENT_PERIOD_START, EXAMPLE_CONSENT_PURPOSE_TREATMENT, EXAMPLE_EMAIL_PROFESSIONAL, EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN, EXAMPLE_IPS_BUNDLE_NOTE_TEXT, EXAMPLE_MEDICATION_STATEMENT_IDENTIFIER, EXAMPLE_MEDICATION_STATEMENT_STATUS, EXAMPLE_MEDICATION_STATEMENT_TEXT, EXAMPLE_SUBJECT_DID, } from './shared.js';
|
|
7
|
-
import { CommunicationBundleSession } from '../utils/communication-bundle-session.js';
|
|
8
|
-
import { setCommunicationCategory, setCommunicationIdentifier, setCommunicationSubject, setCommunicationText, } from '../claims/claims-helpers-communication.js';
|
|
9
|
-
import { setActorIdentifierList, setActorRoleList, setConsentDate, setConsentDecision, setConsentIdentifier, setConsentPeriodEnd, setConsentPeriodStart, setConsentSubject, setPurposeList, setSectionList, } from '../claims/claims-helpers-consent.js';
|
|
10
|
-
/**
|
|
11
|
-
* First developer use case:
|
|
12
|
-
* - edit a Consent entry inside a Communication-attached Bundle
|
|
13
|
-
* - keep active entry in memory
|
|
14
|
-
* - serialize full Bundle to Communication.content-attachment-data on save
|
|
15
|
-
* - release active entry memory when finished
|
|
16
|
-
*/
|
|
17
|
-
export function buildConsentEditingCommunicationSessionExample() {
|
|
18
|
-
let communicationClaims = { '@context': 'org.hl7.fhir.r4' };
|
|
19
|
-
communicationClaims = setCommunicationIdentifier(communicationClaims, EXAMPLE_COMMUNICATION_IDENTIFIER);
|
|
20
|
-
communicationClaims = setCommunicationSubject(communicationClaims, EXAMPLE_SUBJECT_DID);
|
|
21
|
-
communicationClaims = setCommunicationCategory(communicationClaims, CommunicationCategoryCodes.Notification.attributeValue);
|
|
22
|
-
communicationClaims = setCommunicationText(communicationClaims, EXAMPLE_IPS_BUNDLE_NOTE_TEXT);
|
|
23
|
-
const bundleEditor = new CommunicationBundleSession({
|
|
24
|
-
communicationClaims,
|
|
25
|
-
});
|
|
26
|
-
let consentClaims = { '@context': 'org.hl7.fhir.api' };
|
|
27
|
-
consentClaims = setConsentDecision(consentClaims, 'permit');
|
|
28
|
-
consentClaims = setConsentSubject(consentClaims, EXAMPLE_SUBJECT_DID);
|
|
29
|
-
consentClaims = setConsentIdentifier(consentClaims, EXAMPLE_CONSENT_IDENTIFIER);
|
|
30
|
-
consentClaims = setConsentDate(consentClaims, EXAMPLE_CONSENT_DATE);
|
|
31
|
-
consentClaims = setConsentPeriodStart(consentClaims, EXAMPLE_CONSENT_PERIOD_START);
|
|
32
|
-
consentClaims = setConsentPeriodEnd(consentClaims, EXAMPLE_CONSENT_PERIOD_END);
|
|
33
|
-
consentClaims = setPurposeList(consentClaims, [EXAMPLE_CONSENT_PURPOSE_TREATMENT]);
|
|
34
|
-
consentClaims = setSectionList(consentClaims, [
|
|
35
|
-
HealthcareBasicSections.AllergiesAndIntolerances.attributeValue,
|
|
36
|
-
]);
|
|
37
|
-
consentClaims = setActorIdentifierList(consentClaims, [EXAMPLE_EMAIL_PROFESSIONAL]);
|
|
38
|
-
consentClaims = setActorRoleList(consentClaims, [EXAMPLE_HEALTHCARE_ACTOR_ROLE_PHYSICIAN]);
|
|
39
|
-
bundleEditor.upsertActiveConsentEntry({
|
|
40
|
-
claims: consentClaims,
|
|
41
|
-
fullUrl: `urn:uuid:${EXAMPLE_CONSENT_IDENTIFIER}`,
|
|
42
|
-
});
|
|
43
|
-
bundleEditor.saveAndReleaseActiveEntry();
|
|
44
|
-
return {
|
|
45
|
-
communicationClaims: bundleEditor.getCommunicationClaims(),
|
|
46
|
-
bundleInMemory: bundleEditor.getBundleInMemory(),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Second developer use case:
|
|
51
|
-
* - edit MedicationStatement claims to drive a health view
|
|
52
|
-
* - keep bundle attached to Communication as base64 payload
|
|
53
|
-
* - apply save/release lifecycle consistently
|
|
54
|
-
*/
|
|
55
|
-
export function buildMedicationEditingCommunicationSessionExample() {
|
|
56
|
-
let communicationClaims = { '@context': 'org.hl7.fhir.r4' };
|
|
57
|
-
communicationClaims = setCommunicationIdentifier(communicationClaims, EXAMPLE_COMMUNICATION_IDENTIFIER);
|
|
58
|
-
communicationClaims = setCommunicationSubject(communicationClaims, EXAMPLE_SUBJECT_DID);
|
|
59
|
-
communicationClaims = setCommunicationCategory(communicationClaims, CommunicationCategoryCodes.Reminder.attributeValue);
|
|
60
|
-
communicationClaims = setCommunicationText(communicationClaims, EXAMPLE_IPS_BUNDLE_NOTE_TEXT);
|
|
61
|
-
const bundleEditor = new CommunicationBundleSession({
|
|
62
|
-
communicationClaims,
|
|
63
|
-
});
|
|
64
|
-
bundleEditor.upsertActiveMedicationStatementEntry({
|
|
65
|
-
claims: {
|
|
66
|
-
'@context': 'org.hl7.fhir.api',
|
|
67
|
-
[MedicationStatementClaim.Identifier]: EXAMPLE_MEDICATION_STATEMENT_IDENTIFIER,
|
|
68
|
-
[MedicationStatementClaim.Subject]: EXAMPLE_SUBJECT_DID,
|
|
69
|
-
[MedicationStatementClaim.Status]: EXAMPLE_MEDICATION_STATEMENT_STATUS,
|
|
70
|
-
[MedicationStatementClaim.MedicationText]: EXAMPLE_MEDICATION_STATEMENT_TEXT,
|
|
71
|
-
},
|
|
72
|
-
fullUrl: `urn:uuid:${EXAMPLE_MEDICATION_STATEMENT_IDENTIFIER}`,
|
|
73
|
-
});
|
|
74
|
-
bundleEditor.saveAndReleaseActiveEntry();
|
|
75
|
-
return {
|
|
76
|
-
communicationClaims: bundleEditor.getCommunicationClaims(),
|
|
77
|
-
bundleInMemory: bundleEditor.getBundleInMemory(),
|
|
78
|
-
};
|
|
79
|
-
}
|