@metriport/fhir-sdk 0.30.0-alpha.1
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/LICENSE +21 -0
- package/README.md +564 -0
- package/dist/__tests__/careplan.test.d.ts +2 -0
- package/dist/__tests__/careplan.test.d.ts.map +1 -0
- package/dist/__tests__/careplan.test.js +544 -0
- package/dist/__tests__/careplan.test.js.map +1 -0
- package/dist/__tests__/clinical-dates.test.d.ts +2 -0
- package/dist/__tests__/clinical-dates.test.d.ts.map +1 -0
- package/dist/__tests__/clinical-dates.test.js +341 -0
- package/dist/__tests__/clinical-dates.test.js.map +1 -0
- package/dist/__tests__/coding-utilities.test.d.ts +2 -0
- package/dist/__tests__/coding-utilities.test.d.ts.map +1 -0
- package/dist/__tests__/coding-utilities.test.js +482 -0
- package/dist/__tests__/coding-utilities.test.js.map +1 -0
- package/dist/__tests__/date-range-performance.test.d.ts +2 -0
- package/dist/__tests__/date-range-performance.test.d.ts.map +1 -0
- package/dist/__tests__/date-range-performance.test.js +218 -0
- package/dist/__tests__/date-range-performance.test.js.map +1 -0
- package/dist/__tests__/date-range-search.test.d.ts +2 -0
- package/dist/__tests__/date-range-search.test.d.ts.map +1 -0
- package/dist/__tests__/date-range-search.test.js +215 -0
- package/dist/__tests__/date-range-search.test.js.map +1 -0
- package/dist/__tests__/env-setup.d.ts +2 -0
- package/dist/__tests__/env-setup.d.ts.map +1 -0
- package/dist/__tests__/env-setup.js +37 -0
- package/dist/__tests__/env-setup.js.map +1 -0
- package/dist/__tests__/fhir-bundle-sdk-basic.test.d.ts +2 -0
- package/dist/__tests__/fhir-bundle-sdk-basic.test.d.ts.map +1 -0
- package/dist/__tests__/fhir-bundle-sdk-basic.test.js +19 -0
- package/dist/__tests__/fhir-bundle-sdk-basic.test.js.map +1 -0
- package/dist/__tests__/fhir-bundle-sdk.test.d.ts +2 -0
- package/dist/__tests__/fhir-bundle-sdk.test.d.ts.map +1 -0
- package/dist/__tests__/fhir-bundle-sdk.test.js +953 -0
- package/dist/__tests__/fhir-bundle-sdk.test.js.map +1 -0
- package/dist/__tests__/fixtures/fhir-bundles.d.ts +31 -0
- package/dist/__tests__/fixtures/fhir-bundles.d.ts.map +1 -0
- package/dist/__tests__/fixtures/fhir-bundles.js +487 -0
- package/dist/__tests__/fixtures/fhir-bundles.js.map +1 -0
- package/dist/__tests__/phase1-verification.test.d.ts +2 -0
- package/dist/__tests__/phase1-verification.test.d.ts.map +1 -0
- package/dist/__tests__/phase1-verification.test.js +141 -0
- package/dist/__tests__/phase1-verification.test.js.map +1 -0
- package/dist/__tests__/phase2-verification.test.d.ts +2 -0
- package/dist/__tests__/phase2-verification.test.d.ts.map +1 -0
- package/dist/__tests__/phase2-verification.test.js +234 -0
- package/dist/__tests__/phase2-verification.test.js.map +1 -0
- package/dist/__tests__/phase3-verification.test.d.ts +2 -0
- package/dist/__tests__/phase3-verification.test.d.ts.map +1 -0
- package/dist/__tests__/phase3-verification.test.js +121 -0
- package/dist/__tests__/phase3-verification.test.js.map +1 -0
- package/dist/__tests__/phase4-verification.test.d.ts +2 -0
- package/dist/__tests__/phase4-verification.test.d.ts.map +1 -0
- package/dist/__tests__/phase4-verification.test.js +168 -0
- package/dist/__tests__/phase4-verification.test.js.map +1 -0
- package/dist/__tests__/phase5-verification.test.d.ts +2 -0
- package/dist/__tests__/phase5-verification.test.d.ts.map +1 -0
- package/dist/__tests__/phase5-verification.test.js +397 -0
- package/dist/__tests__/phase5-verification.test.js.map +1 -0
- package/dist/__tests__/reverse-references.test.d.ts +2 -0
- package/dist/__tests__/reverse-references.test.d.ts.map +1 -0
- package/dist/__tests__/reverse-references.test.js +294 -0
- package/dist/__tests__/reverse-references.test.js.map +1 -0
- package/dist/__tests__/type-guards.test.d.ts +2 -0
- package/dist/__tests__/type-guards.test.d.ts.map +1 -0
- package/dist/__tests__/type-guards.test.js +163 -0
- package/dist/__tests__/type-guards.test.js.map +1 -0
- package/dist/clinical-dates.d.ts +26 -0
- package/dist/clinical-dates.d.ts.map +1 -0
- package/dist/clinical-dates.js +571 -0
- package/dist/clinical-dates.js.map +1 -0
- package/dist/fhir-bundle-sdk.d.ts +233 -0
- package/dist/fhir-bundle-sdk.d.ts.map +1 -0
- package/dist/fhir-bundle-sdk.js +545 -0
- package/dist/fhir-bundle-sdk.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/bundle-operations.d.ts +14 -0
- package/dist/internal/bundle-operations.d.ts.map +1 -0
- package/dist/internal/bundle-operations.js +55 -0
- package/dist/internal/bundle-operations.js.map +1 -0
- package/dist/internal/coding-systems.d.ts +48 -0
- package/dist/internal/coding-systems.d.ts.map +1 -0
- package/dist/internal/coding-systems.js +55 -0
- package/dist/internal/coding-systems.js.map +1 -0
- package/dist/internal/coding-utilities.d.ts +27 -0
- package/dist/internal/coding-utilities.d.ts.map +1 -0
- package/dist/internal/coding-utilities.js +297 -0
- package/dist/internal/coding-utilities.js.map +1 -0
- package/dist/internal/date-extraction.d.ts +12 -0
- package/dist/internal/date-extraction.d.ts.map +1 -0
- package/dist/internal/date-extraction.js +629 -0
- package/dist/internal/date-extraction.js.map +1 -0
- package/dist/internal/graph-traversal.d.ts +13 -0
- package/dist/internal/graph-traversal.d.ts.map +1 -0
- package/dist/internal/graph-traversal.js +89 -0
- package/dist/internal/graph-traversal.js.map +1 -0
- package/dist/internal/indexing.d.ts +17 -0
- package/dist/internal/indexing.d.ts.map +1 -0
- package/dist/internal/indexing.js +129 -0
- package/dist/internal/indexing.js.map +1 -0
- package/dist/internal/llm-context.d.ts +40 -0
- package/dist/internal/llm-context.d.ts.map +1 -0
- package/dist/internal/llm-context.js +214 -0
- package/dist/internal/llm-context.js.map +1 -0
- package/dist/internal/reference-resolution.d.ts +29 -0
- package/dist/internal/reference-resolution.d.ts.map +1 -0
- package/dist/internal/reference-resolution.js +338 -0
- package/dist/internal/reference-resolution.js.map +1 -0
- package/dist/internal/reference-utils.d.ts +26 -0
- package/dist/internal/reference-utils.d.ts.map +1 -0
- package/dist/internal/reference-utils.js +89 -0
- package/dist/internal/reference-utils.js.map +1 -0
- package/dist/internal/transparent-proxy.d.ts +12 -0
- package/dist/internal/transparent-proxy.d.ts.map +1 -0
- package/dist/internal/transparent-proxy.js +81 -0
- package/dist/internal/transparent-proxy.js.map +1 -0
- package/dist/internal/validation.d.ts +16 -0
- package/dist/internal/validation.d.ts.map +1 -0
- package/dist/internal/validation.js +45 -0
- package/dist/internal/validation.js.map +1 -0
- package/dist/type-guards.d.ts +212 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/dist/type-guards.js +375 -0
- package/dist/type-guards.js.map +1 -0
- package/dist/types/coding-fields.d.ts +311 -0
- package/dist/types/coding-fields.d.ts.map +1 -0
- package/dist/types/coding-fields.js +3 -0
- package/dist/types/coding-fields.js.map +1 -0
- package/dist/types/sdk-types.d.ts +107 -0
- package/dist/types/sdk-types.d.ts.map +1 -0
- package/dist/types/sdk-types.js +17 -0
- package/dist/types/sdk-types.js.map +1 -0
- package/dist/types/smart-resources.d.ts +470 -0
- package/dist/types/smart-resources.d.ts.map +1 -0
- package/dist/types/smart-resources.js +249 -0
- package/dist/types/smart-resources.js.map +1 -0
- package/dist/utils/interval-tree/index.d.ts +87 -0
- package/dist/utils/interval-tree/index.d.ts.map +1 -0
- package/dist/utils/interval-tree/index.js +774 -0
- package/dist/utils/interval-tree/index.js.map +1 -0
- package/dist/utils/interval-tree/shallowequal/arrays.d.ts +3 -0
- package/dist/utils/interval-tree/shallowequal/arrays.d.ts.map +1 -0
- package/dist/utils/interval-tree/shallowequal/arrays.js +25 -0
- package/dist/utils/interval-tree/shallowequal/arrays.js.map +1 -0
- package/dist/utils/interval-tree/shallowequal/index.d.ts +6 -0
- package/dist/utils/interval-tree/shallowequal/index.d.ts.map +1 -0
- package/dist/utils/interval-tree/shallowequal/index.js +28 -0
- package/dist/utils/interval-tree/shallowequal/index.js.map +1 -0
- package/dist/utils/interval-tree/shallowequal/objects.d.ts +3 -0
- package/dist/utils/interval-tree/shallowequal/objects.d.ts.map +1 -0
- package/dist/utils/interval-tree/shallowequal/objects.js +28 -0
- package/dist/utils/interval-tree/shallowequal/objects.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { AllergyIntolerance, Appointment, CarePlan, CareTeam, CommunicationRequest, Composition, Condition, Coverage, Device, DeviceRequest, DiagnosticReport, DocumentReference, Encounter, FamilyMemberHistory, Goal, Group, HealthcareService, Immunization, Location, Medication, MedicationAdministration, MedicationDispense, MedicationRequest, MedicationStatement, NutritionOrder, Observation, Organization, Patient, Practitioner, PractitionerRole, Procedure, RelatedPerson, RequestGroup, Resource, RiskAssessment, ServiceRequest, Substance, Task, VisionPrescription } from "@medplum/fhirtypes";
|
|
2
|
+
import { SmartCodeableConcept, Smart } from "./smart-resources";
|
|
3
|
+
/**
|
|
4
|
+
* Coding Field Type Mappings
|
|
5
|
+
*
|
|
6
|
+
* This file defines explicit type overrides for CodeableConcept and Coding fields
|
|
7
|
+
* in each FHIR resource type. These interfaces document which fields get enhanced
|
|
8
|
+
* with SmartCodeableConcept/SmartCoding utilities at runtime.
|
|
9
|
+
*
|
|
10
|
+
* Runtime behavior: All CodeableConcept and Coding fields are automatically wrapped
|
|
11
|
+
* with smart utilities via proxies when accessed through the SDK.
|
|
12
|
+
*
|
|
13
|
+
* TypeScript limitations: Due to TypeScript's union type complexity limits, we cannot
|
|
14
|
+
* automatically enforce these transformations at the type level for all CodeableConcept
|
|
15
|
+
* properties. To provide type-safe access to coding utilities, we export specific type
|
|
16
|
+
* aliases (SmartObservation, SmartCondition, etc.) that combine Smart<T> with field
|
|
17
|
+
* overrides.
|
|
18
|
+
*
|
|
19
|
+
* USAGE: Always use the specific Smart type aliases (e.g., SmartObservation) instead of
|
|
20
|
+
* the generic Smart<Observation> pattern in user-facing code. This ensures TypeScript
|
|
21
|
+
* recognizes the coding utility methods without requiring type assertions.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // ✅ GOOD - Use specific type alias
|
|
25
|
+
* const obs: SmartObservation = sdk.getObservationById("123")!;
|
|
26
|
+
* obs.code?.hasLoinc(); // TypeScript knows this method exists
|
|
27
|
+
*
|
|
28
|
+
* // ❌ BAD - Generic Smart<T> requires type assertions
|
|
29
|
+
* const obs: Smart<Observation> = sdk.getObservationById("123")!;
|
|
30
|
+
* (obs.code as SmartCodeableConcept).hasLoinc(); // Requires manual casting
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Observation-specific field overrides for CodeableConcept properties
|
|
34
|
+
*/
|
|
35
|
+
export interface ObservationCodingFields {
|
|
36
|
+
code?: SmartCodeableConcept;
|
|
37
|
+
category?: SmartCodeableConcept[];
|
|
38
|
+
valueCodeableConcept?: SmartCodeableConcept;
|
|
39
|
+
dataAbsentReason?: SmartCodeableConcept;
|
|
40
|
+
interpretation?: SmartCodeableConcept[];
|
|
41
|
+
bodySite?: SmartCodeableConcept;
|
|
42
|
+
method?: SmartCodeableConcept;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Condition-specific field overrides for CodeableConcept properties
|
|
46
|
+
*/
|
|
47
|
+
export interface ConditionCodingFields {
|
|
48
|
+
clinicalStatus?: SmartCodeableConcept;
|
|
49
|
+
verificationStatus?: SmartCodeableConcept;
|
|
50
|
+
category?: SmartCodeableConcept[];
|
|
51
|
+
severity?: SmartCodeableConcept;
|
|
52
|
+
code?: SmartCodeableConcept;
|
|
53
|
+
bodySite?: SmartCodeableConcept[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Procedure-specific field overrides for CodeableConcept properties
|
|
57
|
+
*/
|
|
58
|
+
export interface ProcedureCodingFields {
|
|
59
|
+
statusReason?: SmartCodeableConcept;
|
|
60
|
+
category?: SmartCodeableConcept;
|
|
61
|
+
code?: SmartCodeableConcept;
|
|
62
|
+
reasonCode?: SmartCodeableConcept[];
|
|
63
|
+
bodySite?: SmartCodeableConcept[];
|
|
64
|
+
outcome?: SmartCodeableConcept;
|
|
65
|
+
complication?: SmartCodeableConcept[];
|
|
66
|
+
followUp?: SmartCodeableConcept[];
|
|
67
|
+
usedCode?: SmartCodeableConcept[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* AllergyIntolerance-specific field overrides for CodeableConcept properties
|
|
71
|
+
*/
|
|
72
|
+
export interface AllergyIntoleranceCodingFields {
|
|
73
|
+
clinicalStatus?: SmartCodeableConcept;
|
|
74
|
+
verificationStatus?: SmartCodeableConcept;
|
|
75
|
+
code?: SmartCodeableConcept;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Encounter-specific field overrides for CodeableConcept properties
|
|
79
|
+
*/
|
|
80
|
+
export interface EncounterCodingFields {
|
|
81
|
+
type?: SmartCodeableConcept[];
|
|
82
|
+
serviceType?: SmartCodeableConcept;
|
|
83
|
+
priority?: SmartCodeableConcept;
|
|
84
|
+
reasonCode?: SmartCodeableConcept[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* DiagnosticReport-specific field overrides for CodeableConcept properties
|
|
88
|
+
*/
|
|
89
|
+
export interface DiagnosticReportCodingFields {
|
|
90
|
+
category?: SmartCodeableConcept[];
|
|
91
|
+
code?: SmartCodeableConcept;
|
|
92
|
+
conclusionCode?: SmartCodeableConcept[];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Immunization-specific field overrides for CodeableConcept properties
|
|
96
|
+
*/
|
|
97
|
+
export interface ImmunizationCodingFields {
|
|
98
|
+
statusReason?: SmartCodeableConcept;
|
|
99
|
+
vaccineCode?: SmartCodeableConcept;
|
|
100
|
+
reportOrigin?: SmartCodeableConcept;
|
|
101
|
+
site?: SmartCodeableConcept;
|
|
102
|
+
route?: SmartCodeableConcept;
|
|
103
|
+
reasonCode?: SmartCodeableConcept[];
|
|
104
|
+
subpotentReason?: SmartCodeableConcept[];
|
|
105
|
+
programEligibility?: SmartCodeableConcept[];
|
|
106
|
+
fundingSource?: SmartCodeableConcept;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Medication-specific field overrides for CodeableConcept properties
|
|
110
|
+
*/
|
|
111
|
+
export interface MedicationCodingFields {
|
|
112
|
+
code?: SmartCodeableConcept;
|
|
113
|
+
form?: SmartCodeableConcept;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* MedicationRequest-specific field overrides for CodeableConcept properties
|
|
117
|
+
*/
|
|
118
|
+
export interface MedicationRequestCodingFields {
|
|
119
|
+
statusReason?: SmartCodeableConcept;
|
|
120
|
+
category?: SmartCodeableConcept[];
|
|
121
|
+
medicationCodeableConcept?: SmartCodeableConcept;
|
|
122
|
+
performerType?: SmartCodeableConcept;
|
|
123
|
+
reasonCode?: SmartCodeableConcept[];
|
|
124
|
+
courseOfTherapyType?: SmartCodeableConcept;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* MedicationAdministration-specific field overrides for CodeableConcept properties
|
|
128
|
+
*/
|
|
129
|
+
export interface MedicationAdministrationCodingFields {
|
|
130
|
+
statusReason?: SmartCodeableConcept[];
|
|
131
|
+
category?: SmartCodeableConcept;
|
|
132
|
+
medicationCodeableConcept?: SmartCodeableConcept;
|
|
133
|
+
reasonCode?: SmartCodeableConcept[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* MedicationDispense-specific field overrides for CodeableConcept properties
|
|
137
|
+
*/
|
|
138
|
+
export interface MedicationDispenseCodingFields {
|
|
139
|
+
statusReasonCodeableConcept?: SmartCodeableConcept;
|
|
140
|
+
category?: SmartCodeableConcept;
|
|
141
|
+
medicationCodeableConcept?: SmartCodeableConcept;
|
|
142
|
+
type?: SmartCodeableConcept;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* MedicationStatement-specific field overrides for CodeableConcept properties
|
|
146
|
+
*/
|
|
147
|
+
export interface MedicationStatementCodingFields {
|
|
148
|
+
statusReason?: SmartCodeableConcept[];
|
|
149
|
+
category?: SmartCodeableConcept;
|
|
150
|
+
medicationCodeableConcept?: SmartCodeableConcept;
|
|
151
|
+
reasonCode?: SmartCodeableConcept[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* FamilyMemberHistory-specific field overrides for CodeableConcept properties
|
|
155
|
+
*/
|
|
156
|
+
export interface FamilyMemberHistoryCodingFields {
|
|
157
|
+
dataAbsentReason?: SmartCodeableConcept;
|
|
158
|
+
relationship?: SmartCodeableConcept;
|
|
159
|
+
sex?: SmartCodeableConcept;
|
|
160
|
+
reasonCode?: SmartCodeableConcept[];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* RelatedPerson-specific field overrides for CodeableConcept properties
|
|
164
|
+
*/
|
|
165
|
+
export interface RelatedPersonCodingFields {
|
|
166
|
+
relationship?: SmartCodeableConcept[];
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* RiskAssessment-specific field overrides for CodeableConcept properties
|
|
170
|
+
*/
|
|
171
|
+
export interface RiskAssessmentCodingFields {
|
|
172
|
+
method?: SmartCodeableConcept;
|
|
173
|
+
code?: SmartCodeableConcept;
|
|
174
|
+
reasonCode?: SmartCodeableConcept[];
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* ServiceRequest-specific field overrides for CodeableConcept properties
|
|
178
|
+
*/
|
|
179
|
+
export interface ServiceRequestCodingFields {
|
|
180
|
+
category?: SmartCodeableConcept[];
|
|
181
|
+
code?: SmartCodeableConcept;
|
|
182
|
+
orderDetail?: SmartCodeableConcept[];
|
|
183
|
+
asNeededCodeableConcept?: SmartCodeableConcept;
|
|
184
|
+
performerType?: SmartCodeableConcept;
|
|
185
|
+
locationCode?: SmartCodeableConcept[];
|
|
186
|
+
reasonCode?: SmartCodeableConcept[];
|
|
187
|
+
bodySite?: SmartCodeableConcept[];
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* CarePlan-specific field overrides for CodeableConcept properties
|
|
191
|
+
*/
|
|
192
|
+
export interface CarePlanCodingFields {
|
|
193
|
+
category?: SmartCodeableConcept[];
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Patient-specific field overrides for CodeableConcept properties
|
|
197
|
+
*/
|
|
198
|
+
export interface PatientCodingFields {
|
|
199
|
+
maritalStatus?: SmartCodeableConcept;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Practitioner-specific field overrides for CodeableConcept properties
|
|
203
|
+
*/
|
|
204
|
+
export interface PractitionerCodingFields {
|
|
205
|
+
communication?: SmartCodeableConcept[];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Organization-specific field overrides for CodeableConcept properties
|
|
209
|
+
*/
|
|
210
|
+
export interface OrganizationCodingFields {
|
|
211
|
+
type?: SmartCodeableConcept[];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Location-specific field overrides for CodeableConcept properties
|
|
215
|
+
*/
|
|
216
|
+
export interface LocationCodingFields {
|
|
217
|
+
type?: SmartCodeableConcept[];
|
|
218
|
+
physicalType?: SmartCodeableConcept;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Composition-specific field overrides for CodeableConcept properties
|
|
222
|
+
*/
|
|
223
|
+
export interface CompositionCodingFields {
|
|
224
|
+
type?: SmartCodeableConcept;
|
|
225
|
+
category?: SmartCodeableConcept[];
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Coverage-specific field overrides for CodeableConcept properties
|
|
229
|
+
*/
|
|
230
|
+
export interface CoverageCodingFields {
|
|
231
|
+
type?: SmartCodeableConcept;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* DocumentReference-specific field overrides for CodeableConcept properties
|
|
235
|
+
*/
|
|
236
|
+
export interface DocumentReferenceCodingFields {
|
|
237
|
+
type?: SmartCodeableConcept;
|
|
238
|
+
category?: SmartCodeableConcept[];
|
|
239
|
+
securityLabel?: SmartCodeableConcept[];
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Specific type aliases that combine Smart with coding field overrides.
|
|
243
|
+
*
|
|
244
|
+
* ALWAYS use these specific types in user-facing code instead of the generic Smart<T>
|
|
245
|
+
* pattern to enable full TypeScript support for coding system utilities.
|
|
246
|
+
*
|
|
247
|
+
* These types provide:
|
|
248
|
+
* - All Smart resource methods (reference resolution, reverse lookup, etc.)
|
|
249
|
+
* - All CodeableConcept coding utilities (hasLoinc(), getIcd10Code(), etc.)
|
|
250
|
+
* - Full TypeScript autocomplete and type checking
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* // ✅ GOOD - Full TypeScript support
|
|
254
|
+
* const obs: SmartObservation = sdk.getObservationById("123")!;
|
|
255
|
+
* if (obs.code?.hasLoinc("2339-0")) {
|
|
256
|
+
* const loincCode = obs.code.getLoincCode();
|
|
257
|
+
* console.log("Found glucose observation:", loincCode);
|
|
258
|
+
* }
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* // ✅ GOOD - Works in function signatures too
|
|
262
|
+
* function analyzeCondition(condition: SmartCondition) {
|
|
263
|
+
* const icd10 = condition.code?.getIcd10Code();
|
|
264
|
+
* const snomed = condition.code?.getSnomedCode();
|
|
265
|
+
* // TypeScript autocomplete works perfectly
|
|
266
|
+
* }
|
|
267
|
+
*/
|
|
268
|
+
export type SmartObservation = Smart<Observation> & ObservationCodingFields;
|
|
269
|
+
export type SmartCondition = Smart<Condition> & ConditionCodingFields;
|
|
270
|
+
export type SmartProcedure = Smart<Procedure> & ProcedureCodingFields;
|
|
271
|
+
export type SmartAllergyIntolerance = Smart<AllergyIntolerance> & AllergyIntoleranceCodingFields;
|
|
272
|
+
export type SmartEncounter = Smart<Encounter> & EncounterCodingFields;
|
|
273
|
+
export type SmartDiagnosticReport = Smart<DiagnosticReport> & DiagnosticReportCodingFields;
|
|
274
|
+
export type SmartImmunization = Smart<Immunization> & ImmunizationCodingFields;
|
|
275
|
+
export type SmartMedication = Smart<Medication> & MedicationCodingFields;
|
|
276
|
+
export type SmartMedicationRequest = Smart<MedicationRequest> & MedicationRequestCodingFields;
|
|
277
|
+
export type SmartMedicationAdministration = Smart<MedicationAdministration> & MedicationAdministrationCodingFields;
|
|
278
|
+
export type SmartMedicationDispense = Smart<MedicationDispense> & MedicationDispenseCodingFields;
|
|
279
|
+
export type SmartMedicationStatement = Smart<MedicationStatement> & MedicationStatementCodingFields;
|
|
280
|
+
export type SmartFamilyMemberHistory = Smart<FamilyMemberHistory> & FamilyMemberHistoryCodingFields;
|
|
281
|
+
export type SmartRelatedPerson = Smart<RelatedPerson> & RelatedPersonCodingFields;
|
|
282
|
+
export type SmartRiskAssessment = Smart<RiskAssessment> & RiskAssessmentCodingFields;
|
|
283
|
+
export type SmartServiceRequest = Smart<ServiceRequest> & ServiceRequestCodingFields;
|
|
284
|
+
export type SmartCarePlan = Smart<CarePlan> & CarePlanCodingFields;
|
|
285
|
+
export type SmartPatient = Smart<Patient> & PatientCodingFields;
|
|
286
|
+
export type SmartPractitioner = Smart<Practitioner> & PractitionerCodingFields;
|
|
287
|
+
export type SmartOrganization = Smart<Organization> & OrganizationCodingFields;
|
|
288
|
+
export type SmartLocation = Smart<Location> & LocationCodingFields;
|
|
289
|
+
export type SmartComposition = Smart<Composition> & CompositionCodingFields;
|
|
290
|
+
export type SmartCoverage = Smart<Coverage> & CoverageCodingFields;
|
|
291
|
+
export type SmartDocumentReference = Smart<DocumentReference> & DocumentReferenceCodingFields;
|
|
292
|
+
export type SmartPractitionerRole = Smart<PractitionerRole>;
|
|
293
|
+
export type SmartGroup = Smart<Group>;
|
|
294
|
+
export type SmartDevice = Smart<Device>;
|
|
295
|
+
export type SmartCareTeam = Smart<CareTeam>;
|
|
296
|
+
export type SmartGoal = Smart<Goal>;
|
|
297
|
+
export type SmartAppointment = Smart<Appointment>;
|
|
298
|
+
export type SmartCommunicationRequest = Smart<CommunicationRequest>;
|
|
299
|
+
export type SmartDeviceRequest = Smart<DeviceRequest>;
|
|
300
|
+
export type SmartNutritionOrder = Smart<NutritionOrder>;
|
|
301
|
+
export type SmartTask = Smart<Task>;
|
|
302
|
+
export type SmartVisionPrescription = Smart<VisionPrescription>;
|
|
303
|
+
export type SmartRequestGroup = Smart<RequestGroup>;
|
|
304
|
+
export type SmartHealthcareService = Smart<HealthcareService>;
|
|
305
|
+
export type SmartSubstance = Smart<Substance>;
|
|
306
|
+
/**
|
|
307
|
+
* Conditional type that maps base FHIR resource types to their Smart equivalents
|
|
308
|
+
* This ensures consistent typing throughout the SDK
|
|
309
|
+
*/
|
|
310
|
+
export type ToSmart<T extends Resource> = T extends Observation ? SmartObservation : T extends Condition ? SmartCondition : T extends Procedure ? SmartProcedure : T extends AllergyIntolerance ? SmartAllergyIntolerance : T extends Encounter ? SmartEncounter : T extends DiagnosticReport ? SmartDiagnosticReport : T extends Immunization ? SmartImmunization : T extends Medication ? SmartMedication : T extends MedicationRequest ? SmartMedicationRequest : T extends MedicationAdministration ? SmartMedicationAdministration : T extends MedicationDispense ? SmartMedicationDispense : T extends MedicationStatement ? SmartMedicationStatement : T extends FamilyMemberHistory ? SmartFamilyMemberHistory : T extends RelatedPerson ? SmartRelatedPerson : T extends RiskAssessment ? SmartRiskAssessment : T extends ServiceRequest ? SmartServiceRequest : T extends CarePlan ? SmartCarePlan : T extends Patient ? SmartPatient : T extends Practitioner ? SmartPractitioner : T extends PractitionerRole ? SmartPractitionerRole : T extends Organization ? SmartOrganization : T extends Location ? SmartLocation : T extends Composition ? SmartComposition : T extends Coverage ? SmartCoverage : T extends DocumentReference ? SmartDocumentReference : T extends Group ? SmartGroup : T extends Device ? SmartDevice : T extends CareTeam ? SmartCareTeam : T extends Goal ? SmartGoal : T extends Appointment ? SmartAppointment : T extends CommunicationRequest ? SmartCommunicationRequest : T extends DeviceRequest ? SmartDeviceRequest : T extends NutritionOrder ? SmartNutritionOrder : T extends Task ? SmartTask : T extends VisionPrescription ? SmartVisionPrescription : T extends RequestGroup ? SmartRequestGroup : T extends HealthcareService ? SmartHealthcareService : T extends Substance ? SmartSubstance : Smart<T>;
|
|
311
|
+
//# sourceMappingURL=coding-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-fields.d.ts","sourceRoot":"","sources":["../../src/types/coding-fields.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,QAAQ,EACR,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,mBAAmB,EACnB,IAAI,EACJ,KAAK,EACL,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,wBAAwB,EACxB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,cAAc,EACd,SAAS,EACT,IAAI,EACJ,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,QAAQ,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAClC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC,cAAc,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACxC,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;A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AAC,SAAS,kBAAkB,GAC5B,uBAAuB,GACvB,CAAC,SAAS,YAAY,GACtB,iBAAiB,GACjB,CAAC,SAAS,iBAAiB,GAC3B,sBAAsB,GACtB,CAAC,SAAS,SAAS,GACnB,cAAc,GACd,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-fields.js","sourceRoot":"","sources":["../../src/types/coding-fields.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Resource, BundleEntry } from "@medplum/fhirtypes";
|
|
2
|
+
import { Smart } from "./smart-resources";
|
|
3
|
+
import { Interval } from "../utils/interval-tree";
|
|
4
|
+
import type { FhirBundleSdk } from "../fhir-bundle-sdk";
|
|
5
|
+
/**
|
|
6
|
+
* Validation result interface
|
|
7
|
+
*/
|
|
8
|
+
export interface ValidationResult {
|
|
9
|
+
hasBrokenReferences: boolean;
|
|
10
|
+
brokenReferences: BrokenReference[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Broken reference details interface
|
|
14
|
+
*/
|
|
15
|
+
export interface BrokenReference {
|
|
16
|
+
sourceResourceId: string;
|
|
17
|
+
sourceResourceType: string;
|
|
18
|
+
referenceField: string;
|
|
19
|
+
reference: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Bundle diff result interface
|
|
23
|
+
*/
|
|
24
|
+
export interface BundleDiffResult {
|
|
25
|
+
/** Resources that exist in both bundles */
|
|
26
|
+
common: FhirBundleSdk;
|
|
27
|
+
/** Resources that exist only in the base bundle (this bundle) */
|
|
28
|
+
baseOnly: FhirBundleSdk;
|
|
29
|
+
/** Resources that exist only in the parameter bundle */
|
|
30
|
+
parameterOnly: FhirBundleSdk;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Walk options for reference traversal
|
|
34
|
+
*/
|
|
35
|
+
export interface WalkOptions {
|
|
36
|
+
/** Maximum depth to traverse (default: Infinity) */
|
|
37
|
+
maxDepth?: number;
|
|
38
|
+
/** Include the starting resource in results (default: true) */
|
|
39
|
+
includeStartResource?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Options for generating LLM context
|
|
43
|
+
*/
|
|
44
|
+
export interface LLMContextOptions {
|
|
45
|
+
/** Maximum depth to traverse (default: 2) */
|
|
46
|
+
maxDepth?: number;
|
|
47
|
+
/** Include the starting resource in results (default: true) */
|
|
48
|
+
includeStartResource?: boolean;
|
|
49
|
+
/** Output format (default: 'structured-text') */
|
|
50
|
+
format?: "json" | "structured-text";
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Result of walking references
|
|
54
|
+
*/
|
|
55
|
+
export interface WalkResult<T extends Resource> {
|
|
56
|
+
/** All discovered resources organized by depth level */
|
|
57
|
+
resourcesByDepth: Map<number, Smart<Resource>[]>;
|
|
58
|
+
/** All discovered resources as a flat array */
|
|
59
|
+
allResources: Smart<Resource>[];
|
|
60
|
+
/** The starting resource */
|
|
61
|
+
startResource: Smart<T>;
|
|
62
|
+
/** Number of levels traversed */
|
|
63
|
+
depthReached: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Reverse reference details
|
|
67
|
+
*/
|
|
68
|
+
export interface ReverseReference {
|
|
69
|
+
sourceResourceId: string;
|
|
70
|
+
sourceResourceType: string;
|
|
71
|
+
referenceField: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Options for reverse reference lookup
|
|
75
|
+
*/
|
|
76
|
+
export interface ReverseReferenceOptions {
|
|
77
|
+
/** Filter by source resource type */
|
|
78
|
+
resourceType?: string;
|
|
79
|
+
/** Filter by specific reference field */
|
|
80
|
+
referenceField?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Date index record for interval tree
|
|
84
|
+
*/
|
|
85
|
+
export interface DateIndexRecord extends Interval<number> {
|
|
86
|
+
resourceId: string;
|
|
87
|
+
resourceType: string;
|
|
88
|
+
dateField: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Options for date range search
|
|
92
|
+
*/
|
|
93
|
+
export interface DateRangeSearchOptions {
|
|
94
|
+
/** Start date for search range (inclusive) */
|
|
95
|
+
dateFrom: string | Date;
|
|
96
|
+
/** End date for search range (inclusive, defaults to current date if not provided) */
|
|
97
|
+
dateTo?: string | Date;
|
|
98
|
+
/** Filter results by resource types */
|
|
99
|
+
resourceTypes?: string[];
|
|
100
|
+
/** Filter results by specific date fields */
|
|
101
|
+
dateFields?: string[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Helper function to get resource identifier from bundle entry
|
|
105
|
+
*/
|
|
106
|
+
export declare function getResourceIdentifier(entry: BundleEntry): string | undefined;
|
|
107
|
+
//# sourceMappingURL=sdk-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-types.d.ts","sourceRoot":"","sources":["../../src/types/sdk-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,eAAe,EAAE,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,MAAM,EAAE,aAAa,CAAC;IAC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S,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAQ5E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getResourceIdentifier = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to get resource identifier from bundle entry
|
|
6
|
+
*/
|
|
7
|
+
function getResourceIdentifier(entry) {
|
|
8
|
+
if (entry.resource?.id) {
|
|
9
|
+
return entry.resource.id;
|
|
10
|
+
}
|
|
11
|
+
if (entry.fullUrl) {
|
|
12
|
+
return entry.fullUrl;
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
exports.getResourceIdentifier = getResourceIdentifier;
|
|
17
|
+
//# sourceMappingURL=sdk-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|