vet-sdk-core-ts 0.4.5 → 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 +4 -4
- package/dist/gateway-contract.d.ts +5 -4
- package/dist/gateway-contract.js +25 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,17 +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
70
|
resource is `ResearchSubject`, so the Node SDK sends
|
|
71
71
|
`POST digitaltwin/.../ResearchSubject/_search`; the `Composition.*` fields
|
|
72
|
-
|
|
72
|
+
inside GW index the canonical Composition embedded in that ResearchSubject.
|
|
73
73
|
|
|
74
74
|
```ts
|
|
75
75
|
const request = buildVeterinaryDigitalTwinSearchRequest({
|
|
76
76
|
thid: crypto.randomUUID(),
|
|
77
|
-
search: { section,
|
|
77
|
+
search: { section, text, dateFrom, ...(dateTo ? { dateTo } : {}) },
|
|
78
78
|
})
|
|
79
79
|
|
|
80
80
|
await digitalTwins.search(routeContext, {
|
|
@@ -86,10 +86,11 @@ export declare function buildVeterinaryBreakGlassSmartRequest(input: Readonly<{
|
|
|
86
86
|
audience: string;
|
|
87
87
|
}>): VeterinaryBreakGlassSmartRequest;
|
|
88
88
|
/**
|
|
89
|
-
* Converts browser-safe
|
|
90
|
-
*
|
|
91
|
-
* ResearchSubject;
|
|
92
|
-
* Composition index. Callers never choose
|
|
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.
|
|
93
94
|
*/
|
|
94
95
|
export declare function buildVeterinaryDigitalTwinSearchRequest(input: Readonly<{
|
|
95
96
|
thid: string;
|
package/dist/gateway-contract.js
CHANGED
|
@@ -60,42 +60,39 @@ export function buildVeterinaryBreakGlassSmartRequest(input) {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
|
-
* Converts browser-safe
|
|
64
|
-
*
|
|
65
|
-
* ResearchSubject;
|
|
66
|
-
* Composition index. Callers never choose
|
|
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.
|
|
67
68
|
*/
|
|
68
69
|
export function buildVeterinaryDigitalTwinSearchRequest(input) {
|
|
69
|
-
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
|
+
});
|
|
70
77
|
const format = input.format || VeterinaryDigitalTwinFormats.R4;
|
|
71
78
|
const parameter = [
|
|
72
|
-
{ name: '
|
|
79
|
+
{ name: 'section', valueString: search.section },
|
|
80
|
+
{ name: 'text', valueString: search.text },
|
|
81
|
+
{ name: 'date-from', valueDate: search.dateFrom },
|
|
73
82
|
];
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
const filters = {};
|
|
84
|
-
for (const item of parameter) {
|
|
85
|
-
const existing = filters[item.name];
|
|
86
|
-
if (!existing)
|
|
87
|
-
filters[item.name] = item.valueString;
|
|
88
|
-
else if (Array.isArray(existing))
|
|
89
|
-
existing.push(item.valueString);
|
|
90
|
-
else
|
|
91
|
-
filters[item.name] = [existing, item.valueString];
|
|
92
|
-
}
|
|
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
|
+
};
|
|
93
91
|
return Object.freeze({
|
|
94
92
|
format,
|
|
95
93
|
filters: Object.freeze(filters),
|
|
96
|
-
// ResearchSubject is the public twin.
|
|
97
|
-
//
|
|
98
|
-
// those filters never change the asynchronous route resource type.
|
|
94
|
+
// ResearchSubject is the public twin. GW searches the embedded canonical
|
|
95
|
+
// Composition and derived clinical index; the route type never changes.
|
|
99
96
|
resourceType: 'ResearchSubject',
|
|
100
97
|
payload: {
|
|
101
98
|
thid: bounded(input.thid, 'thid'),
|
package/package.json
CHANGED