@openhi/constructs 0.0.114 → 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 +1 -1
- 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
|
@@ -813,6 +813,423 @@ var demoRolesForUserInTenant = (_user, _tenantId) => {
|
|
|
813
813
|
return [import_types.PLATFORM_ROLE_CODE.TENANT_ADMIN];
|
|
814
814
|
};
|
|
815
815
|
|
|
816
|
+
// src/workflows/control-plane/seed-demo-data/data-plane-fixtures.ts
|
|
817
|
+
var fixtureIdentifiers = (scenario, tenantId, workspaceId, resourceType, id, roleSuffix) => [
|
|
818
|
+
demoScenarioIdentifier(scenario, roleSuffix),
|
|
819
|
+
openhiResourceIdentifier({
|
|
820
|
+
tenantId,
|
|
821
|
+
workspaceId,
|
|
822
|
+
resourceType,
|
|
823
|
+
id
|
|
824
|
+
})
|
|
825
|
+
];
|
|
826
|
+
var buildWoundCareFixtures = (scenario, tenantId, workspaceId, idPrefix) => ({
|
|
827
|
+
tenantId,
|
|
828
|
+
workspaceId,
|
|
829
|
+
scenario,
|
|
830
|
+
patients: [
|
|
831
|
+
{
|
|
832
|
+
resourceType: "Patient",
|
|
833
|
+
id: `${idPrefix}-patient-1`,
|
|
834
|
+
identifier: fixtureIdentifiers(
|
|
835
|
+
scenario,
|
|
836
|
+
tenantId,
|
|
837
|
+
workspaceId,
|
|
838
|
+
"Patient",
|
|
839
|
+
`${idPrefix}-patient-1`,
|
|
840
|
+
`patient-1`
|
|
841
|
+
),
|
|
842
|
+
active: true,
|
|
843
|
+
name: [{ family: "Carter", given: ["Eleanor"], use: "official" }],
|
|
844
|
+
gender: "female",
|
|
845
|
+
birthDate: "1952-04-18"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
resourceType: "Patient",
|
|
849
|
+
id: `${idPrefix}-patient-2`,
|
|
850
|
+
identifier: fixtureIdentifiers(
|
|
851
|
+
scenario,
|
|
852
|
+
tenantId,
|
|
853
|
+
workspaceId,
|
|
854
|
+
"Patient",
|
|
855
|
+
`${idPrefix}-patient-2`,
|
|
856
|
+
`patient-2`
|
|
857
|
+
),
|
|
858
|
+
active: true,
|
|
859
|
+
name: [{ family: "Nguyen", given: ["Hao"], use: "official" }],
|
|
860
|
+
gender: "male",
|
|
861
|
+
birthDate: "1968-11-02"
|
|
862
|
+
}
|
|
863
|
+
],
|
|
864
|
+
practitioners: [
|
|
865
|
+
{
|
|
866
|
+
resourceType: "Practitioner",
|
|
867
|
+
id: `${idPrefix}-practitioner-1`,
|
|
868
|
+
identifier: fixtureIdentifiers(
|
|
869
|
+
scenario,
|
|
870
|
+
tenantId,
|
|
871
|
+
workspaceId,
|
|
872
|
+
"Practitioner",
|
|
873
|
+
`${idPrefix}-practitioner-1`,
|
|
874
|
+
`practitioner-1`
|
|
875
|
+
),
|
|
876
|
+
active: true,
|
|
877
|
+
name: [{ family: "Reyes", given: ["Maria"], prefix: ["Dr."] }],
|
|
878
|
+
gender: "female"
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
resourceType: "Practitioner",
|
|
882
|
+
id: `${idPrefix}-practitioner-2`,
|
|
883
|
+
identifier: fixtureIdentifiers(
|
|
884
|
+
scenario,
|
|
885
|
+
tenantId,
|
|
886
|
+
workspaceId,
|
|
887
|
+
"Practitioner",
|
|
888
|
+
`${idPrefix}-practitioner-2`,
|
|
889
|
+
`practitioner-2`
|
|
890
|
+
),
|
|
891
|
+
active: true,
|
|
892
|
+
name: [{ family: "Okafor", given: ["Chinedu"], prefix: ["Dr."] }],
|
|
893
|
+
gender: "male"
|
|
894
|
+
}
|
|
895
|
+
],
|
|
896
|
+
observations: [
|
|
897
|
+
{
|
|
898
|
+
resourceType: "Observation",
|
|
899
|
+
id: `${idPrefix}-observation-1`,
|
|
900
|
+
identifier: fixtureIdentifiers(
|
|
901
|
+
scenario,
|
|
902
|
+
tenantId,
|
|
903
|
+
workspaceId,
|
|
904
|
+
"Observation",
|
|
905
|
+
`${idPrefix}-observation-1`,
|
|
906
|
+
`observation-1`
|
|
907
|
+
),
|
|
908
|
+
status: "final",
|
|
909
|
+
code: {
|
|
910
|
+
coding: [
|
|
911
|
+
{
|
|
912
|
+
system: "http://loinc.org",
|
|
913
|
+
code: "39135-9",
|
|
914
|
+
display: "Wound size"
|
|
915
|
+
}
|
|
916
|
+
]
|
|
917
|
+
},
|
|
918
|
+
subject: { reference: `Patient/${idPrefix}-patient-1` },
|
|
919
|
+
valueString: "3.2cm x 2.1cm"
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
resourceType: "Observation",
|
|
923
|
+
id: `${idPrefix}-observation-2`,
|
|
924
|
+
identifier: fixtureIdentifiers(
|
|
925
|
+
scenario,
|
|
926
|
+
tenantId,
|
|
927
|
+
workspaceId,
|
|
928
|
+
"Observation",
|
|
929
|
+
`${idPrefix}-observation-2`,
|
|
930
|
+
`observation-2`
|
|
931
|
+
),
|
|
932
|
+
status: "final",
|
|
933
|
+
code: {
|
|
934
|
+
coding: [
|
|
935
|
+
{
|
|
936
|
+
system: "http://loinc.org",
|
|
937
|
+
code: "72287-2",
|
|
938
|
+
display: "Wound exudate amount"
|
|
939
|
+
}
|
|
940
|
+
]
|
|
941
|
+
},
|
|
942
|
+
subject: { reference: `Patient/${idPrefix}-patient-2` },
|
|
943
|
+
valueString: "moderate"
|
|
944
|
+
}
|
|
945
|
+
],
|
|
946
|
+
encounters: [
|
|
947
|
+
{
|
|
948
|
+
resourceType: "Encounter",
|
|
949
|
+
id: `${idPrefix}-encounter-1`,
|
|
950
|
+
identifier: fixtureIdentifiers(
|
|
951
|
+
scenario,
|
|
952
|
+
tenantId,
|
|
953
|
+
workspaceId,
|
|
954
|
+
"Encounter",
|
|
955
|
+
`${idPrefix}-encounter-1`,
|
|
956
|
+
`encounter-1`
|
|
957
|
+
),
|
|
958
|
+
status: "finished",
|
|
959
|
+
class: {
|
|
960
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
|
|
961
|
+
code: "AMB",
|
|
962
|
+
display: "ambulatory"
|
|
963
|
+
},
|
|
964
|
+
subject: { reference: `Patient/${idPrefix}-patient-1` }
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
resourceType: "Encounter",
|
|
968
|
+
id: `${idPrefix}-encounter-2`,
|
|
969
|
+
identifier: fixtureIdentifiers(
|
|
970
|
+
scenario,
|
|
971
|
+
tenantId,
|
|
972
|
+
workspaceId,
|
|
973
|
+
"Encounter",
|
|
974
|
+
`${idPrefix}-encounter-2`,
|
|
975
|
+
`encounter-2`
|
|
976
|
+
),
|
|
977
|
+
status: "finished",
|
|
978
|
+
class: {
|
|
979
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
|
|
980
|
+
code: "AMB",
|
|
981
|
+
display: "ambulatory"
|
|
982
|
+
},
|
|
983
|
+
subject: { reference: `Patient/${idPrefix}-patient-2` }
|
|
984
|
+
}
|
|
985
|
+
],
|
|
986
|
+
accounts: [
|
|
987
|
+
{
|
|
988
|
+
resourceType: "Account",
|
|
989
|
+
id: `${idPrefix}-account-1`,
|
|
990
|
+
identifier: fixtureIdentifiers(
|
|
991
|
+
scenario,
|
|
992
|
+
tenantId,
|
|
993
|
+
workspaceId,
|
|
994
|
+
"Account",
|
|
995
|
+
`${idPrefix}-account-1`,
|
|
996
|
+
`account-1`
|
|
997
|
+
),
|
|
998
|
+
status: "active",
|
|
999
|
+
name: "Wound-care self-pay account",
|
|
1000
|
+
subject: [{ reference: `Patient/${idPrefix}-patient-1` }]
|
|
1001
|
+
}
|
|
1002
|
+
]
|
|
1003
|
+
});
|
|
1004
|
+
var buildPrimaryCareFixtures = (scenario, tenantId, workspaceId, idPrefix) => ({
|
|
1005
|
+
tenantId,
|
|
1006
|
+
workspaceId,
|
|
1007
|
+
scenario,
|
|
1008
|
+
patients: [
|
|
1009
|
+
{
|
|
1010
|
+
resourceType: "Patient",
|
|
1011
|
+
id: `${idPrefix}-patient-1`,
|
|
1012
|
+
identifier: fixtureIdentifiers(
|
|
1013
|
+
scenario,
|
|
1014
|
+
tenantId,
|
|
1015
|
+
workspaceId,
|
|
1016
|
+
"Patient",
|
|
1017
|
+
`${idPrefix}-patient-1`,
|
|
1018
|
+
`patient-1`
|
|
1019
|
+
),
|
|
1020
|
+
active: true,
|
|
1021
|
+
name: [{ family: "Bennett", given: ["Sophia"], use: "official" }],
|
|
1022
|
+
gender: "female",
|
|
1023
|
+
birthDate: "1985-06-09"
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
resourceType: "Patient",
|
|
1027
|
+
id: `${idPrefix}-patient-2`,
|
|
1028
|
+
identifier: fixtureIdentifiers(
|
|
1029
|
+
scenario,
|
|
1030
|
+
tenantId,
|
|
1031
|
+
workspaceId,
|
|
1032
|
+
"Patient",
|
|
1033
|
+
`${idPrefix}-patient-2`,
|
|
1034
|
+
`patient-2`
|
|
1035
|
+
),
|
|
1036
|
+
active: true,
|
|
1037
|
+
name: [{ family: "Patel", given: ["Arjun"], use: "official" }],
|
|
1038
|
+
gender: "male",
|
|
1039
|
+
birthDate: "1979-02-21"
|
|
1040
|
+
}
|
|
1041
|
+
],
|
|
1042
|
+
practitioners: [
|
|
1043
|
+
{
|
|
1044
|
+
resourceType: "Practitioner",
|
|
1045
|
+
id: `${idPrefix}-practitioner-1`,
|
|
1046
|
+
identifier: fixtureIdentifiers(
|
|
1047
|
+
scenario,
|
|
1048
|
+
tenantId,
|
|
1049
|
+
workspaceId,
|
|
1050
|
+
"Practitioner",
|
|
1051
|
+
`${idPrefix}-practitioner-1`,
|
|
1052
|
+
`practitioner-1`
|
|
1053
|
+
),
|
|
1054
|
+
active: true,
|
|
1055
|
+
name: [{ family: "Lin", given: ["Wei"], prefix: ["Dr."] }],
|
|
1056
|
+
gender: "female"
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
resourceType: "Practitioner",
|
|
1060
|
+
id: `${idPrefix}-practitioner-2`,
|
|
1061
|
+
identifier: fixtureIdentifiers(
|
|
1062
|
+
scenario,
|
|
1063
|
+
tenantId,
|
|
1064
|
+
workspaceId,
|
|
1065
|
+
"Practitioner",
|
|
1066
|
+
`${idPrefix}-practitioner-2`,
|
|
1067
|
+
`practitioner-2`
|
|
1068
|
+
),
|
|
1069
|
+
active: true,
|
|
1070
|
+
name: [{ family: "Kowalski", given: ["Piotr"], prefix: ["Dr."] }],
|
|
1071
|
+
gender: "male"
|
|
1072
|
+
}
|
|
1073
|
+
],
|
|
1074
|
+
observations: [
|
|
1075
|
+
{
|
|
1076
|
+
resourceType: "Observation",
|
|
1077
|
+
id: `${idPrefix}-observation-1`,
|
|
1078
|
+
identifier: fixtureIdentifiers(
|
|
1079
|
+
scenario,
|
|
1080
|
+
tenantId,
|
|
1081
|
+
workspaceId,
|
|
1082
|
+
"Observation",
|
|
1083
|
+
`${idPrefix}-observation-1`,
|
|
1084
|
+
`observation-1`
|
|
1085
|
+
),
|
|
1086
|
+
status: "final",
|
|
1087
|
+
code: {
|
|
1088
|
+
coding: [
|
|
1089
|
+
{
|
|
1090
|
+
system: "http://loinc.org",
|
|
1091
|
+
code: "8480-6",
|
|
1092
|
+
display: "Systolic blood pressure"
|
|
1093
|
+
}
|
|
1094
|
+
]
|
|
1095
|
+
},
|
|
1096
|
+
subject: { reference: `Patient/${idPrefix}-patient-1` },
|
|
1097
|
+
valueQuantity: { value: 122, unit: "mm[Hg]" }
|
|
1098
|
+
},
|
|
1099
|
+
{
|
|
1100
|
+
resourceType: "Observation",
|
|
1101
|
+
id: `${idPrefix}-observation-2`,
|
|
1102
|
+
identifier: fixtureIdentifiers(
|
|
1103
|
+
scenario,
|
|
1104
|
+
tenantId,
|
|
1105
|
+
workspaceId,
|
|
1106
|
+
"Observation",
|
|
1107
|
+
`${idPrefix}-observation-2`,
|
|
1108
|
+
`observation-2`
|
|
1109
|
+
),
|
|
1110
|
+
status: "final",
|
|
1111
|
+
code: {
|
|
1112
|
+
coding: [
|
|
1113
|
+
{
|
|
1114
|
+
system: "http://loinc.org",
|
|
1115
|
+
code: "8462-4",
|
|
1116
|
+
display: "Diastolic blood pressure"
|
|
1117
|
+
}
|
|
1118
|
+
]
|
|
1119
|
+
},
|
|
1120
|
+
subject: { reference: `Patient/${idPrefix}-patient-2` },
|
|
1121
|
+
valueQuantity: { value: 78, unit: "mm[Hg]" }
|
|
1122
|
+
}
|
|
1123
|
+
],
|
|
1124
|
+
encounters: [
|
|
1125
|
+
{
|
|
1126
|
+
resourceType: "Encounter",
|
|
1127
|
+
id: `${idPrefix}-encounter-1`,
|
|
1128
|
+
identifier: fixtureIdentifiers(
|
|
1129
|
+
scenario,
|
|
1130
|
+
tenantId,
|
|
1131
|
+
workspaceId,
|
|
1132
|
+
"Encounter",
|
|
1133
|
+
`${idPrefix}-encounter-1`,
|
|
1134
|
+
`encounter-1`
|
|
1135
|
+
),
|
|
1136
|
+
status: "finished",
|
|
1137
|
+
class: {
|
|
1138
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
|
|
1139
|
+
code: "AMB",
|
|
1140
|
+
display: "ambulatory"
|
|
1141
|
+
},
|
|
1142
|
+
subject: { reference: `Patient/${idPrefix}-patient-1` }
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
resourceType: "Encounter",
|
|
1146
|
+
id: `${idPrefix}-encounter-2`,
|
|
1147
|
+
identifier: fixtureIdentifiers(
|
|
1148
|
+
scenario,
|
|
1149
|
+
tenantId,
|
|
1150
|
+
workspaceId,
|
|
1151
|
+
"Encounter",
|
|
1152
|
+
`${idPrefix}-encounter-2`,
|
|
1153
|
+
`encounter-2`
|
|
1154
|
+
),
|
|
1155
|
+
status: "in-progress",
|
|
1156
|
+
class: {
|
|
1157
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
|
|
1158
|
+
code: "AMB",
|
|
1159
|
+
display: "ambulatory"
|
|
1160
|
+
},
|
|
1161
|
+
subject: { reference: `Patient/${idPrefix}-patient-2` }
|
|
1162
|
+
}
|
|
1163
|
+
],
|
|
1164
|
+
accounts: [
|
|
1165
|
+
{
|
|
1166
|
+
resourceType: "Account",
|
|
1167
|
+
id: `${idPrefix}-account-1`,
|
|
1168
|
+
identifier: fixtureIdentifiers(
|
|
1169
|
+
scenario,
|
|
1170
|
+
tenantId,
|
|
1171
|
+
workspaceId,
|
|
1172
|
+
"Account",
|
|
1173
|
+
`${idPrefix}-account-1`,
|
|
1174
|
+
`account-1`
|
|
1175
|
+
),
|
|
1176
|
+
status: "active",
|
|
1177
|
+
name: "Primary-care insurance account",
|
|
1178
|
+
subject: [{ reference: `Patient/${idPrefix}-patient-1` }]
|
|
1179
|
+
}
|
|
1180
|
+
]
|
|
1181
|
+
});
|
|
1182
|
+
var DEMO_DATA_PLANE_FIXTURES = [
|
|
1183
|
+
buildWoundCareFixtures(
|
|
1184
|
+
"demo-wound-care",
|
|
1185
|
+
"demo-wound-care-tenant",
|
|
1186
|
+
"demo-wound-care-workspace",
|
|
1187
|
+
"demo-wound-care"
|
|
1188
|
+
),
|
|
1189
|
+
buildPrimaryCareFixtures(
|
|
1190
|
+
"demo-primary-care",
|
|
1191
|
+
"demo-primary-care-tenant",
|
|
1192
|
+
"demo-primary-care-workspace",
|
|
1193
|
+
"demo-primary-care"
|
|
1194
|
+
),
|
|
1195
|
+
buildWoundCareFixtures(
|
|
1196
|
+
"demo-mixed",
|
|
1197
|
+
"demo-mixed-tenant",
|
|
1198
|
+
"demo-mixed-workspace-wound-care",
|
|
1199
|
+
"demo-mixed-wound-care"
|
|
1200
|
+
),
|
|
1201
|
+
buildPrimaryCareFixtures(
|
|
1202
|
+
"demo-mixed",
|
|
1203
|
+
"demo-mixed-tenant",
|
|
1204
|
+
"demo-mixed-workspace-primary-care",
|
|
1205
|
+
"demo-mixed-primary-care"
|
|
1206
|
+
)
|
|
1207
|
+
];
|
|
1208
|
+
var _validateFixturesAgainstTenantSpecs = () => {
|
|
1209
|
+
for (const group of DEMO_DATA_PLANE_FIXTURES) {
|
|
1210
|
+
if (group.tenantId === PLACEHOLDER_TENANT_ID) {
|
|
1211
|
+
throw new Error(
|
|
1212
|
+
"The placeholder tenant must not carry data-plane fixtures."
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
const tenant = DEMO_TENANT_SPECS.find((s) => s.tenantId === group.tenantId);
|
|
1216
|
+
if (!tenant) {
|
|
1217
|
+
throw new Error(
|
|
1218
|
+
`Fixture references unknown tenantId "${group.tenantId}". Add a matching entry to DEMO_TENANT_SPECS first.`
|
|
1219
|
+
);
|
|
1220
|
+
}
|
|
1221
|
+
const workspace = tenant.workspaces.find(
|
|
1222
|
+
(ws) => ws.id === group.workspaceId
|
|
1223
|
+
);
|
|
1224
|
+
if (!workspace) {
|
|
1225
|
+
throw new Error(
|
|
1226
|
+
`Fixture references unknown workspaceId "${group.workspaceId}" for tenant "${group.tenantId}".`
|
|
1227
|
+
);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
_validateFixturesAgainstTenantSpecs();
|
|
1232
|
+
|
|
816
1233
|
// src/data/dynamo/dynamo-control-service.ts
|
|
817
1234
|
var import_electrodb14 = require("electrodb");
|
|
818
1235
|
|
|
@@ -4247,6 +4664,30 @@ function compressResource(jsonString, options) {
|
|
|
4247
4664
|
return JSON.stringify(envelope);
|
|
4248
4665
|
}
|
|
4249
4666
|
|
|
4667
|
+
// src/data/audit-meta.ts
|
|
4668
|
+
var OPENHI_EXT = "http://openhi.org/fhir/StructureDefinition";
|
|
4669
|
+
function mergeAuditIntoMeta(meta, audit) {
|
|
4670
|
+
const existing = meta ?? {};
|
|
4671
|
+
const ext = [
|
|
4672
|
+
...Array.isArray(existing.extension) ? existing.extension : []
|
|
4673
|
+
];
|
|
4674
|
+
const byUrl = new Map(ext.map((e) => [e.url, e]));
|
|
4675
|
+
function set(url, value, type) {
|
|
4676
|
+
if (value == null) return;
|
|
4677
|
+
byUrl.set(url, { url, [type]: value });
|
|
4678
|
+
}
|
|
4679
|
+
set(`${OPENHI_EXT}/created-date`, audit.createdDate, "valueDateTime");
|
|
4680
|
+
set(`${OPENHI_EXT}/created-by-id`, audit.createdById, "valueString");
|
|
4681
|
+
set(`${OPENHI_EXT}/created-by-name`, audit.createdByName, "valueString");
|
|
4682
|
+
set(`${OPENHI_EXT}/modified-date`, audit.modifiedDate, "valueDateTime");
|
|
4683
|
+
set(`${OPENHI_EXT}/modified-by-id`, audit.modifiedById, "valueString");
|
|
4684
|
+
set(`${OPENHI_EXT}/modified-by-name`, audit.modifiedByName, "valueString");
|
|
4685
|
+
set(`${OPENHI_EXT}/deleted-date`, audit.deletedDate, "valueDateTime");
|
|
4686
|
+
set(`${OPENHI_EXT}/deleted-by-id`, audit.deletedById, "valueString");
|
|
4687
|
+
set(`${OPENHI_EXT}/deleted-by-name`, audit.deletedByName, "valueString");
|
|
4688
|
+
return { ...existing, extension: Array.from(byUrl.values()) };
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4250
4691
|
// src/data/operations/data-operations-common.ts
|
|
4251
4692
|
var DATA_ENTITY_SK = "CURRENT";
|
|
4252
4693
|
async function createDataEntityRecord(entity, tenantId, workspaceId, id, resourceWithAudit, fallbackDate) {
|
|
@@ -4339,6 +4780,181 @@ async function createWorkspaceOperation(params) {
|
|
|
4339
4780
|
return { id, resource, meta: { lastUpdated, versionId: vid } };
|
|
4340
4781
|
}
|
|
4341
4782
|
|
|
4783
|
+
// src/data/operations/data/account/account-create-operation.ts
|
|
4784
|
+
var import_ulid = require("ulid");
|
|
4785
|
+
async function createAccountOperation(params) {
|
|
4786
|
+
const { context, body, tableName } = params;
|
|
4787
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4788
|
+
const id = body.id ?? (0, import_ulid.ulid)();
|
|
4789
|
+
const meta = {
|
|
4790
|
+
...body.meta ?? {},
|
|
4791
|
+
lastUpdated: date,
|
|
4792
|
+
versionId: "1"
|
|
4793
|
+
};
|
|
4794
|
+
const accountWithAudit = {
|
|
4795
|
+
...body,
|
|
4796
|
+
resourceType: "Account",
|
|
4797
|
+
id,
|
|
4798
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
4799
|
+
createdDate: date,
|
|
4800
|
+
createdById: actorId,
|
|
4801
|
+
createdByName: actorName,
|
|
4802
|
+
modifiedDate: date,
|
|
4803
|
+
modifiedById: actorId,
|
|
4804
|
+
modifiedByName: actorName
|
|
4805
|
+
})
|
|
4806
|
+
};
|
|
4807
|
+
const service = getDynamoDataService(tableName);
|
|
4808
|
+
return createDataEntityRecord(
|
|
4809
|
+
service.entities.account,
|
|
4810
|
+
tenantId,
|
|
4811
|
+
workspaceId,
|
|
4812
|
+
id,
|
|
4813
|
+
accountWithAudit,
|
|
4814
|
+
date
|
|
4815
|
+
);
|
|
4816
|
+
}
|
|
4817
|
+
|
|
4818
|
+
// src/data/operations/data/encounter/encounter-create-operation.ts
|
|
4819
|
+
var import_ulid2 = require("ulid");
|
|
4820
|
+
async function createEncounterOperation(params) {
|
|
4821
|
+
const { context, body, tableName } = params;
|
|
4822
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4823
|
+
const id = body.id ?? (0, import_ulid2.ulid)();
|
|
4824
|
+
const meta = {
|
|
4825
|
+
...body.meta ?? {},
|
|
4826
|
+
lastUpdated: date,
|
|
4827
|
+
versionId: "1"
|
|
4828
|
+
};
|
|
4829
|
+
const encounterWithAudit = {
|
|
4830
|
+
...body,
|
|
4831
|
+
resourceType: "Encounter",
|
|
4832
|
+
id,
|
|
4833
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
4834
|
+
createdDate: date,
|
|
4835
|
+
createdById: actorId,
|
|
4836
|
+
createdByName: actorName,
|
|
4837
|
+
modifiedDate: date,
|
|
4838
|
+
modifiedById: actorId,
|
|
4839
|
+
modifiedByName: actorName
|
|
4840
|
+
})
|
|
4841
|
+
};
|
|
4842
|
+
const service = getDynamoDataService(tableName);
|
|
4843
|
+
return createDataEntityRecord(
|
|
4844
|
+
service.entities.encounter,
|
|
4845
|
+
tenantId,
|
|
4846
|
+
workspaceId,
|
|
4847
|
+
id,
|
|
4848
|
+
encounterWithAudit,
|
|
4849
|
+
date
|
|
4850
|
+
);
|
|
4851
|
+
}
|
|
4852
|
+
|
|
4853
|
+
// src/data/operations/data/observation/observation-create-operation.ts
|
|
4854
|
+
var import_ulid3 = require("ulid");
|
|
4855
|
+
async function createObservationOperation(params) {
|
|
4856
|
+
const { context, body, tableName } = params;
|
|
4857
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4858
|
+
const id = body.id ?? (0, import_ulid3.ulid)();
|
|
4859
|
+
const meta = {
|
|
4860
|
+
...body.meta ?? {},
|
|
4861
|
+
lastUpdated: date,
|
|
4862
|
+
versionId: "1"
|
|
4863
|
+
};
|
|
4864
|
+
const resourceWithAudit = {
|
|
4865
|
+
...body,
|
|
4866
|
+
resourceType: "Observation",
|
|
4867
|
+
id,
|
|
4868
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
4869
|
+
createdDate: date,
|
|
4870
|
+
createdById: actorId,
|
|
4871
|
+
createdByName: actorName,
|
|
4872
|
+
modifiedDate: date,
|
|
4873
|
+
modifiedById: actorId,
|
|
4874
|
+
modifiedByName: actorName
|
|
4875
|
+
})
|
|
4876
|
+
};
|
|
4877
|
+
const service = getDynamoDataService(tableName);
|
|
4878
|
+
return createDataEntityRecord(
|
|
4879
|
+
service.entities.observation,
|
|
4880
|
+
tenantId,
|
|
4881
|
+
workspaceId,
|
|
4882
|
+
id,
|
|
4883
|
+
resourceWithAudit,
|
|
4884
|
+
date
|
|
4885
|
+
);
|
|
4886
|
+
}
|
|
4887
|
+
|
|
4888
|
+
// src/data/operations/data/patient/patient-create-operation.ts
|
|
4889
|
+
var import_ulid4 = require("ulid");
|
|
4890
|
+
async function createPatientOperation(params) {
|
|
4891
|
+
const { context, body, tableName } = params;
|
|
4892
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4893
|
+
const id = body.id ?? (0, import_ulid4.ulid)();
|
|
4894
|
+
const meta = {
|
|
4895
|
+
...body.meta ?? {},
|
|
4896
|
+
lastUpdated: date,
|
|
4897
|
+
versionId: "1"
|
|
4898
|
+
};
|
|
4899
|
+
const patientWithAudit = {
|
|
4900
|
+
...body,
|
|
4901
|
+
resourceType: "Patient",
|
|
4902
|
+
id,
|
|
4903
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
4904
|
+
createdDate: date,
|
|
4905
|
+
createdById: actorId,
|
|
4906
|
+
createdByName: actorName,
|
|
4907
|
+
modifiedDate: date,
|
|
4908
|
+
modifiedById: actorId,
|
|
4909
|
+
modifiedByName: actorName
|
|
4910
|
+
})
|
|
4911
|
+
};
|
|
4912
|
+
const service = getDynamoDataService(tableName);
|
|
4913
|
+
return createDataEntityRecord(
|
|
4914
|
+
service.entities.patient,
|
|
4915
|
+
tenantId,
|
|
4916
|
+
workspaceId,
|
|
4917
|
+
id,
|
|
4918
|
+
patientWithAudit,
|
|
4919
|
+
date
|
|
4920
|
+
);
|
|
4921
|
+
}
|
|
4922
|
+
|
|
4923
|
+
// src/data/operations/data/practitioner/practitioner-create-operation.ts
|
|
4924
|
+
var import_ulid5 = require("ulid");
|
|
4925
|
+
async function createPractitionerOperation(params) {
|
|
4926
|
+
const { context, body, tableName } = params;
|
|
4927
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4928
|
+
const id = body.id ?? (0, import_ulid5.ulid)();
|
|
4929
|
+
const meta = {
|
|
4930
|
+
...body.meta ?? {},
|
|
4931
|
+
lastUpdated: date,
|
|
4932
|
+
versionId: "1"
|
|
4933
|
+
};
|
|
4934
|
+
const practitionerWithAudit = {
|
|
4935
|
+
...body,
|
|
4936
|
+
resourceType: "Practitioner",
|
|
4937
|
+
id,
|
|
4938
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
4939
|
+
createdDate: date,
|
|
4940
|
+
createdById: actorId,
|
|
4941
|
+
createdByName: actorName,
|
|
4942
|
+
modifiedDate: date,
|
|
4943
|
+
modifiedById: actorId,
|
|
4944
|
+
modifiedByName: actorName
|
|
4945
|
+
})
|
|
4946
|
+
};
|
|
4947
|
+
const service = getDynamoDataService(tableName);
|
|
4948
|
+
return createDataEntityRecord(
|
|
4949
|
+
service.entities.practitioner,
|
|
4950
|
+
tenantId,
|
|
4951
|
+
workspaceId,
|
|
4952
|
+
id,
|
|
4953
|
+
practitionerWithAudit,
|
|
4954
|
+
date
|
|
4955
|
+
);
|
|
4956
|
+
}
|
|
4957
|
+
|
|
4342
4958
|
// src/workflows/control-plane/seed-demo-data/seed-demo-data.handler.ts
|
|
4343
4959
|
var SEED_DEMO_DATA_USER_POOL_ID_ENV_VAR = "SEED_DEMO_DATA_USER_POOL_ID";
|
|
4344
4960
|
var errorMessage = (err) => {
|
|
@@ -4456,6 +5072,43 @@ var upsertUser = async (context, user, cognitoSub) => {
|
|
|
4456
5072
|
lastUpdated: context.date ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
4457
5073
|
}).go();
|
|
4458
5074
|
};
|
|
5075
|
+
var seedWorkspaceDataPlane = async (baseContext, group) => {
|
|
5076
|
+
const workspaceContext = {
|
|
5077
|
+
...baseContext,
|
|
5078
|
+
tenantId: group.tenantId,
|
|
5079
|
+
workspaceId: group.workspaceId
|
|
5080
|
+
};
|
|
5081
|
+
for (const patient of group.patients) {
|
|
5082
|
+
await createPatientOperation({
|
|
5083
|
+
context: workspaceContext,
|
|
5084
|
+
body: patient
|
|
5085
|
+
});
|
|
5086
|
+
}
|
|
5087
|
+
for (const practitioner of group.practitioners) {
|
|
5088
|
+
await createPractitionerOperation({
|
|
5089
|
+
context: workspaceContext,
|
|
5090
|
+
body: practitioner
|
|
5091
|
+
});
|
|
5092
|
+
}
|
|
5093
|
+
for (const observation of group.observations) {
|
|
5094
|
+
await createObservationOperation({
|
|
5095
|
+
context: workspaceContext,
|
|
5096
|
+
body: observation
|
|
5097
|
+
});
|
|
5098
|
+
}
|
|
5099
|
+
for (const encounter of group.encounters) {
|
|
5100
|
+
await createEncounterOperation({
|
|
5101
|
+
context: workspaceContext,
|
|
5102
|
+
body: encounter
|
|
5103
|
+
});
|
|
5104
|
+
}
|
|
5105
|
+
for (const account of group.accounts) {
|
|
5106
|
+
await createAccountOperation({
|
|
5107
|
+
context: workspaceContext,
|
|
5108
|
+
body: account
|
|
5109
|
+
});
|
|
5110
|
+
}
|
|
5111
|
+
};
|
|
4459
5112
|
var seedDemoGraph = async (params) => {
|
|
4460
5113
|
const { baseContext, devUsers, cognito } = params;
|
|
4461
5114
|
for (const spec of DEMO_TENANT_SPECS) {
|
|
@@ -4534,6 +5187,9 @@ var seedDemoGraph = async (params) => {
|
|
|
4534
5187
|
}
|
|
4535
5188
|
});
|
|
4536
5189
|
}
|
|
5190
|
+
for (const group of DEMO_DATA_PLANE_FIXTURES) {
|
|
5191
|
+
await seedWorkspaceDataPlane(baseContext, group);
|
|
5192
|
+
}
|
|
4537
5193
|
};
|
|
4538
5194
|
var runSeedDemoData = async (event, deps, devUsers) => {
|
|
4539
5195
|
const parsed = (0, import_workflows2.parseWorkflowEvent)(event, import_workflows.PlatformSystemDataSeededV1);
|