@medplum/mock 0.9.16 → 0.9.19
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/cjs/index.js +340 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +333 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/types/mocks/index.d.ts +1 -0
- package/dist/types/mocks/workflow.d.ts +10 -0
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -302,6 +302,10 @@
|
|
|
302
302
|
const HomerObservation1 = {
|
|
303
303
|
resourceType: 'Observation',
|
|
304
304
|
id: '1',
|
|
305
|
+
subject: {
|
|
306
|
+
reference: 'Patient/123',
|
|
307
|
+
display: 'Homer Simpson',
|
|
308
|
+
},
|
|
305
309
|
code: {
|
|
306
310
|
text: 'Test 1',
|
|
307
311
|
},
|
|
@@ -310,6 +314,10 @@
|
|
|
310
314
|
const HomerObservation2 = {
|
|
311
315
|
resourceType: 'Observation',
|
|
312
316
|
id: '2',
|
|
317
|
+
subject: {
|
|
318
|
+
reference: 'Patient/123',
|
|
319
|
+
display: 'Homer Simpson',
|
|
320
|
+
},
|
|
313
321
|
code: {
|
|
314
322
|
text: 'Test 2',
|
|
315
323
|
},
|
|
@@ -328,6 +336,10 @@
|
|
|
328
336
|
const HomerObservation3 = {
|
|
329
337
|
resourceType: 'Observation',
|
|
330
338
|
id: '3',
|
|
339
|
+
subject: {
|
|
340
|
+
reference: 'Patient/123',
|
|
341
|
+
display: 'Homer Simpson',
|
|
342
|
+
},
|
|
331
343
|
code: {
|
|
332
344
|
text: 'Test 3',
|
|
333
345
|
},
|
|
@@ -346,6 +358,10 @@
|
|
|
346
358
|
const HomerObservation4 = {
|
|
347
359
|
resourceType: 'Observation',
|
|
348
360
|
id: '4',
|
|
361
|
+
subject: {
|
|
362
|
+
reference: 'Patient/123',
|
|
363
|
+
display: 'Homer Simpson',
|
|
364
|
+
},
|
|
349
365
|
code: {
|
|
350
366
|
text: 'Test 4',
|
|
351
367
|
},
|
|
@@ -375,6 +391,10 @@
|
|
|
375
391
|
const HomerObservation5 = {
|
|
376
392
|
resourceType: 'Observation',
|
|
377
393
|
id: '5',
|
|
394
|
+
subject: {
|
|
395
|
+
reference: 'Patient/123',
|
|
396
|
+
display: 'Homer Simpson',
|
|
397
|
+
},
|
|
378
398
|
code: {
|
|
379
399
|
text: 'Test 5',
|
|
380
400
|
},
|
|
@@ -388,6 +408,10 @@
|
|
|
388
408
|
const HomerObservation6 = {
|
|
389
409
|
resourceType: 'Observation',
|
|
390
410
|
id: '6',
|
|
411
|
+
subject: {
|
|
412
|
+
reference: 'Patient/123',
|
|
413
|
+
display: 'Homer Simpson',
|
|
414
|
+
},
|
|
391
415
|
code: {
|
|
392
416
|
text: 'Test 6',
|
|
393
417
|
},
|
|
@@ -510,6 +534,176 @@
|
|
|
510
534
|
};
|
|
511
535
|
|
|
512
536
|
var StructureDefinitionList = [
|
|
537
|
+
{
|
|
538
|
+
resourceType: "StructureDefinition",
|
|
539
|
+
id: "Address",
|
|
540
|
+
name: "Address",
|
|
541
|
+
description: "Base StructureDefinition for Address Type: An address expressed using postal conventions (as opposed to GPS or other location definition formats). This data type may be used to convey addresses for use in delivering mail as well as for visiting locations which might not be valid for mail delivery. There are a variety of postal address formats defined around the world.",
|
|
542
|
+
type: "Address",
|
|
543
|
+
snapshot: {
|
|
544
|
+
element: [
|
|
545
|
+
{
|
|
546
|
+
id: "Address",
|
|
547
|
+
path: "Address",
|
|
548
|
+
definition: "An address expressed using postal conventions (as opposed to GPS or other location definition formats). This data type may be used to convey addresses for use in delivering mail as well as for visiting locations which might not be valid for mail delivery. There are a variety of postal address formats defined around the world.",
|
|
549
|
+
min: 0,
|
|
550
|
+
max: "*"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
id: "Address.id",
|
|
554
|
+
path: "Address.id",
|
|
555
|
+
definition: "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.",
|
|
556
|
+
min: 0,
|
|
557
|
+
max: "1",
|
|
558
|
+
type: [
|
|
559
|
+
{
|
|
560
|
+
code: "http://hl7.org/fhirpath/System.String"
|
|
561
|
+
}
|
|
562
|
+
]
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
id: "Address.extension",
|
|
566
|
+
path: "Address.extension",
|
|
567
|
+
definition: "May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.",
|
|
568
|
+
min: 0,
|
|
569
|
+
max: "*",
|
|
570
|
+
type: [
|
|
571
|
+
{
|
|
572
|
+
code: "Extension"
|
|
573
|
+
}
|
|
574
|
+
]
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
id: "Address.use",
|
|
578
|
+
path: "Address.use",
|
|
579
|
+
definition: "The purpose of this address.",
|
|
580
|
+
min: 0,
|
|
581
|
+
max: "1",
|
|
582
|
+
type: [
|
|
583
|
+
{
|
|
584
|
+
code: "code"
|
|
585
|
+
}
|
|
586
|
+
],
|
|
587
|
+
binding: {
|
|
588
|
+
description: "The use of an address.",
|
|
589
|
+
valueSet: "http://hl7.org/fhir/ValueSet/address-use|4.0.1"
|
|
590
|
+
}
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
id: "Address.type",
|
|
594
|
+
path: "Address.type",
|
|
595
|
+
definition: "Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.",
|
|
596
|
+
min: 0,
|
|
597
|
+
max: "1",
|
|
598
|
+
type: [
|
|
599
|
+
{
|
|
600
|
+
code: "code"
|
|
601
|
+
}
|
|
602
|
+
],
|
|
603
|
+
binding: {
|
|
604
|
+
description: "The type of an address (physical / postal).",
|
|
605
|
+
valueSet: "http://hl7.org/fhir/ValueSet/address-type|4.0.1"
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
id: "Address.text",
|
|
610
|
+
path: "Address.text",
|
|
611
|
+
definition: "Specifies the entire address as it should be displayed e.g. on a postal label. This may be provided instead of or as well as the specific parts.",
|
|
612
|
+
min: 0,
|
|
613
|
+
max: "1",
|
|
614
|
+
type: [
|
|
615
|
+
{
|
|
616
|
+
code: "string"
|
|
617
|
+
}
|
|
618
|
+
]
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
id: "Address.line",
|
|
622
|
+
path: "Address.line",
|
|
623
|
+
definition: "This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.",
|
|
624
|
+
min: 0,
|
|
625
|
+
max: "*",
|
|
626
|
+
type: [
|
|
627
|
+
{
|
|
628
|
+
code: "string"
|
|
629
|
+
}
|
|
630
|
+
]
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
id: "Address.city",
|
|
634
|
+
path: "Address.city",
|
|
635
|
+
definition: "The name of the city, town, suburb, village or other community or delivery center.",
|
|
636
|
+
min: 0,
|
|
637
|
+
max: "1",
|
|
638
|
+
type: [
|
|
639
|
+
{
|
|
640
|
+
code: "string"
|
|
641
|
+
}
|
|
642
|
+
]
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
id: "Address.district",
|
|
646
|
+
path: "Address.district",
|
|
647
|
+
definition: "The name of the administrative area (county).",
|
|
648
|
+
min: 0,
|
|
649
|
+
max: "1",
|
|
650
|
+
type: [
|
|
651
|
+
{
|
|
652
|
+
code: "string"
|
|
653
|
+
}
|
|
654
|
+
]
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
id: "Address.state",
|
|
658
|
+
path: "Address.state",
|
|
659
|
+
definition: "Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (e.g. US 2 letter state codes).",
|
|
660
|
+
min: 0,
|
|
661
|
+
max: "1",
|
|
662
|
+
type: [
|
|
663
|
+
{
|
|
664
|
+
code: "string"
|
|
665
|
+
}
|
|
666
|
+
]
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
id: "Address.postalCode",
|
|
670
|
+
path: "Address.postalCode",
|
|
671
|
+
definition: "A postal code designating a region defined by the postal service.",
|
|
672
|
+
min: 0,
|
|
673
|
+
max: "1",
|
|
674
|
+
type: [
|
|
675
|
+
{
|
|
676
|
+
code: "string"
|
|
677
|
+
}
|
|
678
|
+
]
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
id: "Address.country",
|
|
682
|
+
path: "Address.country",
|
|
683
|
+
definition: "Country - a nation as commonly understood or generally accepted.",
|
|
684
|
+
min: 0,
|
|
685
|
+
max: "1",
|
|
686
|
+
type: [
|
|
687
|
+
{
|
|
688
|
+
code: "string"
|
|
689
|
+
}
|
|
690
|
+
]
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
id: "Address.period",
|
|
694
|
+
path: "Address.period",
|
|
695
|
+
definition: "Time period when address was/is in use.",
|
|
696
|
+
min: 0,
|
|
697
|
+
max: "1",
|
|
698
|
+
type: [
|
|
699
|
+
{
|
|
700
|
+
code: "Period"
|
|
701
|
+
}
|
|
702
|
+
]
|
|
703
|
+
}
|
|
704
|
+
]
|
|
705
|
+
}
|
|
706
|
+
},
|
|
513
707
|
{
|
|
514
708
|
resourceType: "StructureDefinition",
|
|
515
709
|
id: "DiagnosticReport",
|
|
@@ -6428,7 +6622,7 @@
|
|
|
6428
6622
|
base: ['Patient', 'Practitioner'],
|
|
6429
6623
|
code: 'address-city',
|
|
6430
6624
|
name: 'address-city',
|
|
6431
|
-
type: '
|
|
6625
|
+
type: 'string',
|
|
6432
6626
|
expression: 'Patient.address.city | Practitioner.address.city',
|
|
6433
6627
|
},
|
|
6434
6628
|
{
|
|
@@ -6465,6 +6659,14 @@
|
|
|
6465
6659
|
type: 'quantity',
|
|
6466
6660
|
expression: '(Observation.value as Quantity) | (Observation.value as SampledData)',
|
|
6467
6661
|
},
|
|
6662
|
+
{
|
|
6663
|
+
resourceType: 'SearchParameter',
|
|
6664
|
+
id: 'Observation-value-string',
|
|
6665
|
+
code: 'value-string',
|
|
6666
|
+
base: ['Observation'],
|
|
6667
|
+
type: 'string',
|
|
6668
|
+
expression: '(Observation.value as string) | (Observation.value as CodeableConcept).text',
|
|
6669
|
+
},
|
|
6468
6670
|
{
|
|
6469
6671
|
resourceType: 'SearchParameter',
|
|
6470
6672
|
id: 'Encounter-length',
|
|
@@ -6494,6 +6696,121 @@
|
|
|
6494
6696
|
},
|
|
6495
6697
|
};
|
|
6496
6698
|
|
|
6699
|
+
const ExampleWorkflowQuestionnaire1 = {
|
|
6700
|
+
resourceType: 'Questionnaire',
|
|
6701
|
+
id: 'workflow-questionnaire-1',
|
|
6702
|
+
name: 'Patient Registration',
|
|
6703
|
+
title: 'Patient Registration',
|
|
6704
|
+
subjectType: ['Patient'],
|
|
6705
|
+
item: [
|
|
6706
|
+
{
|
|
6707
|
+
linkId: '1',
|
|
6708
|
+
text: 'First question',
|
|
6709
|
+
type: 'string',
|
|
6710
|
+
},
|
|
6711
|
+
],
|
|
6712
|
+
};
|
|
6713
|
+
const ExampleWorkflowQuestionnaire2 = {
|
|
6714
|
+
resourceType: 'Questionnaire',
|
|
6715
|
+
id: 'workflow-questionnaire-2',
|
|
6716
|
+
name: 'Surgery History',
|
|
6717
|
+
title: 'Surgery History',
|
|
6718
|
+
subjectType: ['Patient'],
|
|
6719
|
+
item: [
|
|
6720
|
+
{
|
|
6721
|
+
linkId: '1',
|
|
6722
|
+
text: 'First question',
|
|
6723
|
+
type: 'string',
|
|
6724
|
+
},
|
|
6725
|
+
],
|
|
6726
|
+
};
|
|
6727
|
+
const ExampleWorkflowQuestionnaire3 = {
|
|
6728
|
+
resourceType: 'Questionnaire',
|
|
6729
|
+
id: 'workflow-questionnaire-3',
|
|
6730
|
+
name: 'Family Health History',
|
|
6731
|
+
title: 'Family Health History',
|
|
6732
|
+
subjectType: ['Patient'],
|
|
6733
|
+
item: [
|
|
6734
|
+
{
|
|
6735
|
+
linkId: '1',
|
|
6736
|
+
text: 'First question',
|
|
6737
|
+
type: 'string',
|
|
6738
|
+
},
|
|
6739
|
+
],
|
|
6740
|
+
};
|
|
6741
|
+
const ExampleWorkflowPlanDefinition = {
|
|
6742
|
+
resourceType: 'PlanDefinition',
|
|
6743
|
+
id: 'workflow-plan-definition-1',
|
|
6744
|
+
title: 'Example Plan Definition',
|
|
6745
|
+
action: [
|
|
6746
|
+
{
|
|
6747
|
+
title: ExampleWorkflowQuestionnaire1.title,
|
|
6748
|
+
definitionCanonical: core.getReferenceString(ExampleWorkflowQuestionnaire1),
|
|
6749
|
+
},
|
|
6750
|
+
{
|
|
6751
|
+
title: ExampleWorkflowQuestionnaire2.title,
|
|
6752
|
+
definitionCanonical: core.getReferenceString(ExampleWorkflowQuestionnaire2),
|
|
6753
|
+
},
|
|
6754
|
+
{
|
|
6755
|
+
title: ExampleWorkflowQuestionnaire3.title,
|
|
6756
|
+
definitionCanonical: core.getReferenceString(ExampleWorkflowQuestionnaire3),
|
|
6757
|
+
},
|
|
6758
|
+
],
|
|
6759
|
+
};
|
|
6760
|
+
const ExampleWorkflowQuestionnaireResponse1 = {
|
|
6761
|
+
resourceType: 'QuestionnaireResponse',
|
|
6762
|
+
id: 'workflow-questionnaire-response-1',
|
|
6763
|
+
questionnaire: core.getReferenceString(ExampleWorkflowQuestionnaire1),
|
|
6764
|
+
subject: core.createReference(HomerSimpson),
|
|
6765
|
+
source: core.createReference(HomerSimpson),
|
|
6766
|
+
};
|
|
6767
|
+
// Based on: http://build.fhir.org/ig/HL7/sdc/Task-example.json.html
|
|
6768
|
+
const ExampleWorkflowTask1 = {
|
|
6769
|
+
resourceType: 'Task',
|
|
6770
|
+
id: 'workflow-task-1',
|
|
6771
|
+
status: 'completed',
|
|
6772
|
+
meta: { author: core.createReference(HomerSimpson) },
|
|
6773
|
+
requester: core.createReference(DrAliceSmith),
|
|
6774
|
+
input: [{ valueReference: core.createReference(ExampleWorkflowQuestionnaire1) }],
|
|
6775
|
+
output: [{ valueReference: core.createReference(ExampleWorkflowQuestionnaireResponse1) }],
|
|
6776
|
+
};
|
|
6777
|
+
const ExampleWorkflowTask2 = {
|
|
6778
|
+
resourceType: 'Task',
|
|
6779
|
+
id: 'workflow-task-2',
|
|
6780
|
+
status: 'requested',
|
|
6781
|
+
meta: { author: core.createReference(DrAliceSmith) },
|
|
6782
|
+
requester: core.createReference(DrAliceSmith),
|
|
6783
|
+
input: [{ valueReference: core.createReference(ExampleWorkflowQuestionnaire2) }],
|
|
6784
|
+
};
|
|
6785
|
+
const ExampleWorkflowTask3 = {
|
|
6786
|
+
resourceType: 'Task',
|
|
6787
|
+
id: 'workflow-task-3',
|
|
6788
|
+
status: 'requested',
|
|
6789
|
+
meta: { author: core.createReference(DrAliceSmith) },
|
|
6790
|
+
requester: core.createReference(DrAliceSmith),
|
|
6791
|
+
input: [{ valueReference: core.createReference(ExampleWorkflowQuestionnaire3) }],
|
|
6792
|
+
};
|
|
6793
|
+
const ExampleWorkflowRequestGroup = {
|
|
6794
|
+
resourceType: 'RequestGroup',
|
|
6795
|
+
id: 'workflow-request-group-1',
|
|
6796
|
+
instantiatesCanonical: [core.getReferenceString(ExampleWorkflowPlanDefinition)],
|
|
6797
|
+
status: 'active',
|
|
6798
|
+
action: [
|
|
6799
|
+
{
|
|
6800
|
+
title: ExampleWorkflowQuestionnaire1.title,
|
|
6801
|
+
resource: core.createReference(ExampleWorkflowTask1),
|
|
6802
|
+
},
|
|
6803
|
+
{
|
|
6804
|
+
title: ExampleWorkflowQuestionnaire2.title,
|
|
6805
|
+
resource: core.createReference(ExampleWorkflowTask2),
|
|
6806
|
+
},
|
|
6807
|
+
{
|
|
6808
|
+
title: ExampleWorkflowQuestionnaire3.title,
|
|
6809
|
+
resource: core.createReference(ExampleWorkflowTask3),
|
|
6810
|
+
},
|
|
6811
|
+
],
|
|
6812
|
+
};
|
|
6813
|
+
|
|
6497
6814
|
/******************************************************************************
|
|
6498
6815
|
Copyright (c) Microsoft Corporation.
|
|
6499
6816
|
|
|
@@ -6531,7 +6848,7 @@
|
|
|
6531
6848
|
__classPrivateFieldSet(this, _MemoryRepository_history, {}, "f");
|
|
6532
6849
|
}
|
|
6533
6850
|
createResource(resource) {
|
|
6534
|
-
var _a;
|
|
6851
|
+
var _a, _b;
|
|
6535
6852
|
const result = resource;
|
|
6536
6853
|
if (!result.id) {
|
|
6537
6854
|
result.id = this.generateId();
|
|
@@ -6542,6 +6859,9 @@
|
|
|
6542
6859
|
if (!((_a = result.meta) === null || _a === void 0 ? void 0 : _a.versionId)) {
|
|
6543
6860
|
result.meta.versionId = this.generateId();
|
|
6544
6861
|
}
|
|
6862
|
+
if (!((_b = result.meta) === null || _b === void 0 ? void 0 : _b.lastUpdated)) {
|
|
6863
|
+
result.meta.lastUpdated = new Date().toISOString();
|
|
6864
|
+
}
|
|
6545
6865
|
const { resourceType, id } = resource;
|
|
6546
6866
|
if (!(resourceType in __classPrivateFieldGet(this, _MemoryRepository_resources, "f"))) {
|
|
6547
6867
|
__classPrivateFieldGet(this, _MemoryRepository_resources, "f")[resourceType] = {};
|
|
@@ -6898,6 +7218,15 @@
|
|
|
6898
7218
|
mockRepo.createResource(DrAliceSmithPreviousVersion);
|
|
6899
7219
|
mockRepo.createResource(DrAliceSmith);
|
|
6900
7220
|
mockRepo.createResource(DrAliceSmithSchedule);
|
|
7221
|
+
mockRepo.createResource(ExampleWorkflowQuestionnaire1);
|
|
7222
|
+
mockRepo.createResource(ExampleWorkflowQuestionnaire2);
|
|
7223
|
+
mockRepo.createResource(ExampleWorkflowQuestionnaire3);
|
|
7224
|
+
mockRepo.createResource(ExampleWorkflowPlanDefinition);
|
|
7225
|
+
mockRepo.createResource(ExampleWorkflowQuestionnaireResponse1);
|
|
7226
|
+
mockRepo.createResource(ExampleWorkflowTask1);
|
|
7227
|
+
mockRepo.createResource(ExampleWorkflowTask2);
|
|
7228
|
+
mockRepo.createResource(ExampleWorkflowTask3);
|
|
7229
|
+
mockRepo.createResource(ExampleWorkflowRequestGroup);
|
|
6901
7230
|
DrAliceSmithSlots.forEach((slot) => mockRepo.createResource(slot));
|
|
6902
7231
|
function mockFhirHandler(method, url, options) {
|
|
6903
7232
|
const path = url.includes('?') ? url.substring(0, url.indexOf('?')) : url;
|
|
@@ -7012,6 +7341,15 @@
|
|
|
7012
7341
|
exports.ExampleStatusValueSet = ExampleStatusValueSet;
|
|
7013
7342
|
exports.ExampleSubscription = ExampleSubscription;
|
|
7014
7343
|
exports.ExampleUserConfiguration = ExampleUserConfiguration;
|
|
7344
|
+
exports.ExampleWorkflowPlanDefinition = ExampleWorkflowPlanDefinition;
|
|
7345
|
+
exports.ExampleWorkflowQuestionnaire1 = ExampleWorkflowQuestionnaire1;
|
|
7346
|
+
exports.ExampleWorkflowQuestionnaire2 = ExampleWorkflowQuestionnaire2;
|
|
7347
|
+
exports.ExampleWorkflowQuestionnaire3 = ExampleWorkflowQuestionnaire3;
|
|
7348
|
+
exports.ExampleWorkflowQuestionnaireResponse1 = ExampleWorkflowQuestionnaireResponse1;
|
|
7349
|
+
exports.ExampleWorkflowRequestGroup = ExampleWorkflowRequestGroup;
|
|
7350
|
+
exports.ExampleWorkflowTask1 = ExampleWorkflowTask1;
|
|
7351
|
+
exports.ExampleWorkflowTask2 = ExampleWorkflowTask2;
|
|
7352
|
+
exports.ExampleWorkflowTask3 = ExampleWorkflowTask3;
|
|
7015
7353
|
exports.GraphQLSchemaResponse = GraphQLSchemaResponse;
|
|
7016
7354
|
exports.HomerCommunication = HomerCommunication;
|
|
7017
7355
|
exports.HomerDiagnosticReport = HomerDiagnosticReport;
|