gdc-sdk-node-ts 2.0.5 → 2.0.7
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.
|
@@ -152,7 +152,7 @@ export class HttpRuntimeClient {
|
|
|
152
152
|
*
|
|
153
153
|
* Plaintext transport note:
|
|
154
154
|
* - this Node runtime currently submits `_activate` as
|
|
155
|
-
* `application/didcomm-
|
|
155
|
+
* `application/didcomm-plain+json`
|
|
156
156
|
* - because there is no real outer JWS/JWE envelope in that mode, the
|
|
157
157
|
* runtime mirrors the technical communication metadata derived from
|
|
158
158
|
* `controller.publicKeyJwk` / `controller.jwks` into `meta.jws.protected`
|
|
@@ -173,7 +173,7 @@ export class HttpRuntimeClient {
|
|
|
173
173
|
const serviceClaims = activationDraft.buildServiceClaims();
|
|
174
174
|
const transportMeta = buildDidcommPlaintextTransportMetadata({
|
|
175
175
|
controller: input.controller,
|
|
176
|
-
contentType: 'application/didcomm-
|
|
176
|
+
contentType: 'application/didcomm-plain+json',
|
|
177
177
|
});
|
|
178
178
|
const payload = {
|
|
179
179
|
thid,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { CommunicationAttachedBundleSession, IndividualBundleVault, buildVitalSignObservationClaims, createSummaryOperationRequestParameters, createSummaryOperationRequestParametersResource, summarizeClinicalBundle, toClinicalResourceExpandedViews, type BuildVitalSignObservationClaimsInput } from 'gdc-common-utils-ts';
|
|
2
|
+
import { type FhirDocumentFacade, type FhirBundleEntryLike, type FhirDocumentEntryQuery, type FhirDocumentSection, type FhirDocumentFamilyQuery, type FhirDocumentResourceQuery, type FhirDocumentSectionCounts, type FhirDocumentSectionSummary, type FhirResourceLike } from 'gdc-sdk-core-ts';
|
|
2
3
|
import type { BackendOrganizationControllerProfile, BackendProfessionalProfile } from './backend-profile-runtime.js';
|
|
4
|
+
type LocalTextAndIntDisplay = ReturnType<FhirDocumentFacade['getLocalTextAndIntDisplay']>;
|
|
5
|
+
type NarrativeResult = ReturnType<FhirDocumentFacade['getNarrative']>;
|
|
3
6
|
export type IpsRequestDraft = Readonly<{
|
|
4
7
|
subjectId: string;
|
|
5
8
|
purpose?: string;
|
|
@@ -13,11 +16,74 @@ export type ProcessedClinicalBundleResponse = Readonly<{
|
|
|
13
16
|
totalSections: number;
|
|
14
17
|
totalResources: number;
|
|
15
18
|
totalResourcesInSection: Readonly<Record<string, number>>;
|
|
16
|
-
totalNarratives: number;
|
|
17
|
-
totalNotes: number;
|
|
18
19
|
summary: ReturnType<typeof summarizeClinicalBundle>;
|
|
19
20
|
views: ReturnType<typeof toClinicalResourceExpandedViews>;
|
|
21
|
+
sectionCounts: FhirDocumentSectionCounts;
|
|
22
|
+
sectionSummary: FhirDocumentSectionSummary;
|
|
23
|
+
getSections: () => FhirDocumentSection[];
|
|
24
|
+
getEntries: (input?: FhirDocumentEntryQuery) => FhirBundleEntryLike[];
|
|
25
|
+
getResources: (query?: string | FhirDocumentResourceQuery) => FhirResourceLike[];
|
|
26
|
+
getByDates: (query: string | FhirDocumentResourceQuery, start?: string, end?: string) => FhirResourceLike[];
|
|
27
|
+
getSectionCounts: (input?: {
|
|
28
|
+
sections?: readonly string[];
|
|
29
|
+
}) => FhirDocumentSectionCounts;
|
|
30
|
+
getSectionSummary: (input?: {
|
|
31
|
+
sections?: readonly string[];
|
|
32
|
+
}) => FhirDocumentSectionSummary;
|
|
33
|
+
getLocalTextAndIntDisplay: (resourceOrEntry: FhirResourceLike | FhirBundleEntryLike) => LocalTextAndIntDisplay;
|
|
34
|
+
getXhtmlOrDerived: (resourceOrEntry: FhirResourceLike | FhirBundleEntryLike) => string | undefined;
|
|
35
|
+
getNarrative: (resourceOrEntry: FhirResourceLike | FhirBundleEntryLike) => NarrativeResult;
|
|
36
|
+
getAllergies: (query?: FhirDocumentFamilyQuery & {
|
|
37
|
+
clinicalStatus?: readonly string[];
|
|
38
|
+
verificationStatus?: readonly string[];
|
|
39
|
+
criticality?: readonly string[];
|
|
40
|
+
}) => FhirBundleEntryLike[];
|
|
41
|
+
getConditions: (query?: FhirDocumentFamilyQuery & {
|
|
42
|
+
clinicalStatus?: readonly string[];
|
|
43
|
+
verificationStatus?: readonly string[];
|
|
44
|
+
severity?: readonly string[];
|
|
45
|
+
}) => FhirBundleEntryLike[];
|
|
46
|
+
getMedications: (query?: FhirDocumentFamilyQuery & {
|
|
47
|
+
status?: readonly string[];
|
|
48
|
+
}) => FhirBundleEntryLike[];
|
|
49
|
+
getVitalSigns: (query?: FhirDocumentFamilyQuery & {
|
|
50
|
+
code?: readonly string[];
|
|
51
|
+
}) => FhirBundleEntryLike[];
|
|
52
|
+
reader: ClinicalBundleQueryBuilder;
|
|
20
53
|
}>;
|
|
54
|
+
export type ClinicalBundleQueryBuilder = Readonly<{
|
|
55
|
+
allSections: () => ClinicalBundleQueryBuilder;
|
|
56
|
+
inSections: (sections?: readonly string[]) => ClinicalBundleQueryBuilder;
|
|
57
|
+
between: (start?: string, end?: string) => ClinicalBundleQueryBuilder;
|
|
58
|
+
matchingText: (searchText?: string) => ClinicalBundleQueryBuilder;
|
|
59
|
+
paginate: (input?: {
|
|
60
|
+
count?: number;
|
|
61
|
+
page?: number;
|
|
62
|
+
offset?: number;
|
|
63
|
+
}) => ClinicalBundleQueryBuilder;
|
|
64
|
+
getEntries: (resourceTypes?: readonly string[]) => FhirBundleEntryLike[];
|
|
65
|
+
getResources: (resourceType?: string) => FhirResourceLike[];
|
|
66
|
+
getAllergies: (query?: {
|
|
67
|
+
clinicalStatus?: readonly string[];
|
|
68
|
+
verificationStatus?: readonly string[];
|
|
69
|
+
criticality?: readonly string[];
|
|
70
|
+
}) => FhirBundleEntryLike[];
|
|
71
|
+
getConditions: (query?: {
|
|
72
|
+
clinicalStatus?: readonly string[];
|
|
73
|
+
verificationStatus?: readonly string[];
|
|
74
|
+
severity?: readonly string[];
|
|
75
|
+
}) => FhirBundleEntryLike[];
|
|
76
|
+
getMedications: (query?: {
|
|
77
|
+
status?: readonly string[];
|
|
78
|
+
}) => FhirBundleEntryLike[];
|
|
79
|
+
getVitalSigns: (query?: {
|
|
80
|
+
code?: readonly string[];
|
|
81
|
+
}) => FhirBundleEntryLike[];
|
|
82
|
+
getSectionCounts: () => FhirDocumentSectionCounts;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Builds one reusable high-level clinical response view over the bundle body.
|
|
86
|
+
*/
|
|
21
87
|
declare function buildProcessedClinicalBundleResponse(body: unknown): ProcessedClinicalBundleResponse;
|
|
22
88
|
declare class ProfessionalSubjectIpsWorkspace {
|
|
23
89
|
private readonly subjectId;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
-
import { CommunicationAttachedBundleSession, IndividualBundleVault, VaultMemRepository, buildVitalSignObservationClaims, createConsentAccessEditor, createInvoiceBundleEditor, createSummaryOperationRequestParameters, createSummaryOperationRequestParametersResource, createSummaryOperationRequestReferencePath, readEmployeeSearchResults, summarizeClinicalBundle, summarizeLicenseListRecords, toClinicalResourceExpandedViews, } from 'gdc-common-utils-ts';
|
|
2
|
+
import { CommunicationAttachedBundleSession, IndividualBundleVault, VaultMemRepository, buildVitalSignObservationClaims, buildBundleDocumentFromClaims, createConsentAccessEditor, createInvoiceBundleEditor, createSummaryOperationRequestParameters, createSummaryOperationRequestParametersResource, createSummaryOperationRequestReferencePath, extractResourceMetaClaimsFromBundle, readEmployeeSearchResults, summarizeClinicalBundle, summarizeLicenseListRecords, toClinicalResourceExpandedViews, } from 'gdc-common-utils-ts';
|
|
3
|
+
import { createFhirDocumentFacade, } from 'gdc-sdk-core-ts';
|
|
3
4
|
function normalizeSectionList(sectionList) {
|
|
4
5
|
return Array.from(new Set((sectionList || []).map((item) => String(item || '').trim()).filter(Boolean)));
|
|
5
6
|
}
|
|
@@ -21,19 +22,121 @@ function buildClinicalSectionCounts(views) {
|
|
|
21
22
|
}
|
|
22
23
|
return out;
|
|
23
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Normalizes the shared claims-first bundle examples into one FHIR document
|
|
27
|
+
* bundle so the section-aware facade can read `Composition.section` without
|
|
28
|
+
* teaching raw claim plumbing to SDK consumers.
|
|
29
|
+
*/
|
|
30
|
+
function normalizeClinicalDocumentBundle(bundle) {
|
|
31
|
+
if (bundle?.resourceType === 'Bundle' && Array.isArray(bundle?.entry)) {
|
|
32
|
+
return bundle;
|
|
33
|
+
}
|
|
34
|
+
const claimsList = extractResourceMetaClaimsFromBundle(bundle).map((item) => item.claims);
|
|
35
|
+
if (claimsList.length === 0) {
|
|
36
|
+
return bundle;
|
|
37
|
+
}
|
|
38
|
+
const subjectDid = claimsList
|
|
39
|
+
.map((claims) => {
|
|
40
|
+
const subjectKeys = Object.keys(claims).filter((key) => String(key || '').toLowerCase().endsWith('.subject'));
|
|
41
|
+
for (const key of subjectKeys) {
|
|
42
|
+
const value = claims[key];
|
|
43
|
+
if (typeof value === 'string' && value.trim())
|
|
44
|
+
return value.trim();
|
|
45
|
+
}
|
|
46
|
+
return '';
|
|
47
|
+
})
|
|
48
|
+
.find(Boolean);
|
|
49
|
+
return buildBundleDocumentFromClaims({
|
|
50
|
+
claimsList,
|
|
51
|
+
...(subjectDid ? { subjectDid } : {}),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates one immutable high-level reader that keeps section/date/text/paging
|
|
56
|
+
* filters chainable across generic and family-specific clinical queries.
|
|
57
|
+
*/
|
|
58
|
+
function createClinicalBundleQueryBuilder(facade, state = {}) {
|
|
59
|
+
const next = (patch) => createClinicalBundleQueryBuilder(facade, {
|
|
60
|
+
...state,
|
|
61
|
+
...patch,
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
allSections: () => next({ sections: [] }),
|
|
65
|
+
inSections: (sections) => next({ sections: sections ? [...sections] : [] }),
|
|
66
|
+
between: (start, end) => next({ start, end }),
|
|
67
|
+
matchingText: (searchText) => next({ searchText }),
|
|
68
|
+
paginate: (input) => next({
|
|
69
|
+
count: input?.count,
|
|
70
|
+
page: input?.page,
|
|
71
|
+
offset: input?.offset,
|
|
72
|
+
}),
|
|
73
|
+
getEntries: (resourceTypes) => facade.getEntries({
|
|
74
|
+
sections: state.sections,
|
|
75
|
+
resourceTypes,
|
|
76
|
+
start: state.start,
|
|
77
|
+
end: state.end,
|
|
78
|
+
searchText: state.searchText,
|
|
79
|
+
count: state.count,
|
|
80
|
+
page: state.page,
|
|
81
|
+
offset: state.offset,
|
|
82
|
+
}),
|
|
83
|
+
getResources: (resourceType) => facade.getResources({
|
|
84
|
+
...state,
|
|
85
|
+
...(resourceType ? { resourceType } : {}),
|
|
86
|
+
}),
|
|
87
|
+
getAllergies: (query = {}) => facade.getAllergies({
|
|
88
|
+
...state,
|
|
89
|
+
...query,
|
|
90
|
+
}),
|
|
91
|
+
getConditions: (query = {}) => facade.getConditions({
|
|
92
|
+
...state,
|
|
93
|
+
...query,
|
|
94
|
+
}),
|
|
95
|
+
getMedications: (query = {}) => facade.getMedications({
|
|
96
|
+
...state,
|
|
97
|
+
...query,
|
|
98
|
+
}),
|
|
99
|
+
getVitalSigns: (query = {}) => facade.getVitalSigns({
|
|
100
|
+
...state,
|
|
101
|
+
...query,
|
|
102
|
+
}),
|
|
103
|
+
getSectionCounts: () => facade.getSectionCounts({ sections: state.sections }),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Builds one reusable high-level clinical response view over the bundle body.
|
|
108
|
+
*/
|
|
24
109
|
function buildProcessedClinicalBundleResponse(body) {
|
|
25
110
|
const bundle = unwrapBody(body);
|
|
26
111
|
const views = toClinicalResourceExpandedViews(bundle);
|
|
27
112
|
const summary = summarizeClinicalBundle(bundle);
|
|
113
|
+
const documentFacade = createFhirDocumentFacade(normalizeClinicalDocumentBundle(bundle));
|
|
114
|
+
const reader = createClinicalBundleQueryBuilder(documentFacade);
|
|
115
|
+
const sectionCounts = documentFacade.getSectionCounts();
|
|
116
|
+
const sectionSummary = documentFacade.getSectionSummary();
|
|
28
117
|
return {
|
|
29
118
|
totalErrors: 0,
|
|
30
119
|
totalSections: Object.keys(buildClinicalSectionCounts(views)).length,
|
|
31
120
|
totalResources: summary.totalEntries,
|
|
32
121
|
totalResourcesInSection: buildClinicalSectionCounts(views),
|
|
33
|
-
totalNarratives: summary.xhtmlEntries,
|
|
34
|
-
totalNotes: summary.notedEntries,
|
|
35
122
|
summary,
|
|
36
123
|
views,
|
|
124
|
+
sectionCounts,
|
|
125
|
+
sectionSummary,
|
|
126
|
+
getSections: () => documentFacade.getSections(),
|
|
127
|
+
getEntries: (input) => documentFacade.getEntries(input),
|
|
128
|
+
getResources: (query) => documentFacade.getResources(query),
|
|
129
|
+
getByDates: (query, start, end) => documentFacade.getByDates(query, start, end),
|
|
130
|
+
getSectionCounts: (input) => documentFacade.getSectionCounts(input),
|
|
131
|
+
getSectionSummary: (input) => documentFacade.getSectionSummary(input),
|
|
132
|
+
getLocalTextAndIntDisplay: (resourceOrEntry) => documentFacade.getLocalTextAndIntDisplay(resourceOrEntry),
|
|
133
|
+
getXhtmlOrDerived: (resourceOrEntry) => documentFacade.getXhtmlOrDerived(resourceOrEntry),
|
|
134
|
+
getNarrative: (resourceOrEntry) => documentFacade.getNarrative(resourceOrEntry),
|
|
135
|
+
getAllergies: (query = {}) => documentFacade.getAllergies(query),
|
|
136
|
+
getConditions: (query = {}) => documentFacade.getConditions(query),
|
|
137
|
+
getMedications: (query = {}) => documentFacade.getMedications(query),
|
|
138
|
+
getVitalSigns: (query = {}) => documentFacade.getVitalSigns(query),
|
|
139
|
+
reader,
|
|
37
140
|
};
|
|
38
141
|
}
|
|
39
142
|
class ProfessionalSubjectIpsWorkspace {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdc-sdk-node-ts",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "Next-generation Node runtime package for the GDC SDK family",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Antifraud Services Inc.",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"test:e2e:live-gw:clean": "bash ./scripts/run-live-gw-clean.sh"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"gdc-common-utils-ts": "^2.0.
|
|
35
|
-
"gdc-sdk-core-ts": "^
|
|
34
|
+
"gdc-common-utils-ts": "^2.0.7",
|
|
35
|
+
"gdc-sdk-core-ts": "^2.0.6"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^20.14.10",
|