fhir-data-utils-ts 0.6.3 → 0.6.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Export one repository-safe, telephone-free IPS demo document with all sixteen
6
+ clinical sections from the explicit `fhir-data-utils-ts/data` entry point so
7
+ product portals and visual tests share the same typed source data.
5
8
  - Publish repository-safe Appointment/Communication and Encounter-transfer
6
9
  fixtures from the explicit `fhir-data-utils-ts/data` entry point. Their
7
10
  `*.data.ts` implementations are excluded from executable coverage while the
@@ -1,3 +1,4 @@
1
1
  /** Reusable, repository-safe examples for tests, docs and portal demos. */
2
2
  export * from './appointment-communication.data.js';
3
3
  export * from './encounter-transfer.data.js';
4
+ export * from './ips-all-sections.data.js';
@@ -1,3 +1,4 @@
1
1
  /** Reusable, repository-safe examples for tests, docs and portal demos. */
2
2
  export * from './appointment-communication.data.js';
3
3
  export * from './encounter-transfer.data.js';
4
+ export * from './ips-all-sections.data.js';
@@ -0,0 +1,327 @@
1
+ /** Repository-safe synthetic IPS document used by portal demos and visual tests. */
2
+ /**
3
+ * Complete synthetic IPS screen fixture.
4
+ *
5
+ * It intentionally uses `Doe`, contains no telephone number, and covers the
6
+ * sixteen clinical sections in the official IPS all-sections order. It is
7
+ * presentation/test data only and never represents authorization or consent.
8
+ */
9
+ export declare const FHIR_IPS_ALL_SECTIONS_DEMO_DATA: Readonly<{
10
+ subject: Readonly<{
11
+ reference: "Patient/jane-doe-demo";
12
+ givenName: "Jane";
13
+ familyName: "Doe";
14
+ displayName: "Jane Doe";
15
+ }>;
16
+ sectionCount: 16;
17
+ bundle: Readonly<{
18
+ resourceType: "Bundle";
19
+ id: "bundle-ips-all-sections-demo";
20
+ type: "document";
21
+ timestamp: "2026-09-30T10:20:00Z";
22
+ entry: readonly ({
23
+ fullUrl: string;
24
+ resource: {
25
+ patient: {
26
+ reference: string;
27
+ };
28
+ clinicalStatus: {
29
+ text: string;
30
+ };
31
+ verificationStatus: {
32
+ text: string;
33
+ };
34
+ code: {
35
+ text: string;
36
+ coding: {
37
+ system: string;
38
+ code: string;
39
+ display: string;
40
+ }[];
41
+ };
42
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
43
+ id: string;
44
+ status: string;
45
+ subject: {
46
+ reference: string;
47
+ };
48
+ } | {
49
+ status: string;
50
+ medicationCodeableConcept: {
51
+ text: string;
52
+ coding: {
53
+ system: string;
54
+ code: string;
55
+ display: string;
56
+ }[];
57
+ };
58
+ effectiveDateTime: string;
59
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
60
+ id: string;
61
+ subject: {
62
+ reference: string;
63
+ };
64
+ } | {
65
+ status: string;
66
+ patient: {
67
+ reference: string;
68
+ };
69
+ vaccineCode: {
70
+ text: string;
71
+ coding: {
72
+ system: string;
73
+ code: string;
74
+ display: string;
75
+ }[];
76
+ };
77
+ occurrenceDateTime: string;
78
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
79
+ id: string;
80
+ subject: {
81
+ reference: string;
82
+ };
83
+ } | {
84
+ status: string;
85
+ code: {
86
+ text: string;
87
+ coding: {
88
+ system: string;
89
+ code: string;
90
+ display: string;
91
+ }[];
92
+ };
93
+ effectiveDateTime: string;
94
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
95
+ id: string;
96
+ subject: {
97
+ reference: string;
98
+ };
99
+ } | {
100
+ status: string;
101
+ code: {
102
+ text: string;
103
+ coding: {
104
+ system: string;
105
+ code: string;
106
+ display: string;
107
+ }[];
108
+ };
109
+ performedDateTime: string;
110
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
111
+ id: string;
112
+ subject: {
113
+ reference: string;
114
+ };
115
+ } | {
116
+ status: string;
117
+ device: {
118
+ display: "Corrective lens use";
119
+ };
120
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
121
+ id: string;
122
+ subject: {
123
+ reference: string;
124
+ };
125
+ } | {
126
+ code: {
127
+ text: string;
128
+ coding: {
129
+ system: string;
130
+ code: string;
131
+ display: string;
132
+ }[];
133
+ };
134
+ effectiveDateTime: string;
135
+ valueQuantity: {
136
+ value: number;
137
+ unit: string;
138
+ system: string;
139
+ code: string;
140
+ };
141
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
142
+ id: string;
143
+ status: string;
144
+ subject: {
145
+ reference: string;
146
+ };
147
+ } | {
148
+ code: {
149
+ text: string;
150
+ coding: {
151
+ system: string;
152
+ code: string;
153
+ display: string;
154
+ }[];
155
+ };
156
+ effectiveDateTime: string;
157
+ valueCodeableConcept: {
158
+ text: string;
159
+ coding: {
160
+ system: string;
161
+ code: string;
162
+ display: string;
163
+ }[];
164
+ };
165
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
166
+ id: string;
167
+ status: string;
168
+ subject: {
169
+ reference: string;
170
+ };
171
+ } | {
172
+ status: string;
173
+ code: {
174
+ text: string;
175
+ coding: {
176
+ system: string;
177
+ code: string;
178
+ display: string;
179
+ }[];
180
+ };
181
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
182
+ id: string;
183
+ subject: {
184
+ reference: string;
185
+ };
186
+ } | {
187
+ lifecycleStatus: string;
188
+ description: {
189
+ text: string;
190
+ coding: {
191
+ system: string;
192
+ code: string;
193
+ display: string;
194
+ }[];
195
+ };
196
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
197
+ id: string;
198
+ status: string;
199
+ subject: {
200
+ reference: string;
201
+ };
202
+ } | {
203
+ status: string;
204
+ scope: {
205
+ text: string;
206
+ coding: {
207
+ system: string;
208
+ code: string;
209
+ display: string;
210
+ }[];
211
+ };
212
+ category: {
213
+ text: string;
214
+ coding: {
215
+ system: string;
216
+ code: string;
217
+ display: string;
218
+ }[];
219
+ }[];
220
+ patient: {
221
+ reference: string;
222
+ };
223
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
224
+ id: string;
225
+ subject: {
226
+ reference: string;
227
+ };
228
+ } | {
229
+ status: string;
230
+ description: "Independent daily activities";
231
+ summary: "Independent daily activities";
232
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
233
+ id: string;
234
+ subject: {
235
+ reference: string;
236
+ };
237
+ } | {
238
+ status: string;
239
+ intent: string;
240
+ title: "Emergency follow-up plan";
241
+ category: {
242
+ text: string;
243
+ coding: {
244
+ system: string;
245
+ code: string;
246
+ display: string;
247
+ }[];
248
+ }[];
249
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
250
+ id: string;
251
+ subject: {
252
+ reference: string;
253
+ };
254
+ } | {
255
+ clinicalStatus: {
256
+ text: string;
257
+ };
258
+ code: {
259
+ text: string;
260
+ coding: {
261
+ system: string;
262
+ code: string;
263
+ display: string;
264
+ }[];
265
+ };
266
+ resourceType: "Condition" | "Goal" | "AllergyIntolerance" | "Procedure" | "DiagnosticReport" | "Observation" | "Immunization" | "CarePlan" | "ClinicalImpression" | "Consent" | "DeviceUseStatement" | "Flag" | "MedicationStatement";
267
+ id: string;
268
+ status: string;
269
+ subject: {
270
+ reference: string;
271
+ };
272
+ };
273
+ } | {
274
+ fullUrl: string;
275
+ resource: Readonly<{
276
+ resourceType: "Composition";
277
+ id: "ips-all-sections-demo";
278
+ status: "final";
279
+ type: {
280
+ coding: {
281
+ system: string;
282
+ code: string;
283
+ display: string;
284
+ }[];
285
+ };
286
+ subject: {
287
+ reference: string;
288
+ };
289
+ date: "2026-09-30T10:20:00Z";
290
+ author: {
291
+ reference: string;
292
+ }[];
293
+ title: "International Patient Summary";
294
+ section: {
295
+ title: "Problem list" | "Allergies and adverse reactions" | "History of medication use" | "History of immunization" | "Relevant diagnostic tests and laboratory data" | "History of procedures" | "History of medical device use" | "Vital signs" | "Social history" | "Alerts" | "Goals and preferences" | "Advance directives" | "Functional status" | "History of past illness" | "Pregnancy history" | "Plan of care";
296
+ code: {
297
+ coding: {
298
+ system: string;
299
+ code: "11450-4" | "48765-2" | "10160-0" | "11369-6" | "30954-2" | "47519-4" | "46264-8" | "8716-3" | "29762-2" | "104605-1" | "81338-6" | "42348-3" | "47420-5" | "11348-0" | "10162-6" | "18776-5";
300
+ display: "Problem list" | "Allergies and adverse reactions" | "History of medication use" | "History of immunization" | "Relevant diagnostic tests and laboratory data" | "History of procedures" | "History of medical device use" | "Vital signs" | "Social history" | "Alerts" | "Goals and preferences" | "Advance directives" | "Functional status" | "History of past illness" | "Pregnancy history" | "Plan of care";
301
+ }[];
302
+ };
303
+ entry: {
304
+ reference: string;
305
+ }[];
306
+ }[];
307
+ }>;
308
+ } | {
309
+ fullUrl: string;
310
+ resource: {
311
+ resourceType: string;
312
+ id: string;
313
+ name: {
314
+ given: string[];
315
+ family: string;
316
+ }[];
317
+ };
318
+ } | {
319
+ fullUrl: string;
320
+ resource: {
321
+ resourceType: string;
322
+ id: string;
323
+ name: string;
324
+ };
325
+ })[];
326
+ }>;
327
+ }>;
@@ -0,0 +1,114 @@
1
+ /** Repository-safe synthetic IPS document used by portal demos and visual tests. */
2
+ const LOINC_SYSTEM = 'http://loinc.org';
3
+ const SNOMED_SYSTEM = 'http://snomed.info/sct';
4
+ const SUBJECT_REFERENCE = 'Patient/jane-doe-demo';
5
+ const sectionDefinitions = Object.freeze([
6
+ ['11450-4', 'Problem list', 'Condition', 'Hypertensive disorder'],
7
+ ['48765-2', 'Allergies and adverse reactions', 'AllergyIntolerance', 'Penicillin allergy'],
8
+ ['10160-0', 'History of medication use', 'MedicationStatement', 'Metformin therapy'],
9
+ ['11369-6', 'History of immunization', 'Immunization', 'Influenza immunization'],
10
+ ['30954-2', 'Relevant diagnostic tests and laboratory data', 'DiagnosticReport', 'Emergency laboratory panel'],
11
+ ['47519-4', 'History of procedures', 'Procedure', 'Appendectomy'],
12
+ ['46264-8', 'History of medical device use', 'DeviceUseStatement', 'Corrective lens use'],
13
+ ['8716-3', 'Vital signs', 'Observation', 'Oxygen saturation'],
14
+ ['29762-2', 'Social history', 'Observation', 'Tobacco use assessment'],
15
+ ['104605-1', 'Alerts', 'Flag', 'Fall risk'],
16
+ ['81338-6', 'Goals and preferences', 'Goal', 'Maintain independent mobility'],
17
+ ['42348-3', 'Advance directives', 'Consent', 'Advance care directive'],
18
+ ['47420-5', 'Functional status', 'ClinicalImpression', 'Independent daily activities'],
19
+ ['11348-0', 'History of past illness', 'Condition', 'Resolved viral infection'],
20
+ ['10162-6', 'Pregnancy history', 'Observation', 'Not pregnant'],
21
+ ['18776-5', 'Plan of care', 'CarePlan', 'Emergency follow-up plan'],
22
+ ]);
23
+ function concept(text, code) {
24
+ return { text, coding: [{ system: SNOMED_SYSTEM, code, display: text }] };
25
+ }
26
+ function clinicalResource([sectionCode, , resourceType, title], index) {
27
+ const id = `ips-demo-${sectionCode.replace(/\D/g, '')}-${index + 1}`;
28
+ const common = { resourceType, id, status: resourceType === 'Goal' ? 'active' : 'final', subject: { reference: SUBJECT_REFERENCE } };
29
+ const coded = concept(title, String(100000 + index));
30
+ switch (resourceType) {
31
+ case 'AllergyIntolerance':
32
+ return { ...common, patient: common.subject, clinicalStatus: { text: 'Active' }, verificationStatus: { text: 'Confirmed' }, code: coded };
33
+ case 'MedicationStatement':
34
+ return { ...common, status: 'active', medicationCodeableConcept: coded, effectiveDateTime: '2026-09-01T08:00:00Z' };
35
+ case 'Immunization':
36
+ return { ...common, status: 'completed', patient: common.subject, vaccineCode: coded, occurrenceDateTime: '2026-04-10T10:00:00Z' };
37
+ case 'DiagnosticReport':
38
+ return { ...common, status: 'final', code: coded, effectiveDateTime: '2026-09-30T09:20:00Z' };
39
+ case 'Procedure':
40
+ return { ...common, status: 'completed', code: coded, performedDateTime: '2019-06-12T10:00:00Z' };
41
+ case 'DeviceUseStatement':
42
+ return { ...common, status: 'active', device: { display: title } };
43
+ case 'Observation':
44
+ return sectionCode === '8716-3'
45
+ ? { ...common, code: coded, effectiveDateTime: '2026-09-30T10:15:00Z', valueQuantity: { value: 97, unit: '%', system: 'http://unitsofmeasure.org', code: '%' } }
46
+ : { ...common, code: coded, effectiveDateTime: '2026-09-01T08:00:00Z', valueCodeableConcept: concept(title, String(200000 + index)) };
47
+ case 'Flag':
48
+ return { ...common, status: 'active', code: coded };
49
+ case 'Goal':
50
+ return { ...common, lifecycleStatus: 'active', description: coded };
51
+ case 'Consent':
52
+ return { ...common, status: 'active', scope: concept('Advance care', '385431004'), category: [coded], patient: common.subject };
53
+ case 'ClinicalImpression':
54
+ return { ...common, status: 'completed', description: title, summary: title };
55
+ case 'CarePlan':
56
+ return { ...common, status: 'active', intent: 'plan', title, category: [coded] };
57
+ default:
58
+ return { ...common, clinicalStatus: { text: sectionCode === '11348-0' ? 'Resolved' : 'Active' }, code: coded };
59
+ }
60
+ }
61
+ const clinicalResources = sectionDefinitions.map(clinicalResource);
62
+ const composition = Object.freeze({
63
+ resourceType: 'Composition',
64
+ id: 'ips-all-sections-demo',
65
+ status: 'final',
66
+ type: { coding: [{ system: LOINC_SYSTEM, code: '60591-5', display: 'Patient summary document' }] },
67
+ subject: { reference: SUBJECT_REFERENCE },
68
+ date: '2026-09-30T10:20:00Z',
69
+ author: [{ reference: 'Organization/demo-hospital' }],
70
+ title: 'International Patient Summary',
71
+ section: sectionDefinitions.map(([code, title], index) => ({
72
+ title,
73
+ code: { coding: [{ system: LOINC_SYSTEM, code, display: title }] },
74
+ entry: [{ reference: `${clinicalResources[index].resourceType}/${clinicalResources[index].id}` }],
75
+ })),
76
+ });
77
+ /**
78
+ * Complete synthetic IPS screen fixture.
79
+ *
80
+ * It intentionally uses `Doe`, contains no telephone number, and covers the
81
+ * sixteen clinical sections in the official IPS all-sections order. It is
82
+ * presentation/test data only and never represents authorization or consent.
83
+ */
84
+ export const FHIR_IPS_ALL_SECTIONS_DEMO_DATA = Object.freeze({
85
+ subject: Object.freeze({
86
+ reference: SUBJECT_REFERENCE,
87
+ givenName: 'Jane',
88
+ familyName: 'Doe',
89
+ displayName: 'Jane Doe',
90
+ }),
91
+ sectionCount: sectionDefinitions.length,
92
+ bundle: Object.freeze({
93
+ resourceType: 'Bundle',
94
+ id: 'bundle-ips-all-sections-demo',
95
+ type: 'document',
96
+ timestamp: '2026-09-30T10:20:00Z',
97
+ entry: Object.freeze([
98
+ { fullUrl: 'Composition/ips-all-sections-demo', resource: composition },
99
+ {
100
+ fullUrl: SUBJECT_REFERENCE,
101
+ resource: {
102
+ resourceType: 'Patient',
103
+ id: 'jane-doe-demo',
104
+ name: [{ given: ['Jane'], family: 'Doe' }],
105
+ },
106
+ },
107
+ {
108
+ fullUrl: 'Organization/demo-hospital',
109
+ resource: { resourceType: 'Organization', id: 'demo-hospital', name: 'Demo Hospital' },
110
+ },
111
+ ...clinicalResources.map(resource => ({ fullUrl: `${resource.resourceType}/${resource.id}`, resource })),
112
+ ]),
113
+ }),
114
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fhir-data-utils-ts",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "FHIR-version-neutral flat-claim and SearchParameter data utilities",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",