@openhi/constructs 0.0.113 → 0.0.115
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/lib/chunk-AHYQFT4N.mjs +212 -0
- package/lib/chunk-AHYQFT4N.mjs.map +1 -0
- package/lib/{chunk-CUUKXDB2.mjs → chunk-AJQUWHFK.mjs} +460 -54
- package/lib/chunk-AJQUWHFK.mjs.map +1 -0
- package/lib/{chunk-GBDIGTNV.mjs → chunk-QWWLM452.mjs} +2 -2
- package/lib/{chunk-QMBJ4VHC.mjs → chunk-U7L7T4XU.mjs} +25 -25
- package/lib/{chunk-QMBJ4VHC.mjs.map → chunk-U7L7T4XU.mjs.map} +1 -1
- package/lib/{chunk-NZRW7ROK.mjs → chunk-YYRWDEG4.mjs} +2 -2
- package/lib/{chunk-KSFC72TT.mjs → chunk-ZHMHLK3S.mjs} +2 -2
- package/lib/{events-DPodvl07.d.mts → events-CMG8xanm.d.mts} +7 -53
- package/lib/{events-DPodvl07.d.ts → events-CMG8xanm.d.ts} +7 -53
- package/lib/index.d.mts +64 -77
- package/lib/index.d.ts +70 -129
- package/lib/index.js +499 -241
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +58 -184
- package/lib/index.mjs.map +1 -1
- package/lib/pre-token-generation.handler.mjs +3 -3
- package/lib/provision-default-workspace.handler.mjs +3 -3
- package/lib/rest-api-lambda.handler.mjs +282 -452
- package/lib/rest-api-lambda.handler.mjs.map +1 -1
- package/lib/seed-demo-data.handler.d.mts +6 -3
- package/lib/seed-demo-data.handler.d.ts +6 -3
- package/lib/seed-demo-data.handler.js +656 -0
- package/lib/seed-demo-data.handler.js.map +1 -1
- package/lib/seed-demo-data.handler.mjs +4 -4
- package/package.json +8 -8
- package/lib/chunk-53OHXLIL.mjs +0 -27
- package/lib/chunk-53OHXLIL.mjs.map +0 -1
- package/lib/chunk-CUUKXDB2.mjs.map +0 -1
- /package/lib/{chunk-GBDIGTNV.mjs.map → chunk-QWWLM452.mjs.map} +0 -0
- /package/lib/{chunk-NZRW7ROK.mjs.map → chunk-YYRWDEG4.mjs.map} +0 -0
- /package/lib/{chunk-KSFC72TT.mjs.map → chunk-ZHMHLK3S.mjs.map} +0 -0
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createAccountOperation,
|
|
3
|
+
createEncounterOperation,
|
|
4
|
+
createObservationOperation,
|
|
5
|
+
createPatientOperation,
|
|
6
|
+
createPractitionerOperation,
|
|
2
7
|
getRoleByIdOperation
|
|
3
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AHYQFT4N.mjs";
|
|
4
9
|
import {
|
|
5
10
|
require_lib
|
|
6
11
|
} from "./chunk-ZM4GDHHC.mjs";
|
|
@@ -9,7 +14,7 @@ import {
|
|
|
9
14
|
createRoleAssignmentOperation,
|
|
10
15
|
createTenantOperation,
|
|
11
16
|
createWorkspaceOperation
|
|
12
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-QWWLM452.mjs";
|
|
13
18
|
import {
|
|
14
19
|
NotFoundError
|
|
15
20
|
} from "./chunk-FYHBHHWK.mjs";
|
|
@@ -130,55 +135,423 @@ var demoRolesForUserInTenant = (_user, _tenantId) => {
|
|
|
130
135
|
void _tenantId;
|
|
131
136
|
return [PLATFORM_ROLE_CODE.TENANT_ADMIN];
|
|
132
137
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
138
|
+
|
|
139
|
+
// src/workflows/control-plane/seed-demo-data/data-plane-fixtures.ts
|
|
140
|
+
var fixtureIdentifiers = (scenario, tenantId, workspaceId, resourceType, id, roleSuffix) => [
|
|
141
|
+
demoScenarioIdentifier(scenario, roleSuffix),
|
|
142
|
+
openhiResourceIdentifier({
|
|
143
|
+
tenantId,
|
|
144
|
+
workspaceId,
|
|
145
|
+
resourceType,
|
|
146
|
+
id
|
|
147
|
+
})
|
|
148
|
+
];
|
|
149
|
+
var buildWoundCareFixtures = (scenario, tenantId, workspaceId, idPrefix) => ({
|
|
150
|
+
tenantId,
|
|
151
|
+
workspaceId,
|
|
152
|
+
scenario,
|
|
153
|
+
patients: [
|
|
154
|
+
{
|
|
155
|
+
resourceType: "Patient",
|
|
156
|
+
id: `${idPrefix}-patient-1`,
|
|
157
|
+
identifier: fixtureIdentifiers(
|
|
158
|
+
scenario,
|
|
159
|
+
tenantId,
|
|
160
|
+
workspaceId,
|
|
161
|
+
"Patient",
|
|
162
|
+
`${idPrefix}-patient-1`,
|
|
163
|
+
`patient-1`
|
|
164
|
+
),
|
|
165
|
+
active: true,
|
|
166
|
+
name: [{ family: "Carter", given: ["Eleanor"], use: "official" }],
|
|
167
|
+
gender: "female",
|
|
168
|
+
birthDate: "1952-04-18"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
resourceType: "Patient",
|
|
172
|
+
id: `${idPrefix}-patient-2`,
|
|
173
|
+
identifier: fixtureIdentifiers(
|
|
174
|
+
scenario,
|
|
175
|
+
tenantId,
|
|
176
|
+
workspaceId,
|
|
177
|
+
"Patient",
|
|
178
|
+
`${idPrefix}-patient-2`,
|
|
179
|
+
`patient-2`
|
|
180
|
+
),
|
|
181
|
+
active: true,
|
|
182
|
+
name: [{ family: "Nguyen", given: ["Hao"], use: "official" }],
|
|
183
|
+
gender: "male",
|
|
184
|
+
birthDate: "1968-11-02"
|
|
145
185
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
186
|
+
],
|
|
187
|
+
practitioners: [
|
|
188
|
+
{
|
|
189
|
+
resourceType: "Practitioner",
|
|
190
|
+
id: `${idPrefix}-practitioner-1`,
|
|
191
|
+
identifier: fixtureIdentifiers(
|
|
192
|
+
scenario,
|
|
193
|
+
tenantId,
|
|
194
|
+
workspaceId,
|
|
195
|
+
"Practitioner",
|
|
196
|
+
`${idPrefix}-practitioner-1`,
|
|
197
|
+
`practitioner-1`
|
|
198
|
+
),
|
|
199
|
+
active: true,
|
|
200
|
+
name: [{ family: "Reyes", given: ["Maria"], prefix: ["Dr."] }],
|
|
201
|
+
gender: "female"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
resourceType: "Practitioner",
|
|
205
|
+
id: `${idPrefix}-practitioner-2`,
|
|
206
|
+
identifier: fixtureIdentifiers(
|
|
207
|
+
scenario,
|
|
208
|
+
tenantId,
|
|
209
|
+
workspaceId,
|
|
210
|
+
"Practitioner",
|
|
211
|
+
`${idPrefix}-practitioner-2`,
|
|
212
|
+
`practitioner-2`
|
|
213
|
+
),
|
|
214
|
+
active: true,
|
|
215
|
+
name: [{ family: "Okafor", given: ["Chinedu"], prefix: ["Dr."] }],
|
|
216
|
+
gender: "male"
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
observations: [
|
|
220
|
+
{
|
|
221
|
+
resourceType: "Observation",
|
|
222
|
+
id: `${idPrefix}-observation-1`,
|
|
223
|
+
identifier: fixtureIdentifiers(
|
|
224
|
+
scenario,
|
|
225
|
+
tenantId,
|
|
226
|
+
workspaceId,
|
|
227
|
+
"Observation",
|
|
228
|
+
`${idPrefix}-observation-1`,
|
|
229
|
+
`observation-1`
|
|
230
|
+
),
|
|
231
|
+
status: "final",
|
|
232
|
+
code: {
|
|
233
|
+
coding: [
|
|
234
|
+
{
|
|
235
|
+
system: "http://loinc.org",
|
|
236
|
+
code: "39135-9",
|
|
237
|
+
display: "Wound size"
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
},
|
|
241
|
+
subject: { reference: `Patient/${idPrefix}-patient-1` },
|
|
242
|
+
valueString: "3.2cm x 2.1cm"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
resourceType: "Observation",
|
|
246
|
+
id: `${idPrefix}-observation-2`,
|
|
247
|
+
identifier: fixtureIdentifiers(
|
|
248
|
+
scenario,
|
|
249
|
+
tenantId,
|
|
250
|
+
workspaceId,
|
|
251
|
+
"Observation",
|
|
252
|
+
`${idPrefix}-observation-2`,
|
|
253
|
+
`observation-2`
|
|
254
|
+
),
|
|
255
|
+
status: "final",
|
|
256
|
+
code: {
|
|
257
|
+
coding: [
|
|
258
|
+
{
|
|
259
|
+
system: "http://loinc.org",
|
|
260
|
+
code: "72287-2",
|
|
261
|
+
display: "Wound exudate amount"
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
subject: { reference: `Patient/${idPrefix}-patient-2` },
|
|
266
|
+
valueString: "moderate"
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
encounters: [
|
|
270
|
+
{
|
|
271
|
+
resourceType: "Encounter",
|
|
272
|
+
id: `${idPrefix}-encounter-1`,
|
|
273
|
+
identifier: fixtureIdentifiers(
|
|
274
|
+
scenario,
|
|
275
|
+
tenantId,
|
|
276
|
+
workspaceId,
|
|
277
|
+
"Encounter",
|
|
278
|
+
`${idPrefix}-encounter-1`,
|
|
279
|
+
`encounter-1`
|
|
280
|
+
),
|
|
281
|
+
status: "finished",
|
|
282
|
+
class: {
|
|
283
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
|
|
284
|
+
code: "AMB",
|
|
285
|
+
display: "ambulatory"
|
|
286
|
+
},
|
|
287
|
+
subject: { reference: `Patient/${idPrefix}-patient-1` }
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
resourceType: "Encounter",
|
|
291
|
+
id: `${idPrefix}-encounter-2`,
|
|
292
|
+
identifier: fixtureIdentifiers(
|
|
293
|
+
scenario,
|
|
294
|
+
tenantId,
|
|
295
|
+
workspaceId,
|
|
296
|
+
"Encounter",
|
|
297
|
+
`${idPrefix}-encounter-2`,
|
|
298
|
+
`encounter-2`
|
|
299
|
+
),
|
|
300
|
+
status: "finished",
|
|
301
|
+
class: {
|
|
302
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
|
|
303
|
+
code: "AMB",
|
|
304
|
+
display: "ambulatory"
|
|
305
|
+
},
|
|
306
|
+
subject: { reference: `Patient/${idPrefix}-patient-2` }
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
accounts: [
|
|
310
|
+
{
|
|
311
|
+
resourceType: "Account",
|
|
312
|
+
id: `${idPrefix}-account-1`,
|
|
313
|
+
identifier: fixtureIdentifiers(
|
|
314
|
+
scenario,
|
|
315
|
+
tenantId,
|
|
316
|
+
workspaceId,
|
|
317
|
+
"Account",
|
|
318
|
+
`${idPrefix}-account-1`,
|
|
319
|
+
`account-1`
|
|
320
|
+
),
|
|
321
|
+
status: "active",
|
|
322
|
+
name: "Wound-care self-pay account",
|
|
323
|
+
subject: [{ reference: `Patient/${idPrefix}-patient-1` }]
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
});
|
|
327
|
+
var buildPrimaryCareFixtures = (scenario, tenantId, workspaceId, idPrefix) => ({
|
|
328
|
+
tenantId,
|
|
329
|
+
workspaceId,
|
|
330
|
+
scenario,
|
|
331
|
+
patients: [
|
|
332
|
+
{
|
|
333
|
+
resourceType: "Patient",
|
|
334
|
+
id: `${idPrefix}-patient-1`,
|
|
335
|
+
identifier: fixtureIdentifiers(
|
|
336
|
+
scenario,
|
|
337
|
+
tenantId,
|
|
338
|
+
workspaceId,
|
|
339
|
+
"Patient",
|
|
340
|
+
`${idPrefix}-patient-1`,
|
|
341
|
+
`patient-1`
|
|
342
|
+
),
|
|
343
|
+
active: true,
|
|
344
|
+
name: [{ family: "Bennett", given: ["Sophia"], use: "official" }],
|
|
345
|
+
gender: "female",
|
|
346
|
+
birthDate: "1985-06-09"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
resourceType: "Patient",
|
|
350
|
+
id: `${idPrefix}-patient-2`,
|
|
351
|
+
identifier: fixtureIdentifiers(
|
|
352
|
+
scenario,
|
|
353
|
+
tenantId,
|
|
354
|
+
workspaceId,
|
|
355
|
+
"Patient",
|
|
356
|
+
`${idPrefix}-patient-2`,
|
|
357
|
+
`patient-2`
|
|
358
|
+
),
|
|
359
|
+
active: true,
|
|
360
|
+
name: [{ family: "Patel", given: ["Arjun"], use: "official" }],
|
|
361
|
+
gender: "male",
|
|
362
|
+
birthDate: "1979-02-21"
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
practitioners: [
|
|
366
|
+
{
|
|
367
|
+
resourceType: "Practitioner",
|
|
368
|
+
id: `${idPrefix}-practitioner-1`,
|
|
369
|
+
identifier: fixtureIdentifiers(
|
|
370
|
+
scenario,
|
|
371
|
+
tenantId,
|
|
372
|
+
workspaceId,
|
|
373
|
+
"Practitioner",
|
|
374
|
+
`${idPrefix}-practitioner-1`,
|
|
375
|
+
`practitioner-1`
|
|
376
|
+
),
|
|
377
|
+
active: true,
|
|
378
|
+
name: [{ family: "Lin", given: ["Wei"], prefix: ["Dr."] }],
|
|
379
|
+
gender: "female"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
resourceType: "Practitioner",
|
|
383
|
+
id: `${idPrefix}-practitioner-2`,
|
|
384
|
+
identifier: fixtureIdentifiers(
|
|
385
|
+
scenario,
|
|
386
|
+
tenantId,
|
|
387
|
+
workspaceId,
|
|
388
|
+
"Practitioner",
|
|
389
|
+
`${idPrefix}-practitioner-2`,
|
|
390
|
+
`practitioner-2`
|
|
391
|
+
),
|
|
392
|
+
active: true,
|
|
393
|
+
name: [{ family: "Kowalski", given: ["Piotr"], prefix: ["Dr."] }],
|
|
394
|
+
gender: "male"
|
|
395
|
+
}
|
|
396
|
+
],
|
|
397
|
+
observations: [
|
|
398
|
+
{
|
|
399
|
+
resourceType: "Observation",
|
|
400
|
+
id: `${idPrefix}-observation-1`,
|
|
401
|
+
identifier: fixtureIdentifiers(
|
|
402
|
+
scenario,
|
|
403
|
+
tenantId,
|
|
404
|
+
workspaceId,
|
|
405
|
+
"Observation",
|
|
406
|
+
`${idPrefix}-observation-1`,
|
|
407
|
+
`observation-1`
|
|
408
|
+
),
|
|
409
|
+
status: "final",
|
|
410
|
+
code: {
|
|
411
|
+
coding: [
|
|
412
|
+
{
|
|
413
|
+
system: "http://loinc.org",
|
|
414
|
+
code: "8480-6",
|
|
415
|
+
display: "Systolic blood pressure"
|
|
416
|
+
}
|
|
417
|
+
]
|
|
418
|
+
},
|
|
419
|
+
subject: { reference: `Patient/${idPrefix}-patient-1` },
|
|
420
|
+
valueQuantity: { value: 122, unit: "mm[Hg]" }
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
resourceType: "Observation",
|
|
424
|
+
id: `${idPrefix}-observation-2`,
|
|
425
|
+
identifier: fixtureIdentifiers(
|
|
426
|
+
scenario,
|
|
427
|
+
tenantId,
|
|
428
|
+
workspaceId,
|
|
429
|
+
"Observation",
|
|
430
|
+
`${idPrefix}-observation-2`,
|
|
431
|
+
`observation-2`
|
|
432
|
+
),
|
|
433
|
+
status: "final",
|
|
434
|
+
code: {
|
|
435
|
+
coding: [
|
|
436
|
+
{
|
|
437
|
+
system: "http://loinc.org",
|
|
438
|
+
code: "8462-4",
|
|
439
|
+
display: "Diastolic blood pressure"
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
},
|
|
443
|
+
subject: { reference: `Patient/${idPrefix}-patient-2` },
|
|
444
|
+
valueQuantity: { value: 78, unit: "mm[Hg]" }
|
|
445
|
+
}
|
|
446
|
+
],
|
|
447
|
+
encounters: [
|
|
448
|
+
{
|
|
449
|
+
resourceType: "Encounter",
|
|
450
|
+
id: `${idPrefix}-encounter-1`,
|
|
451
|
+
identifier: fixtureIdentifiers(
|
|
452
|
+
scenario,
|
|
453
|
+
tenantId,
|
|
454
|
+
workspaceId,
|
|
455
|
+
"Encounter",
|
|
456
|
+
`${idPrefix}-encounter-1`,
|
|
457
|
+
`encounter-1`
|
|
458
|
+
),
|
|
459
|
+
status: "finished",
|
|
460
|
+
class: {
|
|
461
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
|
|
462
|
+
code: "AMB",
|
|
463
|
+
display: "ambulatory"
|
|
464
|
+
},
|
|
465
|
+
subject: { reference: `Patient/${idPrefix}-patient-1` }
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
resourceType: "Encounter",
|
|
469
|
+
id: `${idPrefix}-encounter-2`,
|
|
470
|
+
identifier: fixtureIdentifiers(
|
|
471
|
+
scenario,
|
|
472
|
+
tenantId,
|
|
473
|
+
workspaceId,
|
|
474
|
+
"Encounter",
|
|
475
|
+
`${idPrefix}-encounter-2`,
|
|
476
|
+
`encounter-2`
|
|
477
|
+
),
|
|
478
|
+
status: "in-progress",
|
|
479
|
+
class: {
|
|
480
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
|
|
481
|
+
code: "AMB",
|
|
482
|
+
display: "ambulatory"
|
|
483
|
+
},
|
|
484
|
+
subject: { reference: `Patient/${idPrefix}-patient-2` }
|
|
485
|
+
}
|
|
486
|
+
],
|
|
487
|
+
accounts: [
|
|
488
|
+
{
|
|
489
|
+
resourceType: "Account",
|
|
490
|
+
id: `${idPrefix}-account-1`,
|
|
491
|
+
identifier: fixtureIdentifiers(
|
|
492
|
+
scenario,
|
|
493
|
+
tenantId,
|
|
494
|
+
workspaceId,
|
|
495
|
+
"Account",
|
|
496
|
+
`${idPrefix}-account-1`,
|
|
497
|
+
`account-1`
|
|
498
|
+
),
|
|
499
|
+
status: "active",
|
|
500
|
+
name: "Primary-care insurance account",
|
|
501
|
+
subject: [{ reference: `Patient/${idPrefix}-patient-1` }]
|
|
502
|
+
}
|
|
503
|
+
]
|
|
504
|
+
});
|
|
505
|
+
var DEMO_DATA_PLANE_FIXTURES = [
|
|
506
|
+
buildWoundCareFixtures(
|
|
507
|
+
"demo-wound-care",
|
|
508
|
+
"demo-wound-care-tenant",
|
|
509
|
+
"demo-wound-care-workspace",
|
|
510
|
+
"demo-wound-care"
|
|
511
|
+
),
|
|
512
|
+
buildPrimaryCareFixtures(
|
|
513
|
+
"demo-primary-care",
|
|
514
|
+
"demo-primary-care-tenant",
|
|
515
|
+
"demo-primary-care-workspace",
|
|
516
|
+
"demo-primary-care"
|
|
517
|
+
),
|
|
518
|
+
buildWoundCareFixtures(
|
|
519
|
+
"demo-mixed",
|
|
520
|
+
"demo-mixed-tenant",
|
|
521
|
+
"demo-mixed-workspace-wound-care",
|
|
522
|
+
"demo-mixed-wound-care"
|
|
523
|
+
),
|
|
524
|
+
buildPrimaryCareFixtures(
|
|
525
|
+
"demo-mixed",
|
|
526
|
+
"demo-mixed-tenant",
|
|
527
|
+
"demo-mixed-workspace-primary-care",
|
|
528
|
+
"demo-mixed-primary-care"
|
|
529
|
+
)
|
|
530
|
+
];
|
|
531
|
+
var _validateFixturesAgainstTenantSpecs = () => {
|
|
532
|
+
for (const group of DEMO_DATA_PLANE_FIXTURES) {
|
|
533
|
+
if (group.tenantId === PLACEHOLDER_TENANT_ID) {
|
|
534
|
+
throw new Error(
|
|
535
|
+
"The placeholder tenant must not carry data-plane fixtures."
|
|
159
536
|
);
|
|
160
|
-
for (const roleCode of demoRolesForUserInTenant(user, spec.tenantId)) {
|
|
161
|
-
keys.push(
|
|
162
|
-
demoRoleAssignmentPartitionKey(
|
|
163
|
-
spec.tenantId,
|
|
164
|
-
demoRoleAssignmentId(user.id, spec.tenantId, roleCode)
|
|
165
|
-
)
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
537
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
)
|
|
538
|
+
const tenant = DEMO_TENANT_SPECS.find((s) => s.tenantId === group.tenantId);
|
|
539
|
+
if (!tenant) {
|
|
540
|
+
throw new Error(
|
|
541
|
+
`Fixture references unknown tenantId "${group.tenantId}". Add a matching entry to DEMO_TENANT_SPECS first.`
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
const workspace = tenant.workspaces.find(
|
|
545
|
+
(ws) => ws.id === group.workspaceId
|
|
178
546
|
);
|
|
547
|
+
if (!workspace) {
|
|
548
|
+
throw new Error(
|
|
549
|
+
`Fixture references unknown workspaceId "${group.workspaceId}" for tenant "${group.tenantId}".`
|
|
550
|
+
);
|
|
551
|
+
}
|
|
179
552
|
}
|
|
180
|
-
return keys;
|
|
181
553
|
};
|
|
554
|
+
_validateFixturesAgainstTenantSpecs();
|
|
182
555
|
|
|
183
556
|
// src/workflows/control-plane/seed-demo-data/seed-demo-data.handler.ts
|
|
184
557
|
var SEED_DEMO_DATA_USER_POOL_ID_ENV_VAR = "SEED_DEMO_DATA_USER_POOL_ID";
|
|
@@ -297,6 +670,43 @@ var upsertUser = async (context, user, cognitoSub) => {
|
|
|
297
670
|
lastUpdated: context.date ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
298
671
|
}).go();
|
|
299
672
|
};
|
|
673
|
+
var seedWorkspaceDataPlane = async (baseContext, group) => {
|
|
674
|
+
const workspaceContext = {
|
|
675
|
+
...baseContext,
|
|
676
|
+
tenantId: group.tenantId,
|
|
677
|
+
workspaceId: group.workspaceId
|
|
678
|
+
};
|
|
679
|
+
for (const patient of group.patients) {
|
|
680
|
+
await createPatientOperation({
|
|
681
|
+
context: workspaceContext,
|
|
682
|
+
body: patient
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
for (const practitioner of group.practitioners) {
|
|
686
|
+
await createPractitionerOperation({
|
|
687
|
+
context: workspaceContext,
|
|
688
|
+
body: practitioner
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
for (const observation of group.observations) {
|
|
692
|
+
await createObservationOperation({
|
|
693
|
+
context: workspaceContext,
|
|
694
|
+
body: observation
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
for (const encounter of group.encounters) {
|
|
698
|
+
await createEncounterOperation({
|
|
699
|
+
context: workspaceContext,
|
|
700
|
+
body: encounter
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
for (const account of group.accounts) {
|
|
704
|
+
await createAccountOperation({
|
|
705
|
+
context: workspaceContext,
|
|
706
|
+
body: account
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
};
|
|
300
710
|
var seedDemoGraph = async (params) => {
|
|
301
711
|
const { baseContext, devUsers, cognito } = params;
|
|
302
712
|
for (const spec of DEMO_TENANT_SPECS) {
|
|
@@ -375,6 +785,9 @@ var seedDemoGraph = async (params) => {
|
|
|
375
785
|
}
|
|
376
786
|
});
|
|
377
787
|
}
|
|
788
|
+
for (const group of DEMO_DATA_PLANE_FIXTURES) {
|
|
789
|
+
await seedWorkspaceDataPlane(baseContext, group);
|
|
790
|
+
}
|
|
378
791
|
};
|
|
379
792
|
var runSeedDemoData = async (event, deps, devUsers) => {
|
|
380
793
|
const parsed = (0, import_workflows2.parseWorkflowEvent)(event, import_workflows.PlatformSystemDataSeededV1);
|
|
@@ -511,14 +924,7 @@ export {
|
|
|
511
924
|
demoScenarioIdentifier,
|
|
512
925
|
openhiResourceIdentifier,
|
|
513
926
|
demoRolesForUserInTenant,
|
|
514
|
-
|
|
515
|
-
demoTenantPartitionKey,
|
|
516
|
-
demoWorkspacePartitionKey,
|
|
517
|
-
demoMembershipPartitionKey,
|
|
518
|
-
demoRoleAssignmentPartitionKey,
|
|
519
|
-
demoUserPartitionKey,
|
|
520
|
-
demoBasePartitionKeys,
|
|
521
|
-
demoDevUserPartitionKeys,
|
|
927
|
+
DEMO_DATA_PLANE_FIXTURES,
|
|
522
928
|
SEED_DEMO_DATA_USER_POOL_ID_ENV_VAR,
|
|
523
929
|
seedDemoGraph,
|
|
524
930
|
runSeedDemoData,
|
|
@@ -526,4 +932,4 @@ export {
|
|
|
526
932
|
productionCognitoProvisioner,
|
|
527
933
|
handler
|
|
528
934
|
};
|
|
529
|
-
//# sourceMappingURL=chunk-
|
|
935
|
+
//# sourceMappingURL=chunk-AJQUWHFK.mjs.map
|