@openhi/constructs 0.0.159 → 0.0.161
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-HQ67J7BP.mjs → chunk-5S6VFBLT.mjs} +12 -70
- package/lib/chunk-5S6VFBLT.mjs.map +1 -0
- package/lib/{chunk-MVQWAIMC.mjs → chunk-6BB4CRSS.mjs} +3 -312
- package/lib/chunk-6BB4CRSS.mjs.map +1 -0
- package/lib/{chunk-WPCBVDFZ.mjs → chunk-76UM2LQ5.mjs} +2 -2
- package/lib/chunk-7TRO2STL.mjs +4616 -0
- package/lib/chunk-7TRO2STL.mjs.map +1 -0
- package/lib/chunk-BUAYVN3C.mjs +87 -0
- package/lib/chunk-BUAYVN3C.mjs.map +1 -0
- package/lib/{chunk-23PUSHBV.mjs → chunk-D2Y6DDOC.mjs} +2 -2
- package/lib/chunk-DWSWCUZR.mjs +123 -0
- package/lib/chunk-DWSWCUZR.mjs.map +1 -0
- package/lib/{chunk-VZCPGQXA.mjs → chunk-EUIP2U5F.mjs} +69 -1
- package/lib/{chunk-VZCPGQXA.mjs.map → chunk-EUIP2U5F.mjs.map} +1 -1
- package/lib/chunk-GJTPXJKD.mjs +46 -0
- package/lib/chunk-GJTPXJKD.mjs.map +1 -0
- package/lib/chunk-I6LUPJUY.mjs +61 -0
- package/lib/chunk-I6LUPJUY.mjs.map +1 -0
- package/lib/{chunk-KR2Y2CVQ.mjs → chunk-KA3OMP3X.mjs} +2 -2
- package/lib/{chunk-ZM4GDHHC.mjs → chunk-KMEWULMX.mjs} +51 -3
- package/lib/chunk-KMEWULMX.mjs.map +1 -0
- package/lib/chunk-LKKLO66E.mjs +25 -0
- package/lib/chunk-LKKLO66E.mjs.map +1 -0
- package/lib/{chunk-CFJDATDK.mjs → chunk-MLFMW5IF.mjs} +43 -9
- package/lib/chunk-MLFMW5IF.mjs.map +1 -0
- package/lib/chunk-O5VQWB6U.mjs +315 -0
- package/lib/chunk-O5VQWB6U.mjs.map +1 -0
- package/lib/{chunk-7BQHLC7U.mjs → chunk-P3CTZWC2.mjs} +8 -40
- package/lib/chunk-P3CTZWC2.mjs.map +1 -0
- package/lib/chunk-P3NFCKTZ.mjs +502 -0
- package/lib/chunk-P3NFCKTZ.mjs.map +1 -0
- package/lib/{chunk-M7Y3BOQW.mjs → chunk-Q3MKITPY.mjs} +5 -5
- package/lib/chunk-Q64MOYJ7.mjs +218 -0
- package/lib/chunk-Q64MOYJ7.mjs.map +1 -0
- package/lib/chunk-RQKJNMX5.mjs +89 -0
- package/lib/chunk-RQKJNMX5.mjs.map +1 -0
- package/lib/{chunk-ZWSGM6PZ.mjs → chunk-SD7J3N3C.mjs} +2 -2
- package/lib/{chunk-7RZHFI77.mjs → chunk-VESULYQQ.mjs} +2 -2
- package/lib/{chunk-AOSEKL7U.mjs → chunk-WOTU36P3.mjs} +6 -103
- package/lib/chunk-WOTU36P3.mjs.map +1 -0
- package/lib/{chunk-X5E4YJGZ.mjs → chunk-YPTJJ35S.mjs} +2 -2
- package/lib/counter-apply-operation-DZM3MIDm.d.mts +63 -0
- package/lib/counter-apply-operation-DZM3MIDm.d.ts +63 -0
- package/lib/counter-maintenance.handler.d.mts +38 -0
- package/lib/counter-maintenance.handler.d.ts +38 -0
- package/lib/counter-maintenance.handler.js +2885 -0
- package/lib/counter-maintenance.handler.js.map +1 -0
- package/lib/counter-maintenance.handler.mjs +180 -0
- package/lib/counter-maintenance.handler.mjs.map +1 -0
- package/lib/counter-reconciliation.handler.d.mts +116 -0
- package/lib/counter-reconciliation.handler.d.ts +116 -0
- package/lib/counter-reconciliation.handler.js +3324 -0
- package/lib/counter-reconciliation.handler.js.map +1 -0
- package/lib/counter-reconciliation.handler.mjs +295 -0
- package/lib/counter-reconciliation.handler.mjs.map +1 -0
- package/lib/data-store-postgres-replication.handler.js +50 -2
- package/lib/data-store-postgres-replication.handler.js.map +1 -1
- package/lib/data-store-postgres-replication.handler.mjs +2 -2
- package/lib/delete-chunk.handler.js +118 -2
- package/lib/delete-chunk.handler.js.map +1 -1
- package/lib/delete-chunk.handler.mjs +3 -3
- package/lib/{events-DTgo2dcW.d.mts → events-TG654e7L.d.mts} +68 -19
- package/lib/{events-DTgo2dcW.d.ts → events-TG654e7L.d.ts} +68 -19
- package/lib/finalize.handler.js +50 -2
- package/lib/finalize.handler.js.map +1 -1
- package/lib/finalize.handler.mjs +4 -4
- package/lib/firehose-archive-transform.handler.js +50 -2
- package/lib/firehose-archive-transform.handler.js.map +1 -1
- package/lib/firehose-archive-transform.handler.mjs +2 -2
- package/lib/index.d.mts +1283 -4
- package/lib/index.d.ts +1389 -24
- package/lib/index.js +4113 -320
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +602 -195
- package/lib/index.mjs.map +1 -1
- package/lib/list-chunks.handler.js +118 -2
- package/lib/list-chunks.handler.js.map +1 -1
- package/lib/list-chunks.handler.mjs +3 -3
- package/lib/platform-deploy-bridge.handler.js +50 -2
- package/lib/platform-deploy-bridge.handler.js.map +1 -1
- package/lib/platform-deploy-bridge.handler.mjs +1 -1
- package/lib/pre-token-generation.handler.js +68 -0
- package/lib/pre-token-generation.handler.js.map +1 -1
- package/lib/pre-token-generation.handler.mjs +9 -5
- package/lib/pre-token-generation.handler.mjs.map +1 -1
- package/lib/provision-default-workspace.handler.js +887 -4
- package/lib/provision-default-workspace.handler.js.map +1 -1
- package/lib/provision-default-workspace.handler.mjs +14 -9
- package/lib/provision-default-workspace.handler.mjs.map +1 -1
- package/lib/rename-finalize.handler.js +50 -2
- package/lib/rename-finalize.handler.js.map +1 -1
- package/lib/rename-finalize.handler.mjs +2 -2
- package/lib/rename-list-targets.handler.js +118 -2
- package/lib/rename-list-targets.handler.js.map +1 -1
- package/lib/rename-list-targets.handler.mjs +11 -9
- package/lib/rename-list-targets.handler.mjs.map +1 -1
- package/lib/rename-rewrite-chunk.handler.js +68 -0
- package/lib/rename-rewrite-chunk.handler.js.map +1 -1
- package/lib/rename-rewrite-chunk.handler.mjs +2 -2
- package/lib/rest-api-lambda.handler.js +1454 -251
- package/lib/rest-api-lambda.handler.js.map +1 -1
- package/lib/rest-api-lambda.handler.mjs +673 -821
- package/lib/rest-api-lambda.handler.mjs.map +1 -1
- package/lib/seed-demo-data.handler.d.mts +1 -1
- package/lib/seed-demo-data.handler.d.ts +1 -1
- package/lib/seed-demo-data.handler.js +4004 -201
- package/lib/seed-demo-data.handler.js.map +1 -1
- package/lib/seed-demo-data.handler.mjs +10 -7
- package/lib/seed-system-data.handler.js +118 -2
- package/lib/seed-system-data.handler.js.map +1 -1
- package/lib/seed-system-data.handler.mjs +5 -5
- package/package.json +1 -1
- package/lib/chunk-7BQHLC7U.mjs.map +0 -1
- package/lib/chunk-AOSEKL7U.mjs.map +0 -1
- package/lib/chunk-BQMJSDOD.mjs +0 -1136
- package/lib/chunk-BQMJSDOD.mjs.map +0 -1
- package/lib/chunk-CFJDATDK.mjs.map +0 -1
- package/lib/chunk-E6MCKJVS.mjs +0 -212
- package/lib/chunk-E6MCKJVS.mjs.map +0 -1
- package/lib/chunk-HQ67J7BP.mjs.map +0 -1
- package/lib/chunk-MVQWAIMC.mjs.map +0 -1
- package/lib/chunk-ZM4GDHHC.mjs.map +0 -1
- /package/lib/{chunk-WPCBVDFZ.mjs.map → chunk-76UM2LQ5.mjs.map} +0 -0
- /package/lib/{chunk-23PUSHBV.mjs.map → chunk-D2Y6DDOC.mjs.map} +0 -0
- /package/lib/{chunk-KR2Y2CVQ.mjs.map → chunk-KA3OMP3X.mjs.map} +0 -0
- /package/lib/{chunk-M7Y3BOQW.mjs.map → chunk-Q3MKITPY.mjs.map} +0 -0
- /package/lib/{chunk-ZWSGM6PZ.mjs.map → chunk-SD7J3N3C.mjs.map} +0 -0
- /package/lib/{chunk-7RZHFI77.mjs.map → chunk-VESULYQQ.mjs.map} +0 -0
- /package/lib/{chunk-X5E4YJGZ.mjs.map → chunk-YPTJJ35S.mjs.map} +0 -0
|
@@ -139,7 +139,7 @@ var require_control_plane = __commonJS({
|
|
|
139
139
|
"../workflows/lib/detail-types/control-plane.js"(exports2) {
|
|
140
140
|
"use strict";
|
|
141
141
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
142
|
-
exports2.ControlPlaneRenameFailedV1 = exports2.ControlPlaneRenameCompleteV1 = exports2.ControlPlaneRenameV1 = exports2.RENAMABLE_ENTITY_TYPE = exports2.ControlPlaneOwningDeleteFailedV1 = exports2.ControlPlaneOwningDeleteCompleteV1 = exports2.ControlPlaneOwningDeleteV1 = exports2.OWNING_ENTITY_TYPE = void 0;
|
|
142
|
+
exports2.ControlPlaneWorkspaceDeletedV1 = exports2.ControlPlaneWorkspaceCreatedV1 = exports2.ControlPlaneRoleAssignmentDeletedV1 = exports2.ControlPlaneRoleAssignmentCreatedV1 = exports2.ControlPlaneMembershipDeletedV1 = exports2.ControlPlaneMembershipCreatedV1 = exports2.ControlPlaneRenameFailedV1 = exports2.ControlPlaneRenameCompleteV1 = exports2.ControlPlaneRenameV1 = exports2.RENAMABLE_ENTITY_TYPE = exports2.ControlPlaneOwningDeleteFailedV1 = exports2.ControlPlaneOwningDeleteCompleteV1 = exports2.ControlPlaneOwningDeleteV1 = exports2.OWNING_ENTITY_TYPE = void 0;
|
|
143
143
|
var sources_1 = require_sources();
|
|
144
144
|
var registry_1 = require_registry();
|
|
145
145
|
exports2.OWNING_ENTITY_TYPE = {
|
|
@@ -181,6 +181,36 @@ var require_control_plane = __commonJS({
|
|
|
181
181
|
source: sources_1.OPENHI_OPS_SOURCE,
|
|
182
182
|
dedupRequired: true
|
|
183
183
|
});
|
|
184
|
+
exports2.ControlPlaneMembershipCreatedV1 = (0, registry_1.defineDetailType)({
|
|
185
|
+
detailType: "control-plane.membership-created.v1",
|
|
186
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
187
|
+
dedupRequired: true
|
|
188
|
+
});
|
|
189
|
+
exports2.ControlPlaneMembershipDeletedV1 = (0, registry_1.defineDetailType)({
|
|
190
|
+
detailType: "control-plane.membership-deleted.v1",
|
|
191
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
192
|
+
dedupRequired: true
|
|
193
|
+
});
|
|
194
|
+
exports2.ControlPlaneRoleAssignmentCreatedV1 = (0, registry_1.defineDetailType)({
|
|
195
|
+
detailType: "control-plane.role-assignment-created.v1",
|
|
196
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
197
|
+
dedupRequired: true
|
|
198
|
+
});
|
|
199
|
+
exports2.ControlPlaneRoleAssignmentDeletedV1 = (0, registry_1.defineDetailType)({
|
|
200
|
+
detailType: "control-plane.role-assignment-deleted.v1",
|
|
201
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
202
|
+
dedupRequired: true
|
|
203
|
+
});
|
|
204
|
+
exports2.ControlPlaneWorkspaceCreatedV1 = (0, registry_1.defineDetailType)({
|
|
205
|
+
detailType: "control-plane.workspace-created.v1",
|
|
206
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
207
|
+
dedupRequired: true
|
|
208
|
+
});
|
|
209
|
+
exports2.ControlPlaneWorkspaceDeletedV1 = (0, registry_1.defineDetailType)({
|
|
210
|
+
detailType: "control-plane.workspace-deleted.v1",
|
|
211
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
212
|
+
dedupRequired: true
|
|
213
|
+
});
|
|
184
214
|
}
|
|
185
215
|
});
|
|
186
216
|
|
|
@@ -239,17 +269,17 @@ var require_publisher = __commonJS({
|
|
|
239
269
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
240
270
|
exports2.WorkflowPublishError = void 0;
|
|
241
271
|
exports2.workflowsClient = workflowsClient;
|
|
242
|
-
exports2.publishWorkflowEvent =
|
|
272
|
+
exports2.publishWorkflowEvent = publishWorkflowEvent2;
|
|
243
273
|
var node_crypto_1 = require("crypto");
|
|
244
274
|
var client_eventbridge_1 = require("@aws-sdk/client-eventbridge");
|
|
245
275
|
var envelope_version_1 = require_envelope_version();
|
|
246
276
|
var sources_1 = require_sources();
|
|
247
277
|
function workflowsClient(bridge, options = {}) {
|
|
248
278
|
return {
|
|
249
|
-
publish: (entry, payload, ctx) =>
|
|
279
|
+
publish: (entry, payload, ctx) => publishWorkflowEvent2(bridge, entry, payload, ctx, options)
|
|
250
280
|
};
|
|
251
281
|
}
|
|
252
|
-
async function
|
|
282
|
+
async function publishWorkflowEvent2(bridge, entry, payload, ctx, options = {}) {
|
|
253
283
|
const eventIdGenerator = options.eventIdGenerator ?? (() => (0, node_crypto_1.randomUUID)());
|
|
254
284
|
const correlationIdGenerator = options.correlationIdGenerator ?? (() => (0, node_crypto_1.randomUUID)());
|
|
255
285
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
@@ -578,7 +608,7 @@ var require_lib = __commonJS({
|
|
|
578
608
|
"../workflows/lib/index.js"(exports2) {
|
|
579
609
|
"use strict";
|
|
580
610
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
581
|
-
exports2.workflowDedupClient = exports2.recordIfAbsent = exports2.markFailed = exports2.encodeSortKey = exports2.WorkflowDedupTableNameMissingError = exports2.WorkflowDedupInvalidInputError = exports2.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR = exports2.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH = exports2.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS = exports2.parseWorkflowEvent = exports2.UnsupportedEnvelopeVersionError = exports2.InvalidWorkflowEventError = exports2.workflowsClient = exports2.publishWorkflowEvent = exports2.WorkflowPublishError = exports2.isWellFormedDetailType = exports2.defineDetailType = exports2.RENAMABLE_ENTITY_TYPE = exports2.PlatformSystemDataSeededV1 = exports2.PlatformDeploymentCompletedV1 = exports2.OWNING_ENTITY_TYPE = exports2.InvalidDetailTypeRegistrationError = exports2.ControlPlaneRenameV1 = exports2.ControlPlaneRenameFailedV1 = exports2.ControlPlaneRenameCompleteV1 = exports2.ControlPlaneOwningDeleteV1 = exports2.ControlPlaneOwningDeleteFailedV1 = exports2.ControlPlaneOwningDeleteCompleteV1 = exports2.OPENHI_OPS_SOURCE = exports2.OPENHI_DATA_SOURCE = exports2.OPENHI_CONTROL_SOURCE = exports2.DEFAULT_BUS_NAME_BY_SOURCE = exports2.workflowUserActorFromClaims = exports2.isWorkflowUserActor = exports2.isWorkflowSystemActor = exports2.MissingActorContextError = exports2.isSupportedEnvelopeVersion = exports2.ENVELOPE_VERSION = void 0;
|
|
611
|
+
exports2.workflowDedupClient = exports2.recordIfAbsent = exports2.markFailed = exports2.encodeSortKey = exports2.WorkflowDedupTableNameMissingError = exports2.WorkflowDedupInvalidInputError = exports2.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR = exports2.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH = exports2.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS = exports2.parseWorkflowEvent = exports2.UnsupportedEnvelopeVersionError = exports2.InvalidWorkflowEventError = exports2.workflowsClient = exports2.publishWorkflowEvent = exports2.WorkflowPublishError = exports2.isWellFormedDetailType = exports2.defineDetailType = exports2.RENAMABLE_ENTITY_TYPE = exports2.PlatformSystemDataSeededV1 = exports2.PlatformDeploymentCompletedV1 = exports2.OWNING_ENTITY_TYPE = exports2.InvalidDetailTypeRegistrationError = exports2.ControlPlaneWorkspaceDeletedV1 = exports2.ControlPlaneWorkspaceCreatedV1 = exports2.ControlPlaneRoleAssignmentDeletedV1 = exports2.ControlPlaneRoleAssignmentCreatedV1 = exports2.ControlPlaneRenameV1 = exports2.ControlPlaneRenameFailedV1 = exports2.ControlPlaneRenameCompleteV1 = exports2.ControlPlaneOwningDeleteV1 = exports2.ControlPlaneOwningDeleteFailedV1 = exports2.ControlPlaneOwningDeleteCompleteV1 = exports2.ControlPlaneMembershipDeletedV1 = exports2.ControlPlaneMembershipCreatedV1 = exports2.OPENHI_OPS_SOURCE = exports2.OPENHI_DATA_SOURCE = exports2.OPENHI_CONTROL_SOURCE = exports2.DEFAULT_BUS_NAME_BY_SOURCE = exports2.workflowUserActorFromClaims = exports2.isWorkflowUserActor = exports2.isWorkflowSystemActor = exports2.MissingActorContextError = exports2.isSupportedEnvelopeVersion = exports2.ENVELOPE_VERSION = void 0;
|
|
582
612
|
var envelope_version_1 = require_envelope_version();
|
|
583
613
|
Object.defineProperty(exports2, "ENVELOPE_VERSION", { enumerable: true, get: function() {
|
|
584
614
|
return envelope_version_1.ENVELOPE_VERSION;
|
|
@@ -613,6 +643,12 @@ var require_lib = __commonJS({
|
|
|
613
643
|
return sources_1.OPENHI_OPS_SOURCE;
|
|
614
644
|
} });
|
|
615
645
|
var detail_types_1 = require_detail_types();
|
|
646
|
+
Object.defineProperty(exports2, "ControlPlaneMembershipCreatedV1", { enumerable: true, get: function() {
|
|
647
|
+
return detail_types_1.ControlPlaneMembershipCreatedV1;
|
|
648
|
+
} });
|
|
649
|
+
Object.defineProperty(exports2, "ControlPlaneMembershipDeletedV1", { enumerable: true, get: function() {
|
|
650
|
+
return detail_types_1.ControlPlaneMembershipDeletedV1;
|
|
651
|
+
} });
|
|
616
652
|
Object.defineProperty(exports2, "ControlPlaneOwningDeleteCompleteV1", { enumerable: true, get: function() {
|
|
617
653
|
return detail_types_1.ControlPlaneOwningDeleteCompleteV1;
|
|
618
654
|
} });
|
|
@@ -631,6 +667,18 @@ var require_lib = __commonJS({
|
|
|
631
667
|
Object.defineProperty(exports2, "ControlPlaneRenameV1", { enumerable: true, get: function() {
|
|
632
668
|
return detail_types_1.ControlPlaneRenameV1;
|
|
633
669
|
} });
|
|
670
|
+
Object.defineProperty(exports2, "ControlPlaneRoleAssignmentCreatedV1", { enumerable: true, get: function() {
|
|
671
|
+
return detail_types_1.ControlPlaneRoleAssignmentCreatedV1;
|
|
672
|
+
} });
|
|
673
|
+
Object.defineProperty(exports2, "ControlPlaneRoleAssignmentDeletedV1", { enumerable: true, get: function() {
|
|
674
|
+
return detail_types_1.ControlPlaneRoleAssignmentDeletedV1;
|
|
675
|
+
} });
|
|
676
|
+
Object.defineProperty(exports2, "ControlPlaneWorkspaceCreatedV1", { enumerable: true, get: function() {
|
|
677
|
+
return detail_types_1.ControlPlaneWorkspaceCreatedV1;
|
|
678
|
+
} });
|
|
679
|
+
Object.defineProperty(exports2, "ControlPlaneWorkspaceDeletedV1", { enumerable: true, get: function() {
|
|
680
|
+
return detail_types_1.ControlPlaneWorkspaceDeletedV1;
|
|
681
|
+
} });
|
|
634
682
|
Object.defineProperty(exports2, "InvalidDetailTypeRegistrationError", { enumerable: true, get: function() {
|
|
635
683
|
return detail_types_1.InvalidDetailTypeRegistrationError;
|
|
636
684
|
} });
|
|
@@ -721,7 +769,7 @@ var import_client_cognito_identity_provider = require("@aws-sdk/client-cognito-i
|
|
|
721
769
|
var import_client_dynamodb2 = require("@aws-sdk/client-dynamodb");
|
|
722
770
|
var import_client_ssm = require("@aws-sdk/client-ssm");
|
|
723
771
|
var import_types12 = require("@openhi/types");
|
|
724
|
-
var
|
|
772
|
+
var import_workflows3 = __toESM(require_lib());
|
|
725
773
|
|
|
726
774
|
// src/workflows/control-plane/seed-demo-data/events.ts
|
|
727
775
|
var import_types = require("@openhi/types");
|
|
@@ -737,16 +785,63 @@ var OPENHI_RESOURCE_URN_SYSTEM = "http://openhi.org/";
|
|
|
737
785
|
var DEMO_PERIOD = { start: "2026-01-01T00:00:00Z" };
|
|
738
786
|
var PLACEHOLDER_TENANT_ID = "placeholder-tenant-id";
|
|
739
787
|
var PLACEHOLDER_WORKSPACE_ID = "placeholder-workspace-id";
|
|
788
|
+
var ON_SITE_DEMO_TENANT_ID = "on-site-demo-tenant";
|
|
789
|
+
var ON_SITE_DEMO_WORKSPACE_ID = "on-site-demo-workspace";
|
|
740
790
|
var DEV_USERS = [
|
|
741
|
-
{
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
{
|
|
748
|
-
|
|
749
|
-
|
|
791
|
+
{
|
|
792
|
+
id: "dev-russell",
|
|
793
|
+
email: "russell@codedrifters.com",
|
|
794
|
+
firstName: "Russell",
|
|
795
|
+
lastName: "Ingram"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
id: "dev-cameron",
|
|
799
|
+
email: "cameron@codedrifters.com",
|
|
800
|
+
firstName: "Cameron",
|
|
801
|
+
lastName: "Childress"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
id: "dev-neelima",
|
|
805
|
+
email: "neelima@codedrifters.com",
|
|
806
|
+
firstName: "Neelima",
|
|
807
|
+
lastName: "Ramaraju"
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
id: "dev-garon",
|
|
811
|
+
email: "garon@codedrifters.com",
|
|
812
|
+
firstName: "Garon",
|
|
813
|
+
lastName: "Bailey"
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
id: "dev-dave",
|
|
817
|
+
email: "dave@codedrifters.com",
|
|
818
|
+
firstName: "Dave",
|
|
819
|
+
lastName: "Finlay"
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
id: "dev-drew",
|
|
823
|
+
email: "drew@codedrifters.com",
|
|
824
|
+
firstName: "Drew",
|
|
825
|
+
lastName: "Morris"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
id: "dev-jessica",
|
|
829
|
+
email: "jessica@codedrifters.com",
|
|
830
|
+
firstName: "Jessica",
|
|
831
|
+
lastName: "Branks"
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
id: "dev-jared",
|
|
835
|
+
email: "jared@codedrifters.com",
|
|
836
|
+
firstName: "Jared",
|
|
837
|
+
lastName: "Trotter"
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
id: "dev-goddess",
|
|
841
|
+
email: "goddess@codedrifters.com",
|
|
842
|
+
firstName: "Goddess",
|
|
843
|
+
lastName: "Culberson"
|
|
844
|
+
},
|
|
750
845
|
// Dedicated end-to-end test principal for admin-console Playwright
|
|
751
846
|
// specs (issue #1275). Reuses the standard DEV_USERS plumbing
|
|
752
847
|
// (Cognito user + DynamoDB User + per-tenant Memberships +
|
|
@@ -756,7 +851,12 @@ var DEV_USERS = [
|
|
|
756
851
|
// /openhi/seed/users/e2e-admin-console_at_codedrifters.com/password
|
|
757
852
|
// out of band, and the seeded Cognito user picks it up via
|
|
758
853
|
// AdminSetUserPassword on every seed run.
|
|
759
|
-
{
|
|
854
|
+
{
|
|
855
|
+
id: "dev-e2e-admin-console",
|
|
856
|
+
email: "e2e-admin-console@codedrifters.com",
|
|
857
|
+
firstName: "E2E",
|
|
858
|
+
lastName: "AdminConsole"
|
|
859
|
+
}
|
|
760
860
|
];
|
|
761
861
|
var DEMO_TENANT_SPECS = [
|
|
762
862
|
{
|
|
@@ -771,6 +871,18 @@ var DEMO_TENANT_SPECS = [
|
|
|
771
871
|
}
|
|
772
872
|
]
|
|
773
873
|
},
|
|
874
|
+
{
|
|
875
|
+
scenario: "on-site-demo",
|
|
876
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
877
|
+
tenantName: "On-Site Medical \u2014 Demo",
|
|
878
|
+
workspaces: [
|
|
879
|
+
{
|
|
880
|
+
id: ON_SITE_DEMO_WORKSPACE_ID,
|
|
881
|
+
name: "On-Site Medical \u2014 Primary Workspace",
|
|
882
|
+
roleSuffix: "workspace"
|
|
883
|
+
}
|
|
884
|
+
]
|
|
885
|
+
},
|
|
774
886
|
{
|
|
775
887
|
scenario: "demo-wound-care",
|
|
776
888
|
tenantId: "demo-wound-care-tenant",
|
|
@@ -830,159 +942,3297 @@ var demoRolesForUserInTenant = (_user, _tenantId) => {
|
|
|
830
942
|
return [import_types.PLATFORM_ROLE_CODE.TENANT_ADMIN];
|
|
831
943
|
};
|
|
832
944
|
|
|
833
|
-
// src/workflows/control-plane/seed-demo-data/
|
|
834
|
-
var
|
|
835
|
-
|
|
945
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-facilities.ts
|
|
946
|
+
var DIRECTOR_OF_NURSING_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/director-of-nursing";
|
|
947
|
+
var DIRECTOR_OF_NURSING_NAME_EXTENSION_URL = "name";
|
|
948
|
+
var DIRECTOR_OF_NURSING_PHONE_EXTENSION_URL = "phone";
|
|
949
|
+
var DIRECTOR_OF_NURSING_EMAIL_EXTENSION_URL = "email";
|
|
950
|
+
var ON_SITE_SCENARIO = "on-site-demo";
|
|
951
|
+
var FACILITY_SPECS = [
|
|
952
|
+
{
|
|
953
|
+
id: "on-site-demo-facility-001",
|
|
954
|
+
name: "Druid Hills Skilled Nursing",
|
|
955
|
+
phone: "+14045550301",
|
|
956
|
+
email: "frontdesk@druidhills.on-site-demo.example.com",
|
|
957
|
+
addressLine: "1455 Clifton Road NE",
|
|
958
|
+
addressCity: "Atlanta",
|
|
959
|
+
addressState: "GA",
|
|
960
|
+
addressPostalCode: "30322",
|
|
961
|
+
directorOfNursingName: "Patricia Lambert, RN",
|
|
962
|
+
directorOfNursingPhone: "+14045550311",
|
|
963
|
+
directorOfNursingEmail: "p.lambert@druidhills.on-site-demo.example.com"
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
id: "on-site-demo-facility-002",
|
|
967
|
+
name: "Buckhead Rehabilitation Center",
|
|
968
|
+
phone: "+14045550302",
|
|
969
|
+
email: "frontdesk@buckhead.on-site-demo.example.com",
|
|
970
|
+
addressLine: "3193 Howell Mill Road NW",
|
|
971
|
+
addressCity: "Atlanta",
|
|
972
|
+
addressState: "GA",
|
|
973
|
+
addressPostalCode: "30327",
|
|
974
|
+
directorOfNursingName: "Karen Whitfield, RN",
|
|
975
|
+
directorOfNursingPhone: "+14045550312",
|
|
976
|
+
directorOfNursingEmail: "k.whitfield@buckhead.on-site-demo.example.com"
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
id: "on-site-demo-facility-003",
|
|
980
|
+
name: "Decatur Senior Living",
|
|
981
|
+
phone: "+14045550303",
|
|
982
|
+
email: "frontdesk@decatur.on-site-demo.example.com",
|
|
983
|
+
addressLine: "920 Church Street",
|
|
984
|
+
addressCity: "Decatur",
|
|
985
|
+
addressState: "GA",
|
|
986
|
+
addressPostalCode: "30030",
|
|
987
|
+
directorOfNursingName: "Monique Beaumont, RN",
|
|
988
|
+
directorOfNursingPhone: "+14045550313",
|
|
989
|
+
directorOfNursingEmail: "m.beaumont@decatur.on-site-demo.example.com"
|
|
990
|
+
}
|
|
991
|
+
];
|
|
992
|
+
var buildIdentifierPair = (locationId, roleSuffix) => [
|
|
993
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO, roleSuffix),
|
|
836
994
|
openhiResourceIdentifier({
|
|
837
|
-
tenantId,
|
|
838
|
-
workspaceId,
|
|
839
|
-
resourceType,
|
|
840
|
-
id
|
|
995
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
996
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
997
|
+
resourceType: "Location",
|
|
998
|
+
id: locationId
|
|
841
999
|
})
|
|
842
1000
|
];
|
|
843
|
-
var
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
tenantId,
|
|
854
|
-
workspaceId,
|
|
855
|
-
"Patient",
|
|
856
|
-
`${idPrefix}-patient-1`,
|
|
857
|
-
`patient-1`
|
|
858
|
-
),
|
|
859
|
-
active: true,
|
|
860
|
-
name: [{ family: "Carter", given: ["Eleanor"], use: "official" }],
|
|
861
|
-
gender: "female",
|
|
862
|
-
birthDate: "1952-04-18"
|
|
863
|
-
},
|
|
864
|
-
{
|
|
865
|
-
resourceType: "Patient",
|
|
866
|
-
id: `${idPrefix}-patient-2`,
|
|
867
|
-
identifier: fixtureIdentifiers(
|
|
868
|
-
scenario,
|
|
869
|
-
tenantId,
|
|
870
|
-
workspaceId,
|
|
871
|
-
"Patient",
|
|
872
|
-
`${idPrefix}-patient-2`,
|
|
873
|
-
`patient-2`
|
|
874
|
-
),
|
|
875
|
-
active: true,
|
|
876
|
-
name: [{ family: "Nguyen", given: ["Hao"], use: "official" }],
|
|
877
|
-
gender: "male",
|
|
878
|
-
birthDate: "1968-11-02"
|
|
879
|
-
}
|
|
1001
|
+
var buildFacilityResource = (spec) => ({
|
|
1002
|
+
resourceType: "Location",
|
|
1003
|
+
id: spec.id,
|
|
1004
|
+
status: "active",
|
|
1005
|
+
name: spec.name,
|
|
1006
|
+
identifier: buildIdentifierPair(spec.id, `facility-${spec.id}`),
|
|
1007
|
+
type: [{ text: "facility" }],
|
|
1008
|
+
telecom: [
|
|
1009
|
+
{ system: "phone", value: spec.phone, use: "work" },
|
|
1010
|
+
{ system: "email", value: spec.email, use: "work" }
|
|
880
1011
|
],
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
`${idPrefix}-practitioner-1`,
|
|
891
|
-
`practitioner-1`
|
|
892
|
-
),
|
|
893
|
-
active: true,
|
|
894
|
-
name: [{ family: "Reyes", given: ["Maria"], prefix: ["Dr."] }],
|
|
895
|
-
gender: "female"
|
|
896
|
-
},
|
|
1012
|
+
address: {
|
|
1013
|
+
use: "work",
|
|
1014
|
+
line: [spec.addressLine],
|
|
1015
|
+
city: spec.addressCity,
|
|
1016
|
+
state: spec.addressState,
|
|
1017
|
+
postalCode: spec.addressPostalCode,
|
|
1018
|
+
country: "US"
|
|
1019
|
+
},
|
|
1020
|
+
extension: [
|
|
897
1021
|
{
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1022
|
+
url: DIRECTOR_OF_NURSING_EXTENSION_URL,
|
|
1023
|
+
extension: [
|
|
1024
|
+
{
|
|
1025
|
+
url: DIRECTOR_OF_NURSING_NAME_EXTENSION_URL,
|
|
1026
|
+
valueString: spec.directorOfNursingName
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
url: DIRECTOR_OF_NURSING_PHONE_EXTENSION_URL,
|
|
1030
|
+
valueString: spec.directorOfNursingPhone
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
url: DIRECTOR_OF_NURSING_EMAIL_EXTENSION_URL,
|
|
1034
|
+
valueString: spec.directorOfNursingEmail
|
|
1035
|
+
}
|
|
1036
|
+
]
|
|
911
1037
|
}
|
|
912
|
-
]
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
1038
|
+
]
|
|
1039
|
+
});
|
|
1040
|
+
var ON_SITE_DEMO_FACILITIES = FACILITY_SPECS.map(buildFacilityResource);
|
|
1041
|
+
var ON_SITE_DEMO_FACILITY_IDS = FACILITY_SPECS.map((f) => f.id);
|
|
1042
|
+
|
|
1043
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-blocks.ts
|
|
1044
|
+
var ON_SITE_DEMO_BLOCK_CAPACITY_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/block-capacity";
|
|
1045
|
+
var ON_SITE_APPOINTMENT_TYPE_SYSTEM = "https://onsite-medical.org/appointment-type";
|
|
1046
|
+
var BLOCK_OCCURRENCE_WEEKS_PAST = 4;
|
|
1047
|
+
var BLOCK_OCCURRENCE_WEEKS_FUTURE = 8;
|
|
1048
|
+
var BLOCK_OCCURRENCES_PER_TEMPLATE = BLOCK_OCCURRENCE_WEEKS_PAST + 1 + BLOCK_OCCURRENCE_WEEKS_FUTURE;
|
|
1049
|
+
var BLOCK_TEMPLATES = [
|
|
1050
|
+
{
|
|
1051
|
+
id: "on-site-demo-block-001",
|
|
1052
|
+
facilityId: "on-site-demo-facility-001",
|
|
1053
|
+
// Druid Hills
|
|
1054
|
+
displayName: "Druid Hills \u2014 Tuesday rounds",
|
|
1055
|
+
dayOfWeek: 2,
|
|
1056
|
+
// Tuesday
|
|
1057
|
+
startHourUtc: 14,
|
|
1058
|
+
// 09:00 ET (EST: 14:00 UTC; EDT: 13:00 UTC) — fixed UTC keeps demo deterministic
|
|
1059
|
+
endHourUtc: 18,
|
|
1060
|
+
// 4-hour block
|
|
1061
|
+
doctorId: "on-site-demo-doctor-001",
|
|
1062
|
+
scribeId: "on-site-demo-scribe-001",
|
|
1063
|
+
capacity: 16
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
id: "on-site-demo-block-002",
|
|
1067
|
+
facilityId: "on-site-demo-facility-001",
|
|
1068
|
+
// Druid Hills (same facility, different weekday)
|
|
1069
|
+
displayName: "Druid Hills \u2014 Thursday rounds",
|
|
1070
|
+
dayOfWeek: 4,
|
|
1071
|
+
// Thursday
|
|
1072
|
+
startHourUtc: 14,
|
|
1073
|
+
endHourUtc: 18,
|
|
1074
|
+
doctorId: "on-site-demo-doctor-002",
|
|
1075
|
+
scribeId: "on-site-demo-scribe-002",
|
|
1076
|
+
capacity: 16
|
|
1077
|
+
},
|
|
1078
|
+
{
|
|
1079
|
+
id: "on-site-demo-block-003",
|
|
1080
|
+
facilityId: "on-site-demo-facility-002",
|
|
1081
|
+
// Buckhead
|
|
1082
|
+
displayName: "Buckhead \u2014 Wednesday rounds",
|
|
1083
|
+
dayOfWeek: 3,
|
|
1084
|
+
// Wednesday
|
|
1085
|
+
startHourUtc: 14,
|
|
1086
|
+
endHourUtc: 18,
|
|
1087
|
+
doctorId: "on-site-demo-doctor-003",
|
|
1088
|
+
scribeId: "on-site-demo-scribe-003",
|
|
1089
|
+
capacity: 14
|
|
1090
|
+
},
|
|
1091
|
+
{
|
|
1092
|
+
id: "on-site-demo-block-004",
|
|
1093
|
+
facilityId: "on-site-demo-facility-003",
|
|
1094
|
+
// Decatur
|
|
1095
|
+
displayName: "Decatur \u2014 Monday rounds",
|
|
1096
|
+
dayOfWeek: 1,
|
|
1097
|
+
// Monday
|
|
1098
|
+
startHourUtc: 14,
|
|
1099
|
+
endHourUtc: 18,
|
|
1100
|
+
doctorId: "on-site-demo-doctor-004",
|
|
1101
|
+
scribeId: "on-site-demo-scribe-004",
|
|
1102
|
+
capacity: 12
|
|
1103
|
+
}
|
|
1104
|
+
];
|
|
1105
|
+
var validateBlockTemplateReferences = () => {
|
|
1106
|
+
const facilitySet = new Set(ON_SITE_DEMO_FACILITY_IDS);
|
|
1107
|
+
const doctorSet = new Set(ON_SITE_DEMO_DOCTOR_IDS);
|
|
1108
|
+
const scribeSet = new Set(ON_SITE_DEMO_SCRIBE_IDS);
|
|
1109
|
+
for (const template of BLOCK_TEMPLATES) {
|
|
1110
|
+
if (!facilitySet.has(template.facilityId)) {
|
|
1111
|
+
throw new Error(
|
|
1112
|
+
`Block template "${template.id}" references unknown facility id "${template.facilityId}".`
|
|
1113
|
+
);
|
|
1114
|
+
}
|
|
1115
|
+
if (!doctorSet.has(template.doctorId)) {
|
|
1116
|
+
throw new Error(
|
|
1117
|
+
`Block template "${template.id}" references unknown doctor id "${template.doctorId}".`
|
|
1118
|
+
);
|
|
1119
|
+
}
|
|
1120
|
+
if (!scribeSet.has(template.scribeId)) {
|
|
1121
|
+
throw new Error(
|
|
1122
|
+
`Block template "${template.id}" references unknown scribe id "${template.scribeId}".`
|
|
1123
|
+
);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
var ON_SITE_DEMO_BLOCK_TEMPLATE_IDS = BLOCK_TEMPLATES.map((t) => t.id);
|
|
1128
|
+
var ON_SITE_SCENARIO2 = "on-site-demo";
|
|
1129
|
+
var mondayOfIsoWeekUtc = (referenceIso) => {
|
|
1130
|
+
const ref = new Date(referenceIso);
|
|
1131
|
+
if (Number.isNaN(ref.getTime())) {
|
|
1132
|
+
throw new Error(
|
|
1133
|
+
`mondayOfIsoWeekUtc: invalid reference date "${referenceIso}".`
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
const utcDay = ref.getUTCDay() === 0 ? 7 : ref.getUTCDay();
|
|
1137
|
+
const monday = new Date(
|
|
1138
|
+
Date.UTC(ref.getUTCFullYear(), ref.getUTCMonth(), ref.getUTCDate())
|
|
1139
|
+
);
|
|
1140
|
+
monday.setUTCDate(monday.getUTCDate() - (utcDay - 1));
|
|
1141
|
+
return monday;
|
|
1142
|
+
};
|
|
1143
|
+
var occurrenceId = (templateId, weekOffset) => {
|
|
1144
|
+
const sign = weekOffset >= 0 ? "p" : "m";
|
|
1145
|
+
const magnitude = Math.abs(weekOffset).toString().padStart(2, "0");
|
|
1146
|
+
return `${templateId}-w${sign}${magnitude}`;
|
|
1147
|
+
};
|
|
1148
|
+
var buildIdentifierPair2 = (appointmentId, roleSuffix) => [
|
|
1149
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO2, roleSuffix),
|
|
1150
|
+
openhiResourceIdentifier({
|
|
1151
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
1152
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
1153
|
+
resourceType: "Appointment",
|
|
1154
|
+
id: appointmentId
|
|
1155
|
+
})
|
|
1156
|
+
];
|
|
1157
|
+
var toIsoZ = (d) => (
|
|
1158
|
+
// toISOString() always emits a `Z` suffix on UTC times.
|
|
1159
|
+
d.toISOString()
|
|
1160
|
+
);
|
|
1161
|
+
var buildOccurrenceAppointment = (template, anchorMondayUtc, weekOffset) => {
|
|
1162
|
+
const occurrenceDay = new Date(anchorMondayUtc);
|
|
1163
|
+
occurrenceDay.setUTCDate(
|
|
1164
|
+
occurrenceDay.getUTCDate() + weekOffset * 7 + (template.dayOfWeek - 1)
|
|
1165
|
+
);
|
|
1166
|
+
const start = new Date(occurrenceDay);
|
|
1167
|
+
start.setUTCHours(template.startHourUtc, 0, 0, 0);
|
|
1168
|
+
const end = new Date(occurrenceDay);
|
|
1169
|
+
end.setUTCHours(template.endHourUtc, 0, 0, 0);
|
|
1170
|
+
const id = occurrenceId(template.id, weekOffset);
|
|
1171
|
+
return {
|
|
1172
|
+
resourceType: "Appointment",
|
|
1173
|
+
id,
|
|
1174
|
+
status: "booked",
|
|
1175
|
+
identifier: buildIdentifierPair2(id, `block-${id}`),
|
|
1176
|
+
appointmentType: {
|
|
1177
|
+
coding: [
|
|
1178
|
+
{
|
|
1179
|
+
system: ON_SITE_APPOINTMENT_TYPE_SYSTEM,
|
|
1180
|
+
code: "block",
|
|
1181
|
+
display: "Block"
|
|
1182
|
+
}
|
|
1183
|
+
],
|
|
1184
|
+
text: "Block"
|
|
1185
|
+
},
|
|
1186
|
+
description: template.displayName,
|
|
1187
|
+
start: toIsoZ(start),
|
|
1188
|
+
end: toIsoZ(end),
|
|
1189
|
+
minutesDuration: (template.endHourUtc - template.startHourUtc) * 60,
|
|
1190
|
+
participant: [
|
|
1191
|
+
{
|
|
1192
|
+
actor: {
|
|
1193
|
+
reference: `Location/${template.facilityId}`,
|
|
1194
|
+
type: "Location"
|
|
1195
|
+
},
|
|
1196
|
+
status: "accepted"
|
|
934
1197
|
},
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
identifier: fixtureIdentifiers(
|
|
942
|
-
scenario,
|
|
943
|
-
tenantId,
|
|
944
|
-
workspaceId,
|
|
945
|
-
"Observation",
|
|
946
|
-
`${idPrefix}-observation-2`,
|
|
947
|
-
`observation-2`
|
|
948
|
-
),
|
|
949
|
-
status: "final",
|
|
950
|
-
code: {
|
|
951
|
-
coding: [
|
|
952
|
-
{
|
|
953
|
-
system: "http://loinc.org",
|
|
954
|
-
code: "72287-2",
|
|
955
|
-
display: "Wound exudate amount"
|
|
956
|
-
}
|
|
957
|
-
]
|
|
1198
|
+
{
|
|
1199
|
+
actor: {
|
|
1200
|
+
reference: `Practitioner/${template.doctorId}`,
|
|
1201
|
+
type: "Practitioner"
|
|
1202
|
+
},
|
|
1203
|
+
status: "accepted"
|
|
958
1204
|
},
|
|
959
|
-
|
|
960
|
-
|
|
1205
|
+
{
|
|
1206
|
+
actor: {
|
|
1207
|
+
reference: `Practitioner/${template.scribeId}`,
|
|
1208
|
+
type: "Practitioner"
|
|
1209
|
+
},
|
|
1210
|
+
status: "accepted"
|
|
1211
|
+
}
|
|
1212
|
+
],
|
|
1213
|
+
extension: [
|
|
1214
|
+
{
|
|
1215
|
+
url: ON_SITE_DEMO_BLOCK_CAPACITY_EXTENSION_URL,
|
|
1216
|
+
valueInteger: template.capacity
|
|
1217
|
+
}
|
|
1218
|
+
]
|
|
1219
|
+
};
|
|
1220
|
+
};
|
|
1221
|
+
var buildOnSiteDemoBlockAppointments = (referenceIso) => {
|
|
1222
|
+
validateBlockTemplateReferences();
|
|
1223
|
+
const anchorMonday = mondayOfIsoWeekUtc(referenceIso);
|
|
1224
|
+
const out = [];
|
|
1225
|
+
for (const template of BLOCK_TEMPLATES) {
|
|
1226
|
+
for (let weekOffset = -BLOCK_OCCURRENCE_WEEKS_PAST; weekOffset <= BLOCK_OCCURRENCE_WEEKS_FUTURE; weekOffset += 1) {
|
|
1227
|
+
out.push(buildOccurrenceAppointment(template, anchorMonday, weekOffset));
|
|
961
1228
|
}
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1229
|
+
}
|
|
1230
|
+
return out;
|
|
1231
|
+
};
|
|
1232
|
+
var findOnSiteDemoBlockTemplate = (templateId) => {
|
|
1233
|
+
const t = BLOCK_TEMPLATES.find((tt) => tt.id === templateId);
|
|
1234
|
+
if (!t) {
|
|
1235
|
+
return void 0;
|
|
1236
|
+
}
|
|
1237
|
+
return {
|
|
1238
|
+
id: t.id,
|
|
1239
|
+
facilityId: t.facilityId,
|
|
1240
|
+
displayName: t.displayName,
|
|
1241
|
+
doctorId: t.doctorId,
|
|
1242
|
+
scribeId: t.scribeId,
|
|
1243
|
+
capacity: t.capacity,
|
|
1244
|
+
dayOfWeek: t.dayOfWeek
|
|
1245
|
+
};
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-facility-patients.ts
|
|
1249
|
+
var PATIENT_DEFAULT_CARE_SETTING_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-default-care-setting";
|
|
1250
|
+
var PATIENT_DEFAULT_CARE_LOCATION_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-default-care-location";
|
|
1251
|
+
var PATIENT_RESIDENCY_ADMISSION_DATE_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-residency-admission-date";
|
|
1252
|
+
var PATIENT_RESIDENCY_ROOM_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-residency-room";
|
|
1253
|
+
var PATIENT_ASSIGNED_BLOCK_TEMPLATE_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-assigned-block-template";
|
|
1254
|
+
var PATIENT_HOSPICE_STATUS_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-hospice-status";
|
|
1255
|
+
var HOSPICE_STATUS_VALUE_SUB_EXTENSION_URL = "status";
|
|
1256
|
+
var HOSPICE_EFFECTIVE_DATE_SUB_EXTENSION_URL = "effectiveDate";
|
|
1257
|
+
var COVERAGE_VERIFICATION_DATE_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/coverage-verification-date";
|
|
1258
|
+
var COVERAGE_QMB_STATUS_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/coverage-qmb-status";
|
|
1259
|
+
var QMB_STATUS_VALUE_SUB_EXTENSION_URL = "status";
|
|
1260
|
+
var QMB_EFFECTIVE_DATE_SUB_EXTENSION_URL = "effectiveDate";
|
|
1261
|
+
var COVERAGE_PAYOR_TYPE_SYSTEM = "https://on-site-medical.app/fhir/CodeSystem/coverage-payor-type";
|
|
1262
|
+
var PAYOR_TYPE_COMMERCIAL = "commercial";
|
|
1263
|
+
var PAYOR_TYPE_MEDICARE = "medicare";
|
|
1264
|
+
var PAYOR_TYPE_MEDICARE_ADVANTAGE = "medicare-advantage";
|
|
1265
|
+
var PATIENTS_PER_BLOCK = [
|
|
1266
|
+
{ blockTemplateId: "on-site-demo-block-001", count: 16 },
|
|
1267
|
+
{ blockTemplateId: "on-site-demo-block-002", count: 14 },
|
|
1268
|
+
{ blockTemplateId: "on-site-demo-block-003", count: 18 },
|
|
1269
|
+
{ blockTemplateId: "on-site-demo-block-004", count: 12 }
|
|
1270
|
+
];
|
|
1271
|
+
var INTAKE_ONLY_PATIENTS_PER_FACILITY = 2;
|
|
1272
|
+
var PRIMARY_PAYOR_OPTIONS = [
|
|
1273
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Aetna PPO" },
|
|
1274
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Blue Cross Blue Shield of Georgia" },
|
|
1275
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "UnitedHealthcare Choice Plus" },
|
|
1276
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Cigna OAP" },
|
|
1277
|
+
{ type: PAYOR_TYPE_MEDICARE, display: "Medicare Part B" },
|
|
1278
|
+
{ type: PAYOR_TYPE_MEDICARE_ADVANTAGE, display: "Humana Medicare Advantage" },
|
|
1279
|
+
{
|
|
1280
|
+
type: PAYOR_TYPE_MEDICARE_ADVANTAGE,
|
|
1281
|
+
display: "Wellcare by Allwell HMO"
|
|
1282
|
+
}
|
|
1283
|
+
];
|
|
1284
|
+
var SECONDARY_PAYOR_OPTIONS = [
|
|
1285
|
+
{ display: "AARP Medigap Plan G" },
|
|
1286
|
+
{ display: "Mutual of Omaha Medicare Supplement" },
|
|
1287
|
+
{ display: "Cigna Supplemental Health" },
|
|
1288
|
+
{ display: "AFLAC Supplemental" }
|
|
1289
|
+
];
|
|
1290
|
+
var PATIENT_LAST_NAMES = [
|
|
1291
|
+
"Anderson",
|
|
1292
|
+
"Bennett",
|
|
1293
|
+
"Brennan",
|
|
1294
|
+
"Carter",
|
|
1295
|
+
"Chen",
|
|
1296
|
+
"Coleman",
|
|
1297
|
+
"Cooper",
|
|
1298
|
+
"Davis",
|
|
1299
|
+
"Diaz",
|
|
1300
|
+
"Edwards",
|
|
1301
|
+
"Fisher",
|
|
1302
|
+
"Foster",
|
|
1303
|
+
"Garcia",
|
|
1304
|
+
"Garrett",
|
|
1305
|
+
"Gonzalez",
|
|
1306
|
+
"Graham",
|
|
1307
|
+
"Greene",
|
|
1308
|
+
"Hall",
|
|
1309
|
+
"Harper",
|
|
1310
|
+
"Harris",
|
|
1311
|
+
"Hayes",
|
|
1312
|
+
"Hernandez",
|
|
1313
|
+
"Holloway",
|
|
1314
|
+
"Hughes",
|
|
1315
|
+
"Jackson",
|
|
1316
|
+
"Jenkins",
|
|
1317
|
+
"Johnson",
|
|
1318
|
+
"Jones",
|
|
1319
|
+
"Kelly",
|
|
1320
|
+
"Kim",
|
|
1321
|
+
"Lambert",
|
|
1322
|
+
"Lawson",
|
|
1323
|
+
"Lee",
|
|
1324
|
+
"Lopez",
|
|
1325
|
+
"Marshall",
|
|
1326
|
+
"Martin",
|
|
1327
|
+
"Mason",
|
|
1328
|
+
"McKenzie",
|
|
1329
|
+
"Mendez",
|
|
1330
|
+
"Miller",
|
|
1331
|
+
"Mitchell",
|
|
1332
|
+
"Moore",
|
|
1333
|
+
"Morgan",
|
|
1334
|
+
"Morris",
|
|
1335
|
+
"Murphy",
|
|
1336
|
+
"Nguyen",
|
|
1337
|
+
"Nichols",
|
|
1338
|
+
"Norton",
|
|
1339
|
+
"O'Brien",
|
|
1340
|
+
"Ortiz",
|
|
1341
|
+
"Owens",
|
|
1342
|
+
"Park",
|
|
1343
|
+
"Patel",
|
|
1344
|
+
"Pearson",
|
|
1345
|
+
"Perez",
|
|
1346
|
+
"Phillips",
|
|
1347
|
+
"Porter",
|
|
1348
|
+
"Powell",
|
|
1349
|
+
"Ramirez",
|
|
1350
|
+
"Reed",
|
|
1351
|
+
"Reyes",
|
|
1352
|
+
"Robinson",
|
|
1353
|
+
"Rodriguez",
|
|
1354
|
+
"Russell",
|
|
1355
|
+
"Sanders",
|
|
1356
|
+
"Schultz",
|
|
1357
|
+
"Singh",
|
|
1358
|
+
"Stewart",
|
|
1359
|
+
"Sullivan",
|
|
1360
|
+
"Tanaka",
|
|
1361
|
+
"Taylor",
|
|
1362
|
+
"Thompson",
|
|
1363
|
+
"Torres",
|
|
1364
|
+
"Walker",
|
|
1365
|
+
"Wallace",
|
|
1366
|
+
"Watson",
|
|
1367
|
+
"Webb",
|
|
1368
|
+
"Williams",
|
|
1369
|
+
"Wilson",
|
|
1370
|
+
"Wong",
|
|
1371
|
+
"Wright"
|
|
1372
|
+
];
|
|
1373
|
+
var PATIENT_FIRST_NAMES = [
|
|
1374
|
+
{ name: "Margaret", gender: "female" },
|
|
1375
|
+
{ name: "Robert", gender: "male" },
|
|
1376
|
+
{ name: "Dorothy", gender: "female" },
|
|
1377
|
+
{ name: "William", gender: "male" },
|
|
1378
|
+
{ name: "Helen", gender: "female" },
|
|
1379
|
+
{ name: "Charles", gender: "male" },
|
|
1380
|
+
{ name: "Patricia", gender: "female" },
|
|
1381
|
+
{ name: "Richard", gender: "male" },
|
|
1382
|
+
{ name: "Barbara", gender: "female" },
|
|
1383
|
+
{ name: "James", gender: "male" },
|
|
1384
|
+
{ name: "Linda", gender: "female" },
|
|
1385
|
+
{ name: "George", gender: "male" },
|
|
1386
|
+
{ name: "Mary", gender: "female" },
|
|
1387
|
+
{ name: "Joseph", gender: "male" },
|
|
1388
|
+
{ name: "Elizabeth", gender: "female" },
|
|
1389
|
+
{ name: "Thomas", gender: "male" },
|
|
1390
|
+
{ name: "Susan", gender: "female" },
|
|
1391
|
+
{ name: "Frank", gender: "male" },
|
|
1392
|
+
{ name: "Ruth", gender: "female" },
|
|
1393
|
+
{ name: "Walter", gender: "male" },
|
|
1394
|
+
{ name: "Carol", gender: "female" },
|
|
1395
|
+
{ name: "Donald", gender: "male" },
|
|
1396
|
+
{ name: "Janet", gender: "female" },
|
|
1397
|
+
{ name: "Harold", gender: "male" },
|
|
1398
|
+
{ name: "Joan", gender: "female" },
|
|
1399
|
+
{ name: "Edward", gender: "male" },
|
|
1400
|
+
{ name: "Nancy", gender: "female" },
|
|
1401
|
+
{ name: "Henry", gender: "male" },
|
|
1402
|
+
{ name: "Betty", gender: "female" },
|
|
1403
|
+
{ name: "Arthur", gender: "male" }
|
|
1404
|
+
];
|
|
1405
|
+
var ON_SITE_SCENARIO3 = "on-site-demo";
|
|
1406
|
+
var PATIENT_ANCHOR_DATE = "2026-05-01T00:00:00Z";
|
|
1407
|
+
var padIndex = (n) => n.toString().padStart(3, "0");
|
|
1408
|
+
var deterministicBirthDate = (index) => {
|
|
1409
|
+
const baseYear = 1935;
|
|
1410
|
+
const yearSpan = 30;
|
|
1411
|
+
const year = baseYear + index % yearSpan;
|
|
1412
|
+
const month = index * 7 % 12 + 1;
|
|
1413
|
+
const day = index * 11 % 28 + 1;
|
|
1414
|
+
const mm = month.toString().padStart(2, "0");
|
|
1415
|
+
const dd = day.toString().padStart(2, "0");
|
|
1416
|
+
return `${year}-${mm}-${dd}`;
|
|
1417
|
+
};
|
|
1418
|
+
var deterministicVerificationDate = (index) => {
|
|
1419
|
+
const dayOffset = index % 30 + 1;
|
|
1420
|
+
const anchor = new Date(PATIENT_ANCHOR_DATE);
|
|
1421
|
+
const verifyAt = new Date(anchor);
|
|
1422
|
+
verifyAt.setUTCDate(verifyAt.getUTCDate() - dayOffset);
|
|
1423
|
+
return verifyAt.toISOString();
|
|
1424
|
+
};
|
|
1425
|
+
var deterministicAdmissionDate = (index) => {
|
|
1426
|
+
const dayOffset = index * 13 % 365 + 1;
|
|
1427
|
+
const anchor = new Date(PATIENT_ANCHOR_DATE);
|
|
1428
|
+
const admitAt = new Date(anchor);
|
|
1429
|
+
admitAt.setUTCDate(admitAt.getUTCDate() - dayOffset);
|
|
1430
|
+
return admitAt.toISOString().slice(0, 10);
|
|
1431
|
+
};
|
|
1432
|
+
var deterministicPhone = (index) => {
|
|
1433
|
+
const last4 = (400 + index).toString().padStart(4, "0");
|
|
1434
|
+
return `+1404555${last4}`;
|
|
1435
|
+
};
|
|
1436
|
+
var deterministicEmail = (firstName, lastName, index) => {
|
|
1437
|
+
const local = `${firstName}.${lastName}.${padIndex(index)}`.toLowerCase().replace(/[^a-z0-9.]/g, "");
|
|
1438
|
+
return `${local}@on-site-demo.example.com`;
|
|
1439
|
+
};
|
|
1440
|
+
var FACILITY_STREET_NAMES = [
|
|
1441
|
+
"Peachtree Street NE",
|
|
1442
|
+
"Ponce de Leon Avenue",
|
|
1443
|
+
"Piedmont Avenue",
|
|
1444
|
+
"Howell Mill Road NW",
|
|
1445
|
+
"Northside Drive NW",
|
|
1446
|
+
"Edgewood Avenue SE",
|
|
1447
|
+
"Spring Street NW",
|
|
1448
|
+
"Clifton Road NE"
|
|
1449
|
+
];
|
|
1450
|
+
var deterministicAddressLine = (index) => {
|
|
1451
|
+
const houseNumber = 100 + index * 7;
|
|
1452
|
+
const streetIndex = index % FACILITY_STREET_NAMES.length;
|
|
1453
|
+
return `${houseNumber} ${FACILITY_STREET_NAMES[streetIndex]}`;
|
|
1454
|
+
};
|
|
1455
|
+
var deterministicPrimaryPayor = (index) => {
|
|
1456
|
+
const bucket = index % 10;
|
|
1457
|
+
if (bucket <= 3) {
|
|
1458
|
+
return PRIMARY_PAYOR_OPTIONS[bucket % 4];
|
|
1459
|
+
}
|
|
1460
|
+
if (bucket <= 6) {
|
|
1461
|
+
return PRIMARY_PAYOR_OPTIONS[4];
|
|
1462
|
+
}
|
|
1463
|
+
return PRIMARY_PAYOR_OPTIONS[5 + (bucket - 7) % 2];
|
|
1464
|
+
};
|
|
1465
|
+
var hasSecondaryCoverage = (index) => {
|
|
1466
|
+
return index % 5 < 2;
|
|
1467
|
+
};
|
|
1468
|
+
var hasQmbStatus = (index) => {
|
|
1469
|
+
return index % 2 === 0;
|
|
1470
|
+
};
|
|
1471
|
+
var isHospicePatient = (index) => {
|
|
1472
|
+
return index % 5 === 0;
|
|
1473
|
+
};
|
|
1474
|
+
var buildIdentifierPair3 = (patientId, roleSuffix) => [
|
|
1475
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO3, roleSuffix),
|
|
1476
|
+
openhiResourceIdentifier({
|
|
1477
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
1478
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
1479
|
+
resourceType: "Patient",
|
|
1480
|
+
id: patientId
|
|
1481
|
+
})
|
|
1482
|
+
];
|
|
1483
|
+
var buildCoverageIdentifierPair = (coverageId, roleSuffix) => [
|
|
1484
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO3, roleSuffix),
|
|
1485
|
+
openhiResourceIdentifier({
|
|
1486
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
1487
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
1488
|
+
resourceType: "Coverage",
|
|
1489
|
+
id: coverageId
|
|
1490
|
+
})
|
|
1491
|
+
];
|
|
1492
|
+
var buildFacilityPatientResource = (spec) => {
|
|
1493
|
+
const firstNameEntry = PATIENT_FIRST_NAMES[spec.index % PATIENT_FIRST_NAMES.length];
|
|
1494
|
+
const lastName = PATIENT_LAST_NAMES[spec.index * 3 % PATIENT_LAST_NAMES.length];
|
|
1495
|
+
const fullText = `${firstNameEntry.name} ${lastName}`;
|
|
1496
|
+
const admissionDate = deterministicAdmissionDate(spec.index);
|
|
1497
|
+
const blockExtension = spec.blockTemplateId ? [
|
|
1498
|
+
{
|
|
1499
|
+
url: PATIENT_ASSIGNED_BLOCK_TEMPLATE_EXTENSION_URL,
|
|
1500
|
+
valueString: spec.blockTemplateId
|
|
1501
|
+
}
|
|
1502
|
+
] : [];
|
|
1503
|
+
const hospiceExtension = isHospicePatient(spec.index) ? [
|
|
1504
|
+
{
|
|
1505
|
+
url: PATIENT_HOSPICE_STATUS_EXTENSION_URL,
|
|
1506
|
+
extension: [
|
|
1507
|
+
{
|
|
1508
|
+
url: HOSPICE_STATUS_VALUE_SUB_EXTENSION_URL,
|
|
1509
|
+
valueCode: "in_hospice"
|
|
1510
|
+
},
|
|
1511
|
+
{
|
|
1512
|
+
url: HOSPICE_EFFECTIVE_DATE_SUB_EXTENSION_URL,
|
|
1513
|
+
valueDate: admissionDate
|
|
1514
|
+
}
|
|
1515
|
+
]
|
|
1516
|
+
}
|
|
1517
|
+
] : [];
|
|
1518
|
+
return {
|
|
1519
|
+
resourceType: "Patient",
|
|
1520
|
+
id: spec.id,
|
|
1521
|
+
active: true,
|
|
1522
|
+
identifier: buildIdentifierPair3(spec.id, `patient-${spec.id}`),
|
|
1523
|
+
name: [
|
|
1524
|
+
{
|
|
1525
|
+
use: "official",
|
|
1526
|
+
text: fullText,
|
|
1527
|
+
given: [firstNameEntry.name],
|
|
1528
|
+
family: lastName
|
|
1529
|
+
}
|
|
1530
|
+
],
|
|
1531
|
+
gender: firstNameEntry.gender,
|
|
1532
|
+
birthDate: deterministicBirthDate(spec.index),
|
|
1533
|
+
telecom: [
|
|
1534
|
+
{
|
|
1535
|
+
system: "phone",
|
|
1536
|
+
value: deterministicPhone(spec.index),
|
|
1537
|
+
use: "home"
|
|
1538
|
+
},
|
|
1539
|
+
{
|
|
1540
|
+
system: "email",
|
|
1541
|
+
value: deterministicEmail(firstNameEntry.name, lastName, spec.index),
|
|
1542
|
+
use: "home"
|
|
1543
|
+
}
|
|
1544
|
+
],
|
|
1545
|
+
address: [
|
|
1546
|
+
{
|
|
1547
|
+
use: "home",
|
|
1548
|
+
line: [deterministicAddressLine(spec.index)],
|
|
1549
|
+
city: "Atlanta",
|
|
1550
|
+
state: "GA",
|
|
1551
|
+
postalCode: "30303",
|
|
1552
|
+
country: "US"
|
|
1553
|
+
}
|
|
1554
|
+
],
|
|
1555
|
+
extension: [
|
|
1556
|
+
{
|
|
1557
|
+
url: PATIENT_DEFAULT_CARE_SETTING_EXTENSION_URL,
|
|
1558
|
+
valueCode: "facility"
|
|
1559
|
+
},
|
|
1560
|
+
{
|
|
1561
|
+
url: PATIENT_DEFAULT_CARE_LOCATION_EXTENSION_URL,
|
|
1562
|
+
valueReference: { reference: `Location/${spec.facilityId}` }
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
url: PATIENT_RESIDENCY_ADMISSION_DATE_EXTENSION_URL,
|
|
1566
|
+
valueDate: admissionDate
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
url: PATIENT_RESIDENCY_ROOM_EXTENSION_URL,
|
|
1570
|
+
// Pad to 3 digits so room numbers look like 100..600.
|
|
1571
|
+
valueString: `${100 + spec.index % 500}`
|
|
1572
|
+
},
|
|
1573
|
+
...blockExtension,
|
|
1574
|
+
...hospiceExtension
|
|
1575
|
+
]
|
|
1576
|
+
};
|
|
1577
|
+
};
|
|
1578
|
+
var buildPrimaryCoverageResource = (spec) => {
|
|
1579
|
+
const id = `${spec.id}-coverage-primary`;
|
|
1580
|
+
const payor = deterministicPrimaryPayor(spec.index);
|
|
1581
|
+
const verificationDate = deterministicVerificationDate(spec.index);
|
|
1582
|
+
const isMedicarePrimary = payor.type === PAYOR_TYPE_MEDICARE;
|
|
1583
|
+
const qmbExtension = isMedicarePrimary && hasQmbStatus(spec.index) ? [
|
|
1584
|
+
{
|
|
1585
|
+
url: COVERAGE_QMB_STATUS_EXTENSION_URL,
|
|
1586
|
+
extension: [
|
|
1587
|
+
{
|
|
1588
|
+
url: QMB_STATUS_VALUE_SUB_EXTENSION_URL,
|
|
1589
|
+
valueCode: "active"
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
url: QMB_EFFECTIVE_DATE_SUB_EXTENSION_URL,
|
|
1593
|
+
valueDate: deterministicAdmissionDate(spec.index)
|
|
1594
|
+
}
|
|
1595
|
+
]
|
|
1596
|
+
}
|
|
1597
|
+
] : [];
|
|
1598
|
+
return {
|
|
1599
|
+
resourceType: "Coverage",
|
|
1600
|
+
id,
|
|
1601
|
+
status: "active",
|
|
1602
|
+
identifier: buildCoverageIdentifierPair(id, `coverage-primary-${spec.id}`),
|
|
1603
|
+
beneficiary: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
1604
|
+
subscriber: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
1605
|
+
subscriberId: `MBR-${padIndex(spec.index)}-PRI`,
|
|
1606
|
+
relationship: { text: "self" },
|
|
1607
|
+
payor: [
|
|
1608
|
+
{
|
|
1609
|
+
display: payor.display
|
|
1610
|
+
}
|
|
1611
|
+
],
|
|
1612
|
+
type: {
|
|
1613
|
+
coding: [
|
|
1614
|
+
{
|
|
1615
|
+
system: COVERAGE_PAYOR_TYPE_SYSTEM,
|
|
1616
|
+
code: payor.type,
|
|
1617
|
+
display: payor.display
|
|
1618
|
+
}
|
|
1619
|
+
],
|
|
1620
|
+
text: payor.display
|
|
1621
|
+
},
|
|
1622
|
+
order: 1,
|
|
1623
|
+
extension: [
|
|
1624
|
+
{
|
|
1625
|
+
url: COVERAGE_VERIFICATION_DATE_EXTENSION_URL,
|
|
1626
|
+
valueDateTime: verificationDate
|
|
1627
|
+
},
|
|
1628
|
+
...qmbExtension
|
|
1629
|
+
]
|
|
1630
|
+
};
|
|
1631
|
+
};
|
|
1632
|
+
var buildSecondaryCoverageResource = (spec) => {
|
|
1633
|
+
if (!hasSecondaryCoverage(spec.index)) {
|
|
1634
|
+
return void 0;
|
|
1635
|
+
}
|
|
1636
|
+
const id = `${spec.id}-coverage-secondary`;
|
|
1637
|
+
const payor = SECONDARY_PAYOR_OPTIONS[spec.index % SECONDARY_PAYOR_OPTIONS.length];
|
|
1638
|
+
const verificationDate = deterministicVerificationDate(spec.index);
|
|
1639
|
+
return {
|
|
1640
|
+
resourceType: "Coverage",
|
|
1641
|
+
id,
|
|
1642
|
+
status: "active",
|
|
1643
|
+
identifier: buildCoverageIdentifierPair(
|
|
1644
|
+
id,
|
|
1645
|
+
`coverage-secondary-${spec.id}`
|
|
1646
|
+
),
|
|
1647
|
+
beneficiary: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
1648
|
+
subscriber: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
1649
|
+
subscriberId: `MBR-${padIndex(spec.index)}-SEC`,
|
|
1650
|
+
relationship: { text: "self" },
|
|
1651
|
+
payor: [
|
|
1652
|
+
{
|
|
1653
|
+
display: payor.display
|
|
1654
|
+
}
|
|
1655
|
+
],
|
|
1656
|
+
type: {
|
|
1657
|
+
text: payor.display
|
|
1658
|
+
},
|
|
1659
|
+
order: 2,
|
|
1660
|
+
extension: [
|
|
1661
|
+
{
|
|
1662
|
+
url: COVERAGE_VERIFICATION_DATE_EXTENSION_URL,
|
|
1663
|
+
valueDateTime: verificationDate
|
|
1664
|
+
}
|
|
1665
|
+
]
|
|
1666
|
+
};
|
|
1667
|
+
};
|
|
1668
|
+
var buildAllFacilityPatientSpecs = () => {
|
|
1669
|
+
validateBlockReferences();
|
|
1670
|
+
const specs = [];
|
|
1671
|
+
let nextIndex = 0;
|
|
1672
|
+
for (const { blockTemplateId, count } of PATIENTS_PER_BLOCK) {
|
|
1673
|
+
const template = findOnSiteDemoBlockTemplate(blockTemplateId);
|
|
1674
|
+
if (!template) {
|
|
1675
|
+
throw new Error(
|
|
1676
|
+
`Block template "${blockTemplateId}" not found while seeding facility patients.`
|
|
1677
|
+
);
|
|
1678
|
+
}
|
|
1679
|
+
for (let i = 0; i < count; i += 1) {
|
|
1680
|
+
const index = nextIndex;
|
|
1681
|
+
specs.push({
|
|
1682
|
+
id: `on-site-demo-facility-patient-${padIndex(index + 1)}`,
|
|
1683
|
+
index,
|
|
1684
|
+
facilityId: template.facilityId,
|
|
1685
|
+
blockTemplateId
|
|
1686
|
+
});
|
|
1687
|
+
nextIndex += 1;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
for (const facilityId of ON_SITE_DEMO_FACILITY_IDS) {
|
|
1691
|
+
for (let i = 0; i < INTAKE_ONLY_PATIENTS_PER_FACILITY; i += 1) {
|
|
1692
|
+
const index = nextIndex;
|
|
1693
|
+
specs.push({
|
|
1694
|
+
id: `on-site-demo-facility-patient-${padIndex(index + 1)}`,
|
|
1695
|
+
index,
|
|
1696
|
+
facilityId,
|
|
1697
|
+
blockTemplateId: void 0
|
|
1698
|
+
});
|
|
1699
|
+
nextIndex += 1;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
return specs;
|
|
1703
|
+
};
|
|
1704
|
+
var validateBlockReferences = () => {
|
|
1705
|
+
const blockSet = new Set(ON_SITE_DEMO_BLOCK_TEMPLATE_IDS);
|
|
1706
|
+
for (const entry of PATIENTS_PER_BLOCK) {
|
|
1707
|
+
if (!blockSet.has(entry.blockTemplateId)) {
|
|
1708
|
+
throw new Error(
|
|
1709
|
+
`Facility-patient generator references unknown block template id "${entry.blockTemplateId}".`
|
|
1710
|
+
);
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
var cachedSpecs;
|
|
1715
|
+
var getFacilityPatientSpecs = () => {
|
|
1716
|
+
if (!cachedSpecs) {
|
|
1717
|
+
cachedSpecs = buildAllFacilityPatientSpecs();
|
|
1718
|
+
}
|
|
1719
|
+
return cachedSpecs;
|
|
1720
|
+
};
|
|
1721
|
+
var buildOnSiteDemoFacilityPatients = () => getFacilityPatientSpecs().map(buildFacilityPatientResource);
|
|
1722
|
+
var buildOnSiteDemoFacilityCoverages = () => {
|
|
1723
|
+
const out = [];
|
|
1724
|
+
for (const spec of getFacilityPatientSpecs()) {
|
|
1725
|
+
out.push(buildPrimaryCoverageResource(spec));
|
|
1726
|
+
const secondary = buildSecondaryCoverageResource(spec);
|
|
1727
|
+
if (secondary) {
|
|
1728
|
+
out.push(secondary);
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
return out;
|
|
1732
|
+
};
|
|
1733
|
+
var onSiteDemoScheduledFacilityPatientIds = () => getFacilityPatientSpecs().filter((s) => s.blockTemplateId !== void 0).map((s) => s.id);
|
|
1734
|
+
var facilityPatientsForBlock = (blockTemplateId) => getFacilityPatientSpecs().filter((s) => s.blockTemplateId === blockTemplateId).map((s) => s.id);
|
|
1735
|
+
|
|
1736
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-home-health-patients.ts
|
|
1737
|
+
var PATIENT_ASSIGNED_HOME_HEALTH_PROVIDER_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-assigned-home-health-provider";
|
|
1738
|
+
var HOME_HEALTH_VISIT_CADENCE_DAYS_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/home-health-visit-cadence-days";
|
|
1739
|
+
var HOME_HEALTH_VISIT_CADENCE_OPTIONS = [
|
|
1740
|
+
7,
|
|
1741
|
+
14,
|
|
1742
|
+
28
|
|
1743
|
+
];
|
|
1744
|
+
var SCHEDULED_HOME_HEALTH_PATIENTS = 17;
|
|
1745
|
+
var INTAKE_ONLY_HOME_HEALTH_PATIENTS = 3;
|
|
1746
|
+
var TOTAL_HOME_HEALTH_PATIENTS = SCHEDULED_HOME_HEALTH_PATIENTS + INTAKE_ONLY_HOME_HEALTH_PATIENTS;
|
|
1747
|
+
var PRIMARY_PAYOR_OPTIONS2 = [
|
|
1748
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Aetna PPO" },
|
|
1749
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Blue Cross Blue Shield of Georgia" },
|
|
1750
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "UnitedHealthcare Choice Plus" },
|
|
1751
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Cigna OAP" },
|
|
1752
|
+
{ type: PAYOR_TYPE_MEDICARE, display: "Medicare Part B" },
|
|
1753
|
+
{ type: PAYOR_TYPE_MEDICARE_ADVANTAGE, display: "Humana Medicare Advantage" },
|
|
1754
|
+
{
|
|
1755
|
+
type: PAYOR_TYPE_MEDICARE_ADVANTAGE,
|
|
1756
|
+
display: "Wellcare by Allwell HMO"
|
|
1757
|
+
}
|
|
1758
|
+
];
|
|
1759
|
+
var SECONDARY_PAYOR_OPTIONS2 = [
|
|
1760
|
+
{ display: "AARP Medigap Plan G" },
|
|
1761
|
+
{ display: "Mutual of Omaha Medicare Supplement" },
|
|
1762
|
+
{ display: "Cigna Supplemental Health" },
|
|
1763
|
+
{ display: "AFLAC Supplemental" }
|
|
1764
|
+
];
|
|
1765
|
+
var PATIENT_LAST_NAMES2 = [
|
|
1766
|
+
"Acosta",
|
|
1767
|
+
"Barnett",
|
|
1768
|
+
"Bryant",
|
|
1769
|
+
"Castillo",
|
|
1770
|
+
"Conway",
|
|
1771
|
+
"Delgado",
|
|
1772
|
+
"Eldridge",
|
|
1773
|
+
"Fitzgerald",
|
|
1774
|
+
"Garza",
|
|
1775
|
+
"Hicks",
|
|
1776
|
+
"Ingram",
|
|
1777
|
+
"Jensen",
|
|
1778
|
+
"Klein",
|
|
1779
|
+
"Larson",
|
|
1780
|
+
"McCarthy",
|
|
1781
|
+
"Nash",
|
|
1782
|
+
"O'Connor",
|
|
1783
|
+
"Pierce",
|
|
1784
|
+
"Quintana",
|
|
1785
|
+
"Reilly",
|
|
1786
|
+
"Salazar",
|
|
1787
|
+
"Tate",
|
|
1788
|
+
"Underwood",
|
|
1789
|
+
"Vega",
|
|
1790
|
+
"Whitaker"
|
|
1791
|
+
];
|
|
1792
|
+
var PATIENT_FIRST_NAMES2 = [
|
|
1793
|
+
{ name: "Eleanor", gender: "female" },
|
|
1794
|
+
{ name: "Albert", gender: "male" },
|
|
1795
|
+
{ name: "Florence", gender: "female" },
|
|
1796
|
+
{ name: "Bernard", gender: "male" },
|
|
1797
|
+
{ name: "Marjorie", gender: "female" },
|
|
1798
|
+
{ name: "Stanley", gender: "male" },
|
|
1799
|
+
{ name: "Gladys", gender: "female" },
|
|
1800
|
+
{ name: "Norman", gender: "male" },
|
|
1801
|
+
{ name: "Pauline", gender: "female" },
|
|
1802
|
+
{ name: "Raymond", gender: "male" },
|
|
1803
|
+
{ name: "Lillian", gender: "female" },
|
|
1804
|
+
{ name: "Howard", gender: "male" },
|
|
1805
|
+
{ name: "Mildred", gender: "female" },
|
|
1806
|
+
{ name: "Russell", gender: "male" },
|
|
1807
|
+
{ name: "Frances", gender: "female" },
|
|
1808
|
+
{ name: "Eugene", gender: "male" },
|
|
1809
|
+
{ name: "Bernice", gender: "female" },
|
|
1810
|
+
{ name: "Leonard", gender: "male" },
|
|
1811
|
+
{ name: "Eileen", gender: "female" },
|
|
1812
|
+
{ name: "Clifford", gender: "male" }
|
|
1813
|
+
];
|
|
1814
|
+
var ON_SITE_SCENARIO4 = "on-site-demo";
|
|
1815
|
+
var PATIENT_ANCHOR_DATE2 = "2026-05-01T00:00:00Z";
|
|
1816
|
+
var padIndex2 = (n) => n.toString().padStart(3, "0");
|
|
1817
|
+
var deterministicBirthDate2 = (index) => {
|
|
1818
|
+
const baseYear = 1932;
|
|
1819
|
+
const yearSpan = 25;
|
|
1820
|
+
const year = baseYear + index % yearSpan;
|
|
1821
|
+
const month = index * 7 % 12 + 1;
|
|
1822
|
+
const day = index * 11 % 28 + 1;
|
|
1823
|
+
const mm = month.toString().padStart(2, "0");
|
|
1824
|
+
const dd = day.toString().padStart(2, "0");
|
|
1825
|
+
return `${year}-${mm}-${dd}`;
|
|
1826
|
+
};
|
|
1827
|
+
var deterministicVerificationDate2 = (index) => {
|
|
1828
|
+
const dayOffset = index % 30 + 1;
|
|
1829
|
+
const anchor = new Date(PATIENT_ANCHOR_DATE2);
|
|
1830
|
+
const verifyAt = new Date(anchor);
|
|
1831
|
+
verifyAt.setUTCDate(verifyAt.getUTCDate() - dayOffset);
|
|
1832
|
+
return verifyAt.toISOString();
|
|
1833
|
+
};
|
|
1834
|
+
var deterministicEffectiveDate = (index) => {
|
|
1835
|
+
const dayOffset = index * 13 % 365 + 1;
|
|
1836
|
+
const anchor = new Date(PATIENT_ANCHOR_DATE2);
|
|
1837
|
+
const eff = new Date(anchor);
|
|
1838
|
+
eff.setUTCDate(eff.getUTCDate() - dayOffset);
|
|
1839
|
+
return eff.toISOString().slice(0, 10);
|
|
1840
|
+
};
|
|
1841
|
+
var deterministicPhone2 = (index) => {
|
|
1842
|
+
const last4 = (600 + index).toString().padStart(4, "0");
|
|
1843
|
+
return `+1404555${last4}`;
|
|
1844
|
+
};
|
|
1845
|
+
var deterministicEmail2 = (firstName, lastName, index) => {
|
|
1846
|
+
const local = `${firstName}.${lastName}.${padIndex2(index)}`.toLowerCase().replace(/[^a-z0-9.]/g, "");
|
|
1847
|
+
return `${local}@on-site-demo.example.com`;
|
|
1848
|
+
};
|
|
1849
|
+
var HOME_STREET_NAMES = [
|
|
1850
|
+
"Briarcliff Road NE",
|
|
1851
|
+
"Cheshire Bridge Road",
|
|
1852
|
+
"Dekalb Avenue NE",
|
|
1853
|
+
"Lavista Road",
|
|
1854
|
+
"Memorial Drive SE",
|
|
1855
|
+
"Moreland Avenue NE",
|
|
1856
|
+
"North Decatur Road",
|
|
1857
|
+
"Roswell Road",
|
|
1858
|
+
"Virginia Avenue NE",
|
|
1859
|
+
"West Paces Ferry Road"
|
|
1860
|
+
];
|
|
1861
|
+
var deterministicAddressLine2 = (index) => {
|
|
1862
|
+
const houseNumber = 200 + index * 11;
|
|
1863
|
+
const streetIndex = index % HOME_STREET_NAMES.length;
|
|
1864
|
+
return `${houseNumber} ${HOME_STREET_NAMES[streetIndex]}`;
|
|
1865
|
+
};
|
|
1866
|
+
var HOME_POSTAL_CODES = [
|
|
1867
|
+
"30306",
|
|
1868
|
+
"30307",
|
|
1869
|
+
"30324",
|
|
1870
|
+
"30329",
|
|
1871
|
+
"30033",
|
|
1872
|
+
"30030",
|
|
1873
|
+
"30342",
|
|
1874
|
+
"30327",
|
|
1875
|
+
"30319",
|
|
1876
|
+
"30305"
|
|
1877
|
+
];
|
|
1878
|
+
var deterministicPostalCode = (index) => HOME_POSTAL_CODES[index % HOME_POSTAL_CODES.length];
|
|
1879
|
+
var deterministicPrimaryPayor2 = (index) => {
|
|
1880
|
+
const bucket = index % 10;
|
|
1881
|
+
if (bucket <= 3) {
|
|
1882
|
+
return PRIMARY_PAYOR_OPTIONS2[bucket % 4];
|
|
1883
|
+
}
|
|
1884
|
+
if (bucket <= 6) {
|
|
1885
|
+
return PRIMARY_PAYOR_OPTIONS2[4];
|
|
1886
|
+
}
|
|
1887
|
+
return PRIMARY_PAYOR_OPTIONS2[5 + (bucket - 7) % 2];
|
|
1888
|
+
};
|
|
1889
|
+
var hasSecondaryCoverage2 = (index) => {
|
|
1890
|
+
return index % 5 < 2;
|
|
1891
|
+
};
|
|
1892
|
+
var hasQmbStatus2 = (index) => {
|
|
1893
|
+
return index % 2 === 0;
|
|
1894
|
+
};
|
|
1895
|
+
var isHospicePatient2 = (index) => {
|
|
1896
|
+
return index % 5 === 0;
|
|
1897
|
+
};
|
|
1898
|
+
var deterministicVisitCadenceDays = (index) => HOME_HEALTH_VISIT_CADENCE_OPTIONS[index % HOME_HEALTH_VISIT_CADENCE_OPTIONS.length];
|
|
1899
|
+
var buildIdentifierPair4 = (patientId, roleSuffix) => [
|
|
1900
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO4, roleSuffix),
|
|
1901
|
+
openhiResourceIdentifier({
|
|
1902
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
1903
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
1904
|
+
resourceType: "Patient",
|
|
1905
|
+
id: patientId
|
|
1906
|
+
})
|
|
1907
|
+
];
|
|
1908
|
+
var buildCoverageIdentifierPair2 = (coverageId, roleSuffix) => [
|
|
1909
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO4, roleSuffix),
|
|
1910
|
+
openhiResourceIdentifier({
|
|
1911
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
1912
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
1913
|
+
resourceType: "Coverage",
|
|
1914
|
+
id: coverageId
|
|
1915
|
+
})
|
|
1916
|
+
];
|
|
1917
|
+
var buildHomeHealthPatientResource = (spec) => {
|
|
1918
|
+
const firstNameEntry = PATIENT_FIRST_NAMES2[spec.index % PATIENT_FIRST_NAMES2.length];
|
|
1919
|
+
const lastName = PATIENT_LAST_NAMES2[spec.index * 3 % PATIENT_LAST_NAMES2.length];
|
|
1920
|
+
const fullText = `${firstNameEntry.name} ${lastName}`;
|
|
1921
|
+
const effectiveDate = deterministicEffectiveDate(spec.index);
|
|
1922
|
+
const providerExtension = spec.providerId ? [
|
|
1923
|
+
{
|
|
1924
|
+
url: PATIENT_ASSIGNED_HOME_HEALTH_PROVIDER_EXTENSION_URL,
|
|
1925
|
+
valueReference: {
|
|
1926
|
+
reference: `Practitioner/${spec.providerId}`,
|
|
1927
|
+
type: "Practitioner"
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
] : [];
|
|
1931
|
+
const cadenceExtension = typeof spec.visitCadenceDays === "number" ? [
|
|
1932
|
+
{
|
|
1933
|
+
url: HOME_HEALTH_VISIT_CADENCE_DAYS_EXTENSION_URL,
|
|
1934
|
+
valueInteger: spec.visitCadenceDays
|
|
1935
|
+
}
|
|
1936
|
+
] : [];
|
|
1937
|
+
const hospiceExtension = isHospicePatient2(spec.index) ? [
|
|
1938
|
+
{
|
|
1939
|
+
url: PATIENT_HOSPICE_STATUS_EXTENSION_URL,
|
|
1940
|
+
extension: [
|
|
1941
|
+
{
|
|
1942
|
+
url: HOSPICE_STATUS_VALUE_SUB_EXTENSION_URL,
|
|
1943
|
+
valueCode: "in_hospice"
|
|
1944
|
+
},
|
|
1945
|
+
{
|
|
1946
|
+
url: HOSPICE_EFFECTIVE_DATE_SUB_EXTENSION_URL,
|
|
1947
|
+
valueDate: effectiveDate
|
|
1948
|
+
}
|
|
1949
|
+
]
|
|
1950
|
+
}
|
|
1951
|
+
] : [];
|
|
1952
|
+
return {
|
|
1953
|
+
resourceType: "Patient",
|
|
1954
|
+
id: spec.id,
|
|
1955
|
+
active: true,
|
|
1956
|
+
identifier: buildIdentifierPair4(spec.id, `patient-${spec.id}`),
|
|
1957
|
+
name: [
|
|
1958
|
+
{
|
|
1959
|
+
use: "official",
|
|
1960
|
+
text: fullText,
|
|
1961
|
+
given: [firstNameEntry.name],
|
|
1962
|
+
family: lastName
|
|
1963
|
+
}
|
|
1964
|
+
],
|
|
1965
|
+
gender: firstNameEntry.gender,
|
|
1966
|
+
birthDate: deterministicBirthDate2(spec.index),
|
|
1967
|
+
telecom: [
|
|
1968
|
+
{
|
|
1969
|
+
system: "phone",
|
|
1970
|
+
value: deterministicPhone2(spec.index),
|
|
1971
|
+
use: "home"
|
|
1972
|
+
},
|
|
1973
|
+
{
|
|
1974
|
+
system: "email",
|
|
1975
|
+
value: deterministicEmail2(firstNameEntry.name, lastName, spec.index),
|
|
1976
|
+
use: "home"
|
|
1977
|
+
}
|
|
1978
|
+
],
|
|
1979
|
+
address: [
|
|
1980
|
+
{
|
|
1981
|
+
use: "home",
|
|
1982
|
+
line: [deterministicAddressLine2(spec.index)],
|
|
1983
|
+
city: "Atlanta",
|
|
1984
|
+
state: "GA",
|
|
1985
|
+
postalCode: deterministicPostalCode(spec.index),
|
|
1986
|
+
country: "US"
|
|
1987
|
+
}
|
|
1988
|
+
],
|
|
1989
|
+
extension: [
|
|
1990
|
+
{
|
|
1991
|
+
url: PATIENT_DEFAULT_CARE_SETTING_EXTENSION_URL,
|
|
1992
|
+
valueCode: "home"
|
|
1993
|
+
},
|
|
1994
|
+
// No `patient-default-care-location` extension — home-health
|
|
1995
|
+
// patients have no facility Location reference (mirrors the
|
|
1996
|
+
// on-site `buildDefaultCareSettingExtensions` helper, which
|
|
1997
|
+
// only emits the location extension when setting === "facility").
|
|
1998
|
+
...providerExtension,
|
|
1999
|
+
...cadenceExtension,
|
|
2000
|
+
...hospiceExtension
|
|
2001
|
+
]
|
|
2002
|
+
};
|
|
2003
|
+
};
|
|
2004
|
+
var buildPrimaryCoverageResource2 = (spec) => {
|
|
2005
|
+
const id = `${spec.id}-coverage-primary`;
|
|
2006
|
+
const payor = deterministicPrimaryPayor2(spec.index);
|
|
2007
|
+
const verificationDate = deterministicVerificationDate2(spec.index);
|
|
2008
|
+
const isMedicarePrimary = payor.type === PAYOR_TYPE_MEDICARE;
|
|
2009
|
+
const qmbExtension = isMedicarePrimary && hasQmbStatus2(spec.index) ? [
|
|
2010
|
+
{
|
|
2011
|
+
url: COVERAGE_QMB_STATUS_EXTENSION_URL,
|
|
2012
|
+
extension: [
|
|
2013
|
+
{
|
|
2014
|
+
url: QMB_STATUS_VALUE_SUB_EXTENSION_URL,
|
|
2015
|
+
valueCode: "active"
|
|
2016
|
+
},
|
|
2017
|
+
{
|
|
2018
|
+
url: QMB_EFFECTIVE_DATE_SUB_EXTENSION_URL,
|
|
2019
|
+
valueDate: deterministicEffectiveDate(spec.index)
|
|
2020
|
+
}
|
|
2021
|
+
]
|
|
2022
|
+
}
|
|
2023
|
+
] : [];
|
|
2024
|
+
return {
|
|
2025
|
+
resourceType: "Coverage",
|
|
2026
|
+
id,
|
|
2027
|
+
status: "active",
|
|
2028
|
+
identifier: buildCoverageIdentifierPair2(id, `coverage-primary-${spec.id}`),
|
|
2029
|
+
beneficiary: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
2030
|
+
subscriber: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
2031
|
+
subscriberId: `MBR-HH-${padIndex2(spec.index)}-PRI`,
|
|
2032
|
+
relationship: { text: "self" },
|
|
2033
|
+
payor: [
|
|
2034
|
+
{
|
|
2035
|
+
display: payor.display
|
|
2036
|
+
}
|
|
2037
|
+
],
|
|
2038
|
+
type: {
|
|
2039
|
+
coding: [
|
|
2040
|
+
{
|
|
2041
|
+
system: COVERAGE_PAYOR_TYPE_SYSTEM,
|
|
2042
|
+
code: payor.type,
|
|
2043
|
+
display: payor.display
|
|
2044
|
+
}
|
|
2045
|
+
],
|
|
2046
|
+
text: payor.display
|
|
2047
|
+
},
|
|
2048
|
+
order: 1,
|
|
2049
|
+
extension: [
|
|
2050
|
+
{
|
|
2051
|
+
url: COVERAGE_VERIFICATION_DATE_EXTENSION_URL,
|
|
2052
|
+
valueDateTime: verificationDate
|
|
2053
|
+
},
|
|
2054
|
+
...qmbExtension
|
|
2055
|
+
]
|
|
2056
|
+
};
|
|
2057
|
+
};
|
|
2058
|
+
var buildSecondaryCoverageResource2 = (spec) => {
|
|
2059
|
+
if (!hasSecondaryCoverage2(spec.index)) {
|
|
2060
|
+
return void 0;
|
|
2061
|
+
}
|
|
2062
|
+
const id = `${spec.id}-coverage-secondary`;
|
|
2063
|
+
const payor = SECONDARY_PAYOR_OPTIONS2[spec.index % SECONDARY_PAYOR_OPTIONS2.length];
|
|
2064
|
+
const verificationDate = deterministicVerificationDate2(spec.index);
|
|
2065
|
+
return {
|
|
2066
|
+
resourceType: "Coverage",
|
|
2067
|
+
id,
|
|
2068
|
+
status: "active",
|
|
2069
|
+
identifier: buildCoverageIdentifierPair2(
|
|
2070
|
+
id,
|
|
2071
|
+
`coverage-secondary-${spec.id}`
|
|
2072
|
+
),
|
|
2073
|
+
beneficiary: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
2074
|
+
subscriber: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
2075
|
+
subscriberId: `MBR-HH-${padIndex2(spec.index)}-SEC`,
|
|
2076
|
+
relationship: { text: "self" },
|
|
2077
|
+
payor: [
|
|
2078
|
+
{
|
|
2079
|
+
display: payor.display
|
|
2080
|
+
}
|
|
2081
|
+
],
|
|
2082
|
+
type: {
|
|
2083
|
+
text: payor.display
|
|
2084
|
+
},
|
|
2085
|
+
order: 2,
|
|
2086
|
+
extension: [
|
|
2087
|
+
{
|
|
2088
|
+
url: COVERAGE_VERIFICATION_DATE_EXTENSION_URL,
|
|
2089
|
+
valueDateTime: verificationDate
|
|
2090
|
+
}
|
|
2091
|
+
]
|
|
2092
|
+
};
|
|
2093
|
+
};
|
|
2094
|
+
var buildAllHomeHealthPatientSpecs = () => {
|
|
2095
|
+
const eligibleDoctors = homeHealthEligibleDoctors();
|
|
2096
|
+
if (eligibleDoctors.length === 0) {
|
|
2097
|
+
throw new Error(
|
|
2098
|
+
"No home-health-eligible doctors found \u2014 cannot seed home-health patients."
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2101
|
+
const specs = [];
|
|
2102
|
+
for (let i = 0; i < SCHEDULED_HOME_HEALTH_PATIENTS; i += 1) {
|
|
2103
|
+
const index = i;
|
|
2104
|
+
const providerId = eligibleDoctors[i % eligibleDoctors.length].id;
|
|
2105
|
+
if (!providerId) {
|
|
2106
|
+
throw new Error(
|
|
2107
|
+
"Home-health-eligible doctor is missing an id; cannot seed."
|
|
2108
|
+
);
|
|
2109
|
+
}
|
|
2110
|
+
specs.push({
|
|
2111
|
+
id: `on-site-demo-home-health-patient-${padIndex2(index + 1)}`,
|
|
2112
|
+
index,
|
|
2113
|
+
providerId,
|
|
2114
|
+
visitCadenceDays: deterministicVisitCadenceDays(index)
|
|
2115
|
+
});
|
|
2116
|
+
}
|
|
2117
|
+
for (let i = 0; i < INTAKE_ONLY_HOME_HEALTH_PATIENTS; i += 1) {
|
|
2118
|
+
const index = SCHEDULED_HOME_HEALTH_PATIENTS + i;
|
|
2119
|
+
specs.push({
|
|
2120
|
+
id: `on-site-demo-home-health-patient-${padIndex2(index + 1)}`,
|
|
2121
|
+
index,
|
|
2122
|
+
providerId: void 0,
|
|
2123
|
+
visitCadenceDays: void 0
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
return specs;
|
|
2127
|
+
};
|
|
2128
|
+
var cachedSpecs2;
|
|
2129
|
+
var getHomeHealthPatientSpecs = () => {
|
|
2130
|
+
if (!cachedSpecs2) {
|
|
2131
|
+
cachedSpecs2 = buildAllHomeHealthPatientSpecs();
|
|
2132
|
+
}
|
|
2133
|
+
return cachedSpecs2;
|
|
2134
|
+
};
|
|
2135
|
+
var buildOnSiteDemoHomeHealthPatients = () => getHomeHealthPatientSpecs().map(buildHomeHealthPatientResource);
|
|
2136
|
+
var buildOnSiteDemoHomeHealthCoverages = () => {
|
|
2137
|
+
const out = [];
|
|
2138
|
+
for (const spec of getHomeHealthPatientSpecs()) {
|
|
2139
|
+
out.push(buildPrimaryCoverageResource2(spec));
|
|
2140
|
+
const secondary = buildSecondaryCoverageResource2(spec);
|
|
2141
|
+
if (secondary) {
|
|
2142
|
+
out.push(secondary);
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
return out;
|
|
2146
|
+
};
|
|
2147
|
+
var onSiteDemoScheduledHomeHealthPatientIds = () => getHomeHealthPatientSpecs().filter((s) => s.providerId !== void 0).map((s) => s.id);
|
|
2148
|
+
var findOnSiteDemoHomeHealthPatientProvider = (patientId) => {
|
|
2149
|
+
const spec = getHomeHealthPatientSpecs().find((s) => s.id === patientId);
|
|
2150
|
+
return spec?.providerId;
|
|
2151
|
+
};
|
|
2152
|
+
var findOnSiteDemoHomeHealthPatientVisitCadenceDays = (patientId) => {
|
|
2153
|
+
const spec = getHomeHealthPatientSpecs().find((s) => s.id === patientId);
|
|
2154
|
+
return spec?.visitCadenceDays;
|
|
2155
|
+
};
|
|
2156
|
+
|
|
2157
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-encounters.ts
|
|
2158
|
+
var ENCOUNTER_CLASS_SYSTEM = "http://terminology.hl7.org/CodeSystem/v3-ActCode";
|
|
2159
|
+
var ENCOUNTER_CLASS_FACILITY = {
|
|
2160
|
+
system: ENCOUNTER_CLASS_SYSTEM,
|
|
2161
|
+
code: "IMP",
|
|
2162
|
+
display: "Facility"
|
|
2163
|
+
};
|
|
2164
|
+
var ENCOUNTER_CLASS_HOME_HEALTH = {
|
|
2165
|
+
system: ENCOUNTER_CLASS_SYSTEM,
|
|
2166
|
+
code: "HH",
|
|
2167
|
+
display: "Home Health"
|
|
2168
|
+
};
|
|
2169
|
+
var LOINC_SYSTEM = "http://loinc.org";
|
|
2170
|
+
var SNOMED_SYSTEM = "http://snomed.info/sct";
|
|
2171
|
+
var CPT_SYSTEM = "http://www.ama-assn.org/go/cpt";
|
|
2172
|
+
var WOUND_EXAM_PANEL_CODE = "39135-9";
|
|
2173
|
+
var WOUND_EXAM_PANEL_DISPLAY = "Wound assessment panel";
|
|
2174
|
+
var WOUND_LENGTH_CODE = "39126-8";
|
|
2175
|
+
var WOUND_WIDTH_CODE = "39125-0";
|
|
2176
|
+
var WOUND_DEPTH_CODE = "39127-6";
|
|
2177
|
+
var WOUND_STATUS_CODE = "72311-4";
|
|
2178
|
+
var CONDITION_CLINICAL_STATUS_SYSTEM = "http://terminology.hl7.org/CodeSystem/condition-clinical";
|
|
2179
|
+
var HOME_HEALTH_VISITS_PAST = 4;
|
|
2180
|
+
var WOUND_BEARING_PATIENT_THRESHOLD = 70;
|
|
2181
|
+
var WOUND_PROCEDURE_PATIENT_THRESHOLD = 25;
|
|
2182
|
+
var WOUND_TYPE_OPTIONS = [
|
|
2183
|
+
{ code: "421076008", display: "Pressure ulcer" },
|
|
2184
|
+
{ code: "402863003", display: "Venous stasis ulcer" },
|
|
2185
|
+
{ code: "371087003", display: "Diabetic foot ulcer" },
|
|
2186
|
+
{ code: "262528002", display: "Arterial ulcer of lower extremity" },
|
|
2187
|
+
{ code: "283682007", display: "Traumatic wound of lower extremity" }
|
|
2188
|
+
];
|
|
2189
|
+
var WOUND_BODY_SITE_OPTIONS = [
|
|
2190
|
+
{ code: "118473006", display: "Left lower limb" },
|
|
2191
|
+
{ code: "32153003", display: "Left foot" },
|
|
2192
|
+
{ code: "239043009", display: "Left heel" },
|
|
2193
|
+
{ code: "61685007", display: "Lower limb" },
|
|
2194
|
+
{ code: "118474000", display: "Right lower limb" },
|
|
2195
|
+
{ code: "78791008", display: "Right foot" },
|
|
2196
|
+
{ code: "239044003", display: "Right heel" }
|
|
2197
|
+
];
|
|
2198
|
+
var WOUND_DEBRIDEMENT_PRESETS = [
|
|
2199
|
+
{ id: "sharp-debridement", display: "Sharp Debridement", cptCode: "97597" },
|
|
2200
|
+
{
|
|
2201
|
+
id: "enzymatic-debridement",
|
|
2202
|
+
display: "Enzymatic Debridement",
|
|
2203
|
+
cptCode: "97602"
|
|
2204
|
+
},
|
|
2205
|
+
{ id: "wound-irrigation", display: "Wound Irrigation", cptCode: "97605" },
|
|
2206
|
+
{
|
|
2207
|
+
id: "skin-substitute",
|
|
2208
|
+
display: "Skin Substitute Application",
|
|
2209
|
+
cptCode: "15271"
|
|
2210
|
+
}
|
|
2211
|
+
];
|
|
2212
|
+
var ON_SITE_SCENARIO5 = "on-site-demo";
|
|
2213
|
+
var padIndex3 = (n) => n.toString().padStart(3, "0");
|
|
2214
|
+
var hashString = (input) => {
|
|
2215
|
+
let h = 0;
|
|
2216
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
2217
|
+
h = h * 31 + input.charCodeAt(i) | 0;
|
|
2218
|
+
}
|
|
2219
|
+
return Math.abs(h);
|
|
2220
|
+
};
|
|
2221
|
+
var isWoundBearingPatient = (patientId) => hashString(`${patientId}:wound-bearing`) % 100 < WOUND_BEARING_PATIENT_THRESHOLD;
|
|
2222
|
+
var getsWoundProcedure = (patientId) => hashString(`${patientId}:procedure`) % 100 < WOUND_PROCEDURE_PATIENT_THRESHOLD;
|
|
2223
|
+
var getWoundTrajectory = (patientId) => hashString(`${patientId}:trajectory`) % 5 < 3 ? "healing" : "worsening";
|
|
2224
|
+
var getWoundType = (patientId) => WOUND_TYPE_OPTIONS[hashString(`${patientId}:type`) % WOUND_TYPE_OPTIONS.length];
|
|
2225
|
+
var getWoundBodySite = (patientId) => WOUND_BODY_SITE_OPTIONS[hashString(`${patientId}:bodysite`) % WOUND_BODY_SITE_OPTIONS.length];
|
|
2226
|
+
var getWoundProcedurePreset = (patientId) => WOUND_DEBRIDEMENT_PRESETS[hashString(`${patientId}:cpt`) % WOUND_DEBRIDEMENT_PRESETS.length];
|
|
2227
|
+
var woundConditionIdForPatient = (patientId) => `${patientId}-wound-001`;
|
|
2228
|
+
var buildIdentifierPair5 = (resourceType, resourceId, roleSuffix) => [
|
|
2229
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO5, roleSuffix),
|
|
2230
|
+
openhiResourceIdentifier({
|
|
2231
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
2232
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
2233
|
+
resourceType,
|
|
2234
|
+
id: resourceId
|
|
2235
|
+
})
|
|
2236
|
+
];
|
|
2237
|
+
var mondayOfIsoWeekUtc2 = (referenceIso) => {
|
|
2238
|
+
const ref = new Date(referenceIso);
|
|
2239
|
+
if (Number.isNaN(ref.getTime())) {
|
|
2240
|
+
throw new Error(
|
|
2241
|
+
`mondayOfIsoWeekUtc: invalid reference date "${referenceIso}".`
|
|
2242
|
+
);
|
|
2243
|
+
}
|
|
2244
|
+
const utcDay = ref.getUTCDay() === 0 ? 7 : ref.getUTCDay();
|
|
2245
|
+
const monday = new Date(
|
|
2246
|
+
Date.UTC(ref.getUTCFullYear(), ref.getUTCMonth(), ref.getUTCDate())
|
|
2247
|
+
);
|
|
2248
|
+
monday.setUTCDate(monday.getUTCDate() - (utcDay - 1));
|
|
2249
|
+
return monday;
|
|
2250
|
+
};
|
|
2251
|
+
var toIsoZ2 = (d) => d.toISOString();
|
|
2252
|
+
var buildFacilityEncounterSpecs = (referenceIso) => {
|
|
2253
|
+
const anchorMonday = mondayOfIsoWeekUtc2(referenceIso);
|
|
2254
|
+
const out = [];
|
|
2255
|
+
for (const patientId of onSiteDemoScheduledFacilityPatientIds()) {
|
|
2256
|
+
const block = findBlockForPatient(patientId);
|
|
2257
|
+
if (!block) {
|
|
2258
|
+
continue;
|
|
2259
|
+
}
|
|
2260
|
+
const total = BLOCK_OCCURRENCE_WEEKS_PAST;
|
|
2261
|
+
for (let i = 0; i < total; i += 1) {
|
|
2262
|
+
const weekOffset = -(BLOCK_OCCURRENCE_WEEKS_PAST - i);
|
|
2263
|
+
const occurrenceDay = new Date(anchorMonday);
|
|
2264
|
+
occurrenceDay.setUTCDate(
|
|
2265
|
+
occurrenceDay.getUTCDate() + weekOffset * 7 + (block.dayOfWeek - 1)
|
|
2266
|
+
);
|
|
2267
|
+
const start = new Date(occurrenceDay);
|
|
2268
|
+
start.setUTCHours(14, 0, 0, 0);
|
|
2269
|
+
const end = new Date(occurrenceDay);
|
|
2270
|
+
end.setUTCHours(18, 0, 0, 0);
|
|
2271
|
+
const sign = "m";
|
|
2272
|
+
const magnitude = Math.abs(weekOffset).toString().padStart(2, "0");
|
|
2273
|
+
const appointmentId = `${block.id}-w${sign}${magnitude}`;
|
|
2274
|
+
out.push({
|
|
2275
|
+
id: `${patientId}-encounter-${padIndex3(i + 1)}`,
|
|
2276
|
+
patientId,
|
|
2277
|
+
sequence: i + 1,
|
|
2278
|
+
totalEncounters: total,
|
|
2279
|
+
periodStart: toIsoZ2(start),
|
|
2280
|
+
periodEnd: toIsoZ2(end),
|
|
2281
|
+
doctorId: block.doctorId,
|
|
2282
|
+
scribeId: block.scribeId,
|
|
2283
|
+
classCoding: ENCOUNTER_CLASS_FACILITY,
|
|
2284
|
+
facilityId: block.facilityId,
|
|
2285
|
+
appointmentId
|
|
2286
|
+
});
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
return out;
|
|
2290
|
+
};
|
|
2291
|
+
var patientToBlockCache;
|
|
2292
|
+
var findBlockForPatient = (patientId) => {
|
|
2293
|
+
if (!patientToBlockCache) {
|
|
2294
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2295
|
+
const scheduledIds = new Set(onSiteDemoScheduledFacilityPatientIds());
|
|
2296
|
+
const blockIds = [
|
|
2297
|
+
"on-site-demo-block-001",
|
|
2298
|
+
"on-site-demo-block-002",
|
|
2299
|
+
"on-site-demo-block-003",
|
|
2300
|
+
"on-site-demo-block-004"
|
|
2301
|
+
];
|
|
2302
|
+
for (const blockId of blockIds) {
|
|
2303
|
+
const block = findOnSiteDemoBlockTemplate(blockId);
|
|
2304
|
+
if (!block) {
|
|
2305
|
+
continue;
|
|
2306
|
+
}
|
|
2307
|
+
for (const pid of facilityPatientsForBlock(blockId)) {
|
|
2308
|
+
if (scheduledIds.has(pid)) {
|
|
2309
|
+
cache.set(pid, block);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
patientToBlockCache = cache;
|
|
2314
|
+
}
|
|
2315
|
+
return patientToBlockCache.get(patientId);
|
|
2316
|
+
};
|
|
2317
|
+
var buildHomeHealthEncounterSpecs = (referenceIso) => {
|
|
2318
|
+
const reference = new Date(referenceIso);
|
|
2319
|
+
if (Number.isNaN(reference.getTime())) {
|
|
2320
|
+
throw new Error(
|
|
2321
|
+
`buildHomeHealthEncounterSpecs: invalid reference date "${referenceIso}".`
|
|
2322
|
+
);
|
|
2323
|
+
}
|
|
2324
|
+
const out = [];
|
|
2325
|
+
for (const patientId of onSiteDemoScheduledHomeHealthPatientIds()) {
|
|
2326
|
+
const providerId = findOnSiteDemoHomeHealthPatientProvider(patientId);
|
|
2327
|
+
const cadenceDays = findOnSiteDemoHomeHealthPatientVisitCadenceDays(patientId);
|
|
2328
|
+
if (!providerId || typeof cadenceDays !== "number") {
|
|
2329
|
+
continue;
|
|
2330
|
+
}
|
|
2331
|
+
const total = HOME_HEALTH_VISITS_PAST;
|
|
2332
|
+
for (let i = 0; i < total; i += 1) {
|
|
2333
|
+
const visitsBack = total - i;
|
|
2334
|
+
const visitDay = new Date(reference);
|
|
2335
|
+
visitDay.setUTCDate(visitDay.getUTCDate() - visitsBack * cadenceDays);
|
|
2336
|
+
const start = new Date(visitDay);
|
|
2337
|
+
start.setUTCHours(14, 0, 0, 0);
|
|
2338
|
+
const end = new Date(visitDay);
|
|
2339
|
+
end.setUTCHours(15, 0, 0, 0);
|
|
2340
|
+
out.push({
|
|
2341
|
+
id: `${patientId}-encounter-${padIndex3(i + 1)}`,
|
|
2342
|
+
patientId,
|
|
2343
|
+
sequence: i + 1,
|
|
2344
|
+
totalEncounters: total,
|
|
2345
|
+
periodStart: toIsoZ2(start),
|
|
2346
|
+
periodEnd: toIsoZ2(end),
|
|
2347
|
+
doctorId: providerId,
|
|
2348
|
+
scribeId: void 0,
|
|
2349
|
+
classCoding: ENCOUNTER_CLASS_HOME_HEALTH,
|
|
2350
|
+
facilityId: void 0,
|
|
2351
|
+
appointmentId: void 0
|
|
2352
|
+
});
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
return out;
|
|
2356
|
+
};
|
|
2357
|
+
var buildEncounterResource = (spec) => {
|
|
2358
|
+
const participant = [
|
|
2359
|
+
{
|
|
2360
|
+
individual: {
|
|
2361
|
+
reference: `Practitioner/${spec.doctorId}`,
|
|
2362
|
+
type: "Practitioner"
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
];
|
|
2366
|
+
if (spec.scribeId) {
|
|
2367
|
+
participant.push({
|
|
2368
|
+
individual: {
|
|
2369
|
+
reference: `Practitioner/${spec.scribeId}`,
|
|
2370
|
+
type: "Practitioner"
|
|
2371
|
+
}
|
|
2372
|
+
});
|
|
2373
|
+
}
|
|
2374
|
+
const encounter = {
|
|
2375
|
+
resourceType: "Encounter",
|
|
2376
|
+
id: spec.id,
|
|
2377
|
+
identifier: buildIdentifierPair5(
|
|
2378
|
+
"Encounter",
|
|
2379
|
+
spec.id,
|
|
2380
|
+
`encounter-${spec.id}`
|
|
2381
|
+
),
|
|
2382
|
+
status: "finished",
|
|
2383
|
+
class: { ...spec.classCoding },
|
|
2384
|
+
subject: { reference: `Patient/${spec.patientId}`, type: "Patient" },
|
|
2385
|
+
period: { start: spec.periodStart, end: spec.periodEnd },
|
|
2386
|
+
participant
|
|
2387
|
+
};
|
|
2388
|
+
if (spec.facilityId) {
|
|
2389
|
+
encounter.location = [
|
|
2390
|
+
{
|
|
2391
|
+
location: {
|
|
2392
|
+
reference: `Location/${spec.facilityId}`,
|
|
2393
|
+
type: "Location"
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
];
|
|
2397
|
+
}
|
|
2398
|
+
if (spec.appointmentId) {
|
|
2399
|
+
encounter.appointment = [
|
|
2400
|
+
{
|
|
2401
|
+
reference: `Appointment/${spec.appointmentId}`,
|
|
2402
|
+
type: "Appointment"
|
|
2403
|
+
}
|
|
2404
|
+
];
|
|
2405
|
+
}
|
|
2406
|
+
return encounter;
|
|
2407
|
+
};
|
|
2408
|
+
var buildWoundConditionResource = (patientId, firstEncounterStart) => {
|
|
2409
|
+
const woundType = getWoundType(patientId);
|
|
2410
|
+
const bodySite = getWoundBodySite(patientId);
|
|
2411
|
+
const id = woundConditionIdForPatient(patientId);
|
|
2412
|
+
return {
|
|
2413
|
+
resourceType: "Condition",
|
|
2414
|
+
id,
|
|
2415
|
+
identifier: buildIdentifierPair5("Condition", id, `wound-${patientId}`),
|
|
2416
|
+
clinicalStatus: {
|
|
2417
|
+
coding: [
|
|
2418
|
+
{
|
|
2419
|
+
system: CONDITION_CLINICAL_STATUS_SYSTEM,
|
|
2420
|
+
code: "active",
|
|
2421
|
+
display: "Active"
|
|
2422
|
+
}
|
|
2423
|
+
]
|
|
2424
|
+
},
|
|
2425
|
+
category: [{ text: "wound" }],
|
|
2426
|
+
code: {
|
|
2427
|
+
text: woundType.display,
|
|
2428
|
+
coding: [
|
|
2429
|
+
{
|
|
2430
|
+
system: SNOMED_SYSTEM,
|
|
2431
|
+
code: woundType.code,
|
|
2432
|
+
display: woundType.display
|
|
2433
|
+
}
|
|
2434
|
+
]
|
|
2435
|
+
},
|
|
2436
|
+
bodySite: [
|
|
2437
|
+
{
|
|
2438
|
+
coding: [
|
|
2439
|
+
{
|
|
2440
|
+
system: SNOMED_SYSTEM,
|
|
2441
|
+
code: bodySite.code,
|
|
2442
|
+
display: bodySite.display
|
|
2443
|
+
}
|
|
2444
|
+
],
|
|
2445
|
+
text: bodySite.display
|
|
2446
|
+
}
|
|
2447
|
+
],
|
|
2448
|
+
subject: { reference: `Patient/${patientId}`, type: "Patient" },
|
|
2449
|
+
onsetDateTime: firstEncounterStart,
|
|
2450
|
+
recordedDate: firstEncounterStart
|
|
2451
|
+
};
|
|
2452
|
+
};
|
|
2453
|
+
var woundSizeAtSequence = (patientId, sequence, totalEncounters) => {
|
|
2454
|
+
const baseLength = 4 + hashString(`${patientId}:length`) % 4;
|
|
2455
|
+
const baseWidth = 3 + hashString(`${patientId}:width`) % 3;
|
|
2456
|
+
const baseDepthTenths = 3 + hashString(`${patientId}:depth`) % 6;
|
|
2457
|
+
const trajectory = getWoundTrajectory(patientId);
|
|
2458
|
+
const denom = Math.max(1, totalEncounters - 1);
|
|
2459
|
+
const progress = (sequence - 1) / denom;
|
|
2460
|
+
const sign = trajectory === "healing" ? -1 : 1;
|
|
2461
|
+
const shrinkOrGrow = trajectory === "healing" ? 0.4 : 0.3;
|
|
2462
|
+
const length = +(baseLength * (1 + sign * shrinkOrGrow * progress)).toFixed(
|
|
2463
|
+
1
|
|
2464
|
+
);
|
|
2465
|
+
const width = +(baseWidth * (1 + sign * shrinkOrGrow * progress)).toFixed(1);
|
|
2466
|
+
const depth = +(baseDepthTenths / 10 * (1 + sign * shrinkOrGrow * progress)).toFixed(2);
|
|
2467
|
+
const status = trajectory === "healing" && sequence > 1 ? "improving" : trajectory === "worsening" && sequence > 1 ? "declining" : "stagnant";
|
|
2468
|
+
return { length, width, depth, status };
|
|
2469
|
+
};
|
|
2470
|
+
var buildWoundExamObservation = (patientId, encounterId, sequence, totalEncounters, effectiveDateTime) => {
|
|
2471
|
+
const size = woundSizeAtSequence(patientId, sequence, totalEncounters);
|
|
2472
|
+
const woundConditionId = woundConditionIdForPatient(patientId);
|
|
2473
|
+
const id = `${encounterId}-wound-exam`;
|
|
2474
|
+
return {
|
|
2475
|
+
resourceType: "Observation",
|
|
2476
|
+
id,
|
|
2477
|
+
identifier: buildIdentifierPair5(
|
|
2478
|
+
"Observation",
|
|
2479
|
+
id,
|
|
2480
|
+
`wound-exam-${encounterId}`
|
|
2481
|
+
),
|
|
2482
|
+
status: "final",
|
|
2483
|
+
code: {
|
|
2484
|
+
coding: [
|
|
2485
|
+
{
|
|
2486
|
+
system: LOINC_SYSTEM,
|
|
2487
|
+
code: WOUND_EXAM_PANEL_CODE,
|
|
2488
|
+
display: WOUND_EXAM_PANEL_DISPLAY
|
|
2489
|
+
}
|
|
2490
|
+
]
|
|
2491
|
+
},
|
|
2492
|
+
subject: { reference: `Patient/${patientId}`, type: "Patient" },
|
|
2493
|
+
encounter: { reference: `Encounter/${encounterId}`, type: "Encounter" },
|
|
2494
|
+
focus: [
|
|
2495
|
+
{
|
|
2496
|
+
reference: `Condition/${woundConditionId}`,
|
|
2497
|
+
type: "Condition"
|
|
2498
|
+
}
|
|
2499
|
+
],
|
|
2500
|
+
effectiveDateTime,
|
|
2501
|
+
component: [
|
|
2502
|
+
{
|
|
2503
|
+
code: {
|
|
2504
|
+
coding: [
|
|
2505
|
+
{
|
|
2506
|
+
system: LOINC_SYSTEM,
|
|
2507
|
+
code: WOUND_LENGTH_CODE,
|
|
2508
|
+
display: "Length"
|
|
2509
|
+
}
|
|
2510
|
+
]
|
|
2511
|
+
},
|
|
2512
|
+
valueQuantity: { value: size.length, unit: "cm" }
|
|
2513
|
+
},
|
|
2514
|
+
{
|
|
2515
|
+
code: {
|
|
2516
|
+
coding: [
|
|
2517
|
+
{ system: LOINC_SYSTEM, code: WOUND_WIDTH_CODE, display: "Width" }
|
|
2518
|
+
]
|
|
2519
|
+
},
|
|
2520
|
+
valueQuantity: { value: size.width, unit: "cm" }
|
|
2521
|
+
},
|
|
2522
|
+
{
|
|
2523
|
+
code: {
|
|
2524
|
+
coding: [
|
|
2525
|
+
{ system: LOINC_SYSTEM, code: WOUND_DEPTH_CODE, display: "Depth" }
|
|
2526
|
+
]
|
|
2527
|
+
},
|
|
2528
|
+
valueQuantity: { value: size.depth, unit: "cm" }
|
|
2529
|
+
},
|
|
2530
|
+
{
|
|
2531
|
+
code: {
|
|
2532
|
+
coding: [
|
|
2533
|
+
{
|
|
2534
|
+
system: LOINC_SYSTEM,
|
|
2535
|
+
code: WOUND_STATUS_CODE,
|
|
2536
|
+
display: "Status"
|
|
2537
|
+
}
|
|
2538
|
+
]
|
|
2539
|
+
},
|
|
2540
|
+
valueCodeableConcept: {
|
|
2541
|
+
coding: [{ code: size.status, display: size.status }]
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
]
|
|
2545
|
+
};
|
|
2546
|
+
};
|
|
2547
|
+
var buildWoundProcedureResource = (patientId, encounterId, performedDateTime) => {
|
|
2548
|
+
const preset = getWoundProcedurePreset(patientId);
|
|
2549
|
+
const woundConditionId = woundConditionIdForPatient(patientId);
|
|
2550
|
+
const id = `${encounterId}-procedure`;
|
|
2551
|
+
return {
|
|
2552
|
+
resourceType: "Procedure",
|
|
2553
|
+
id,
|
|
2554
|
+
identifier: buildIdentifierPair5(
|
|
2555
|
+
"Procedure",
|
|
2556
|
+
id,
|
|
2557
|
+
`procedure-${encounterId}`
|
|
2558
|
+
),
|
|
2559
|
+
status: "completed",
|
|
2560
|
+
code: {
|
|
2561
|
+
text: preset.display,
|
|
2562
|
+
coding: [
|
|
2563
|
+
{
|
|
2564
|
+
system: CPT_SYSTEM,
|
|
2565
|
+
code: preset.cptCode,
|
|
2566
|
+
display: preset.display
|
|
2567
|
+
}
|
|
2568
|
+
]
|
|
2569
|
+
},
|
|
2570
|
+
subject: { reference: `Patient/${patientId}`, type: "Patient" },
|
|
2571
|
+
encounter: { reference: `Encounter/${encounterId}`, type: "Encounter" },
|
|
2572
|
+
reasonReference: [
|
|
2573
|
+
{
|
|
2574
|
+
reference: `Condition/${woundConditionId}`,
|
|
2575
|
+
type: "Condition"
|
|
2576
|
+
}
|
|
2577
|
+
],
|
|
2578
|
+
performedDateTime
|
|
2579
|
+
};
|
|
2580
|
+
};
|
|
2581
|
+
var encounterSpecsCache = /* @__PURE__ */ new Map();
|
|
2582
|
+
var getAllEncounterSpecs = (referenceIso) => {
|
|
2583
|
+
const cached = encounterSpecsCache.get(referenceIso);
|
|
2584
|
+
if (cached) {
|
|
2585
|
+
return cached;
|
|
2586
|
+
}
|
|
2587
|
+
const all = [
|
|
2588
|
+
...buildFacilityEncounterSpecs(referenceIso),
|
|
2589
|
+
...buildHomeHealthEncounterSpecs(referenceIso)
|
|
2590
|
+
];
|
|
2591
|
+
encounterSpecsCache.set(referenceIso, all);
|
|
2592
|
+
return all;
|
|
2593
|
+
};
|
|
2594
|
+
var buildOnSiteDemoEncounters = (referenceIso) => getAllEncounterSpecs(referenceIso).map(buildEncounterResource);
|
|
2595
|
+
var buildOnSiteDemoWoundConditions = (referenceIso) => {
|
|
2596
|
+
const specs = getAllEncounterSpecs(referenceIso);
|
|
2597
|
+
const firstByPatient = /* @__PURE__ */ new Map();
|
|
2598
|
+
for (const spec of specs) {
|
|
2599
|
+
if (!isWoundBearingPatient(spec.patientId)) {
|
|
2600
|
+
continue;
|
|
2601
|
+
}
|
|
2602
|
+
const existing = firstByPatient.get(spec.patientId);
|
|
2603
|
+
if (!existing || spec.periodStart < existing) {
|
|
2604
|
+
firstByPatient.set(spec.patientId, spec.periodStart);
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
const out = [];
|
|
2608
|
+
for (const [patientId, firstStart] of firstByPatient.entries()) {
|
|
2609
|
+
out.push(buildWoundConditionResource(patientId, firstStart));
|
|
2610
|
+
}
|
|
2611
|
+
return out;
|
|
2612
|
+
};
|
|
2613
|
+
var buildOnSiteDemoWoundObservations = (referenceIso) => {
|
|
2614
|
+
const specs = getAllEncounterSpecs(referenceIso);
|
|
2615
|
+
const out = [];
|
|
2616
|
+
for (const spec of specs) {
|
|
2617
|
+
if (!isWoundBearingPatient(spec.patientId)) {
|
|
2618
|
+
continue;
|
|
2619
|
+
}
|
|
2620
|
+
out.push(
|
|
2621
|
+
buildWoundExamObservation(
|
|
2622
|
+
spec.patientId,
|
|
2623
|
+
spec.id,
|
|
2624
|
+
spec.sequence,
|
|
2625
|
+
spec.totalEncounters,
|
|
2626
|
+
spec.periodStart
|
|
2627
|
+
)
|
|
2628
|
+
);
|
|
2629
|
+
}
|
|
2630
|
+
return out;
|
|
2631
|
+
};
|
|
2632
|
+
var buildOnSiteDemoWoundProcedures = (referenceIso) => {
|
|
2633
|
+
const specs = getAllEncounterSpecs(referenceIso);
|
|
2634
|
+
const lastByPatient = /* @__PURE__ */ new Map();
|
|
2635
|
+
for (const spec of specs) {
|
|
2636
|
+
if (!isWoundBearingPatient(spec.patientId)) {
|
|
2637
|
+
continue;
|
|
2638
|
+
}
|
|
2639
|
+
if (!getsWoundProcedure(spec.patientId)) {
|
|
2640
|
+
continue;
|
|
2641
|
+
}
|
|
2642
|
+
const existing = lastByPatient.get(spec.patientId);
|
|
2643
|
+
if (!existing || spec.sequence > existing.sequence) {
|
|
2644
|
+
lastByPatient.set(spec.patientId, spec);
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
const out = [];
|
|
2648
|
+
for (const spec of lastByPatient.values()) {
|
|
2649
|
+
out.push(
|
|
2650
|
+
buildWoundProcedureResource(spec.patientId, spec.id, spec.periodStart)
|
|
2651
|
+
);
|
|
2652
|
+
}
|
|
2653
|
+
return out;
|
|
2654
|
+
};
|
|
2655
|
+
var onSiteDemoEncounterMetadata = (referenceIso) => {
|
|
2656
|
+
const specs = getAllEncounterSpecs(referenceIso);
|
|
2657
|
+
const lastEncounterByPatient = /* @__PURE__ */ new Map();
|
|
2658
|
+
for (const spec of specs) {
|
|
2659
|
+
const existing = lastEncounterByPatient.get(spec.patientId);
|
|
2660
|
+
if (!existing) {
|
|
2661
|
+
lastEncounterByPatient.set(spec.patientId, spec.id);
|
|
2662
|
+
continue;
|
|
2663
|
+
}
|
|
2664
|
+
if (spec.sequence > specs.find((s) => s.id === existing).sequence) {
|
|
2665
|
+
lastEncounterByPatient.set(spec.patientId, spec.id);
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
const procedurePatients = new Set(onSiteDemoWoundProcedurePatientIds());
|
|
2669
|
+
return specs.map((spec) => ({
|
|
2670
|
+
id: spec.id,
|
|
2671
|
+
patientId: spec.patientId,
|
|
2672
|
+
sequence: spec.sequence,
|
|
2673
|
+
totalEncounters: spec.totalEncounters,
|
|
2674
|
+
periodStart: spec.periodStart,
|
|
2675
|
+
hasWoundProcedure: procedurePatients.has(spec.patientId) && lastEncounterByPatient.get(spec.patientId) === spec.id
|
|
2676
|
+
}));
|
|
2677
|
+
};
|
|
2678
|
+
var onSiteDemoWoundBearingPatientIds = () => {
|
|
2679
|
+
const out = [];
|
|
2680
|
+
for (const id of onSiteDemoScheduledFacilityPatientIds()) {
|
|
2681
|
+
if (isWoundBearingPatient(id)) {
|
|
2682
|
+
out.push(id);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
for (const id of onSiteDemoScheduledHomeHealthPatientIds()) {
|
|
2686
|
+
if (isWoundBearingPatient(id)) {
|
|
2687
|
+
out.push(id);
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
return out;
|
|
2691
|
+
};
|
|
2692
|
+
var onSiteDemoWoundProcedurePatientIds = () => onSiteDemoWoundBearingPatientIds().filter((id) => getsWoundProcedure(id));
|
|
2693
|
+
|
|
2694
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-claims.ts
|
|
2695
|
+
var CLAIM_WORKFLOW_STATUS_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/claim-workflow-status";
|
|
2696
|
+
var CLAIM_WORKFLOW_STATUS_VALUE_SUB_EXTENSION_URL = "status";
|
|
2697
|
+
var CLAIM_WORKFLOW_STATUS_LAST_TRANSITION_SUB_EXTENSION_URL = "lastTransition";
|
|
2698
|
+
var CLAIM_WORKFLOW_STATUS = {
|
|
2699
|
+
SUBMITTED: "submitted",
|
|
2700
|
+
ACCEPTED: "accepted",
|
|
2701
|
+
REJECTED: "rejected",
|
|
2702
|
+
REWORKED: "reworked",
|
|
2703
|
+
RESUBMITTED: "resubmitted"
|
|
2704
|
+
};
|
|
2705
|
+
var PAYMENT_STATUS = {
|
|
2706
|
+
PARTIAL: "partial",
|
|
2707
|
+
FULL: "full",
|
|
2708
|
+
WRITE_OFF: "write-off"
|
|
2709
|
+
};
|
|
2710
|
+
var PAYMENT_STATUS_SYSTEM = "https://on-site-medical.app/fhir/CodeSystem/payment-status";
|
|
2711
|
+
var EM_VISIT_CODES = [
|
|
2712
|
+
{
|
|
2713
|
+
code: "99213",
|
|
2714
|
+
display: "Office visit, established patient, low",
|
|
2715
|
+
amount: 110
|
|
2716
|
+
},
|
|
2717
|
+
{
|
|
2718
|
+
code: "99214",
|
|
2719
|
+
display: "Office visit, established patient, moderate",
|
|
2720
|
+
amount: 165
|
|
2721
|
+
},
|
|
2722
|
+
{
|
|
2723
|
+
code: "99215",
|
|
2724
|
+
display: "Office visit, established patient, high",
|
|
2725
|
+
amount: 220
|
|
2726
|
+
}
|
|
2727
|
+
];
|
|
2728
|
+
var PROCEDURE_CPT_AMOUNTS = {
|
|
2729
|
+
"97597": { display: "Sharp Debridement", amount: 145 },
|
|
2730
|
+
"97602": { display: "Enzymatic Debridement", amount: 95 },
|
|
2731
|
+
"97605": { display: "Wound Irrigation (NPWT)", amount: 175 },
|
|
2732
|
+
"15271": { display: "Skin Substitute Application", amount: 410 }
|
|
2733
|
+
};
|
|
2734
|
+
var ON_SITE_SCENARIO6 = "on-site-demo";
|
|
2735
|
+
var hashString2 = (input) => {
|
|
2736
|
+
let h = 0;
|
|
2737
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
2738
|
+
h = h * 31 + input.charCodeAt(i) | 0;
|
|
2739
|
+
}
|
|
2740
|
+
return Math.abs(h);
|
|
2741
|
+
};
|
|
2742
|
+
var UNBILLED_BUCKET_THRESHOLD = 15;
|
|
2743
|
+
var SUBMITTED_BUCKET_THRESHOLD = 35;
|
|
2744
|
+
var ACCEPTED_BUCKET_THRESHOLD = 80;
|
|
2745
|
+
var REJECTED_BUCKET_THRESHOLD = 90;
|
|
2746
|
+
var REWORKED_BUCKET_THRESHOLD = 100;
|
|
2747
|
+
var isEncounterUnbilled = (encounterId) => hashString2(`${encounterId}:billed`) % 100 < UNBILLED_BUCKET_THRESHOLD;
|
|
2748
|
+
var workflowStatusForEncounter = (encounterId) => {
|
|
2749
|
+
const bucket = hashString2(`${encounterId}:status`) % 100;
|
|
2750
|
+
if (bucket < SUBMITTED_BUCKET_THRESHOLD - UNBILLED_BUCKET_THRESHOLD) {
|
|
2751
|
+
return CLAIM_WORKFLOW_STATUS.SUBMITTED;
|
|
2752
|
+
}
|
|
2753
|
+
if (bucket < ACCEPTED_BUCKET_THRESHOLD - UNBILLED_BUCKET_THRESHOLD) {
|
|
2754
|
+
return CLAIM_WORKFLOW_STATUS.ACCEPTED;
|
|
2755
|
+
}
|
|
2756
|
+
if (bucket < REJECTED_BUCKET_THRESHOLD - UNBILLED_BUCKET_THRESHOLD) {
|
|
2757
|
+
return CLAIM_WORKFLOW_STATUS.REJECTED;
|
|
2758
|
+
}
|
|
2759
|
+
if (bucket < REWORKED_BUCKET_THRESHOLD - UNBILLED_BUCKET_THRESHOLD) {
|
|
2760
|
+
return CLAIM_WORKFLOW_STATUS.REWORKED;
|
|
2761
|
+
}
|
|
2762
|
+
return CLAIM_WORKFLOW_STATUS.RESUBMITTED;
|
|
2763
|
+
};
|
|
2764
|
+
var paymentStatusForEncounter = (encounterId) => {
|
|
2765
|
+
const bucket = hashString2(`${encounterId}:payment`) % 10;
|
|
2766
|
+
if (bucket < 4) {
|
|
2767
|
+
return PAYMENT_STATUS.PARTIAL;
|
|
2768
|
+
}
|
|
2769
|
+
if (bucket < 8) {
|
|
2770
|
+
return PAYMENT_STATUS.FULL;
|
|
2771
|
+
}
|
|
2772
|
+
return PAYMENT_STATUS.WRITE_OFF;
|
|
2773
|
+
};
|
|
2774
|
+
var cachedPrimaryCoverageByPatient;
|
|
2775
|
+
var getPrimaryCoverageByPatient = () => {
|
|
2776
|
+
if (!cachedPrimaryCoverageByPatient) {
|
|
2777
|
+
const map = /* @__PURE__ */ new Map();
|
|
2778
|
+
const allCoverages = [
|
|
2779
|
+
...buildOnSiteDemoFacilityCoverages(),
|
|
2780
|
+
...buildOnSiteDemoHomeHealthCoverages()
|
|
2781
|
+
];
|
|
2782
|
+
for (const cov of allCoverages) {
|
|
2783
|
+
if (cov.order !== 1) {
|
|
2784
|
+
continue;
|
|
2785
|
+
}
|
|
2786
|
+
const ref = cov.beneficiary.reference;
|
|
2787
|
+
if (typeof ref !== "string") {
|
|
2788
|
+
continue;
|
|
2789
|
+
}
|
|
2790
|
+
const patientId = ref.replace(/^Patient\//, "");
|
|
2791
|
+
map.set(patientId, cov);
|
|
2792
|
+
}
|
|
2793
|
+
cachedPrimaryCoverageByPatient = map;
|
|
2794
|
+
}
|
|
2795
|
+
return cachedPrimaryCoverageByPatient;
|
|
2796
|
+
};
|
|
2797
|
+
var buildIdentifierPair6 = (resourceType, resourceId, roleSuffix) => [
|
|
2798
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO6, roleSuffix),
|
|
2799
|
+
openhiResourceIdentifier({
|
|
2800
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
2801
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
2802
|
+
resourceType,
|
|
2803
|
+
id: resourceId
|
|
2804
|
+
})
|
|
2805
|
+
];
|
|
2806
|
+
var emCodeForEncounter = (encounterId) => EM_VISIT_CODES[hashString2(`${encounterId}:em`) % EM_VISIT_CODES.length];
|
|
2807
|
+
var cptForProcedureEncounter = (encounterId) => {
|
|
2808
|
+
const cptKeys = Object.keys(PROCEDURE_CPT_AMOUNTS);
|
|
2809
|
+
const code = cptKeys[hashString2(`${encounterId}:procedure-cpt`) % cptKeys.length];
|
|
2810
|
+
const entry = PROCEDURE_CPT_AMOUNTS[code];
|
|
2811
|
+
if (!entry) {
|
|
2812
|
+
return EM_VISIT_CODES[0];
|
|
2813
|
+
}
|
|
2814
|
+
return { code, display: entry.display, amount: entry.amount };
|
|
2815
|
+
};
|
|
2816
|
+
var usdMoney = (amount) => ({
|
|
2817
|
+
value: +amount.toFixed(2),
|
|
2818
|
+
currency: "USD"
|
|
2819
|
+
});
|
|
2820
|
+
var buildClaimResource = (meta, status, primaryCoverageId, insurerDisplay) => {
|
|
2821
|
+
const claimId = `${meta.id}-claim`;
|
|
2822
|
+
const line = meta.hasWoundProcedure ? cptForProcedureEncounter(meta.id) : emCodeForEncounter(meta.id);
|
|
2823
|
+
const total = usdMoney(line.amount);
|
|
2824
|
+
const lastTransition = meta.periodStart;
|
|
2825
|
+
return {
|
|
2826
|
+
resourceType: "Claim",
|
|
2827
|
+
id: claimId,
|
|
2828
|
+
identifier: buildIdentifierPair6("Claim", claimId, `claim-${meta.id}`),
|
|
2829
|
+
status: "active",
|
|
2830
|
+
type: {
|
|
2831
|
+
coding: [
|
|
2832
|
+
{
|
|
2833
|
+
system: "http://terminology.hl7.org/CodeSystem/claim-type",
|
|
2834
|
+
code: "professional",
|
|
2835
|
+
display: "Professional"
|
|
2836
|
+
}
|
|
2837
|
+
],
|
|
2838
|
+
text: "Professional"
|
|
2839
|
+
},
|
|
2840
|
+
use: "claim",
|
|
2841
|
+
patient: { reference: `Patient/${meta.patientId}`, type: "Patient" },
|
|
2842
|
+
created: meta.periodStart,
|
|
2843
|
+
insurer: { display: insurerDisplay },
|
|
2844
|
+
provider: { reference: `Patient/${meta.patientId}`, type: "Patient" },
|
|
2845
|
+
priority: {
|
|
2846
|
+
coding: [
|
|
2847
|
+
{
|
|
2848
|
+
system: "http://terminology.hl7.org/CodeSystem/processpriority",
|
|
2849
|
+
code: "normal",
|
|
2850
|
+
display: "Normal"
|
|
2851
|
+
}
|
|
2852
|
+
],
|
|
2853
|
+
text: "Normal"
|
|
2854
|
+
},
|
|
2855
|
+
insurance: [
|
|
2856
|
+
{
|
|
2857
|
+
sequence: 1,
|
|
2858
|
+
focal: true,
|
|
2859
|
+
coverage: {
|
|
2860
|
+
reference: `Coverage/${primaryCoverageId}`,
|
|
2861
|
+
type: "Coverage"
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
],
|
|
2865
|
+
item: [
|
|
2866
|
+
{
|
|
2867
|
+
sequence: 1,
|
|
2868
|
+
productOrService: {
|
|
2869
|
+
coding: [
|
|
2870
|
+
{ system: CPT_SYSTEM, code: line.code, display: line.display }
|
|
2871
|
+
],
|
|
2872
|
+
text: line.display
|
|
2873
|
+
},
|
|
2874
|
+
servicedDate: meta.periodStart.slice(0, 10),
|
|
2875
|
+
unitPrice: total,
|
|
2876
|
+
net: total,
|
|
2877
|
+
encounter: [{ reference: `Encounter/${meta.id}`, type: "Encounter" }]
|
|
2878
|
+
}
|
|
2879
|
+
],
|
|
2880
|
+
total,
|
|
2881
|
+
extension: [
|
|
2882
|
+
{
|
|
2883
|
+
url: CLAIM_WORKFLOW_STATUS_EXTENSION_URL,
|
|
2884
|
+
extension: [
|
|
2885
|
+
{
|
|
2886
|
+
url: CLAIM_WORKFLOW_STATUS_VALUE_SUB_EXTENSION_URL,
|
|
2887
|
+
valueCode: status
|
|
2888
|
+
},
|
|
2889
|
+
{
|
|
2890
|
+
url: CLAIM_WORKFLOW_STATUS_LAST_TRANSITION_SUB_EXTENSION_URL,
|
|
2891
|
+
valueDateTime: lastTransition
|
|
2892
|
+
}
|
|
2893
|
+
]
|
|
2894
|
+
}
|
|
2895
|
+
]
|
|
2896
|
+
};
|
|
2897
|
+
};
|
|
2898
|
+
var buildPaymentNoticeResource = (meta, status, claimId, totalCharged, insurerDisplay) => {
|
|
2899
|
+
const paymentId = `${meta.id}-payment`;
|
|
2900
|
+
const charged = totalCharged.value ?? 0;
|
|
2901
|
+
let paid;
|
|
2902
|
+
if (status === PAYMENT_STATUS.FULL) {
|
|
2903
|
+
paid = charged;
|
|
2904
|
+
} else if (status === PAYMENT_STATUS.PARTIAL) {
|
|
2905
|
+
const fraction = 0.4 + hashString2(`${meta.id}:partial`) % 31 / 100;
|
|
2906
|
+
paid = +(charged * fraction).toFixed(2);
|
|
2907
|
+
} else {
|
|
2908
|
+
paid = 0;
|
|
2909
|
+
}
|
|
2910
|
+
return {
|
|
2911
|
+
resourceType: "PaymentNotice",
|
|
2912
|
+
id: paymentId,
|
|
2913
|
+
identifier: buildIdentifierPair6(
|
|
2914
|
+
"PaymentNotice",
|
|
2915
|
+
paymentId,
|
|
2916
|
+
`payment-${meta.id}`
|
|
2917
|
+
),
|
|
2918
|
+
status: "active",
|
|
2919
|
+
request: { reference: `Claim/${claimId}`, type: "Claim" },
|
|
2920
|
+
created: meta.periodStart,
|
|
2921
|
+
// FHIR R4 PaymentNotice.payment is Reference(PaymentReconciliation).
|
|
2922
|
+
// Demo seeding does not produce PaymentReconciliation resources;
|
|
2923
|
+
// we point at the Claim so the reference is at least resolvable on
|
|
2924
|
+
// read paths. The `request` field above is the FHIR-correct link
|
|
2925
|
+
// from PaymentNotice back to the originating Claim.
|
|
2926
|
+
payment: { reference: `Claim/${claimId}`, type: "Claim" },
|
|
2927
|
+
paymentDate: meta.periodStart.slice(0, 10),
|
|
2928
|
+
recipient: { display: insurerDisplay },
|
|
2929
|
+
amount: usdMoney(paid),
|
|
2930
|
+
paymentStatus: {
|
|
2931
|
+
coding: [
|
|
2932
|
+
{
|
|
2933
|
+
system: PAYMENT_STATUS_SYSTEM,
|
|
2934
|
+
code: status,
|
|
2935
|
+
display: status
|
|
2936
|
+
}
|
|
2937
|
+
],
|
|
2938
|
+
text: status
|
|
2939
|
+
}
|
|
2940
|
+
};
|
|
2941
|
+
};
|
|
2942
|
+
var insurerDisplayForCoverage = (cov) => {
|
|
2943
|
+
const payor = cov.payor?.[0];
|
|
2944
|
+
if (payor && typeof payor.display === "string" && payor.display.length > 0) {
|
|
2945
|
+
return payor.display;
|
|
2946
|
+
}
|
|
2947
|
+
if (typeof cov.type?.text === "string" && cov.type.text.length > 0) {
|
|
2948
|
+
return cov.type.text;
|
|
2949
|
+
}
|
|
2950
|
+
return "Unknown Insurer";
|
|
2951
|
+
};
|
|
2952
|
+
var buildOnSiteDemoClaims = (referenceIso) => {
|
|
2953
|
+
const primaryByPatient = getPrimaryCoverageByPatient();
|
|
2954
|
+
const out = [];
|
|
2955
|
+
for (const meta of onSiteDemoEncounterMetadata(referenceIso)) {
|
|
2956
|
+
if (isEncounterUnbilled(meta.id)) {
|
|
2957
|
+
continue;
|
|
2958
|
+
}
|
|
2959
|
+
const coverage = primaryByPatient.get(meta.patientId);
|
|
2960
|
+
if (!coverage || !coverage.id) {
|
|
2961
|
+
continue;
|
|
2962
|
+
}
|
|
2963
|
+
const status = workflowStatusForEncounter(meta.id);
|
|
2964
|
+
out.push(
|
|
2965
|
+
buildClaimResource(
|
|
2966
|
+
meta,
|
|
2967
|
+
status,
|
|
2968
|
+
coverage.id,
|
|
2969
|
+
insurerDisplayForCoverage(coverage)
|
|
2970
|
+
)
|
|
2971
|
+
);
|
|
2972
|
+
}
|
|
2973
|
+
return out;
|
|
2974
|
+
};
|
|
2975
|
+
var buildOnSiteDemoPaymentNotices = (referenceIso) => {
|
|
2976
|
+
const primaryByPatient = getPrimaryCoverageByPatient();
|
|
2977
|
+
const out = [];
|
|
2978
|
+
for (const meta of onSiteDemoEncounterMetadata(referenceIso)) {
|
|
2979
|
+
if (isEncounterUnbilled(meta.id)) {
|
|
2980
|
+
continue;
|
|
2981
|
+
}
|
|
2982
|
+
const status = workflowStatusForEncounter(meta.id);
|
|
2983
|
+
if (status !== CLAIM_WORKFLOW_STATUS.ACCEPTED) {
|
|
2984
|
+
continue;
|
|
2985
|
+
}
|
|
2986
|
+
const coverage = primaryByPatient.get(meta.patientId);
|
|
2987
|
+
if (!coverage || !coverage.id) {
|
|
2988
|
+
continue;
|
|
2989
|
+
}
|
|
2990
|
+
const paymentStatus = paymentStatusForEncounter(meta.id);
|
|
2991
|
+
const line = meta.hasWoundProcedure ? cptForProcedureEncounter(meta.id) : emCodeForEncounter(meta.id);
|
|
2992
|
+
const total = usdMoney(line.amount);
|
|
2993
|
+
const claimId = `${meta.id}-claim`;
|
|
2994
|
+
out.push(
|
|
2995
|
+
buildPaymentNoticeResource(
|
|
2996
|
+
meta,
|
|
2997
|
+
paymentStatus,
|
|
2998
|
+
claimId,
|
|
2999
|
+
total,
|
|
3000
|
+
insurerDisplayForCoverage(coverage)
|
|
3001
|
+
)
|
|
3002
|
+
);
|
|
3003
|
+
}
|
|
3004
|
+
return out;
|
|
3005
|
+
};
|
|
3006
|
+
|
|
3007
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-directory.ts
|
|
3008
|
+
var ON_SITE_SCENARIO7 = "on-site-demo";
|
|
3009
|
+
var FHIR_ORGANIZATION_TYPE_SYSTEM = "http://terminology.hl7.org/CodeSystem/organization-type";
|
|
3010
|
+
var ON_SITE_DIRECTORY_CATEGORY_SYSTEM = "https://on-site-medical.app/fhir/CodeSystem/directory-category";
|
|
3011
|
+
var DME_SUPPLIER_CATEGORY_CODE = "dme-supplier";
|
|
3012
|
+
var INSURANCE_PAYOR_CATEGORY_CODE = "insurance-payor";
|
|
3013
|
+
var INSURANCE_PAYOR_PLAN_TYPE_SYSTEM = "https://on-site-medical.app/fhir/CodeSystem/payor-plan-type";
|
|
3014
|
+
var PAYOR_PLAN_TYPE_COMMERCIAL = "commercial";
|
|
3015
|
+
var PAYOR_PLAN_TYPE_MEDICARE = "medicare";
|
|
3016
|
+
var PAYOR_PLAN_TYPE_MEDICARE_ADVANTAGE = "medicare-advantage";
|
|
3017
|
+
var PRACTITIONER_CREDENTIALING_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/practitioner-credentialing";
|
|
3018
|
+
var PRACTITIONER_CREDENTIALING_STATE_SUB_EXTENSION_URL = "state";
|
|
3019
|
+
var PRACTITIONER_CREDENTIALING_STATUS_SUB_EXTENSION_URL = "status";
|
|
3020
|
+
var CREDENTIALING_STATUS = {
|
|
3021
|
+
ACTIVE: "active",
|
|
3022
|
+
SUSPENDED: "suspended",
|
|
3023
|
+
EXPIRED: "expired"
|
|
3024
|
+
};
|
|
3025
|
+
var STATE_MEDICAL_LICENSE_SYSTEM = "https://on-site-medical.app/fhir/sid/state-medical-license";
|
|
3026
|
+
var DME_SUPPLIER_SPECS = [
|
|
3027
|
+
{
|
|
3028
|
+
id: "on-site-demo-dme-supplier-001",
|
|
3029
|
+
name: "Apria Healthcare",
|
|
3030
|
+
phone: "+18004554111",
|
|
3031
|
+
email: "orders@apria.on-site-demo.example.com",
|
|
3032
|
+
addressLine: "12230 El Camino Real",
|
|
3033
|
+
addressCity: "San Diego",
|
|
3034
|
+
addressState: "CA",
|
|
3035
|
+
addressPostalCode: "92130",
|
|
3036
|
+
contactName: "Marcus Whitfield",
|
|
3037
|
+
contactPhone: "+18004554112",
|
|
3038
|
+
contactEmail: "m.whitfield@apria.on-site-demo.example.com"
|
|
3039
|
+
},
|
|
3040
|
+
{
|
|
3041
|
+
id: "on-site-demo-dme-supplier-002",
|
|
3042
|
+
name: "Lincare Holdings",
|
|
3043
|
+
phone: "+17275301700",
|
|
3044
|
+
email: "intake@lincare.on-site-demo.example.com",
|
|
3045
|
+
addressLine: "19387 US Highway 19 North",
|
|
3046
|
+
addressCity: "Clearwater",
|
|
3047
|
+
addressState: "FL",
|
|
3048
|
+
addressPostalCode: "33764",
|
|
3049
|
+
contactName: "Rachel Donovan",
|
|
3050
|
+
contactPhone: "+17275301701",
|
|
3051
|
+
contactEmail: "r.donovan@lincare.on-site-demo.example.com"
|
|
3052
|
+
},
|
|
3053
|
+
{
|
|
3054
|
+
id: "on-site-demo-dme-supplier-003",
|
|
3055
|
+
name: "AdaptHealth",
|
|
3056
|
+
phone: "+16104840700",
|
|
3057
|
+
email: "referrals@adapthealth.on-site-demo.example.com",
|
|
3058
|
+
addressLine: "220 West Germantown Pike",
|
|
3059
|
+
addressCity: "Plymouth Meeting",
|
|
3060
|
+
addressState: "PA",
|
|
3061
|
+
addressPostalCode: "19462",
|
|
3062
|
+
contactName: "Brian Calloway",
|
|
3063
|
+
contactPhone: "+16104840701",
|
|
3064
|
+
contactEmail: "b.calloway@adapthealth.on-site-demo.example.com"
|
|
3065
|
+
},
|
|
3066
|
+
{
|
|
3067
|
+
id: "on-site-demo-dme-supplier-004",
|
|
3068
|
+
name: "Rotech Healthcare",
|
|
3069
|
+
phone: "+14072629230",
|
|
3070
|
+
email: "support@rotech.on-site-demo.example.com",
|
|
3071
|
+
addressLine: "3600 Vineland Road",
|
|
3072
|
+
addressCity: "Orlando",
|
|
3073
|
+
addressState: "FL",
|
|
3074
|
+
addressPostalCode: "32811",
|
|
3075
|
+
contactName: "Elena Marsh",
|
|
3076
|
+
contactPhone: "+14072629231",
|
|
3077
|
+
contactEmail: "e.marsh@rotech.on-site-demo.example.com"
|
|
3078
|
+
},
|
|
3079
|
+
{
|
|
3080
|
+
id: "on-site-demo-dme-supplier-005",
|
|
3081
|
+
name: "Byram Healthcare",
|
|
3082
|
+
phone: "+18004220606",
|
|
3083
|
+
email: "orders@byram.on-site-demo.example.com",
|
|
3084
|
+
addressLine: "120 Bloomingdale Road",
|
|
3085
|
+
addressCity: "White Plains",
|
|
3086
|
+
addressState: "NY",
|
|
3087
|
+
addressPostalCode: "10605",
|
|
3088
|
+
contactName: "Thomas Pritchard",
|
|
3089
|
+
contactPhone: "+18004220607",
|
|
3090
|
+
contactEmail: "t.pritchard@byram.on-site-demo.example.com"
|
|
3091
|
+
},
|
|
3092
|
+
{
|
|
3093
|
+
id: "on-site-demo-dme-supplier-006",
|
|
3094
|
+
name: "Medline Industries",
|
|
3095
|
+
phone: "+18476434400",
|
|
3096
|
+
email: "wound-care@medline.on-site-demo.example.com",
|
|
3097
|
+
addressLine: "Three Lakes Drive",
|
|
3098
|
+
addressCity: "Northfield",
|
|
3099
|
+
addressState: "IL",
|
|
3100
|
+
addressPostalCode: "60093",
|
|
3101
|
+
contactName: "Jacqueline Vance",
|
|
3102
|
+
contactPhone: "+18476434401",
|
|
3103
|
+
contactEmail: "j.vance@medline.on-site-demo.example.com"
|
|
3104
|
+
},
|
|
3105
|
+
{
|
|
3106
|
+
id: "on-site-demo-dme-supplier-007",
|
|
3107
|
+
name: "McKesson Medical-Surgical",
|
|
3108
|
+
phone: "+18044703300",
|
|
3109
|
+
email: "service@mckesson-ms.on-site-demo.example.com",
|
|
3110
|
+
addressLine: "9954 Mayland Drive",
|
|
3111
|
+
addressCity: "Richmond",
|
|
3112
|
+
addressState: "VA",
|
|
3113
|
+
addressPostalCode: "23233",
|
|
3114
|
+
contactName: "Andre Holloway",
|
|
3115
|
+
contactPhone: "+18044703301",
|
|
3116
|
+
contactEmail: "a.holloway@mckesson-ms.on-site-demo.example.com"
|
|
3117
|
+
},
|
|
3118
|
+
{
|
|
3119
|
+
id: "on-site-demo-dme-supplier-008",
|
|
3120
|
+
name: "Cardinal Health at-Home Solutions",
|
|
3121
|
+
phone: "+16147573030",
|
|
3122
|
+
email: "home@cardinal.on-site-demo.example.com",
|
|
3123
|
+
addressLine: "7000 Cardinal Place",
|
|
3124
|
+
addressCity: "Dublin",
|
|
3125
|
+
addressState: "OH",
|
|
3126
|
+
addressPostalCode: "43017",
|
|
3127
|
+
contactName: "Naomi Sutherland",
|
|
3128
|
+
contactPhone: "+16147573031",
|
|
3129
|
+
contactEmail: "n.sutherland@cardinal.on-site-demo.example.com"
|
|
3130
|
+
},
|
|
3131
|
+
{
|
|
3132
|
+
id: "on-site-demo-dme-supplier-009",
|
|
3133
|
+
name: "Edgepark Medical Supplies",
|
|
3134
|
+
phone: "+18003217828",
|
|
3135
|
+
email: "orders@edgepark.on-site-demo.example.com",
|
|
3136
|
+
addressLine: "1810 Summit Commerce Park",
|
|
3137
|
+
addressCity: "Twinsburg",
|
|
3138
|
+
addressState: "OH",
|
|
3139
|
+
addressPostalCode: "44087",
|
|
3140
|
+
contactName: "Derek Ashford",
|
|
3141
|
+
contactPhone: "+18003217829",
|
|
3142
|
+
contactEmail: "d.ashford@edgepark.on-site-demo.example.com"
|
|
3143
|
+
},
|
|
3144
|
+
{
|
|
3145
|
+
id: "on-site-demo-dme-supplier-010",
|
|
3146
|
+
name: "Numotion",
|
|
3147
|
+
phone: "+18006240498",
|
|
3148
|
+
email: "intake@numotion.on-site-demo.example.com",
|
|
3149
|
+
addressLine: "5117 W Terrace Drive",
|
|
3150
|
+
addressCity: "Brentwood",
|
|
3151
|
+
addressState: "TN",
|
|
3152
|
+
addressPostalCode: "37027",
|
|
3153
|
+
contactName: "Sienna Lockhart",
|
|
3154
|
+
contactPhone: "+18006240499",
|
|
3155
|
+
contactEmail: "s.lockhart@numotion.on-site-demo.example.com"
|
|
3156
|
+
},
|
|
3157
|
+
{
|
|
3158
|
+
id: "on-site-demo-dme-supplier-011",
|
|
3159
|
+
name: "Pride Mobility",
|
|
3160
|
+
phone: "+18008003636",
|
|
3161
|
+
email: "service@pridemobility.on-site-demo.example.com",
|
|
3162
|
+
addressLine: "182 Susquehanna Avenue",
|
|
3163
|
+
addressCity: "Exeter",
|
|
3164
|
+
addressState: "PA",
|
|
3165
|
+
addressPostalCode: "18643",
|
|
3166
|
+
contactName: "Vincent Marlowe",
|
|
3167
|
+
contactPhone: "+18008003637",
|
|
3168
|
+
contactEmail: "v.marlowe@pridemobility.on-site-demo.example.com"
|
|
3169
|
+
},
|
|
3170
|
+
{
|
|
3171
|
+
id: "on-site-demo-dme-supplier-012",
|
|
3172
|
+
name: "Hollister Wound Care",
|
|
3173
|
+
phone: "+18003234060",
|
|
3174
|
+
email: "wound@hollister.on-site-demo.example.com",
|
|
3175
|
+
addressLine: "2000 Hollister Drive",
|
|
3176
|
+
addressCity: "Libertyville",
|
|
3177
|
+
addressState: "IL",
|
|
3178
|
+
addressPostalCode: "60048",
|
|
3179
|
+
contactName: "Priscilla Hawthorne",
|
|
3180
|
+
contactPhone: "+18003234061",
|
|
3181
|
+
contactEmail: "p.hawthorne@hollister.on-site-demo.example.com"
|
|
3182
|
+
},
|
|
3183
|
+
{
|
|
3184
|
+
id: "on-site-demo-dme-supplier-013",
|
|
3185
|
+
name: "Smith & Nephew Advanced Wound Management",
|
|
3186
|
+
phone: "+18008765556",
|
|
3187
|
+
email: "wound@smith-nephew.on-site-demo.example.com",
|
|
3188
|
+
addressLine: "5600 Clearfork Main Street",
|
|
3189
|
+
addressCity: "Fort Worth",
|
|
3190
|
+
addressState: "TX",
|
|
3191
|
+
addressPostalCode: "76109",
|
|
3192
|
+
contactName: "Gregory Eastland",
|
|
3193
|
+
contactPhone: "+18008765557",
|
|
3194
|
+
contactEmail: "g.eastland@smith-nephew.on-site-demo.example.com"
|
|
3195
|
+
}
|
|
3196
|
+
];
|
|
3197
|
+
var INSURANCE_PAYOR_SPECS = [
|
|
3198
|
+
{
|
|
3199
|
+
id: "on-site-demo-insurance-payor-001",
|
|
3200
|
+
name: "Aetna",
|
|
3201
|
+
planType: PAYOR_PLAN_TYPE_COMMERCIAL,
|
|
3202
|
+
phone: "+18008721414",
|
|
3203
|
+
email: "provider-services@aetna.on-site-demo.example.com",
|
|
3204
|
+
addressLine: "151 Farmington Avenue",
|
|
3205
|
+
addressCity: "Hartford",
|
|
3206
|
+
addressState: "CT",
|
|
3207
|
+
addressPostalCode: "06156",
|
|
3208
|
+
contactName: "Stephanie Wakefield",
|
|
3209
|
+
contactPhone: "+18008721415",
|
|
3210
|
+
contactEmail: "s.wakefield@aetna.on-site-demo.example.com"
|
|
3211
|
+
},
|
|
3212
|
+
{
|
|
3213
|
+
id: "on-site-demo-insurance-payor-002",
|
|
3214
|
+
name: "Cigna Healthcare",
|
|
3215
|
+
planType: PAYOR_PLAN_TYPE_COMMERCIAL,
|
|
3216
|
+
phone: "+18002442488",
|
|
3217
|
+
email: "provider-services@cigna.on-site-demo.example.com",
|
|
3218
|
+
addressLine: "900 Cottage Grove Road",
|
|
3219
|
+
addressCity: "Bloomfield",
|
|
3220
|
+
addressState: "CT",
|
|
3221
|
+
addressPostalCode: "06002",
|
|
3222
|
+
contactName: "Howard Greenberg",
|
|
3223
|
+
contactPhone: "+18002442489",
|
|
3224
|
+
contactEmail: "h.greenberg@cigna.on-site-demo.example.com"
|
|
3225
|
+
},
|
|
3226
|
+
{
|
|
3227
|
+
id: "on-site-demo-insurance-payor-003",
|
|
3228
|
+
name: "UnitedHealthcare",
|
|
3229
|
+
planType: PAYOR_PLAN_TYPE_COMMERCIAL,
|
|
3230
|
+
phone: "+18778425539",
|
|
3231
|
+
email: "provider-services@uhc.on-site-demo.example.com",
|
|
3232
|
+
addressLine: "9900 Bren Road East",
|
|
3233
|
+
addressCity: "Minnetonka",
|
|
3234
|
+
addressState: "MN",
|
|
3235
|
+
addressPostalCode: "55343",
|
|
3236
|
+
contactName: "Cassandra Bellamy",
|
|
3237
|
+
contactPhone: "+18778425540",
|
|
3238
|
+
contactEmail: "c.bellamy@uhc.on-site-demo.example.com"
|
|
3239
|
+
},
|
|
3240
|
+
{
|
|
3241
|
+
id: "on-site-demo-insurance-payor-004",
|
|
3242
|
+
name: "Anthem Blue Cross Blue Shield",
|
|
3243
|
+
planType: PAYOR_PLAN_TYPE_COMMERCIAL,
|
|
3244
|
+
phone: "+18004504000",
|
|
3245
|
+
email: "provider-services@anthem.on-site-demo.example.com",
|
|
3246
|
+
addressLine: "220 Virginia Avenue",
|
|
3247
|
+
addressCity: "Indianapolis",
|
|
3248
|
+
addressState: "IN",
|
|
3249
|
+
addressPostalCode: "46204",
|
|
3250
|
+
contactName: "Maurice Pendleton",
|
|
3251
|
+
contactPhone: "+18004504001",
|
|
3252
|
+
contactEmail: "m.pendleton@anthem.on-site-demo.example.com"
|
|
3253
|
+
},
|
|
3254
|
+
{
|
|
3255
|
+
id: "on-site-demo-insurance-payor-005",
|
|
3256
|
+
name: "CMS \u2014 Medicare",
|
|
3257
|
+
planType: PAYOR_PLAN_TYPE_MEDICARE,
|
|
3258
|
+
phone: "+18006334227",
|
|
3259
|
+
email: "provider-services@cms.on-site-demo.example.com",
|
|
3260
|
+
addressLine: "7500 Security Boulevard",
|
|
3261
|
+
addressCity: "Baltimore",
|
|
3262
|
+
addressState: "MD",
|
|
3263
|
+
addressPostalCode: "21244",
|
|
3264
|
+
contactName: "Theresa Kavanagh",
|
|
3265
|
+
contactPhone: "+18006334228",
|
|
3266
|
+
contactEmail: "t.kavanagh@cms.on-site-demo.example.com"
|
|
3267
|
+
},
|
|
3268
|
+
{
|
|
3269
|
+
id: "on-site-demo-insurance-payor-006",
|
|
3270
|
+
name: "Humana Medicare Advantage",
|
|
3271
|
+
planType: PAYOR_PLAN_TYPE_MEDICARE_ADVANTAGE,
|
|
3272
|
+
phone: "+18004574708",
|
|
3273
|
+
email: "provider-services@humana.on-site-demo.example.com",
|
|
3274
|
+
addressLine: "500 West Main Street",
|
|
3275
|
+
addressCity: "Louisville",
|
|
3276
|
+
addressState: "KY",
|
|
3277
|
+
addressPostalCode: "40202",
|
|
3278
|
+
contactName: "Lawrence Whitmore",
|
|
3279
|
+
contactPhone: "+18004574709",
|
|
3280
|
+
contactEmail: "l.whitmore@humana.on-site-demo.example.com"
|
|
3281
|
+
},
|
|
3282
|
+
{
|
|
3283
|
+
id: "on-site-demo-insurance-payor-007",
|
|
3284
|
+
name: "Wellcare by Centene",
|
|
3285
|
+
planType: PAYOR_PLAN_TYPE_MEDICARE_ADVANTAGE,
|
|
3286
|
+
phone: "+18886353224",
|
|
3287
|
+
email: "provider-services@wellcare.on-site-demo.example.com",
|
|
3288
|
+
addressLine: "8735 Henderson Road",
|
|
3289
|
+
addressCity: "Tampa",
|
|
3290
|
+
addressState: "FL",
|
|
3291
|
+
addressPostalCode: "33634",
|
|
3292
|
+
contactName: "Yolanda Caldwell",
|
|
3293
|
+
contactPhone: "+18886353225",
|
|
3294
|
+
contactEmail: "y.caldwell@wellcare.on-site-demo.example.com"
|
|
3295
|
+
},
|
|
3296
|
+
{
|
|
3297
|
+
id: "on-site-demo-insurance-payor-008",
|
|
3298
|
+
name: "Kaiser Permanente",
|
|
3299
|
+
planType: PAYOR_PLAN_TYPE_COMMERCIAL,
|
|
3300
|
+
phone: "+18004646000",
|
|
3301
|
+
email: "provider-services@kaiser.on-site-demo.example.com",
|
|
3302
|
+
addressLine: "1 Kaiser Plaza",
|
|
3303
|
+
addressCity: "Oakland",
|
|
3304
|
+
addressState: "CA",
|
|
3305
|
+
addressPostalCode: "94612",
|
|
3306
|
+
contactName: "Bradford Tennyson",
|
|
3307
|
+
contactPhone: "+18004646001",
|
|
3308
|
+
contactEmail: "b.tennyson@kaiser.on-site-demo.example.com"
|
|
3309
|
+
}
|
|
3310
|
+
];
|
|
3311
|
+
var buildOrganizationIdentifierPair = (organizationId, roleSuffix) => [
|
|
3312
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO7, roleSuffix),
|
|
3313
|
+
openhiResourceIdentifier({
|
|
3314
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
3315
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
3316
|
+
resourceType: "Organization",
|
|
3317
|
+
id: organizationId
|
|
3318
|
+
})
|
|
3319
|
+
];
|
|
3320
|
+
var buildDmeSupplierResource = (spec) => ({
|
|
3321
|
+
resourceType: "Organization",
|
|
3322
|
+
id: spec.id,
|
|
3323
|
+
active: true,
|
|
3324
|
+
identifier: buildOrganizationIdentifierPair(
|
|
3325
|
+
spec.id,
|
|
3326
|
+
`dme-supplier-${spec.id}`
|
|
3327
|
+
),
|
|
3328
|
+
name: spec.name,
|
|
3329
|
+
type: [
|
|
3330
|
+
{
|
|
3331
|
+
coding: [
|
|
3332
|
+
{
|
|
3333
|
+
system: FHIR_ORGANIZATION_TYPE_SYSTEM,
|
|
3334
|
+
code: "prov",
|
|
3335
|
+
display: "Healthcare Provider"
|
|
3336
|
+
},
|
|
3337
|
+
{
|
|
3338
|
+
system: ON_SITE_DIRECTORY_CATEGORY_SYSTEM,
|
|
3339
|
+
code: DME_SUPPLIER_CATEGORY_CODE,
|
|
3340
|
+
display: "DME Supplier"
|
|
3341
|
+
}
|
|
3342
|
+
],
|
|
3343
|
+
text: "DME Supplier"
|
|
3344
|
+
}
|
|
3345
|
+
],
|
|
3346
|
+
telecom: [
|
|
3347
|
+
{ system: "phone", value: spec.phone, use: "work" },
|
|
3348
|
+
{ system: "email", value: spec.email, use: "work" }
|
|
3349
|
+
],
|
|
3350
|
+
address: [
|
|
3351
|
+
{
|
|
3352
|
+
use: "work",
|
|
3353
|
+
line: [spec.addressLine],
|
|
3354
|
+
city: spec.addressCity,
|
|
3355
|
+
state: spec.addressState,
|
|
3356
|
+
postalCode: spec.addressPostalCode,
|
|
3357
|
+
country: "US"
|
|
3358
|
+
}
|
|
3359
|
+
],
|
|
3360
|
+
contact: [
|
|
3361
|
+
{
|
|
3362
|
+
purpose: { text: "Primary Contact" },
|
|
3363
|
+
name: {
|
|
3364
|
+
text: spec.contactName,
|
|
3365
|
+
given: [spec.contactName.split(" ")[0] ?? spec.contactName],
|
|
3366
|
+
family: spec.contactName.split(" ").slice(-1)[0] ?? spec.contactName
|
|
3367
|
+
},
|
|
3368
|
+
telecom: [
|
|
3369
|
+
{ system: "phone", value: spec.contactPhone, use: "work" },
|
|
3370
|
+
{ system: "email", value: spec.contactEmail, use: "work" }
|
|
3371
|
+
]
|
|
3372
|
+
}
|
|
3373
|
+
]
|
|
3374
|
+
});
|
|
3375
|
+
var planTypeDisplayLabel = (planType) => {
|
|
3376
|
+
if (planType === PAYOR_PLAN_TYPE_COMMERCIAL) {
|
|
3377
|
+
return "Commercial";
|
|
3378
|
+
}
|
|
3379
|
+
if (planType === PAYOR_PLAN_TYPE_MEDICARE) {
|
|
3380
|
+
return "Medicare";
|
|
3381
|
+
}
|
|
3382
|
+
return "Medicare Advantage";
|
|
3383
|
+
};
|
|
3384
|
+
var buildInsurancePayorResource = (spec) => ({
|
|
3385
|
+
resourceType: "Organization",
|
|
3386
|
+
id: spec.id,
|
|
3387
|
+
active: true,
|
|
3388
|
+
identifier: buildOrganizationIdentifierPair(
|
|
3389
|
+
spec.id,
|
|
3390
|
+
`insurance-payor-${spec.id}`
|
|
3391
|
+
),
|
|
3392
|
+
name: spec.name,
|
|
3393
|
+
type: [
|
|
3394
|
+
{
|
|
3395
|
+
coding: [
|
|
3396
|
+
{
|
|
3397
|
+
system: FHIR_ORGANIZATION_TYPE_SYSTEM,
|
|
3398
|
+
code: "pay",
|
|
3399
|
+
display: "Payer"
|
|
3400
|
+
},
|
|
3401
|
+
{
|
|
3402
|
+
system: ON_SITE_DIRECTORY_CATEGORY_SYSTEM,
|
|
3403
|
+
code: INSURANCE_PAYOR_CATEGORY_CODE,
|
|
3404
|
+
display: "Insurance Payor"
|
|
3405
|
+
},
|
|
3406
|
+
{
|
|
3407
|
+
system: INSURANCE_PAYOR_PLAN_TYPE_SYSTEM,
|
|
3408
|
+
code: spec.planType,
|
|
3409
|
+
display: planTypeDisplayLabel(spec.planType)
|
|
3410
|
+
}
|
|
3411
|
+
],
|
|
3412
|
+
text: planTypeDisplayLabel(spec.planType)
|
|
3413
|
+
}
|
|
3414
|
+
],
|
|
3415
|
+
telecom: [
|
|
3416
|
+
{ system: "phone", value: spec.phone, use: "work" },
|
|
3417
|
+
{ system: "email", value: spec.email, use: "work" }
|
|
3418
|
+
],
|
|
3419
|
+
address: [
|
|
3420
|
+
{
|
|
3421
|
+
use: "work",
|
|
3422
|
+
line: [spec.addressLine],
|
|
3423
|
+
city: spec.addressCity,
|
|
3424
|
+
state: spec.addressState,
|
|
3425
|
+
postalCode: spec.addressPostalCode,
|
|
3426
|
+
country: "US"
|
|
3427
|
+
}
|
|
3428
|
+
],
|
|
3429
|
+
contact: [
|
|
3430
|
+
{
|
|
3431
|
+
purpose: { text: "Provider Services" },
|
|
3432
|
+
name: {
|
|
3433
|
+
text: spec.contactName,
|
|
3434
|
+
given: [spec.contactName.split(" ")[0] ?? spec.contactName],
|
|
3435
|
+
family: spec.contactName.split(" ").slice(-1)[0] ?? spec.contactName
|
|
3436
|
+
},
|
|
3437
|
+
telecom: [
|
|
3438
|
+
{ system: "phone", value: spec.contactPhone, use: "work" },
|
|
3439
|
+
{ system: "email", value: spec.contactEmail, use: "work" }
|
|
3440
|
+
]
|
|
3441
|
+
}
|
|
3442
|
+
]
|
|
3443
|
+
});
|
|
3444
|
+
var ON_SITE_DEMO_DME_SUPPLIERS = DME_SUPPLIER_SPECS.map(buildDmeSupplierResource);
|
|
3445
|
+
var ON_SITE_DEMO_INSURANCE_PAYORS = INSURANCE_PAYOR_SPECS.map(buildInsurancePayorResource);
|
|
3446
|
+
var ON_SITE_DEMO_DIRECTORY_ORGANIZATIONS = [...ON_SITE_DEMO_DME_SUPPLIERS, ...ON_SITE_DEMO_INSURANCE_PAYORS];
|
|
3447
|
+
var PRACTITIONER_CREDENTIALING_BY_DOCTOR = {
|
|
3448
|
+
"on-site-demo-doctor-001": [
|
|
3449
|
+
{
|
|
3450
|
+
state: "GA",
|
|
3451
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3452
|
+
licenseNumber: "GA-MD-082431",
|
|
3453
|
+
issued: "2014-06-12",
|
|
3454
|
+
expires: "2027-06-30",
|
|
3455
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3456
|
+
},
|
|
3457
|
+
{
|
|
3458
|
+
state: "AL",
|
|
3459
|
+
stateBoardDisplay: "Alabama Board of Medical Examiners",
|
|
3460
|
+
licenseNumber: "AL-MD-MD031298",
|
|
3461
|
+
issued: "2016-04-02",
|
|
3462
|
+
expires: "2026-12-31",
|
|
3463
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3464
|
+
},
|
|
3465
|
+
{
|
|
3466
|
+
state: "TN",
|
|
3467
|
+
stateBoardDisplay: "Tennessee Board of Medical Examiners",
|
|
3468
|
+
licenseNumber: "TN-MD-MD51227",
|
|
3469
|
+
issued: "2017-09-21",
|
|
3470
|
+
expires: "2026-09-30",
|
|
3471
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3472
|
+
}
|
|
3473
|
+
],
|
|
3474
|
+
"on-site-demo-doctor-002": [
|
|
3475
|
+
{
|
|
3476
|
+
state: "GA",
|
|
3477
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3478
|
+
licenseNumber: "GA-MD-076120",
|
|
3479
|
+
issued: "2012-08-04",
|
|
3480
|
+
expires: "2027-08-31",
|
|
3481
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3482
|
+
},
|
|
3483
|
+
{
|
|
3484
|
+
state: "FL",
|
|
3485
|
+
stateBoardDisplay: "Florida Board of Medicine",
|
|
3486
|
+
licenseNumber: "FL-MD-ME128443",
|
|
3487
|
+
issued: "2018-02-18",
|
|
3488
|
+
expires: "2026-02-28",
|
|
3489
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3490
|
+
}
|
|
3491
|
+
],
|
|
3492
|
+
"on-site-demo-doctor-003": [
|
|
3493
|
+
{
|
|
3494
|
+
state: "GA",
|
|
3495
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3496
|
+
licenseNumber: "GA-MD-091047",
|
|
3497
|
+
issued: "2015-11-22",
|
|
3498
|
+
expires: "2027-11-30",
|
|
3499
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3500
|
+
},
|
|
3501
|
+
{
|
|
3502
|
+
state: "SC",
|
|
3503
|
+
stateBoardDisplay: "South Carolina Board of Medical Examiners",
|
|
3504
|
+
licenseNumber: "SC-MD-32788",
|
|
3505
|
+
issued: "2019-05-10",
|
|
3506
|
+
expires: "2027-05-31",
|
|
3507
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3508
|
+
}
|
|
3509
|
+
],
|
|
3510
|
+
"on-site-demo-doctor-004": [
|
|
3511
|
+
{
|
|
3512
|
+
state: "GA",
|
|
3513
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3514
|
+
licenseNumber: "GA-MD-064118",
|
|
3515
|
+
issued: "2009-07-14",
|
|
3516
|
+
expires: "2027-07-31",
|
|
3517
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3518
|
+
},
|
|
3519
|
+
{
|
|
3520
|
+
state: "NC",
|
|
3521
|
+
stateBoardDisplay: "North Carolina Medical Board",
|
|
3522
|
+
licenseNumber: "NC-MD-2014-00892",
|
|
3523
|
+
issued: "2014-03-08",
|
|
3524
|
+
expires: "2027-03-31",
|
|
3525
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3526
|
+
}
|
|
3527
|
+
],
|
|
3528
|
+
"on-site-demo-doctor-005": [
|
|
3529
|
+
{
|
|
3530
|
+
state: "GA",
|
|
3531
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3532
|
+
licenseNumber: "GA-MD-098712",
|
|
3533
|
+
issued: "2017-01-19",
|
|
3534
|
+
expires: "2027-01-31",
|
|
3535
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3536
|
+
},
|
|
3537
|
+
{
|
|
3538
|
+
state: "AL",
|
|
3539
|
+
stateBoardDisplay: "Alabama Board of Medical Examiners",
|
|
3540
|
+
licenseNumber: "AL-MD-MD040115",
|
|
3541
|
+
issued: "2020-06-30",
|
|
3542
|
+
expires: "2026-06-30",
|
|
3543
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3544
|
+
}
|
|
3545
|
+
],
|
|
3546
|
+
"on-site-demo-doctor-006": [
|
|
3547
|
+
{
|
|
3548
|
+
state: "GA",
|
|
3549
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3550
|
+
licenseNumber: "GA-MD-052901",
|
|
3551
|
+
issued: "2004-09-02",
|
|
3552
|
+
expires: "2027-09-30",
|
|
3553
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3554
|
+
},
|
|
3555
|
+
{
|
|
3556
|
+
state: "TN",
|
|
3557
|
+
stateBoardDisplay: "Tennessee Board of Medical Examiners",
|
|
3558
|
+
licenseNumber: "TN-MD-MD43091",
|
|
3559
|
+
issued: "2011-05-15",
|
|
3560
|
+
expires: "2027-05-31",
|
|
3561
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3562
|
+
}
|
|
3563
|
+
],
|
|
3564
|
+
"on-site-demo-doctor-007": [
|
|
3565
|
+
{
|
|
3566
|
+
state: "GA",
|
|
3567
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3568
|
+
licenseNumber: "GA-MD-073445",
|
|
3569
|
+
issued: "2013-04-27",
|
|
3570
|
+
expires: "2027-04-30",
|
|
3571
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3572
|
+
},
|
|
3573
|
+
{
|
|
3574
|
+
state: "FL",
|
|
3575
|
+
stateBoardDisplay: "Florida Board of Medicine",
|
|
3576
|
+
licenseNumber: "FL-MD-ME119001",
|
|
3577
|
+
issued: "2015-12-12",
|
|
3578
|
+
expires: "2026-12-31",
|
|
3579
|
+
status: CREDENTIALING_STATUS.SUSPENDED
|
|
3580
|
+
}
|
|
3581
|
+
],
|
|
3582
|
+
"on-site-demo-doctor-008": [
|
|
3583
|
+
{
|
|
3584
|
+
state: "GA",
|
|
3585
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3586
|
+
licenseNumber: "GA-MD-101203",
|
|
3587
|
+
issued: "2018-08-09",
|
|
3588
|
+
expires: "2027-08-31",
|
|
3589
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3590
|
+
},
|
|
3591
|
+
{
|
|
3592
|
+
state: "SC",
|
|
3593
|
+
stateBoardDisplay: "South Carolina Board of Medical Examiners",
|
|
3594
|
+
licenseNumber: "SC-MD-35112",
|
|
3595
|
+
issued: "2021-02-01",
|
|
3596
|
+
expires: "2027-02-28",
|
|
3597
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3598
|
+
}
|
|
3599
|
+
],
|
|
3600
|
+
"on-site-demo-doctor-009": [
|
|
3601
|
+
{
|
|
3602
|
+
state: "GA",
|
|
3603
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3604
|
+
licenseNumber: "GA-MD-061887",
|
|
3605
|
+
issued: "2010-11-30",
|
|
3606
|
+
expires: "2026-11-30",
|
|
3607
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3608
|
+
},
|
|
3609
|
+
{
|
|
3610
|
+
state: "TN",
|
|
3611
|
+
stateBoardDisplay: "Tennessee Board of Medical Examiners",
|
|
3612
|
+
licenseNumber: "TN-MD-MD38712",
|
|
3613
|
+
issued: "2012-06-04",
|
|
3614
|
+
expires: "2024-06-30",
|
|
3615
|
+
status: CREDENTIALING_STATUS.EXPIRED
|
|
3616
|
+
}
|
|
3617
|
+
],
|
|
3618
|
+
"on-site-demo-doctor-010": [
|
|
3619
|
+
{
|
|
3620
|
+
state: "GA",
|
|
3621
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3622
|
+
licenseNumber: "GA-MD-108901",
|
|
3623
|
+
issued: "2020-03-15",
|
|
3624
|
+
expires: "2027-03-31",
|
|
3625
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3626
|
+
}
|
|
3627
|
+
]
|
|
3628
|
+
};
|
|
3629
|
+
var practitionerCredentialingForDoctor = (practitionerId) => PRACTITIONER_CREDENTIALING_BY_DOCTOR[practitionerId] ?? [];
|
|
3630
|
+
var buildCredentialingQualifications = (practitionerId) => practitionerCredentialingForDoctor(practitionerId).map((cred) => ({
|
|
3631
|
+
identifier: [
|
|
3632
|
+
{
|
|
3633
|
+
system: STATE_MEDICAL_LICENSE_SYSTEM,
|
|
3634
|
+
value: cred.licenseNumber
|
|
3635
|
+
}
|
|
3636
|
+
],
|
|
3637
|
+
code: {
|
|
3638
|
+
text: "Medical License"
|
|
3639
|
+
},
|
|
3640
|
+
period: {
|
|
3641
|
+
start: cred.issued,
|
|
3642
|
+
end: cred.expires
|
|
3643
|
+
},
|
|
3644
|
+
issuer: {
|
|
3645
|
+
display: cred.stateBoardDisplay
|
|
3646
|
+
},
|
|
3647
|
+
extension: [
|
|
3648
|
+
{
|
|
3649
|
+
url: PRACTITIONER_CREDENTIALING_EXTENSION_URL,
|
|
3650
|
+
extension: [
|
|
3651
|
+
{
|
|
3652
|
+
url: PRACTITIONER_CREDENTIALING_STATE_SUB_EXTENSION_URL,
|
|
3653
|
+
valueCode: cred.state
|
|
3654
|
+
},
|
|
3655
|
+
{
|
|
3656
|
+
url: PRACTITIONER_CREDENTIALING_STATUS_SUB_EXTENSION_URL,
|
|
3657
|
+
valueCode: cred.status
|
|
3658
|
+
}
|
|
3659
|
+
]
|
|
3660
|
+
}
|
|
3661
|
+
]
|
|
3662
|
+
}));
|
|
3663
|
+
|
|
3664
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-fixtures.ts
|
|
3665
|
+
var US_NPI_SYSTEM = "http://hl7.org/fhir/sid/us-npi";
|
|
3666
|
+
var HOME_HEALTH_ELIGIBLE_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/home-health-eligible";
|
|
3667
|
+
var PRACTITIONER_ROLE_PHYSICIAN = "Physician";
|
|
3668
|
+
var PRACTITIONER_ROLE_SCRIBE = "Scribe";
|
|
3669
|
+
var ON_SITE_STAFF_ID_SYSTEM = "https://on-site-medical.app/fhir/sid/staff-id";
|
|
3670
|
+
var DOCTOR_SPECS = [
|
|
3671
|
+
{
|
|
3672
|
+
id: "on-site-demo-doctor-001",
|
|
3673
|
+
firstName: "Sarah",
|
|
3674
|
+
lastName: "Patel",
|
|
3675
|
+
suffix: "MD",
|
|
3676
|
+
gender: "female",
|
|
3677
|
+
birthDate: "1978-03-14",
|
|
3678
|
+
phone: "+14045550101",
|
|
3679
|
+
email: "sarah.patel@on-site-demo.example.com",
|
|
3680
|
+
npi: "1003000001",
|
|
3681
|
+
addressLine: "120 Peachtree Street NE",
|
|
3682
|
+
addressCity: "Atlanta",
|
|
3683
|
+
addressState: "GA",
|
|
3684
|
+
addressPostalCode: "30303",
|
|
3685
|
+
homeHealthEligible: true
|
|
3686
|
+
},
|
|
3687
|
+
{
|
|
3688
|
+
id: "on-site-demo-doctor-002",
|
|
3689
|
+
firstName: "Michael",
|
|
3690
|
+
lastName: "Brennan",
|
|
3691
|
+
suffix: "DO",
|
|
3692
|
+
gender: "male",
|
|
3693
|
+
birthDate: "1972-08-22",
|
|
3694
|
+
phone: "+14045550102",
|
|
3695
|
+
email: "michael.brennan@on-site-demo.example.com",
|
|
3696
|
+
npi: "1003000002",
|
|
3697
|
+
addressLine: "300 Ponce de Leon Avenue",
|
|
3698
|
+
addressCity: "Atlanta",
|
|
3699
|
+
addressState: "GA",
|
|
3700
|
+
addressPostalCode: "30308",
|
|
3701
|
+
homeHealthEligible: true
|
|
3702
|
+
},
|
|
3703
|
+
{
|
|
3704
|
+
id: "on-site-demo-doctor-003",
|
|
3705
|
+
firstName: "Linda",
|
|
3706
|
+
lastName: "Nguyen",
|
|
3707
|
+
suffix: "MD",
|
|
3708
|
+
gender: "female",
|
|
3709
|
+
birthDate: "1981-11-05",
|
|
3710
|
+
phone: "+14045550103",
|
|
3711
|
+
email: "linda.nguyen@on-site-demo.example.com",
|
|
3712
|
+
npi: "1003000003",
|
|
3713
|
+
addressLine: "75 Piedmont Avenue",
|
|
3714
|
+
addressCity: "Atlanta",
|
|
3715
|
+
addressState: "GA",
|
|
3716
|
+
addressPostalCode: "30303",
|
|
3717
|
+
homeHealthEligible: true
|
|
3718
|
+
},
|
|
3719
|
+
{
|
|
3720
|
+
id: "on-site-demo-doctor-004",
|
|
3721
|
+
firstName: "James",
|
|
3722
|
+
lastName: "Ortiz",
|
|
3723
|
+
suffix: "MD",
|
|
3724
|
+
gender: "male",
|
|
3725
|
+
birthDate: "1969-04-30",
|
|
3726
|
+
phone: "+14045550104",
|
|
3727
|
+
email: "james.ortiz@on-site-demo.example.com",
|
|
3728
|
+
npi: "1003000004",
|
|
3729
|
+
addressLine: "1825 Howell Mill Road",
|
|
3730
|
+
addressCity: "Atlanta",
|
|
3731
|
+
addressState: "GA",
|
|
3732
|
+
addressPostalCode: "30318",
|
|
3733
|
+
homeHealthEligible: true
|
|
3734
|
+
},
|
|
3735
|
+
{
|
|
3736
|
+
id: "on-site-demo-doctor-005",
|
|
3737
|
+
firstName: "Olivia",
|
|
3738
|
+
lastName: "Carter",
|
|
3739
|
+
suffix: "MD",
|
|
3740
|
+
gender: "female",
|
|
3741
|
+
birthDate: "1985-07-19",
|
|
3742
|
+
phone: "+14045550105",
|
|
3743
|
+
email: "olivia.carter@on-site-demo.example.com",
|
|
3744
|
+
npi: "1003000005",
|
|
3745
|
+
addressLine: "999 Peachtree Street NE",
|
|
3746
|
+
addressCity: "Atlanta",
|
|
3747
|
+
addressState: "GA",
|
|
3748
|
+
addressPostalCode: "30309",
|
|
3749
|
+
homeHealthEligible: true
|
|
3750
|
+
},
|
|
3751
|
+
{
|
|
3752
|
+
id: "on-site-demo-doctor-006",
|
|
3753
|
+
firstName: "David",
|
|
3754
|
+
lastName: "Sullivan",
|
|
3755
|
+
suffix: "MD",
|
|
3756
|
+
gender: "male",
|
|
3757
|
+
birthDate: "1965-12-02",
|
|
3758
|
+
phone: "+14045550106",
|
|
3759
|
+
email: "david.sullivan@on-site-demo.example.com",
|
|
3760
|
+
npi: "1003000006",
|
|
3761
|
+
addressLine: "550 Pharr Road",
|
|
3762
|
+
addressCity: "Atlanta",
|
|
3763
|
+
addressState: "GA",
|
|
3764
|
+
addressPostalCode: "30305",
|
|
3765
|
+
homeHealthEligible: false
|
|
3766
|
+
},
|
|
3767
|
+
{
|
|
3768
|
+
id: "on-site-demo-doctor-007",
|
|
3769
|
+
firstName: "Maria",
|
|
3770
|
+
lastName: "Hernandez",
|
|
3771
|
+
suffix: "MD",
|
|
3772
|
+
gender: "female",
|
|
3773
|
+
birthDate: "1976-06-11",
|
|
3774
|
+
phone: "+14045550107",
|
|
3775
|
+
email: "maria.hernandez@on-site-demo.example.com",
|
|
3776
|
+
npi: "1003000007",
|
|
3777
|
+
addressLine: "2200 Northside Drive NW",
|
|
3778
|
+
addressCity: "Atlanta",
|
|
3779
|
+
addressState: "GA",
|
|
3780
|
+
addressPostalCode: "30318",
|
|
3781
|
+
homeHealthEligible: false
|
|
3782
|
+
},
|
|
3783
|
+
{
|
|
3784
|
+
id: "on-site-demo-doctor-008",
|
|
3785
|
+
firstName: "Robert",
|
|
3786
|
+
lastName: "Kim",
|
|
3787
|
+
suffix: "DO",
|
|
3788
|
+
gender: "male",
|
|
3789
|
+
birthDate: "1983-02-27",
|
|
3790
|
+
phone: "+14045550108",
|
|
3791
|
+
email: "robert.kim@on-site-demo.example.com",
|
|
3792
|
+
npi: "1003000008",
|
|
3793
|
+
addressLine: "400 West Peachtree Street",
|
|
3794
|
+
addressCity: "Atlanta",
|
|
3795
|
+
addressState: "GA",
|
|
3796
|
+
addressPostalCode: "30308",
|
|
3797
|
+
homeHealthEligible: false
|
|
3798
|
+
},
|
|
3799
|
+
{
|
|
3800
|
+
id: "on-site-demo-doctor-009",
|
|
3801
|
+
firstName: "Jennifer",
|
|
3802
|
+
lastName: "Williams",
|
|
3803
|
+
suffix: "MD",
|
|
3804
|
+
gender: "female",
|
|
3805
|
+
birthDate: "1970-10-16",
|
|
3806
|
+
phone: "+14045550109",
|
|
3807
|
+
email: "jennifer.williams@on-site-demo.example.com",
|
|
3808
|
+
npi: "1003000009",
|
|
3809
|
+
addressLine: "1364 Clifton Road NE",
|
|
3810
|
+
addressCity: "Atlanta",
|
|
3811
|
+
addressState: "GA",
|
|
3812
|
+
addressPostalCode: "30322",
|
|
3813
|
+
homeHealthEligible: false
|
|
3814
|
+
},
|
|
3815
|
+
{
|
|
3816
|
+
id: "on-site-demo-doctor-010",
|
|
3817
|
+
firstName: "Thomas",
|
|
3818
|
+
lastName: "Anderson",
|
|
3819
|
+
suffix: "MD",
|
|
3820
|
+
gender: "male",
|
|
3821
|
+
birthDate: "1988-09-08",
|
|
3822
|
+
phone: "+14045550110",
|
|
3823
|
+
email: "thomas.anderson@on-site-demo.example.com",
|
|
3824
|
+
npi: "1003000010",
|
|
3825
|
+
addressLine: "1900 The Exchange SE",
|
|
3826
|
+
addressCity: "Atlanta",
|
|
3827
|
+
addressState: "GA",
|
|
3828
|
+
addressPostalCode: "30339",
|
|
3829
|
+
homeHealthEligible: false
|
|
3830
|
+
}
|
|
3831
|
+
];
|
|
3832
|
+
var SCRIBE_SPECS = [
|
|
3833
|
+
{
|
|
3834
|
+
id: "on-site-demo-scribe-001",
|
|
3835
|
+
firstName: "Emily",
|
|
3836
|
+
lastName: "Reed",
|
|
3837
|
+
gender: "female",
|
|
3838
|
+
birthDate: "1995-01-23",
|
|
3839
|
+
phone: "+14045550201",
|
|
3840
|
+
email: "emily.reed@on-site-demo.example.com",
|
|
3841
|
+
staffId: "SCR-0001",
|
|
3842
|
+
addressLine: "240 Edgewood Avenue SE",
|
|
3843
|
+
addressCity: "Atlanta",
|
|
3844
|
+
addressState: "GA",
|
|
3845
|
+
addressPostalCode: "30303"
|
|
3846
|
+
},
|
|
3847
|
+
{
|
|
3848
|
+
id: "on-site-demo-scribe-002",
|
|
3849
|
+
firstName: "Daniel",
|
|
3850
|
+
lastName: "Foster",
|
|
3851
|
+
gender: "male",
|
|
3852
|
+
birthDate: "1993-05-17",
|
|
3853
|
+
phone: "+14045550202",
|
|
3854
|
+
email: "daniel.foster@on-site-demo.example.com",
|
|
3855
|
+
staffId: "SCR-0002",
|
|
3856
|
+
addressLine: "780 Boulevard SE",
|
|
3857
|
+
addressCity: "Atlanta",
|
|
3858
|
+
addressState: "GA",
|
|
3859
|
+
addressPostalCode: "30312"
|
|
3860
|
+
},
|
|
3861
|
+
{
|
|
3862
|
+
id: "on-site-demo-scribe-003",
|
|
3863
|
+
firstName: "Ashley",
|
|
3864
|
+
lastName: "Garrett",
|
|
3865
|
+
gender: "female",
|
|
3866
|
+
birthDate: "1997-11-29",
|
|
3867
|
+
phone: "+14045550203",
|
|
3868
|
+
email: "ashley.garrett@on-site-demo.example.com",
|
|
3869
|
+
staffId: "SCR-0003",
|
|
3870
|
+
addressLine: "55 Allen Plaza",
|
|
3871
|
+
addressCity: "Atlanta",
|
|
3872
|
+
addressState: "GA",
|
|
3873
|
+
addressPostalCode: "30308"
|
|
3874
|
+
},
|
|
3875
|
+
{
|
|
3876
|
+
id: "on-site-demo-scribe-004",
|
|
3877
|
+
firstName: "Brandon",
|
|
3878
|
+
lastName: "Murray",
|
|
3879
|
+
gender: "male",
|
|
3880
|
+
birthDate: "1991-07-04",
|
|
3881
|
+
phone: "+14045550204",
|
|
3882
|
+
email: "brandon.murray@on-site-demo.example.com",
|
|
3883
|
+
staffId: "SCR-0004",
|
|
3884
|
+
addressLine: "1100 Spring Street NW",
|
|
3885
|
+
addressCity: "Atlanta",
|
|
3886
|
+
addressState: "GA",
|
|
3887
|
+
addressPostalCode: "30309"
|
|
3888
|
+
},
|
|
3889
|
+
{
|
|
3890
|
+
id: "on-site-demo-scribe-005",
|
|
3891
|
+
firstName: "Sofia",
|
|
3892
|
+
lastName: "Bennett",
|
|
3893
|
+
gender: "female",
|
|
3894
|
+
birthDate: "1999-03-12",
|
|
3895
|
+
phone: "+14045550205",
|
|
3896
|
+
email: "sofia.bennett@on-site-demo.example.com",
|
|
3897
|
+
staffId: "SCR-0005",
|
|
3898
|
+
addressLine: "165 Courtland Street NE",
|
|
3899
|
+
addressCity: "Atlanta",
|
|
3900
|
+
addressState: "GA",
|
|
3901
|
+
addressPostalCode: "30303"
|
|
3902
|
+
}
|
|
3903
|
+
];
|
|
3904
|
+
var ON_SITE_SCENARIO8 = "on-site-demo";
|
|
3905
|
+
var buildIdentifierPair7 = (practitionerId, roleSuffix) => [
|
|
3906
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO8, roleSuffix),
|
|
3907
|
+
openhiResourceIdentifier({
|
|
3908
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
3909
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
3910
|
+
resourceType: "Practitioner",
|
|
3911
|
+
id: practitionerId
|
|
3912
|
+
})
|
|
3913
|
+
];
|
|
3914
|
+
var buildDoctorResource = (spec) => {
|
|
3915
|
+
const fullText = `${spec.firstName} ${spec.lastName}${spec.suffix ? `, ${spec.suffix}` : ""}`;
|
|
3916
|
+
const baseIdentifiers = buildIdentifierPair7(
|
|
3917
|
+
spec.id,
|
|
3918
|
+
`practitioner-${spec.id}`
|
|
3919
|
+
);
|
|
3920
|
+
return {
|
|
3921
|
+
resourceType: "Practitioner",
|
|
3922
|
+
id: spec.id,
|
|
3923
|
+
active: true,
|
|
3924
|
+
identifier: [
|
|
3925
|
+
...baseIdentifiers ?? [],
|
|
3926
|
+
{
|
|
3927
|
+
system: US_NPI_SYSTEM,
|
|
3928
|
+
value: spec.npi
|
|
3929
|
+
}
|
|
3930
|
+
],
|
|
3931
|
+
name: [
|
|
3932
|
+
{
|
|
3933
|
+
use: "official",
|
|
3934
|
+
text: fullText,
|
|
3935
|
+
given: [spec.firstName],
|
|
3936
|
+
family: spec.lastName,
|
|
3937
|
+
prefix: ["Dr."],
|
|
3938
|
+
...spec.suffix ? { suffix: [spec.suffix] } : {}
|
|
3939
|
+
}
|
|
3940
|
+
],
|
|
3941
|
+
gender: spec.gender,
|
|
3942
|
+
birthDate: spec.birthDate,
|
|
3943
|
+
telecom: [
|
|
3944
|
+
{ system: "phone", value: spec.phone, use: "work" },
|
|
3945
|
+
{ system: "email", value: spec.email, use: "work" }
|
|
3946
|
+
],
|
|
3947
|
+
address: [
|
|
3948
|
+
{
|
|
3949
|
+
use: "work",
|
|
3950
|
+
line: [spec.addressLine],
|
|
3951
|
+
city: spec.addressCity,
|
|
3952
|
+
state: spec.addressState,
|
|
3953
|
+
postalCode: spec.addressPostalCode,
|
|
3954
|
+
country: "US"
|
|
3955
|
+
}
|
|
3956
|
+
],
|
|
3957
|
+
qualification: [
|
|
3958
|
+
{
|
|
3959
|
+
code: {
|
|
3960
|
+
text: PRACTITIONER_ROLE_PHYSICIAN
|
|
3961
|
+
}
|
|
3962
|
+
},
|
|
3963
|
+
// Per-state credentialing entries appended after the role
|
|
3964
|
+
// label (#1308). Each on-site doctor carries 1-3 state
|
|
3965
|
+
// licenses with status / period / issuer fields populated
|
|
3966
|
+
// for the directory UI's credentialing column.
|
|
3967
|
+
...buildCredentialingQualifications(spec.id)
|
|
3968
|
+
],
|
|
3969
|
+
...spec.homeHealthEligible ? {
|
|
3970
|
+
extension: [
|
|
3971
|
+
{
|
|
3972
|
+
url: HOME_HEALTH_ELIGIBLE_EXTENSION_URL,
|
|
3973
|
+
valueBoolean: true
|
|
3974
|
+
}
|
|
3975
|
+
]
|
|
3976
|
+
} : {}
|
|
3977
|
+
};
|
|
3978
|
+
};
|
|
3979
|
+
var buildScribeResource = (spec) => {
|
|
3980
|
+
const fullText = `${spec.firstName} ${spec.lastName}`;
|
|
3981
|
+
const baseIdentifiers = buildIdentifierPair7(
|
|
3982
|
+
spec.id,
|
|
3983
|
+
`practitioner-${spec.id}`
|
|
3984
|
+
);
|
|
3985
|
+
return {
|
|
3986
|
+
resourceType: "Practitioner",
|
|
3987
|
+
id: spec.id,
|
|
3988
|
+
active: true,
|
|
3989
|
+
identifier: [
|
|
3990
|
+
...baseIdentifiers ?? [],
|
|
3991
|
+
{
|
|
3992
|
+
system: ON_SITE_STAFF_ID_SYSTEM,
|
|
3993
|
+
value: spec.staffId
|
|
3994
|
+
}
|
|
3995
|
+
],
|
|
3996
|
+
name: [
|
|
3997
|
+
{
|
|
3998
|
+
use: "official",
|
|
3999
|
+
text: fullText,
|
|
4000
|
+
given: [spec.firstName],
|
|
4001
|
+
family: spec.lastName
|
|
4002
|
+
}
|
|
4003
|
+
],
|
|
4004
|
+
gender: spec.gender,
|
|
4005
|
+
birthDate: spec.birthDate,
|
|
4006
|
+
telecom: [
|
|
4007
|
+
{ system: "phone", value: spec.phone, use: "work" },
|
|
4008
|
+
{ system: "email", value: spec.email, use: "work" }
|
|
4009
|
+
],
|
|
4010
|
+
address: [
|
|
4011
|
+
{
|
|
4012
|
+
use: "work",
|
|
4013
|
+
line: [spec.addressLine],
|
|
4014
|
+
city: spec.addressCity,
|
|
4015
|
+
state: spec.addressState,
|
|
4016
|
+
postalCode: spec.addressPostalCode,
|
|
4017
|
+
country: "US"
|
|
4018
|
+
}
|
|
4019
|
+
],
|
|
4020
|
+
qualification: [
|
|
4021
|
+
{
|
|
4022
|
+
code: {
|
|
4023
|
+
text: PRACTITIONER_ROLE_SCRIBE
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
]
|
|
4027
|
+
};
|
|
4028
|
+
};
|
|
4029
|
+
var ON_SITE_DEMO_DOCTORS = DOCTOR_SPECS.map(buildDoctorResource);
|
|
4030
|
+
var ON_SITE_DEMO_SCRIBES = SCRIBE_SPECS.map(buildScribeResource);
|
|
4031
|
+
var ON_SITE_DEMO_DOCTOR_IDS = DOCTOR_SPECS.map(
|
|
4032
|
+
(d) => d.id
|
|
4033
|
+
);
|
|
4034
|
+
var ON_SITE_DEMO_SCRIBE_IDS = SCRIBE_SPECS.map(
|
|
4035
|
+
(s) => s.id
|
|
4036
|
+
);
|
|
4037
|
+
var homeHealthEligibleDoctors = () => ON_SITE_DEMO_DOCTORS.filter(
|
|
4038
|
+
(p) => (p.extension ?? []).some(
|
|
4039
|
+
(ext) => ext.url === HOME_HEALTH_ELIGIBLE_EXTENSION_URL && ext.valueBoolean === true
|
|
4040
|
+
)
|
|
4041
|
+
);
|
|
4042
|
+
var ON_SITE_DEMO_FIXTURES = {
|
|
4043
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
4044
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
4045
|
+
scenario: ON_SITE_SCENARIO8,
|
|
4046
|
+
// Patients + Coverages are materialised lazily via the
|
|
4047
|
+
// `buildPatients` / `buildCoverages` hooks below. Module-level
|
|
4048
|
+
// arrays would force a TDZ on the cross-module imports between
|
|
4049
|
+
// `on-site-demo-fixtures.ts`, `on-site-demo-blocks.ts`, and
|
|
4050
|
+
// `on-site-demo-facility-patients.ts`.
|
|
4051
|
+
patients: [],
|
|
4052
|
+
practitioners: [...ON_SITE_DEMO_DOCTORS, ...ON_SITE_DEMO_SCRIBES],
|
|
4053
|
+
observations: [],
|
|
4054
|
+
encounters: [],
|
|
4055
|
+
accounts: [],
|
|
4056
|
+
locations: [...ON_SITE_DEMO_FACILITIES],
|
|
4057
|
+
organizations: [...ON_SITE_DEMO_DIRECTORY_ORGANIZATIONS],
|
|
4058
|
+
buildPatients: () => [
|
|
4059
|
+
...buildOnSiteDemoFacilityPatients(),
|
|
4060
|
+
...buildOnSiteDemoHomeHealthPatients()
|
|
4061
|
+
],
|
|
4062
|
+
buildCoverages: () => [
|
|
4063
|
+
...buildOnSiteDemoFacilityCoverages(),
|
|
4064
|
+
...buildOnSiteDemoHomeHealthCoverages()
|
|
4065
|
+
],
|
|
4066
|
+
buildAppointments: (baseContext) => buildOnSiteDemoBlockAppointments(
|
|
4067
|
+
baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
4068
|
+
),
|
|
4069
|
+
buildConditions: (baseContext) => buildOnSiteDemoWoundConditions(
|
|
4070
|
+
baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
4071
|
+
),
|
|
4072
|
+
buildEncounters: (baseContext) => buildOnSiteDemoEncounters(baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()),
|
|
4073
|
+
buildObservations: (baseContext) => buildOnSiteDemoWoundObservations(
|
|
4074
|
+
baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
4075
|
+
),
|
|
4076
|
+
buildProcedures: (baseContext) => buildOnSiteDemoWoundProcedures(
|
|
4077
|
+
baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
4078
|
+
),
|
|
4079
|
+
buildClaims: (baseContext) => buildOnSiteDemoClaims(baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()),
|
|
4080
|
+
buildPaymentNotices: (baseContext) => buildOnSiteDemoPaymentNotices(baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString())
|
|
4081
|
+
};
|
|
4082
|
+
|
|
4083
|
+
// src/workflows/control-plane/seed-demo-data/data-plane-fixtures.ts
|
|
4084
|
+
var fixtureIdentifiers = (scenario, tenantId, workspaceId, resourceType, id, roleSuffix) => [
|
|
4085
|
+
demoScenarioIdentifier(scenario, roleSuffix),
|
|
4086
|
+
openhiResourceIdentifier({
|
|
4087
|
+
tenantId,
|
|
4088
|
+
workspaceId,
|
|
4089
|
+
resourceType,
|
|
4090
|
+
id
|
|
4091
|
+
})
|
|
4092
|
+
];
|
|
4093
|
+
var buildWoundCareFixtures = (scenario, tenantId, workspaceId, idPrefix) => ({
|
|
4094
|
+
tenantId,
|
|
4095
|
+
workspaceId,
|
|
4096
|
+
scenario,
|
|
4097
|
+
patients: [
|
|
4098
|
+
{
|
|
4099
|
+
resourceType: "Patient",
|
|
4100
|
+
id: `${idPrefix}-patient-1`,
|
|
4101
|
+
identifier: fixtureIdentifiers(
|
|
4102
|
+
scenario,
|
|
4103
|
+
tenantId,
|
|
4104
|
+
workspaceId,
|
|
4105
|
+
"Patient",
|
|
4106
|
+
`${idPrefix}-patient-1`,
|
|
4107
|
+
`patient-1`
|
|
4108
|
+
),
|
|
4109
|
+
active: true,
|
|
4110
|
+
name: [{ family: "Carter", given: ["Eleanor"], use: "official" }],
|
|
4111
|
+
gender: "female",
|
|
4112
|
+
birthDate: "1952-04-18"
|
|
4113
|
+
},
|
|
4114
|
+
{
|
|
4115
|
+
resourceType: "Patient",
|
|
4116
|
+
id: `${idPrefix}-patient-2`,
|
|
4117
|
+
identifier: fixtureIdentifiers(
|
|
4118
|
+
scenario,
|
|
4119
|
+
tenantId,
|
|
4120
|
+
workspaceId,
|
|
4121
|
+
"Patient",
|
|
4122
|
+
`${idPrefix}-patient-2`,
|
|
4123
|
+
`patient-2`
|
|
4124
|
+
),
|
|
4125
|
+
active: true,
|
|
4126
|
+
name: [{ family: "Nguyen", given: ["Hao"], use: "official" }],
|
|
4127
|
+
gender: "male",
|
|
4128
|
+
birthDate: "1968-11-02"
|
|
4129
|
+
}
|
|
4130
|
+
],
|
|
4131
|
+
practitioners: [
|
|
4132
|
+
{
|
|
4133
|
+
resourceType: "Practitioner",
|
|
4134
|
+
id: `${idPrefix}-practitioner-1`,
|
|
4135
|
+
identifier: fixtureIdentifiers(
|
|
4136
|
+
scenario,
|
|
4137
|
+
tenantId,
|
|
4138
|
+
workspaceId,
|
|
4139
|
+
"Practitioner",
|
|
4140
|
+
`${idPrefix}-practitioner-1`,
|
|
4141
|
+
`practitioner-1`
|
|
4142
|
+
),
|
|
4143
|
+
active: true,
|
|
4144
|
+
name: [{ family: "Reyes", given: ["Maria"], prefix: ["Dr."] }],
|
|
4145
|
+
gender: "female"
|
|
4146
|
+
},
|
|
4147
|
+
{
|
|
4148
|
+
resourceType: "Practitioner",
|
|
4149
|
+
id: `${idPrefix}-practitioner-2`,
|
|
4150
|
+
identifier: fixtureIdentifiers(
|
|
4151
|
+
scenario,
|
|
4152
|
+
tenantId,
|
|
4153
|
+
workspaceId,
|
|
4154
|
+
"Practitioner",
|
|
4155
|
+
`${idPrefix}-practitioner-2`,
|
|
4156
|
+
`practitioner-2`
|
|
4157
|
+
),
|
|
4158
|
+
active: true,
|
|
4159
|
+
name: [{ family: "Okafor", given: ["Chinedu"], prefix: ["Dr."] }],
|
|
4160
|
+
gender: "male"
|
|
4161
|
+
}
|
|
4162
|
+
],
|
|
4163
|
+
observations: [
|
|
4164
|
+
{
|
|
4165
|
+
resourceType: "Observation",
|
|
4166
|
+
id: `${idPrefix}-observation-1`,
|
|
4167
|
+
identifier: fixtureIdentifiers(
|
|
4168
|
+
scenario,
|
|
4169
|
+
tenantId,
|
|
4170
|
+
workspaceId,
|
|
4171
|
+
"Observation",
|
|
4172
|
+
`${idPrefix}-observation-1`,
|
|
4173
|
+
`observation-1`
|
|
4174
|
+
),
|
|
4175
|
+
status: "final",
|
|
4176
|
+
code: {
|
|
4177
|
+
coding: [
|
|
4178
|
+
{
|
|
4179
|
+
system: "http://loinc.org",
|
|
4180
|
+
code: "39135-9",
|
|
4181
|
+
display: "Wound size"
|
|
4182
|
+
}
|
|
4183
|
+
]
|
|
4184
|
+
},
|
|
4185
|
+
subject: { reference: `Patient/${idPrefix}-patient-1` },
|
|
4186
|
+
valueString: "3.2cm x 2.1cm"
|
|
4187
|
+
},
|
|
4188
|
+
{
|
|
4189
|
+
resourceType: "Observation",
|
|
4190
|
+
id: `${idPrefix}-observation-2`,
|
|
4191
|
+
identifier: fixtureIdentifiers(
|
|
4192
|
+
scenario,
|
|
4193
|
+
tenantId,
|
|
4194
|
+
workspaceId,
|
|
4195
|
+
"Observation",
|
|
4196
|
+
`${idPrefix}-observation-2`,
|
|
4197
|
+
`observation-2`
|
|
4198
|
+
),
|
|
4199
|
+
status: "final",
|
|
4200
|
+
code: {
|
|
4201
|
+
coding: [
|
|
4202
|
+
{
|
|
4203
|
+
system: "http://loinc.org",
|
|
4204
|
+
code: "72287-2",
|
|
4205
|
+
display: "Wound exudate amount"
|
|
4206
|
+
}
|
|
4207
|
+
]
|
|
4208
|
+
},
|
|
4209
|
+
subject: { reference: `Patient/${idPrefix}-patient-2` },
|
|
4210
|
+
valueString: "moderate"
|
|
4211
|
+
}
|
|
4212
|
+
],
|
|
4213
|
+
encounters: [
|
|
4214
|
+
{
|
|
4215
|
+
resourceType: "Encounter",
|
|
4216
|
+
id: `${idPrefix}-encounter-1`,
|
|
4217
|
+
identifier: fixtureIdentifiers(
|
|
4218
|
+
scenario,
|
|
4219
|
+
tenantId,
|
|
4220
|
+
workspaceId,
|
|
4221
|
+
"Encounter",
|
|
4222
|
+
`${idPrefix}-encounter-1`,
|
|
4223
|
+
`encounter-1`
|
|
4224
|
+
),
|
|
4225
|
+
status: "finished",
|
|
4226
|
+
class: {
|
|
4227
|
+
system: "http://terminology.hl7.org/CodeSystem/v3-ActCode",
|
|
4228
|
+
code: "AMB",
|
|
4229
|
+
display: "ambulatory"
|
|
4230
|
+
},
|
|
4231
|
+
subject: { reference: `Patient/${idPrefix}-patient-1` }
|
|
4232
|
+
},
|
|
4233
|
+
{
|
|
4234
|
+
resourceType: "Encounter",
|
|
4235
|
+
id: `${idPrefix}-encounter-2`,
|
|
986
4236
|
identifier: fixtureIdentifiers(
|
|
987
4237
|
scenario,
|
|
988
4238
|
tenantId,
|
|
@@ -1197,6 +4447,10 @@ var buildPrimaryCareFixtures = (scenario, tenantId, workspaceId, idPrefix) => ({
|
|
|
1197
4447
|
]
|
|
1198
4448
|
});
|
|
1199
4449
|
var DEMO_DATA_PLANE_FIXTURES = [
|
|
4450
|
+
// On-site-medical UAT demo workspace — practitioners only (issue
|
|
4451
|
+
// #1302). Patients, encounters, and other data-plane resources for
|
|
4452
|
+
// this tenant land in later tickets.
|
|
4453
|
+
ON_SITE_DEMO_FIXTURES,
|
|
1200
4454
|
buildWoundCareFixtures(
|
|
1201
4455
|
"demo-wound-care",
|
|
1202
4456
|
"demo-wound-care-tenant",
|
|
@@ -2691,6 +5945,24 @@ var TenantEntity = new import_electrodb11.Entity({
|
|
|
2691
5945
|
type: "string",
|
|
2692
5946
|
required: true
|
|
2693
5947
|
},
|
|
5948
|
+
/**
|
|
5949
|
+
* ADR-028 denormalized counter — number of tenant-scoped Memberships
|
|
5950
|
+
* (users) in this tenant. Maintained by the counter-maintenance
|
|
5951
|
+
* consumer via atomic ADD; absent/0 until first event or reconciliation.
|
|
5952
|
+
*/
|
|
5953
|
+
usersInTenant: {
|
|
5954
|
+
type: "number",
|
|
5955
|
+
required: false
|
|
5956
|
+
},
|
|
5957
|
+
/**
|
|
5958
|
+
* ADR-028 denormalized counter — number of Workspaces in this tenant.
|
|
5959
|
+
* Maintained by the counter-maintenance consumer via atomic ADD;
|
|
5960
|
+
* absent/0 until first event or reconciliation.
|
|
5961
|
+
*/
|
|
5962
|
+
workspacesInTenant: {
|
|
5963
|
+
type: "number",
|
|
5964
|
+
required: false
|
|
5965
|
+
},
|
|
2694
5966
|
gsi1Shard: gsi1ShardAttribute,
|
|
2695
5967
|
/** Derived GSI1 sort key — name-based when extractable; else `<lastUpdated>#<id>`. */
|
|
2696
5968
|
gsi1sk: gsi1skAttribute,
|
|
@@ -2795,6 +6067,26 @@ var UserEntity = new import_electrodb12.Entity({
|
|
|
2795
6067
|
type: "string",
|
|
2796
6068
|
required: true
|
|
2797
6069
|
},
|
|
6070
|
+
/**
|
|
6071
|
+
* ADR-028 denormalized counter — number of tenant-scoped Memberships
|
|
6072
|
+
* (tenants) this user belongs to. Maintained by the
|
|
6073
|
+
* counter-maintenance consumer via atomic ADD; absent/0 until first
|
|
6074
|
+
* event or reconciliation.
|
|
6075
|
+
*/
|
|
6076
|
+
tenantsForUser: {
|
|
6077
|
+
type: "number",
|
|
6078
|
+
required: false
|
|
6079
|
+
},
|
|
6080
|
+
/**
|
|
6081
|
+
* ADR-028 denormalized counter — number of workspace-scoped
|
|
6082
|
+
* Memberships (workspaces) this user belongs to. Maintained by the
|
|
6083
|
+
* counter-maintenance consumer via atomic ADD; absent/0 until first
|
|
6084
|
+
* event or reconciliation.
|
|
6085
|
+
*/
|
|
6086
|
+
workspacesForUser: {
|
|
6087
|
+
type: "number",
|
|
6088
|
+
required: false
|
|
6089
|
+
},
|
|
2798
6090
|
gsi1Shard: gsi1ShardAttribute,
|
|
2799
6091
|
/** Derived GSI1 sort key — name-based when extractable; else `<lastUpdated>#<id>`. */
|
|
2800
6092
|
gsi1sk: gsi1skAttribute,
|
|
@@ -2939,6 +6231,36 @@ var WorkspaceEntity = new import_electrodb13.Entity({
|
|
|
2939
6231
|
type: "string",
|
|
2940
6232
|
required: true
|
|
2941
6233
|
},
|
|
6234
|
+
/**
|
|
6235
|
+
* ADR-028 denormalized counter — number of workspace-scoped
|
|
6236
|
+
* Memberships (users) in this workspace. Maintained by the
|
|
6237
|
+
* counter-maintenance consumer via atomic ADD; absent/0 until first
|
|
6238
|
+
* event or reconciliation.
|
|
6239
|
+
*/
|
|
6240
|
+
usersInWorkspace: {
|
|
6241
|
+
type: "number",
|
|
6242
|
+
required: false
|
|
6243
|
+
},
|
|
6244
|
+
/**
|
|
6245
|
+
* ADR-028 denormalized counter — number of workspace-scoped
|
|
6246
|
+
* RoleAssignments classified as admin-tier in this workspace.
|
|
6247
|
+
* Maintained by the counter-maintenance consumer via atomic ADD;
|
|
6248
|
+
* absent/0 until first event or reconciliation.
|
|
6249
|
+
*/
|
|
6250
|
+
adminUsersInWorkspace: {
|
|
6251
|
+
type: "number",
|
|
6252
|
+
required: false
|
|
6253
|
+
},
|
|
6254
|
+
/**
|
|
6255
|
+
* ADR-028 denormalized counter — number of workspace-scoped
|
|
6256
|
+
* RoleAssignments classified as non-admin in this workspace.
|
|
6257
|
+
* Maintained by the counter-maintenance consumer via atomic ADD;
|
|
6258
|
+
* absent/0 until first event or reconciliation.
|
|
6259
|
+
*/
|
|
6260
|
+
normalUsersInWorkspace: {
|
|
6261
|
+
type: "number",
|
|
6262
|
+
required: false
|
|
6263
|
+
},
|
|
2942
6264
|
gsi1Shard: gsi1ShardAttribute,
|
|
2943
6265
|
/** Derived GSI1 sort key — name-based when extractable; else `<lastUpdated>#<id>`. */
|
|
2944
6266
|
gsi1sk: gsi1skAttribute,
|
|
@@ -3166,6 +6488,63 @@ function buildMembershipWorkspaceProjectionItem(input) {
|
|
|
3166
6488
|
};
|
|
3167
6489
|
}
|
|
3168
6490
|
|
|
6491
|
+
// src/data/operations/control/control-event-publisher.ts
|
|
6492
|
+
var import_client_eventbridge = require("@aws-sdk/client-eventbridge");
|
|
6493
|
+
var import_workflows2 = __toESM(require_lib());
|
|
6494
|
+
var CONTROL_EVENT_BUS_NAME_ENV_VAR = "CONTROL_EVENT_BUS_NAME";
|
|
6495
|
+
var cachedClient;
|
|
6496
|
+
function getClient() {
|
|
6497
|
+
if (!cachedClient) {
|
|
6498
|
+
cachedClient = new import_client_eventbridge.EventBridgeClient({
|
|
6499
|
+
region: process.env.AWS_REGION ?? "us-east-1"
|
|
6500
|
+
});
|
|
6501
|
+
}
|
|
6502
|
+
return cachedClient;
|
|
6503
|
+
}
|
|
6504
|
+
function actorFromContext(context) {
|
|
6505
|
+
return {
|
|
6506
|
+
ohi_tid: context.tenantId,
|
|
6507
|
+
ohi_wid: context.workspaceId,
|
|
6508
|
+
ohi_uid: context.actorId,
|
|
6509
|
+
ohi_uname: context.actorName
|
|
6510
|
+
};
|
|
6511
|
+
}
|
|
6512
|
+
async function publishControlEvent(entry, payload, context) {
|
|
6513
|
+
const busName = process.env[CONTROL_EVENT_BUS_NAME_ENV_VAR];
|
|
6514
|
+
if (!busName) {
|
|
6515
|
+
return;
|
|
6516
|
+
}
|
|
6517
|
+
try {
|
|
6518
|
+
await (0, import_workflows2.publishWorkflowEvent)(
|
|
6519
|
+
getClient(),
|
|
6520
|
+
entry,
|
|
6521
|
+
payload,
|
|
6522
|
+
{ actor: actorFromContext(context) },
|
|
6523
|
+
{ busNameByPlane: { [import_workflows2.OPENHI_CONTROL_SOURCE]: busName } }
|
|
6524
|
+
);
|
|
6525
|
+
} catch (err) {
|
|
6526
|
+
console.error(`control-event publish failed for ${entry.detailType}:`, err);
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6529
|
+
async function publishMembershipCreated(context, detail) {
|
|
6530
|
+
await publishControlEvent(import_workflows2.ControlPlaneMembershipCreatedV1, detail, context);
|
|
6531
|
+
}
|
|
6532
|
+
async function publishRoleAssignmentCreated(context, detail) {
|
|
6533
|
+
await publishControlEvent(
|
|
6534
|
+
import_workflows2.ControlPlaneRoleAssignmentCreatedV1,
|
|
6535
|
+
detail,
|
|
6536
|
+
context
|
|
6537
|
+
);
|
|
6538
|
+
}
|
|
6539
|
+
async function publishWorkspaceCreated(context, detail) {
|
|
6540
|
+
await publishControlEvent(import_workflows2.ControlPlaneWorkspaceCreatedV1, detail, context);
|
|
6541
|
+
}
|
|
6542
|
+
function extractRoleLevel(resource) {
|
|
6543
|
+
const code = resource?.code;
|
|
6544
|
+
const first = code?.coding?.[0]?.code;
|
|
6545
|
+
return typeof first === "string" && first.length > 0 ? first : void 0;
|
|
6546
|
+
}
|
|
6547
|
+
|
|
3169
6548
|
// src/data/operations/control/denormalized-display-names.ts
|
|
3170
6549
|
function extractDenormalizedReferenceDisplay(resource, fieldName) {
|
|
3171
6550
|
const field = resource[fieldName];
|
|
@@ -3399,6 +6778,14 @@ async function createMembershipOperation(params) {
|
|
|
3399
6778
|
});
|
|
3400
6779
|
}
|
|
3401
6780
|
await executeMultiWrite({ service, triples });
|
|
6781
|
+
await publishMembershipCreated(context, {
|
|
6782
|
+
membershipId: id,
|
|
6783
|
+
tenantId: context.tenantId,
|
|
6784
|
+
...userIdFromResource !== void 0 && { userId: userIdFromResource },
|
|
6785
|
+
...workspaceIdFromResource !== void 0 && {
|
|
6786
|
+
workspaceId: workspaceIdFromResource
|
|
6787
|
+
}
|
|
6788
|
+
});
|
|
3402
6789
|
return {
|
|
3403
6790
|
id,
|
|
3404
6791
|
resource,
|
|
@@ -3640,6 +7027,18 @@ async function createRoleAssignmentOperation(params) {
|
|
|
3640
7027
|
});
|
|
3641
7028
|
}
|
|
3642
7029
|
await executeMultiWrite({ service, triples });
|
|
7030
|
+
await publishRoleAssignmentCreated(context, {
|
|
7031
|
+
roleAssignmentId: id,
|
|
7032
|
+
tenantId: context.tenantId,
|
|
7033
|
+
...userIdFromResource !== void 0 && { userId: userIdFromResource },
|
|
7034
|
+
...workspaceIdFromResource !== void 0 && {
|
|
7035
|
+
workspaceId: workspaceIdFromResource
|
|
7036
|
+
},
|
|
7037
|
+
...roleIdFromResource !== void 0 && { roleId: roleIdFromResource },
|
|
7038
|
+
...extractRoleLevel(resourceRecord) !== void 0 && {
|
|
7039
|
+
roleLevel: extractRoleLevel(resourceRecord)
|
|
7040
|
+
}
|
|
7041
|
+
});
|
|
3643
7042
|
return {
|
|
3644
7043
|
id,
|
|
3645
7044
|
resource,
|
|
@@ -4839,35 +8238,179 @@ async function createWorkspaceOperation(params) {
|
|
|
4839
8238
|
await service.entities.workspace.put({
|
|
4840
8239
|
tenantId,
|
|
4841
8240
|
id,
|
|
4842
|
-
resource: JSON.stringify(resource),
|
|
4843
|
-
summary,
|
|
4844
|
-
vid,
|
|
4845
|
-
lastUpdated
|
|
4846
|
-
}).go();
|
|
4847
|
-
const workspaceName = typeof parsedResource.name === "string" ? parsedResource.name : void 0;
|
|
4848
|
-
await provisionOrganizationForWorkspaceOperation({
|
|
4849
|
-
context,
|
|
4850
|
-
workspaceId: id,
|
|
4851
|
-
workspaceName,
|
|
4852
|
-
tableName
|
|
4853
|
-
});
|
|
4854
|
-
|
|
8241
|
+
resource: JSON.stringify(resource),
|
|
8242
|
+
summary,
|
|
8243
|
+
vid,
|
|
8244
|
+
lastUpdated
|
|
8245
|
+
}).go();
|
|
8246
|
+
const workspaceName = typeof parsedResource.name === "string" ? parsedResource.name : void 0;
|
|
8247
|
+
await provisionOrganizationForWorkspaceOperation({
|
|
8248
|
+
context,
|
|
8249
|
+
workspaceId: id,
|
|
8250
|
+
workspaceName,
|
|
8251
|
+
tableName
|
|
8252
|
+
});
|
|
8253
|
+
await publishWorkspaceCreated(context, {
|
|
8254
|
+
workspaceId: id,
|
|
8255
|
+
tenantId
|
|
8256
|
+
});
|
|
8257
|
+
return { id, resource, meta: { lastUpdated, versionId: vid } };
|
|
8258
|
+
}
|
|
8259
|
+
|
|
8260
|
+
// src/data/operations/data/account/account-create-operation.ts
|
|
8261
|
+
var import_ulid = require("ulid");
|
|
8262
|
+
async function createAccountOperation(params) {
|
|
8263
|
+
const { context, body, tableName } = params;
|
|
8264
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8265
|
+
const id = body.id ?? (0, import_ulid.ulid)();
|
|
8266
|
+
const meta = {
|
|
8267
|
+
...body.meta ?? {},
|
|
8268
|
+
lastUpdated: date,
|
|
8269
|
+
versionId: "1"
|
|
8270
|
+
};
|
|
8271
|
+
const accountWithAudit = {
|
|
8272
|
+
...body,
|
|
8273
|
+
resourceType: "Account",
|
|
8274
|
+
id,
|
|
8275
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8276
|
+
createdDate: date,
|
|
8277
|
+
createdById: actorId,
|
|
8278
|
+
createdByName: actorName,
|
|
8279
|
+
modifiedDate: date,
|
|
8280
|
+
modifiedById: actorId,
|
|
8281
|
+
modifiedByName: actorName
|
|
8282
|
+
})
|
|
8283
|
+
};
|
|
8284
|
+
const service = getDynamoDataService(tableName);
|
|
8285
|
+
return createDataEntityRecord(
|
|
8286
|
+
service.entities.account,
|
|
8287
|
+
tenantId,
|
|
8288
|
+
workspaceId,
|
|
8289
|
+
id,
|
|
8290
|
+
accountWithAudit,
|
|
8291
|
+
date
|
|
8292
|
+
);
|
|
8293
|
+
}
|
|
8294
|
+
|
|
8295
|
+
// src/data/operations/data/appointment/appointment-create-operation.ts
|
|
8296
|
+
var import_ulid2 = require("ulid");
|
|
8297
|
+
async function createAppointmentOperation(params) {
|
|
8298
|
+
const { context, body, tableName } = params;
|
|
8299
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8300
|
+
const id = body.id ?? (0, import_ulid2.ulid)();
|
|
8301
|
+
const meta = {
|
|
8302
|
+
...body.meta ?? {},
|
|
8303
|
+
lastUpdated: date,
|
|
8304
|
+
versionId: "1"
|
|
8305
|
+
};
|
|
8306
|
+
const resourceWithAudit = {
|
|
8307
|
+
...body,
|
|
8308
|
+
resourceType: "Appointment",
|
|
8309
|
+
id,
|
|
8310
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8311
|
+
createdDate: date,
|
|
8312
|
+
createdById: actorId,
|
|
8313
|
+
createdByName: actorName,
|
|
8314
|
+
modifiedDate: date,
|
|
8315
|
+
modifiedById: actorId,
|
|
8316
|
+
modifiedByName: actorName
|
|
8317
|
+
})
|
|
8318
|
+
};
|
|
8319
|
+
const service = getDynamoDataService(tableName);
|
|
8320
|
+
return createDataEntityRecord(
|
|
8321
|
+
service.entities.appointment,
|
|
8322
|
+
tenantId,
|
|
8323
|
+
workspaceId,
|
|
8324
|
+
id,
|
|
8325
|
+
resourceWithAudit,
|
|
8326
|
+
date
|
|
8327
|
+
);
|
|
8328
|
+
}
|
|
8329
|
+
|
|
8330
|
+
// src/data/operations/data/claim/claim-create-operation.ts
|
|
8331
|
+
var import_ulid3 = require("ulid");
|
|
8332
|
+
async function createClaimOperation(params) {
|
|
8333
|
+
const { context, body, tableName } = params;
|
|
8334
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8335
|
+
const id = body.id ?? (0, import_ulid3.ulid)();
|
|
8336
|
+
const meta = {
|
|
8337
|
+
...body.meta ?? {},
|
|
8338
|
+
lastUpdated: date,
|
|
8339
|
+
versionId: "1"
|
|
8340
|
+
};
|
|
8341
|
+
const resourceWithAudit = {
|
|
8342
|
+
...body,
|
|
8343
|
+
resourceType: "Claim",
|
|
8344
|
+
id,
|
|
8345
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8346
|
+
createdDate: date,
|
|
8347
|
+
createdById: actorId,
|
|
8348
|
+
createdByName: actorName,
|
|
8349
|
+
modifiedDate: date,
|
|
8350
|
+
modifiedById: actorId,
|
|
8351
|
+
modifiedByName: actorName
|
|
8352
|
+
})
|
|
8353
|
+
};
|
|
8354
|
+
const service = getDynamoDataService(tableName);
|
|
8355
|
+
return createDataEntityRecord(
|
|
8356
|
+
service.entities.claim,
|
|
8357
|
+
tenantId,
|
|
8358
|
+
workspaceId,
|
|
8359
|
+
id,
|
|
8360
|
+
resourceWithAudit,
|
|
8361
|
+
date
|
|
8362
|
+
);
|
|
8363
|
+
}
|
|
8364
|
+
|
|
8365
|
+
// src/data/operations/data/condition/condition-create-operation.ts
|
|
8366
|
+
var import_ulid4 = require("ulid");
|
|
8367
|
+
async function createConditionOperation(params) {
|
|
8368
|
+
const { context, body, tableName } = params;
|
|
8369
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8370
|
+
const id = body.id ?? (0, import_ulid4.ulid)();
|
|
8371
|
+
const meta = {
|
|
8372
|
+
...body.meta ?? {},
|
|
8373
|
+
lastUpdated: date,
|
|
8374
|
+
versionId: "1"
|
|
8375
|
+
};
|
|
8376
|
+
const resourceWithAudit = {
|
|
8377
|
+
...body,
|
|
8378
|
+
resourceType: "Condition",
|
|
8379
|
+
id,
|
|
8380
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8381
|
+
createdDate: date,
|
|
8382
|
+
createdById: actorId,
|
|
8383
|
+
createdByName: actorName,
|
|
8384
|
+
modifiedDate: date,
|
|
8385
|
+
modifiedById: actorId,
|
|
8386
|
+
modifiedByName: actorName
|
|
8387
|
+
})
|
|
8388
|
+
};
|
|
8389
|
+
const service = getDynamoDataService(tableName);
|
|
8390
|
+
return createDataEntityRecord(
|
|
8391
|
+
service.entities.condition,
|
|
8392
|
+
tenantId,
|
|
8393
|
+
workspaceId,
|
|
8394
|
+
id,
|
|
8395
|
+
resourceWithAudit,
|
|
8396
|
+
date
|
|
8397
|
+
);
|
|
4855
8398
|
}
|
|
4856
8399
|
|
|
4857
|
-
// src/data/operations/data/
|
|
4858
|
-
var
|
|
4859
|
-
async function
|
|
8400
|
+
// src/data/operations/data/coverage/coverage-create-operation.ts
|
|
8401
|
+
var import_ulid5 = require("ulid");
|
|
8402
|
+
async function createCoverageOperation(params) {
|
|
4860
8403
|
const { context, body, tableName } = params;
|
|
4861
8404
|
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4862
|
-
const id = body.id ?? (0,
|
|
8405
|
+
const id = body.id ?? (0, import_ulid5.ulid)();
|
|
4863
8406
|
const meta = {
|
|
4864
8407
|
...body.meta ?? {},
|
|
4865
8408
|
lastUpdated: date,
|
|
4866
8409
|
versionId: "1"
|
|
4867
8410
|
};
|
|
4868
|
-
const
|
|
8411
|
+
const resourceWithAudit = {
|
|
4869
8412
|
...body,
|
|
4870
|
-
resourceType: "
|
|
8413
|
+
resourceType: "Coverage",
|
|
4871
8414
|
id,
|
|
4872
8415
|
meta: mergeAuditIntoMeta(meta, {
|
|
4873
8416
|
createdDate: date,
|
|
@@ -4880,21 +8423,21 @@ async function createAccountOperation(params) {
|
|
|
4880
8423
|
};
|
|
4881
8424
|
const service = getDynamoDataService(tableName);
|
|
4882
8425
|
return createDataEntityRecord(
|
|
4883
|
-
service.entities.
|
|
8426
|
+
service.entities.coverage,
|
|
4884
8427
|
tenantId,
|
|
4885
8428
|
workspaceId,
|
|
4886
8429
|
id,
|
|
4887
|
-
|
|
8430
|
+
resourceWithAudit,
|
|
4888
8431
|
date
|
|
4889
8432
|
);
|
|
4890
8433
|
}
|
|
4891
8434
|
|
|
4892
8435
|
// src/data/operations/data/encounter/encounter-create-operation.ts
|
|
4893
|
-
var
|
|
8436
|
+
var import_ulid6 = require("ulid");
|
|
4894
8437
|
async function createEncounterOperation(params) {
|
|
4895
8438
|
const { context, body, tableName } = params;
|
|
4896
8439
|
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4897
|
-
const id = body.id ?? (0,
|
|
8440
|
+
const id = body.id ?? (0, import_ulid6.ulid)();
|
|
4898
8441
|
const meta = {
|
|
4899
8442
|
...body.meta ?? {},
|
|
4900
8443
|
lastUpdated: date,
|
|
@@ -4924,12 +8467,47 @@ async function createEncounterOperation(params) {
|
|
|
4924
8467
|
);
|
|
4925
8468
|
}
|
|
4926
8469
|
|
|
8470
|
+
// src/data/operations/data/location/location-create-operation.ts
|
|
8471
|
+
var import_ulid7 = require("ulid");
|
|
8472
|
+
async function createLocationOperation(params) {
|
|
8473
|
+
const { context, body, tableName } = params;
|
|
8474
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8475
|
+
const id = body.id ?? (0, import_ulid7.ulid)();
|
|
8476
|
+
const meta = {
|
|
8477
|
+
...body.meta ?? {},
|
|
8478
|
+
lastUpdated: date,
|
|
8479
|
+
versionId: "1"
|
|
8480
|
+
};
|
|
8481
|
+
const resourceWithAudit = {
|
|
8482
|
+
...body,
|
|
8483
|
+
resourceType: "Location",
|
|
8484
|
+
id,
|
|
8485
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8486
|
+
createdDate: date,
|
|
8487
|
+
createdById: actorId,
|
|
8488
|
+
createdByName: actorName,
|
|
8489
|
+
modifiedDate: date,
|
|
8490
|
+
modifiedById: actorId,
|
|
8491
|
+
modifiedByName: actorName
|
|
8492
|
+
})
|
|
8493
|
+
};
|
|
8494
|
+
const service = getDynamoDataService(tableName);
|
|
8495
|
+
return createDataEntityRecord(
|
|
8496
|
+
service.entities.location,
|
|
8497
|
+
tenantId,
|
|
8498
|
+
workspaceId,
|
|
8499
|
+
id,
|
|
8500
|
+
resourceWithAudit,
|
|
8501
|
+
date
|
|
8502
|
+
);
|
|
8503
|
+
}
|
|
8504
|
+
|
|
4927
8505
|
// src/data/operations/data/observation/observation-create-operation.ts
|
|
4928
|
-
var
|
|
8506
|
+
var import_ulid8 = require("ulid");
|
|
4929
8507
|
async function createObservationOperation(params) {
|
|
4930
8508
|
const { context, body, tableName } = params;
|
|
4931
8509
|
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4932
|
-
const id = body.id ?? (0,
|
|
8510
|
+
const id = body.id ?? (0, import_ulid8.ulid)();
|
|
4933
8511
|
const meta = {
|
|
4934
8512
|
...body.meta ?? {},
|
|
4935
8513
|
lastUpdated: date,
|
|
@@ -4959,12 +8537,47 @@ async function createObservationOperation(params) {
|
|
|
4959
8537
|
);
|
|
4960
8538
|
}
|
|
4961
8539
|
|
|
8540
|
+
// src/data/operations/data/organization/organization-create-operation.ts
|
|
8541
|
+
var import_ulid9 = require("ulid");
|
|
8542
|
+
async function createOrganizationOperation(params) {
|
|
8543
|
+
const { context, body, tableName } = params;
|
|
8544
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8545
|
+
const id = body.id ?? (0, import_ulid9.ulid)();
|
|
8546
|
+
const meta = {
|
|
8547
|
+
...body.meta ?? {},
|
|
8548
|
+
lastUpdated: date,
|
|
8549
|
+
versionId: "1"
|
|
8550
|
+
};
|
|
8551
|
+
const resourceWithAudit = {
|
|
8552
|
+
...body,
|
|
8553
|
+
resourceType: "Organization",
|
|
8554
|
+
id,
|
|
8555
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8556
|
+
createdDate: date,
|
|
8557
|
+
createdById: actorId,
|
|
8558
|
+
createdByName: actorName,
|
|
8559
|
+
modifiedDate: date,
|
|
8560
|
+
modifiedById: actorId,
|
|
8561
|
+
modifiedByName: actorName
|
|
8562
|
+
})
|
|
8563
|
+
};
|
|
8564
|
+
const service = getDynamoDataService(tableName);
|
|
8565
|
+
return createDataEntityRecord(
|
|
8566
|
+
service.entities.organization,
|
|
8567
|
+
tenantId,
|
|
8568
|
+
workspaceId,
|
|
8569
|
+
id,
|
|
8570
|
+
resourceWithAudit,
|
|
8571
|
+
date
|
|
8572
|
+
);
|
|
8573
|
+
}
|
|
8574
|
+
|
|
4962
8575
|
// src/data/operations/data/patient/patient-create-operation.ts
|
|
4963
|
-
var
|
|
8576
|
+
var import_ulid10 = require("ulid");
|
|
4964
8577
|
async function createPatientOperation(params) {
|
|
4965
8578
|
const { context, body, tableName } = params;
|
|
4966
8579
|
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4967
|
-
const id = body.id ?? (0,
|
|
8580
|
+
const id = body.id ?? (0, import_ulid10.ulid)();
|
|
4968
8581
|
const meta = {
|
|
4969
8582
|
...body.meta ?? {},
|
|
4970
8583
|
lastUpdated: date,
|
|
@@ -4994,12 +8607,47 @@ async function createPatientOperation(params) {
|
|
|
4994
8607
|
);
|
|
4995
8608
|
}
|
|
4996
8609
|
|
|
8610
|
+
// src/data/operations/data/paymentnotice/paymentnotice-create-operation.ts
|
|
8611
|
+
var import_ulid11 = require("ulid");
|
|
8612
|
+
async function createPaymentNoticeOperation(params) {
|
|
8613
|
+
const { context, body, tableName } = params;
|
|
8614
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8615
|
+
const id = body.id ?? (0, import_ulid11.ulid)();
|
|
8616
|
+
const meta = {
|
|
8617
|
+
...body.meta ?? {},
|
|
8618
|
+
lastUpdated: date,
|
|
8619
|
+
versionId: "1"
|
|
8620
|
+
};
|
|
8621
|
+
const resourceWithAudit = {
|
|
8622
|
+
...body,
|
|
8623
|
+
resourceType: "PaymentNotice",
|
|
8624
|
+
id,
|
|
8625
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8626
|
+
createdDate: date,
|
|
8627
|
+
createdById: actorId,
|
|
8628
|
+
createdByName: actorName,
|
|
8629
|
+
modifiedDate: date,
|
|
8630
|
+
modifiedById: actorId,
|
|
8631
|
+
modifiedByName: actorName
|
|
8632
|
+
})
|
|
8633
|
+
};
|
|
8634
|
+
const service = getDynamoDataService(tableName);
|
|
8635
|
+
return createDataEntityRecord(
|
|
8636
|
+
service.entities.paymentnotice,
|
|
8637
|
+
tenantId,
|
|
8638
|
+
workspaceId,
|
|
8639
|
+
id,
|
|
8640
|
+
resourceWithAudit,
|
|
8641
|
+
date
|
|
8642
|
+
);
|
|
8643
|
+
}
|
|
8644
|
+
|
|
4997
8645
|
// src/data/operations/data/practitioner/practitioner-create-operation.ts
|
|
4998
|
-
var
|
|
8646
|
+
var import_ulid12 = require("ulid");
|
|
4999
8647
|
async function createPractitionerOperation(params) {
|
|
5000
8648
|
const { context, body, tableName } = params;
|
|
5001
8649
|
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
5002
|
-
const id = body.id ?? (0,
|
|
8650
|
+
const id = body.id ?? (0, import_ulid12.ulid)();
|
|
5003
8651
|
const meta = {
|
|
5004
8652
|
...body.meta ?? {},
|
|
5005
8653
|
lastUpdated: date,
|
|
@@ -5029,6 +8677,41 @@ async function createPractitionerOperation(params) {
|
|
|
5029
8677
|
);
|
|
5030
8678
|
}
|
|
5031
8679
|
|
|
8680
|
+
// src/data/operations/data/procedure/procedure-create-operation.ts
|
|
8681
|
+
var import_ulid13 = require("ulid");
|
|
8682
|
+
async function createProcedureOperation(params) {
|
|
8683
|
+
const { context, body, tableName } = params;
|
|
8684
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8685
|
+
const id = body.id ?? (0, import_ulid13.ulid)();
|
|
8686
|
+
const meta = {
|
|
8687
|
+
...body.meta ?? {},
|
|
8688
|
+
lastUpdated: date,
|
|
8689
|
+
versionId: "1"
|
|
8690
|
+
};
|
|
8691
|
+
const resourceWithAudit = {
|
|
8692
|
+
...body,
|
|
8693
|
+
resourceType: "Procedure",
|
|
8694
|
+
id,
|
|
8695
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8696
|
+
createdDate: date,
|
|
8697
|
+
createdById: actorId,
|
|
8698
|
+
createdByName: actorName,
|
|
8699
|
+
modifiedDate: date,
|
|
8700
|
+
modifiedById: actorId,
|
|
8701
|
+
modifiedByName: actorName
|
|
8702
|
+
})
|
|
8703
|
+
};
|
|
8704
|
+
const service = getDynamoDataService(tableName);
|
|
8705
|
+
return createDataEntityRecord(
|
|
8706
|
+
service.entities.procedure,
|
|
8707
|
+
tenantId,
|
|
8708
|
+
workspaceId,
|
|
8709
|
+
id,
|
|
8710
|
+
resourceWithAudit,
|
|
8711
|
+
date
|
|
8712
|
+
);
|
|
8713
|
+
}
|
|
8714
|
+
|
|
5032
8715
|
// src/workflows/control-plane/seed-demo-data/seed-demo-data.handler.ts
|
|
5033
8716
|
var SEED_DEMO_DATA_USER_POOL_ID_ENV_VAR = "SEED_DEMO_DATA_USER_POOL_ID";
|
|
5034
8717
|
var errorMessage = (err) => {
|
|
@@ -5146,11 +8829,18 @@ var roleAssignmentResourceBody = (scenario, tenantId, user, roleCode, roleAssign
|
|
|
5146
8829
|
var userResourceBody = (user, cognitoSub) => ({
|
|
5147
8830
|
resourceType: "User",
|
|
5148
8831
|
id: user.id,
|
|
5149
|
-
name: [
|
|
8832
|
+
name: [
|
|
8833
|
+
{
|
|
8834
|
+
text: `${user.firstName} ${user.lastName}`,
|
|
8835
|
+
given: [user.firstName],
|
|
8836
|
+
family: user.lastName
|
|
8837
|
+
}
|
|
8838
|
+
],
|
|
8839
|
+
telecom: [{ system: "email", value: user.email }],
|
|
5150
8840
|
status: "active",
|
|
5151
8841
|
cognitoSub,
|
|
5152
|
-
currentTenant: { reference: `Tenant/${
|
|
5153
|
-
currentWorkspace: { reference: `Workspace/${
|
|
8842
|
+
currentTenant: { reference: `Tenant/${ON_SITE_DEMO_TENANT_ID}` },
|
|
8843
|
+
currentWorkspace: { reference: `Workspace/${ON_SITE_DEMO_WORKSPACE_ID}` }
|
|
5154
8844
|
});
|
|
5155
8845
|
var upsertUser = async (context, user, cognitoSub) => {
|
|
5156
8846
|
const service = getDynamoControlService();
|
|
@@ -5172,7 +8862,34 @@ var seedWorkspaceDataPlane = async (baseContext, group, failures) => {
|
|
|
5172
8862
|
workspaceId: group.workspaceId
|
|
5173
8863
|
};
|
|
5174
8864
|
const scope = `${group.tenantId}/${group.workspaceId}`;
|
|
5175
|
-
for (const
|
|
8865
|
+
for (const location of group.locations ?? []) {
|
|
8866
|
+
await tryRun(
|
|
8867
|
+
failures,
|
|
8868
|
+
"phase-3",
|
|
8869
|
+
scope,
|
|
8870
|
+
"Location",
|
|
8871
|
+
location.id ?? "",
|
|
8872
|
+
() => createLocationOperation({
|
|
8873
|
+
context: workspaceContext,
|
|
8874
|
+
body: location
|
|
8875
|
+
})
|
|
8876
|
+
);
|
|
8877
|
+
}
|
|
8878
|
+
for (const organization of group.organizations ?? []) {
|
|
8879
|
+
await tryRun(
|
|
8880
|
+
failures,
|
|
8881
|
+
"phase-3",
|
|
8882
|
+
scope,
|
|
8883
|
+
"Organization",
|
|
8884
|
+
organization.id ?? "",
|
|
8885
|
+
() => createOrganizationOperation({
|
|
8886
|
+
context: workspaceContext,
|
|
8887
|
+
body: organization
|
|
8888
|
+
})
|
|
8889
|
+
);
|
|
8890
|
+
}
|
|
8891
|
+
const patients = group.buildPatients ? group.buildPatients() : group.patients;
|
|
8892
|
+
for (const patient of patients) {
|
|
5176
8893
|
await tryRun(
|
|
5177
8894
|
failures,
|
|
5178
8895
|
"phase-3",
|
|
@@ -5185,6 +8902,20 @@ var seedWorkspaceDataPlane = async (baseContext, group, failures) => {
|
|
|
5185
8902
|
})
|
|
5186
8903
|
);
|
|
5187
8904
|
}
|
|
8905
|
+
const coverages = group.buildCoverages ? group.buildCoverages() : group.coverages ?? [];
|
|
8906
|
+
for (const coverage of coverages) {
|
|
8907
|
+
await tryRun(
|
|
8908
|
+
failures,
|
|
8909
|
+
"phase-3",
|
|
8910
|
+
scope,
|
|
8911
|
+
"Coverage",
|
|
8912
|
+
coverage.id ?? "",
|
|
8913
|
+
() => createCoverageOperation({
|
|
8914
|
+
context: workspaceContext,
|
|
8915
|
+
body: coverage
|
|
8916
|
+
})
|
|
8917
|
+
);
|
|
8918
|
+
}
|
|
5188
8919
|
for (const practitioner of group.practitioners) {
|
|
5189
8920
|
await tryRun(
|
|
5190
8921
|
failures,
|
|
@@ -5198,20 +8929,22 @@ var seedWorkspaceDataPlane = async (baseContext, group, failures) => {
|
|
|
5198
8929
|
})
|
|
5199
8930
|
);
|
|
5200
8931
|
}
|
|
5201
|
-
|
|
8932
|
+
const conditions = group.buildConditions ? group.buildConditions(baseContext) : group.conditions ?? [];
|
|
8933
|
+
for (const condition of conditions) {
|
|
5202
8934
|
await tryRun(
|
|
5203
8935
|
failures,
|
|
5204
8936
|
"phase-3",
|
|
5205
8937
|
scope,
|
|
5206
|
-
"
|
|
5207
|
-
|
|
5208
|
-
() =>
|
|
8938
|
+
"Condition",
|
|
8939
|
+
condition.id ?? "",
|
|
8940
|
+
() => createConditionOperation({
|
|
5209
8941
|
context: workspaceContext,
|
|
5210
|
-
body:
|
|
8942
|
+
body: condition
|
|
5211
8943
|
})
|
|
5212
8944
|
);
|
|
5213
8945
|
}
|
|
5214
|
-
|
|
8946
|
+
const encounters = group.buildEncounters ? group.buildEncounters(baseContext) : group.encounters;
|
|
8947
|
+
for (const encounter of encounters) {
|
|
5215
8948
|
await tryRun(
|
|
5216
8949
|
failures,
|
|
5217
8950
|
"phase-3",
|
|
@@ -5224,6 +8957,62 @@ var seedWorkspaceDataPlane = async (baseContext, group, failures) => {
|
|
|
5224
8957
|
})
|
|
5225
8958
|
);
|
|
5226
8959
|
}
|
|
8960
|
+
const observations = group.buildObservations ? group.buildObservations(baseContext) : group.observations;
|
|
8961
|
+
for (const observation of observations) {
|
|
8962
|
+
await tryRun(
|
|
8963
|
+
failures,
|
|
8964
|
+
"phase-3",
|
|
8965
|
+
scope,
|
|
8966
|
+
"Observation",
|
|
8967
|
+
observation.id ?? "",
|
|
8968
|
+
() => createObservationOperation({
|
|
8969
|
+
context: workspaceContext,
|
|
8970
|
+
body: observation
|
|
8971
|
+
})
|
|
8972
|
+
);
|
|
8973
|
+
}
|
|
8974
|
+
const procedures = group.buildProcedures ? group.buildProcedures(baseContext) : group.procedures ?? [];
|
|
8975
|
+
for (const procedure of procedures) {
|
|
8976
|
+
await tryRun(
|
|
8977
|
+
failures,
|
|
8978
|
+
"phase-3",
|
|
8979
|
+
scope,
|
|
8980
|
+
"Procedure",
|
|
8981
|
+
procedure.id ?? "",
|
|
8982
|
+
() => createProcedureOperation({
|
|
8983
|
+
context: workspaceContext,
|
|
8984
|
+
body: procedure
|
|
8985
|
+
})
|
|
8986
|
+
);
|
|
8987
|
+
}
|
|
8988
|
+
const claims = group.buildClaims ? group.buildClaims(baseContext) : [];
|
|
8989
|
+
for (const claim of claims) {
|
|
8990
|
+
await tryRun(
|
|
8991
|
+
failures,
|
|
8992
|
+
"phase-3",
|
|
8993
|
+
scope,
|
|
8994
|
+
"Claim",
|
|
8995
|
+
claim.id ?? "",
|
|
8996
|
+
() => createClaimOperation({
|
|
8997
|
+
context: workspaceContext,
|
|
8998
|
+
body: claim
|
|
8999
|
+
})
|
|
9000
|
+
);
|
|
9001
|
+
}
|
|
9002
|
+
const paymentNotices = group.buildPaymentNotices ? group.buildPaymentNotices(baseContext) : [];
|
|
9003
|
+
for (const paymentNotice of paymentNotices) {
|
|
9004
|
+
await tryRun(
|
|
9005
|
+
failures,
|
|
9006
|
+
"phase-3",
|
|
9007
|
+
scope,
|
|
9008
|
+
"PaymentNotice",
|
|
9009
|
+
paymentNotice.id ?? "",
|
|
9010
|
+
() => createPaymentNoticeOperation({
|
|
9011
|
+
context: workspaceContext,
|
|
9012
|
+
body: paymentNotice
|
|
9013
|
+
})
|
|
9014
|
+
);
|
|
9015
|
+
}
|
|
5227
9016
|
for (const account of group.accounts) {
|
|
5228
9017
|
await tryRun(
|
|
5229
9018
|
failures,
|
|
@@ -5237,6 +9026,20 @@ var seedWorkspaceDataPlane = async (baseContext, group, failures) => {
|
|
|
5237
9026
|
})
|
|
5238
9027
|
);
|
|
5239
9028
|
}
|
|
9029
|
+
const appointments = group.buildAppointments ? group.buildAppointments(baseContext) : [];
|
|
9030
|
+
for (const appointment of appointments) {
|
|
9031
|
+
await tryRun(
|
|
9032
|
+
failures,
|
|
9033
|
+
"phase-3",
|
|
9034
|
+
scope,
|
|
9035
|
+
"Appointment",
|
|
9036
|
+
appointment.id ?? "",
|
|
9037
|
+
() => createAppointmentOperation({
|
|
9038
|
+
context: workspaceContext,
|
|
9039
|
+
body: appointment
|
|
9040
|
+
})
|
|
9041
|
+
);
|
|
9042
|
+
}
|
|
5240
9043
|
};
|
|
5241
9044
|
var seedDemoGraph = async (params) => {
|
|
5242
9045
|
const { baseContext, devUsers, cognito } = params;
|
|
@@ -5390,7 +9193,7 @@ var seedDemoGraph = async (params) => {
|
|
|
5390
9193
|
}
|
|
5391
9194
|
};
|
|
5392
9195
|
var runSeedDemoData = async (event, deps, devUsers) => {
|
|
5393
|
-
const parsed = (0,
|
|
9196
|
+
const parsed = (0, import_workflows3.parseWorkflowEvent)(event, import_workflows.PlatformSystemDataSeededV1);
|
|
5394
9197
|
const recordResult = await deps.dedupClient.recordIfAbsent({
|
|
5395
9198
|
consumerName: SEED_DEMO_DATA_CONSUMER_NAME,
|
|
5396
9199
|
eventId: parsed.dedupKey.eventId,
|
|
@@ -5561,7 +9364,7 @@ var productionDependencies = () => {
|
|
|
5561
9364
|
const dynamodb = new import_client_dynamodb2.DynamoDBClient({});
|
|
5562
9365
|
const cognito = productionCognitoProvisioner();
|
|
5563
9366
|
return {
|
|
5564
|
-
dedupClient: (0,
|
|
9367
|
+
dedupClient: (0, import_workflows3.workflowDedupClient)(dynamodb),
|
|
5565
9368
|
verifyRoles: verifySystemRolesExist,
|
|
5566
9369
|
seedDemoGraph,
|
|
5567
9370
|
cognito
|