@metriport/fhir-sdk 1.6.2 → 1.6.3
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/dist/__tests__/careplan.test.js +24 -22
- package/dist/__tests__/careplan.test.js.map +1 -1
- package/dist/__tests__/clinical-dates.test.js +25 -23
- package/dist/__tests__/clinical-dates.test.js.map +1 -1
- package/dist/__tests__/coding-utilities.test.js +9 -7
- package/dist/__tests__/coding-utilities.test.js.map +1 -1
- package/dist/__tests__/date-range-performance.test.js +4 -2
- package/dist/__tests__/date-range-performance.test.js.map +1 -1
- package/dist/__tests__/date-range-search.test.js +15 -13
- package/dist/__tests__/date-range-search.test.js.map +1 -1
- package/dist/__tests__/env-setup.js +32 -4
- package/dist/__tests__/env-setup.js.map +1 -1
- package/dist/__tests__/fhir-bundle-sdk-basic.test.js +6 -4
- package/dist/__tests__/fhir-bundle-sdk-basic.test.js.map +1 -1
- package/dist/__tests__/fhir-bundle-sdk.test.js +87 -85
- package/dist/__tests__/fhir-bundle-sdk.test.js.map +1 -1
- package/dist/__tests__/fixtures/fhir-bundles.d.ts +1 -1
- package/dist/__tests__/fixtures/fhir-bundles.d.ts.map +1 -1
- package/dist/__tests__/fixtures/fhir-bundles.js +17 -11
- package/dist/__tests__/fixtures/fhir-bundles.js.map +1 -1
- package/dist/__tests__/phase1-verification.test.js +12 -10
- package/dist/__tests__/phase1-verification.test.js.map +1 -1
- package/dist/__tests__/phase2-verification.test.js +16 -14
- package/dist/__tests__/phase2-verification.test.js.map +1 -1
- package/dist/__tests__/phase3-verification.test.js +17 -15
- package/dist/__tests__/phase3-verification.test.js.map +1 -1
- package/dist/__tests__/phase4-verification.test.js +29 -27
- package/dist/__tests__/phase4-verification.test.js.map +1 -1
- package/dist/__tests__/phase5-verification.test.js +40 -38
- package/dist/__tests__/phase5-verification.test.js.map +1 -1
- package/dist/__tests__/reverse-references.test.js +31 -29
- package/dist/__tests__/reverse-references.test.js.map +1 -1
- package/dist/__tests__/type-guards.test.js +54 -132
- package/dist/__tests__/type-guards.test.js.map +1 -1
- package/dist/clinical-dates.js +5 -1
- package/dist/clinical-dates.js.map +1 -1
- package/dist/fhir-bundle-sdk.js +38 -34
- package/dist/fhir-bundle-sdk.js.map +1 -1
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/bundle-operations.js +9 -3
- package/dist/internal/bundle-operations.js.map +1 -1
- package/dist/internal/coding-systems.d.ts +12 -12
- package/dist/internal/coding-systems.js +18 -15
- package/dist/internal/coding-systems.js.map +1 -1
- package/dist/internal/coding-utilities.js +23 -15
- package/dist/internal/coding-utilities.js.map +1 -1
- package/dist/internal/date-extraction.js +7 -2
- package/dist/internal/date-extraction.js.map +1 -1
- package/dist/internal/graph-traversal.js +7 -3
- package/dist/internal/graph-traversal.js.map +1 -1
- package/dist/internal/indexing.js +15 -9
- package/dist/internal/indexing.js.map +1 -1
- package/dist/internal/llm-context.js +17 -8
- package/dist/internal/llm-context.js.map +1 -1
- package/dist/internal/reference-resolution.js +32 -25
- package/dist/internal/reference-resolution.js.map +1 -1
- package/dist/internal/reference-utils.js +11 -4
- package/dist/internal/reference-utils.js.map +1 -1
- package/dist/internal/transparent-proxy.js +14 -10
- package/dist/internal/transparent-proxy.js.map +1 -1
- package/dist/internal/validation.js +8 -4
- package/dist/internal/validation.js.map +1 -1
- package/dist/type-guards.d.ts +134 -105
- package/dist/type-guards.d.ts.map +1 -1
- package/dist/type-guards.js +322 -26
- package/dist/type-guards.js.map +1 -1
- package/dist/types/coding-fields.js +2 -1
- package/dist/types/sdk-types.js +5 -1
- package/dist/types/sdk-types.js.map +1 -1
- package/dist/types/smart-resources.js +10 -5
- package/dist/types/smart-resources.js.map +1 -1
- package/dist/utils/interval-tree/index.js +19 -10
- package/dist/utils/interval-tree/index.js.map +1 -1
- package/dist/utils/interval-tree/shallowequal/arrays.js +4 -1
- package/dist/utils/interval-tree/shallowequal/arrays.js.map +1 -1
- package/dist/utils/interval-tree/shallowequal/index.js +13 -5
- package/dist/utils/interval-tree/shallowequal/index.js.map +1 -1
- package/dist/utils/interval-tree/shallowequal/objects.js +4 -1
- package/dist/utils/interval-tree/shallowequal/objects.js.map +1 -1
- package/package.json +1 -1
package/dist/type-guards.js
CHANGED
|
@@ -1,79 +1,375 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPlainServiceRequest = exports.isPlainRiskAssessment = exports.isPlainRelatedPerson = exports.isPlainProcedure = exports.isPlainMedicationStatement = exports.isPlainMedicationRequest = exports.isPlainMedicationDispense = exports.isPlainMedicationAdministration = exports.isPlainMedication = exports.isPlainImmunization = exports.isPlainFamilyMemberHistory = exports.isPlainDocumentReference = exports.isPlainCoverage = exports.isPlainComposition = exports.isPlainCondition = exports.isPlainAllergyIntolerance = exports.isPlainLocation = exports.isPlainOrganization = exports.isPlainPractitionerRole = exports.isPlainPractitioner = exports.isPlainEncounter = exports.isPlainDiagnosticReport = exports.isPlainObservation = exports.isPlainPatient = exports.isBundle = exports.isCarePlan = exports.isServiceRequest = exports.isRiskAssessment = exports.isRelatedPerson = exports.isProcedure = exports.isMedicationStatement = exports.isMedicationRequest = exports.isMedicationDispense = exports.isMedicationAdministration = exports.isMedication = exports.isImmunization = exports.isFamilyMemberHistory = exports.isDocumentReference = exports.isCoverage = exports.isComposition = exports.isCondition = exports.isAllergyIntolerance = exports.isLocation = exports.isOrganization = exports.isPractitionerRole = exports.isPractitioner = exports.isEncounter = exports.isDiagnosticReport = exports.isObservation = exports.isPatient = void 0;
|
|
4
|
+
exports.isPlainBundle = exports.isPlainCarePlan = void 0;
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Smart Resource Type Guards (for SDK resources)
|
|
7
|
+
// =============================================================================
|
|
8
|
+
/**
|
|
9
|
+
* Patient type guard for Smart resources
|
|
10
|
+
*/
|
|
11
|
+
function isPatient(resource) {
|
|
2
12
|
return resource?.resourceType === "Patient";
|
|
3
13
|
}
|
|
4
|
-
|
|
14
|
+
exports.isPatient = isPatient;
|
|
15
|
+
/**
|
|
16
|
+
* Observation type guard for Smart resources
|
|
17
|
+
*/
|
|
18
|
+
function isObservation(resource) {
|
|
5
19
|
return resource?.resourceType === "Observation";
|
|
6
20
|
}
|
|
7
|
-
|
|
21
|
+
exports.isObservation = isObservation;
|
|
22
|
+
/**
|
|
23
|
+
* DiagnosticReport type guard for Smart resources
|
|
24
|
+
*/
|
|
25
|
+
function isDiagnosticReport(resource) {
|
|
8
26
|
return resource?.resourceType === "DiagnosticReport";
|
|
9
27
|
}
|
|
10
|
-
|
|
28
|
+
exports.isDiagnosticReport = isDiagnosticReport;
|
|
29
|
+
/**
|
|
30
|
+
* Encounter type guard for Smart resources
|
|
31
|
+
*/
|
|
32
|
+
function isEncounter(resource) {
|
|
11
33
|
return resource?.resourceType === "Encounter";
|
|
12
34
|
}
|
|
13
|
-
|
|
35
|
+
exports.isEncounter = isEncounter;
|
|
36
|
+
/**
|
|
37
|
+
* Practitioner type guard for Smart resources
|
|
38
|
+
*/
|
|
39
|
+
function isPractitioner(resource) {
|
|
14
40
|
return resource?.resourceType === "Practitioner";
|
|
15
41
|
}
|
|
16
|
-
|
|
42
|
+
exports.isPractitioner = isPractitioner;
|
|
43
|
+
/**
|
|
44
|
+
* PractitionerRole type guard for Smart resources
|
|
45
|
+
*/
|
|
46
|
+
function isPractitionerRole(resource) {
|
|
17
47
|
return resource?.resourceType === "PractitionerRole";
|
|
18
48
|
}
|
|
19
|
-
|
|
49
|
+
exports.isPractitionerRole = isPractitionerRole;
|
|
50
|
+
/**
|
|
51
|
+
* Organization type guard for Smart resources
|
|
52
|
+
*/
|
|
53
|
+
function isOrganization(resource) {
|
|
20
54
|
return resource?.resourceType === "Organization";
|
|
21
55
|
}
|
|
22
|
-
|
|
56
|
+
exports.isOrganization = isOrganization;
|
|
57
|
+
/**
|
|
58
|
+
* Location type guard for Smart resources
|
|
59
|
+
*/
|
|
60
|
+
function isLocation(resource) {
|
|
23
61
|
return resource?.resourceType === "Location";
|
|
24
62
|
}
|
|
25
|
-
|
|
63
|
+
exports.isLocation = isLocation;
|
|
64
|
+
/**
|
|
65
|
+
* AllergyIntolerance type guard for Smart resources
|
|
66
|
+
*/
|
|
67
|
+
function isAllergyIntolerance(resource) {
|
|
26
68
|
return resource?.resourceType === "AllergyIntolerance";
|
|
27
69
|
}
|
|
28
|
-
|
|
70
|
+
exports.isAllergyIntolerance = isAllergyIntolerance;
|
|
71
|
+
/**
|
|
72
|
+
* Condition type guard for Smart resources
|
|
73
|
+
*/
|
|
74
|
+
function isCondition(resource) {
|
|
29
75
|
return resource?.resourceType === "Condition";
|
|
30
76
|
}
|
|
31
|
-
|
|
77
|
+
exports.isCondition = isCondition;
|
|
78
|
+
/**
|
|
79
|
+
* Composition type guard for Smart resources
|
|
80
|
+
*/
|
|
81
|
+
function isComposition(resource) {
|
|
32
82
|
return resource?.resourceType === "Composition";
|
|
33
83
|
}
|
|
34
|
-
|
|
84
|
+
exports.isComposition = isComposition;
|
|
85
|
+
/**
|
|
86
|
+
* Coverage type guard for Smart resources
|
|
87
|
+
*/
|
|
88
|
+
function isCoverage(resource) {
|
|
35
89
|
return resource?.resourceType === "Coverage";
|
|
36
90
|
}
|
|
37
|
-
|
|
91
|
+
exports.isCoverage = isCoverage;
|
|
92
|
+
/**
|
|
93
|
+
* DocumentReference type guard for Smart resources
|
|
94
|
+
*/
|
|
95
|
+
function isDocumentReference(resource) {
|
|
38
96
|
return resource?.resourceType === "DocumentReference";
|
|
39
97
|
}
|
|
40
|
-
|
|
98
|
+
exports.isDocumentReference = isDocumentReference;
|
|
99
|
+
/**
|
|
100
|
+
* FamilyMemberHistory type guard for Smart resources
|
|
101
|
+
*/
|
|
102
|
+
function isFamilyMemberHistory(resource) {
|
|
41
103
|
return resource?.resourceType === "FamilyMemberHistory";
|
|
42
104
|
}
|
|
43
|
-
|
|
105
|
+
exports.isFamilyMemberHistory = isFamilyMemberHistory;
|
|
106
|
+
/**
|
|
107
|
+
* Immunization type guard for Smart resources
|
|
108
|
+
*/
|
|
109
|
+
function isImmunization(resource) {
|
|
44
110
|
return resource?.resourceType === "Immunization";
|
|
45
111
|
}
|
|
46
|
-
|
|
112
|
+
exports.isImmunization = isImmunization;
|
|
113
|
+
/**
|
|
114
|
+
* Medication type guard for Smart resources
|
|
115
|
+
*/
|
|
116
|
+
function isMedication(resource) {
|
|
47
117
|
return resource?.resourceType === "Medication";
|
|
48
118
|
}
|
|
49
|
-
|
|
119
|
+
exports.isMedication = isMedication;
|
|
120
|
+
/**
|
|
121
|
+
* MedicationAdministration type guard for Smart resources
|
|
122
|
+
*/
|
|
123
|
+
function isMedicationAdministration(resource) {
|
|
50
124
|
return resource?.resourceType === "MedicationAdministration";
|
|
51
125
|
}
|
|
52
|
-
|
|
126
|
+
exports.isMedicationAdministration = isMedicationAdministration;
|
|
127
|
+
/**
|
|
128
|
+
* MedicationDispense type guard for Smart resources
|
|
129
|
+
*/
|
|
130
|
+
function isMedicationDispense(resource) {
|
|
53
131
|
return resource?.resourceType === "MedicationDispense";
|
|
54
132
|
}
|
|
55
|
-
|
|
133
|
+
exports.isMedicationDispense = isMedicationDispense;
|
|
134
|
+
/**
|
|
135
|
+
* MedicationRequest type guard for Smart resources
|
|
136
|
+
*/
|
|
137
|
+
function isMedicationRequest(resource) {
|
|
56
138
|
return resource?.resourceType === "MedicationRequest";
|
|
57
139
|
}
|
|
58
|
-
|
|
140
|
+
exports.isMedicationRequest = isMedicationRequest;
|
|
141
|
+
/**
|
|
142
|
+
* MedicationStatement type guard for Smart resources
|
|
143
|
+
*/
|
|
144
|
+
function isMedicationStatement(resource) {
|
|
59
145
|
return resource?.resourceType === "MedicationStatement";
|
|
60
146
|
}
|
|
61
|
-
|
|
147
|
+
exports.isMedicationStatement = isMedicationStatement;
|
|
148
|
+
/**
|
|
149
|
+
* Procedure type guard for Smart resources
|
|
150
|
+
*/
|
|
151
|
+
function isProcedure(resource) {
|
|
62
152
|
return resource?.resourceType === "Procedure";
|
|
63
153
|
}
|
|
64
|
-
|
|
154
|
+
exports.isProcedure = isProcedure;
|
|
155
|
+
/**
|
|
156
|
+
* RelatedPerson type guard for Smart resources
|
|
157
|
+
*/
|
|
158
|
+
function isRelatedPerson(resource) {
|
|
65
159
|
return resource?.resourceType === "RelatedPerson";
|
|
66
160
|
}
|
|
67
|
-
|
|
161
|
+
exports.isRelatedPerson = isRelatedPerson;
|
|
162
|
+
/**
|
|
163
|
+
* RiskAssessment type guard for Smart resources
|
|
164
|
+
*/
|
|
165
|
+
function isRiskAssessment(resource) {
|
|
68
166
|
return resource?.resourceType === "RiskAssessment";
|
|
69
167
|
}
|
|
70
|
-
|
|
168
|
+
exports.isRiskAssessment = isRiskAssessment;
|
|
169
|
+
/**
|
|
170
|
+
* ServiceRequest type guard for Smart resources
|
|
171
|
+
*/
|
|
172
|
+
function isServiceRequest(resource) {
|
|
71
173
|
return resource?.resourceType === "ServiceRequest";
|
|
72
174
|
}
|
|
73
|
-
|
|
175
|
+
exports.isServiceRequest = isServiceRequest;
|
|
176
|
+
/**
|
|
177
|
+
* CarePlan type guard for Smart resources
|
|
178
|
+
*/
|
|
179
|
+
function isCarePlan(resource) {
|
|
74
180
|
return resource?.resourceType === "CarePlan";
|
|
75
181
|
}
|
|
76
|
-
|
|
182
|
+
exports.isCarePlan = isCarePlan;
|
|
183
|
+
/**
|
|
184
|
+
* Bundle type guard for Smart resources
|
|
185
|
+
*/
|
|
186
|
+
function isBundle(resource) {
|
|
77
187
|
return resource?.resourceType === "Bundle";
|
|
78
188
|
}
|
|
189
|
+
exports.isBundle = isBundle;
|
|
190
|
+
// =============================================================================
|
|
191
|
+
// Plain FHIR Resource Type Guards
|
|
192
|
+
// =============================================================================
|
|
193
|
+
/**
|
|
194
|
+
* Patient type guard for plain FHIR resources
|
|
195
|
+
*/
|
|
196
|
+
function isPlainPatient(resource) {
|
|
197
|
+
return resource?.resourceType === "Patient";
|
|
198
|
+
}
|
|
199
|
+
exports.isPlainPatient = isPlainPatient;
|
|
200
|
+
/**
|
|
201
|
+
* Observation type guard for plain FHIR resources
|
|
202
|
+
*/
|
|
203
|
+
function isPlainObservation(resource) {
|
|
204
|
+
return resource?.resourceType === "Observation";
|
|
205
|
+
}
|
|
206
|
+
exports.isPlainObservation = isPlainObservation;
|
|
207
|
+
/**
|
|
208
|
+
* DiagnosticReport type guard for plain FHIR resources
|
|
209
|
+
*/
|
|
210
|
+
function isPlainDiagnosticReport(resource) {
|
|
211
|
+
return resource?.resourceType === "DiagnosticReport";
|
|
212
|
+
}
|
|
213
|
+
exports.isPlainDiagnosticReport = isPlainDiagnosticReport;
|
|
214
|
+
/**
|
|
215
|
+
* Encounter type guard for plain FHIR resources
|
|
216
|
+
*/
|
|
217
|
+
function isPlainEncounter(resource) {
|
|
218
|
+
return resource?.resourceType === "Encounter";
|
|
219
|
+
}
|
|
220
|
+
exports.isPlainEncounter = isPlainEncounter;
|
|
221
|
+
/**
|
|
222
|
+
* Practitioner type guard for plain FHIR resources
|
|
223
|
+
*/
|
|
224
|
+
function isPlainPractitioner(resource) {
|
|
225
|
+
return resource?.resourceType === "Practitioner";
|
|
226
|
+
}
|
|
227
|
+
exports.isPlainPractitioner = isPlainPractitioner;
|
|
228
|
+
/**
|
|
229
|
+
* PractitionerRole type guard for plain FHIR resources
|
|
230
|
+
*/
|
|
231
|
+
function isPlainPractitionerRole(resource) {
|
|
232
|
+
return resource?.resourceType === "PractitionerRole";
|
|
233
|
+
}
|
|
234
|
+
exports.isPlainPractitionerRole = isPlainPractitionerRole;
|
|
235
|
+
/**
|
|
236
|
+
* Organization type guard for plain FHIR resources
|
|
237
|
+
*/
|
|
238
|
+
function isPlainOrganization(resource) {
|
|
239
|
+
return resource?.resourceType === "Organization";
|
|
240
|
+
}
|
|
241
|
+
exports.isPlainOrganization = isPlainOrganization;
|
|
242
|
+
/**
|
|
243
|
+
* Location type guard for plain FHIR resources
|
|
244
|
+
*/
|
|
245
|
+
function isPlainLocation(resource) {
|
|
246
|
+
return resource?.resourceType === "Location";
|
|
247
|
+
}
|
|
248
|
+
exports.isPlainLocation = isPlainLocation;
|
|
249
|
+
/**
|
|
250
|
+
* AllergyIntolerance type guard for plain FHIR resources
|
|
251
|
+
*/
|
|
252
|
+
function isPlainAllergyIntolerance(resource) {
|
|
253
|
+
return resource?.resourceType === "AllergyIntolerance";
|
|
254
|
+
}
|
|
255
|
+
exports.isPlainAllergyIntolerance = isPlainAllergyIntolerance;
|
|
256
|
+
/**
|
|
257
|
+
* Condition type guard for plain FHIR resources
|
|
258
|
+
*/
|
|
259
|
+
function isPlainCondition(resource) {
|
|
260
|
+
return resource?.resourceType === "Condition";
|
|
261
|
+
}
|
|
262
|
+
exports.isPlainCondition = isPlainCondition;
|
|
263
|
+
/**
|
|
264
|
+
* Composition type guard for plain FHIR resources
|
|
265
|
+
*/
|
|
266
|
+
function isPlainComposition(resource) {
|
|
267
|
+
return resource?.resourceType === "Composition";
|
|
268
|
+
}
|
|
269
|
+
exports.isPlainComposition = isPlainComposition;
|
|
270
|
+
/**
|
|
271
|
+
* Coverage type guard for plain FHIR resources
|
|
272
|
+
*/
|
|
273
|
+
function isPlainCoverage(resource) {
|
|
274
|
+
return resource?.resourceType === "Coverage";
|
|
275
|
+
}
|
|
276
|
+
exports.isPlainCoverage = isPlainCoverage;
|
|
277
|
+
/**
|
|
278
|
+
* DocumentReference type guard for plain FHIR resources
|
|
279
|
+
*/
|
|
280
|
+
function isPlainDocumentReference(resource) {
|
|
281
|
+
return resource?.resourceType === "DocumentReference";
|
|
282
|
+
}
|
|
283
|
+
exports.isPlainDocumentReference = isPlainDocumentReference;
|
|
284
|
+
/**
|
|
285
|
+
* FamilyMemberHistory type guard for plain FHIR resources
|
|
286
|
+
*/
|
|
287
|
+
function isPlainFamilyMemberHistory(resource) {
|
|
288
|
+
return resource?.resourceType === "FamilyMemberHistory";
|
|
289
|
+
}
|
|
290
|
+
exports.isPlainFamilyMemberHistory = isPlainFamilyMemberHistory;
|
|
291
|
+
/**
|
|
292
|
+
* Immunization type guard for plain FHIR resources
|
|
293
|
+
*/
|
|
294
|
+
function isPlainImmunization(resource) {
|
|
295
|
+
return resource?.resourceType === "Immunization";
|
|
296
|
+
}
|
|
297
|
+
exports.isPlainImmunization = isPlainImmunization;
|
|
298
|
+
/**
|
|
299
|
+
* Medication type guard for plain FHIR resources
|
|
300
|
+
*/
|
|
301
|
+
function isPlainMedication(resource) {
|
|
302
|
+
return resource?.resourceType === "Medication";
|
|
303
|
+
}
|
|
304
|
+
exports.isPlainMedication = isPlainMedication;
|
|
305
|
+
/**
|
|
306
|
+
* MedicationAdministration type guard for plain FHIR resources
|
|
307
|
+
*/
|
|
308
|
+
function isPlainMedicationAdministration(resource) {
|
|
309
|
+
return resource?.resourceType === "MedicationAdministration";
|
|
310
|
+
}
|
|
311
|
+
exports.isPlainMedicationAdministration = isPlainMedicationAdministration;
|
|
312
|
+
/**
|
|
313
|
+
* MedicationDispense type guard for plain FHIR resources
|
|
314
|
+
*/
|
|
315
|
+
function isPlainMedicationDispense(resource) {
|
|
316
|
+
return resource?.resourceType === "MedicationDispense";
|
|
317
|
+
}
|
|
318
|
+
exports.isPlainMedicationDispense = isPlainMedicationDispense;
|
|
319
|
+
/**
|
|
320
|
+
* MedicationRequest type guard for plain FHIR resources
|
|
321
|
+
*/
|
|
322
|
+
function isPlainMedicationRequest(resource) {
|
|
323
|
+
return resource?.resourceType === "MedicationRequest";
|
|
324
|
+
}
|
|
325
|
+
exports.isPlainMedicationRequest = isPlainMedicationRequest;
|
|
326
|
+
/**
|
|
327
|
+
* MedicationStatement type guard for plain FHIR resources
|
|
328
|
+
*/
|
|
329
|
+
function isPlainMedicationStatement(resource) {
|
|
330
|
+
return resource?.resourceType === "MedicationStatement";
|
|
331
|
+
}
|
|
332
|
+
exports.isPlainMedicationStatement = isPlainMedicationStatement;
|
|
333
|
+
/**
|
|
334
|
+
* Procedure type guard for plain FHIR resources
|
|
335
|
+
*/
|
|
336
|
+
function isPlainProcedure(resource) {
|
|
337
|
+
return resource?.resourceType === "Procedure";
|
|
338
|
+
}
|
|
339
|
+
exports.isPlainProcedure = isPlainProcedure;
|
|
340
|
+
/**
|
|
341
|
+
* RelatedPerson type guard for plain FHIR resources
|
|
342
|
+
*/
|
|
343
|
+
function isPlainRelatedPerson(resource) {
|
|
344
|
+
return resource?.resourceType === "RelatedPerson";
|
|
345
|
+
}
|
|
346
|
+
exports.isPlainRelatedPerson = isPlainRelatedPerson;
|
|
347
|
+
/**
|
|
348
|
+
* RiskAssessment type guard for plain FHIR resources
|
|
349
|
+
*/
|
|
350
|
+
function isPlainRiskAssessment(resource) {
|
|
351
|
+
return resource?.resourceType === "RiskAssessment";
|
|
352
|
+
}
|
|
353
|
+
exports.isPlainRiskAssessment = isPlainRiskAssessment;
|
|
354
|
+
/**
|
|
355
|
+
* ServiceRequest type guard for plain FHIR resources
|
|
356
|
+
*/
|
|
357
|
+
function isPlainServiceRequest(resource) {
|
|
358
|
+
return resource?.resourceType === "ServiceRequest";
|
|
359
|
+
}
|
|
360
|
+
exports.isPlainServiceRequest = isPlainServiceRequest;
|
|
361
|
+
/**
|
|
362
|
+
* CarePlan type guard for plain FHIR resources
|
|
363
|
+
*/
|
|
364
|
+
function isPlainCarePlan(resource) {
|
|
365
|
+
return resource?.resourceType === "CarePlan";
|
|
366
|
+
}
|
|
367
|
+
exports.isPlainCarePlan = isPlainCarePlan;
|
|
368
|
+
/**
|
|
369
|
+
* Bundle type guard for plain FHIR resources
|
|
370
|
+
*/
|
|
371
|
+
function isPlainBundle(resource) {
|
|
372
|
+
return resource?.resourceType === "Bundle";
|
|
373
|
+
}
|
|
374
|
+
exports.isPlainBundle = isPlainBundle;
|
|
79
375
|
//# sourceMappingURL=type-guards.js.map
|
package/dist/type-guards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-guards.js","sourceRoot":"","sources":["../src/type-gu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GAEG;AACH,SAAgB,qBAAqB,CAAC,QAA8B;IAClE,OAAO,QAAQ,EAAE,YAAY,KAAK,gBAAgB,CAAC;AACrD,CAAC;AAFD,sDAEC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,QAA8B;IAC5D,OAAO,QAAQ,EAAE,YAAY,KAAK,UAAU,CAAC;AAC/C,CAAC;AAFD,0CAEC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,QAA8B;IAC1D,OAAO,QAAQ,EAAE,YAAY,KAAK,QAAQ,CAAC;AAC7C,CAAC;AAFD,sCAEC"}
|
package/dist/types/sdk-types.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getResourceIdentifier = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* Helper function to get resource identifier from bundle entry
|
|
3
6
|
*/
|
|
4
|
-
|
|
7
|
+
function getResourceIdentifier(entry) {
|
|
5
8
|
if (entry.resource?.id) {
|
|
6
9
|
return entry.resource.id;
|
|
7
10
|
}
|
|
@@ -10,4 +13,5 @@ export function getResourceIdentifier(entry) {
|
|
|
10
13
|
}
|
|
11
14
|
return undefined;
|
|
12
15
|
}
|
|
16
|
+
exports.getResourceIdentifier = getResourceIdentifier;
|
|
13
17
|
//# sourceMappingURL=sdk-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-types.js","sourceRoot":"","sources":["../../src/types/sdk-types.ts"],"names":[],"mappings":"AAiHA;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"sdk-types.js","sourceRoot":"","sources":["../../src/types/sdk-types.ts"],"names":[],"mappings":";;;AAiHA;;GAEG;AACH,SAAgB,qBAAqB,CAAC,KAAkB;IACtD,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE;QACtB,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;KAC1B;IACD,IAAI,KAAK,CAAC,OAAO,EAAE;QACjB,OAAO,KAAK,CAAC,OAAO,CAAC;KACtB;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AARD,sDAQC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getReferenceField = exports.isReferenceMethod = exports.REFERENCE_METHOD_MAPPING = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* IMPORTANT: For user-facing code, prefer specific Smart type aliases (SmartObservation,
|
|
3
6
|
* SmartCondition, etc.) defined in coding-fields.ts over the generic Smart<T> pattern.
|
|
@@ -18,7 +21,7 @@
|
|
|
18
21
|
/**
|
|
19
22
|
* Reference field mapping - maps reference method names to their field paths
|
|
20
23
|
*/
|
|
21
|
-
|
|
24
|
+
exports.REFERENCE_METHOD_MAPPING = {
|
|
22
25
|
Observation: {
|
|
23
26
|
getBasedOn: "basedOn",
|
|
24
27
|
getPartOf: "partOf",
|
|
@@ -230,15 +233,17 @@ export const REFERENCE_METHOD_MAPPING = {
|
|
|
230
233
|
/**
|
|
231
234
|
* Helper type to check if a method name is a valid reference method for a resource type
|
|
232
235
|
*/
|
|
233
|
-
|
|
234
|
-
const mapping = REFERENCE_METHOD_MAPPING[resourceType];
|
|
236
|
+
function isReferenceMethod(methodName, resourceType) {
|
|
237
|
+
const mapping = exports.REFERENCE_METHOD_MAPPING[resourceType];
|
|
235
238
|
return mapping ? methodName in mapping : false;
|
|
236
239
|
}
|
|
240
|
+
exports.isReferenceMethod = isReferenceMethod;
|
|
237
241
|
/**
|
|
238
242
|
* Get the reference field path for a method name and resource type
|
|
239
243
|
*/
|
|
240
|
-
|
|
241
|
-
const mapping = REFERENCE_METHOD_MAPPING[resourceType];
|
|
244
|
+
function getReferenceField(methodName, resourceType) {
|
|
245
|
+
const mapping = exports.REFERENCE_METHOD_MAPPING[resourceType];
|
|
242
246
|
return mapping ? mapping[methodName] : undefined;
|
|
243
247
|
}
|
|
248
|
+
exports.getReferenceField = getReferenceField;
|
|
244
249
|
//# sourceMappingURL=smart-resources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-resources.js","sourceRoot":"","sources":["../../src/types/smart-resources.ts"],"names":[],"mappings":"AAosBA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;
|
|
1
|
+
{"version":3,"file":"smart-resources.js","sourceRoot":"","sources":["../../src/types/smart-resources.ts"],"names":[],"mappings":";;;AAosBA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AACU,QAAA,wBAAwB,GAA2C;IAC9E,WAAW,EAAE;QACX,UAAU,EAAE,SAAS;QACrB,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,SAAS;QACrB,QAAQ,EAAE,OAAO;QACjB,YAAY,EAAE,WAAW;QACzB,aAAa,EAAE,WAAW;QAC1B,WAAW,EAAE,UAAU;QACvB,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,WAAW;QACzB,cAAc,EAAE,aAAa;KAC9B;IACD,SAAS,EAAE;QACT,UAAU,EAAE,SAAS;QACrB,gBAAgB,EAAE,eAAe;QACjC,UAAU,EAAE,SAAS;QACrB,eAAe,EAAE,wBAAwB;QACzC,cAAc,EAAE,aAAa;QAC7B,kBAAkB,EAAE,iBAAiB;QACrC,UAAU,EAAE,SAAS;QACrB,kBAAkB,EAAE,iBAAiB;QACrC,SAAS,EAAE,QAAQ;QACnB,wBAAwB,EAAE,wBAAwB;QAClD,6BAA6B,EAAE,6BAA6B;QAC5D,WAAW,EAAE,mBAAmB;QAChC,qBAAqB,EAAE,qBAAqB;KAC7C;IACD,gBAAgB,EAAE;QAChB,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,SAAS;QACrB,YAAY,EAAE,WAAW;QACzB,aAAa,EAAE,WAAW;QAC1B,qBAAqB,EAAE,oBAAoB;QAC3C,WAAW,EAAE,UAAU;QACvB,UAAU,EAAE,QAAQ;QACpB,eAAe,E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QACnE,qBAAqB,EAAE,sBAAsB;QAC7C,yBAAyB,EAAE,0BAA0B;QACrD,0BAA0B,EAAE,2BAA2B;QACvD,iCAAiC,EAAE,kCAAkC;KACtE;CACF,CAAC;AAEF;;GAEG;AACH,SAAgB,iBAAiB,CAAC,UAAkB,EAAE,YAAoB;IACxE,MAAM,OAAO,GAAG,gCAAwB,CAAC,YAAY,CAAC,CAAC;IACvD,OAAO,OAAO,CAAC,CAAC,CAAC,UAAU,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;AACjD,CAAC;AAHD,8CAGC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,UAAkB,EAAE,YAAoB;IACxE,MAAM,OAAO,GAAG,gCAAwB,CAAC,YAAY,CAAC,CAAC;IACvD,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC;AAHD,8CAGC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
4
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
5
|
// @ts-nocheck
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.PreOrder = exports.ReverseInOrder = exports.InOrder = exports.IntervalTree = exports.Node = void 0;
|
|
5
8
|
// This file is a modified version of the original node-interval-tree library.
|
|
6
9
|
// We want to make as few / minimal changes as possible, and ignore lint errors.
|
|
7
10
|
// An augmented AVL Tree where each node maintains a list of records and their search intervals.
|
|
@@ -9,7 +12,7 @@
|
|
|
9
12
|
// interval tree to have the same interval inserted multiple times, as long its data is different.
|
|
10
13
|
// Both insertion and deletion require O(log n) time. Searching requires O(k*logn) time, where `k`
|
|
11
14
|
// is the number of intervals in the output list.
|
|
12
|
-
|
|
15
|
+
const shallowequal_1 = require("./shallowequal");
|
|
13
16
|
function max(a, b) {
|
|
14
17
|
return a < b ? b : a;
|
|
15
18
|
}
|
|
@@ -21,7 +24,7 @@ function height(node) {
|
|
|
21
24
|
return node.height;
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
|
-
|
|
27
|
+
class Node {
|
|
25
28
|
constructor(intervalTree, record) {
|
|
26
29
|
this.intervalTree = intervalTree;
|
|
27
30
|
this.records = [];
|
|
@@ -430,7 +433,8 @@ export class Node {
|
|
|
430
433
|
return undefined;
|
|
431
434
|
}
|
|
432
435
|
}
|
|
433
|
-
|
|
436
|
+
exports.Node = Node;
|
|
437
|
+
class IntervalTree {
|
|
434
438
|
constructor() {
|
|
435
439
|
this.count = 0;
|
|
436
440
|
}
|
|
@@ -450,7 +454,7 @@ export class IntervalTree {
|
|
|
450
454
|
if (node !== undefined) {
|
|
451
455
|
// Check the records in this node if there already is the one with same low, high, data
|
|
452
456
|
for (let i = 0; i < node.records.length; i++) {
|
|
453
|
-
if (shallowEqual(node.records[i], record)) {
|
|
457
|
+
if ((0, shallowequal_1.shallowEqual)(node.records[i], record)) {
|
|
454
458
|
// This record is same as the one we're trying to insert; return false to indicate
|
|
455
459
|
// nothing has been inserted
|
|
456
460
|
return false;
|
|
@@ -499,7 +503,7 @@ export class IntervalTree {
|
|
|
499
503
|
let removedRecord;
|
|
500
504
|
// Node with this key has 2 or more records. Find the one we need and remove it
|
|
501
505
|
for (let i = 0; i < node.records.length; i++) {
|
|
502
|
-
if (shallowEqual(node.records[i], record)) {
|
|
506
|
+
if ((0, shallowequal_1.shallowEqual)(node.records[i], record)) {
|
|
503
507
|
removedRecord = node.records[i];
|
|
504
508
|
node.records.splice(i, 1);
|
|
505
509
|
break;
|
|
@@ -536,7 +540,7 @@ export class IntervalTree {
|
|
|
536
540
|
else if (node.records.length === 1) {
|
|
537
541
|
// Node with this key has only 1 record. Check if the remaining record in this node is
|
|
538
542
|
// actually the one we want to remove
|
|
539
|
-
if (shallowEqual(node.records[0], record)) {
|
|
543
|
+
if ((0, shallowequal_1.shallowEqual)(node.records[0], record)) {
|
|
540
544
|
// The remaining record is the one we want to remove. Remove the whole node from the tree
|
|
541
545
|
if (this.root.key === node.key) {
|
|
542
546
|
// We're removing the root element. Create a dummy node that will temporarily take
|
|
@@ -591,11 +595,12 @@ export class IntervalTree {
|
|
|
591
595
|
return new PreOrder(this.root);
|
|
592
596
|
}
|
|
593
597
|
}
|
|
598
|
+
exports.IntervalTree = IntervalTree;
|
|
594
599
|
/**
|
|
595
600
|
* The default export just wraps the `IntervalTree`, while providing a simpler API. Check out the
|
|
596
601
|
* README for description on how to use each.
|
|
597
602
|
*/
|
|
598
|
-
|
|
603
|
+
class DataIntervalTree {
|
|
599
604
|
constructor() {
|
|
600
605
|
this.tree = new IntervalTree();
|
|
601
606
|
}
|
|
@@ -621,7 +626,8 @@ export default class DataIntervalTree {
|
|
|
621
626
|
return this.tree.count;
|
|
622
627
|
}
|
|
623
628
|
}
|
|
624
|
-
|
|
629
|
+
exports.default = DataIntervalTree;
|
|
630
|
+
class InOrder {
|
|
625
631
|
constructor(startNode) {
|
|
626
632
|
this.stack = [];
|
|
627
633
|
if (startNode !== undefined) {
|
|
@@ -670,7 +676,8 @@ export class InOrder {
|
|
|
670
676
|
this.i = 0;
|
|
671
677
|
}
|
|
672
678
|
}
|
|
673
|
-
|
|
679
|
+
exports.InOrder = InOrder;
|
|
680
|
+
class ReverseInOrder {
|
|
674
681
|
constructor(startNode) {
|
|
675
682
|
this.stack = [];
|
|
676
683
|
if (startNode !== undefined) {
|
|
@@ -720,7 +727,8 @@ export class ReverseInOrder {
|
|
|
720
727
|
this.i = (this.currentNode?.records.length ?? 0) - 1;
|
|
721
728
|
}
|
|
722
729
|
}
|
|
723
|
-
|
|
730
|
+
exports.ReverseInOrder = ReverseInOrder;
|
|
731
|
+
class PreOrder {
|
|
724
732
|
constructor(startNode) {
|
|
725
733
|
this.stack = [];
|
|
726
734
|
this.i = 0;
|
|
@@ -762,4 +770,5 @@ export class PreOrder {
|
|
|
762
770
|
this.i = 0;
|
|
763
771
|
}
|
|
764
772
|
}
|
|
773
|
+
exports.PreOrder = PreOrder;
|
|
765
774
|
//# sourceMappingURL=index.js.map
|