vet-sdk-core-ts 0.4.4 → 0.4.6
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 -3
- package/dist/gateway-contract.d.ts +6 -4
- package/dist/gateway-contract.js +27 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,14 +64,17 @@ findVetChainSpeciesByTaxonomyId("9685")?.key; // "Cat"
|
|
|
64
64
|
## Digital-twin search
|
|
65
65
|
|
|
66
66
|
`buildVeterinaryDigitalTwinSearchRequest` accepts only one governed section,
|
|
67
|
-
|
|
67
|
+
free text and dates. It returns both the basic FHIR
|
|
68
68
|
`Parameters` body and the `filters` map for `DigitalTwinSdk.search`; callers do
|
|
69
|
-
not author `Composition.section
|
|
69
|
+
not author `Composition.section`, resource families or flat claim names. The returned public
|
|
70
|
+
resource is `ResearchSubject`, so the Node SDK sends
|
|
71
|
+
`POST digitaltwin/.../ResearchSubject/_search`; the `Composition.*` fields
|
|
72
|
+
inside GW index the canonical Composition embedded in that ResearchSubject.
|
|
70
73
|
|
|
71
74
|
```ts
|
|
72
75
|
const request = buildVeterinaryDigitalTwinSearchRequest({
|
|
73
76
|
thid: crypto.randomUUID(),
|
|
74
|
-
search: { section,
|
|
77
|
+
search: { section, text, dateFrom, ...(dateTo ? { dateTo } : {}) },
|
|
75
78
|
})
|
|
76
79
|
|
|
77
80
|
await digitalTwins.search(routeContext, {
|
|
@@ -48,7 +48,7 @@ export type VeterinaryBreakGlassSmartAuthorization = Readonly<{
|
|
|
48
48
|
}>;
|
|
49
49
|
export type VeterinaryDigitalTwinSearchRequest = Readonly<{
|
|
50
50
|
format: VeterinaryDigitalTwinFormat;
|
|
51
|
-
resourceType: '
|
|
51
|
+
resourceType: 'ResearchSubject';
|
|
52
52
|
filters: Readonly<Record<string, string | readonly string[]>>;
|
|
53
53
|
payload: Readonly<{
|
|
54
54
|
thid: string;
|
|
@@ -86,9 +86,11 @@ export declare function buildVeterinaryBreakGlassSmartRequest(input: Readonly<{
|
|
|
86
86
|
audience: string;
|
|
87
87
|
}>): VeterinaryBreakGlassSmartRequest;
|
|
88
88
|
/**
|
|
89
|
-
* Converts browser-safe
|
|
90
|
-
*
|
|
91
|
-
*
|
|
89
|
+
* Converts browser-safe section, text and date values into the basic FHIR
|
|
90
|
+
* Parameters accepted by the Node DigitalTwin SDK. The public resource is a
|
|
91
|
+
* ResearchSubject; GW applies these business filters to its embedded canonical
|
|
92
|
+
* Composition and derived clinical index. Callers never choose claim names or
|
|
93
|
+
* clinical resource families; coded search can be added as a separate profile.
|
|
92
94
|
*/
|
|
93
95
|
export declare function buildVeterinaryDigitalTwinSearchRequest(input: Readonly<{
|
|
94
96
|
thid: string;
|
package/dist/gateway-contract.js
CHANGED
|
@@ -60,46 +60,44 @@ export function buildVeterinaryBreakGlassSmartRequest(input) {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Converts browser-safe
|
|
64
|
-
*
|
|
65
|
-
*
|
|
63
|
+
* Converts browser-safe section, text and date values into the basic FHIR
|
|
64
|
+
* Parameters accepted by the Node DigitalTwin SDK. The public resource is a
|
|
65
|
+
* ResearchSubject; GW applies these business filters to its embedded canonical
|
|
66
|
+
* Composition and derived clinical index. Callers never choose claim names or
|
|
67
|
+
* clinical resource families; coded search can be added as a separate profile.
|
|
66
68
|
*/
|
|
67
69
|
export function buildVeterinaryDigitalTwinSearchRequest(input) {
|
|
68
|
-
const
|
|
70
|
+
const rawSearch = (input.search || {});
|
|
71
|
+
const requestedSection = String(rawSearch.section || '').trim();
|
|
72
|
+
const defaultProfile = (VeterinaryDigitalTwinSectionSearchProfiles[requestedSection] || [])[0];
|
|
73
|
+
const search = parseVeterinaryDigitalTwinSearch({
|
|
74
|
+
...rawSearch,
|
|
75
|
+
resourceTypes: defaultProfile ? [defaultProfile.resourceType] : [],
|
|
76
|
+
});
|
|
69
77
|
const format = input.format || VeterinaryDigitalTwinFormats.R4;
|
|
70
78
|
const parameter = [
|
|
71
|
-
{ name: '
|
|
79
|
+
{ name: 'section', valueString: search.section },
|
|
80
|
+
{ name: 'text', valueString: search.text },
|
|
81
|
+
{ name: 'date-from', valueDate: search.dateFrom },
|
|
72
82
|
];
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
const filters = {};
|
|
83
|
-
for (const item of parameter) {
|
|
84
|
-
const existing = filters[item.name];
|
|
85
|
-
if (!existing)
|
|
86
|
-
filters[item.name] = item.valueString;
|
|
87
|
-
else if (Array.isArray(existing))
|
|
88
|
-
existing.push(item.valueString);
|
|
89
|
-
else
|
|
90
|
-
filters[item.name] = [existing, item.valueString];
|
|
91
|
-
}
|
|
83
|
+
if (search.dateTo)
|
|
84
|
+
parameter.push({ name: 'date-to', valueDate: search.dateTo });
|
|
85
|
+
const filters = {
|
|
86
|
+
section: search.section,
|
|
87
|
+
text: search.text,
|
|
88
|
+
'date-from': search.dateFrom,
|
|
89
|
+
...(search.dateTo ? { 'date-to': search.dateTo } : {}),
|
|
90
|
+
};
|
|
92
91
|
return Object.freeze({
|
|
93
92
|
format,
|
|
94
93
|
filters: Object.freeze(filters),
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
resourceType: 'Composition',
|
|
94
|
+
// ResearchSubject is the public twin. GW searches the embedded canonical
|
|
95
|
+
// Composition and derived clinical index; the route type never changes.
|
|
96
|
+
resourceType: 'ResearchSubject',
|
|
99
97
|
payload: {
|
|
100
98
|
thid: bounded(input.thid, 'thid'),
|
|
101
99
|
body: format === VeterinaryDigitalTwinFormats.Api
|
|
102
|
-
? { data: [{ type: '
|
|
100
|
+
? { data: [{ type: 'ResearchSubject-search-request-v1.0', resource: { resourceType: 'Parameters', parameter } }] }
|
|
103
101
|
: { resourceType: 'Parameters', parameter },
|
|
104
102
|
},
|
|
105
103
|
});
|
package/package.json
CHANGED