@openhi/constructs 0.0.159 → 0.0.160
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-EFB5OFM7.mjs +500 -0
- package/lib/chunk-EFB5OFM7.mjs.map +1 -0
- package/lib/chunk-QFHYTCVY.mjs +4616 -0
- package/lib/chunk-QFHYTCVY.mjs.map +1 -0
- 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/index.d.mts +1144 -3
- package/lib/index.d.ts +1248 -21
- package/lib/index.js +3570 -74
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +244 -4
- package/lib/index.mjs.map +1 -1
- package/lib/provision-default-workspace.handler.js +4 -4
- package/lib/provision-default-workspace.handler.js.map +1 -1
- package/lib/provision-default-workspace.handler.mjs +4 -4
- package/lib/provision-default-workspace.handler.mjs.map +1 -1
- package/lib/rest-api-lambda.handler.mjs +259 -531
- 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 +3713 -107
- package/lib/seed-demo-data.handler.js.map +1 -1
- package/lib/seed-demo-data.handler.mjs +2 -2
- package/package.json +1 -1
- package/lib/chunk-BQMJSDOD.mjs +0 -1136
- package/lib/chunk-BQMJSDOD.mjs.map +0 -1
- package/lib/chunk-E6MCKJVS.mjs +0 -212
- package/lib/chunk-E6MCKJVS.mjs.map +0 -1
|
@@ -737,16 +737,63 @@ var OPENHI_RESOURCE_URN_SYSTEM = "http://openhi.org/";
|
|
|
737
737
|
var DEMO_PERIOD = { start: "2026-01-01T00:00:00Z" };
|
|
738
738
|
var PLACEHOLDER_TENANT_ID = "placeholder-tenant-id";
|
|
739
739
|
var PLACEHOLDER_WORKSPACE_ID = "placeholder-workspace-id";
|
|
740
|
+
var ON_SITE_DEMO_TENANT_ID = "on-site-demo-tenant";
|
|
741
|
+
var ON_SITE_DEMO_WORKSPACE_ID = "on-site-demo-workspace";
|
|
740
742
|
var DEV_USERS = [
|
|
741
|
-
{
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
{
|
|
748
|
-
|
|
749
|
-
|
|
743
|
+
{
|
|
744
|
+
id: "dev-russell",
|
|
745
|
+
email: "russell@codedrifters.com",
|
|
746
|
+
firstName: "Russell",
|
|
747
|
+
lastName: "Ingram"
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
id: "dev-cameron",
|
|
751
|
+
email: "cameron@codedrifters.com",
|
|
752
|
+
firstName: "Cameron",
|
|
753
|
+
lastName: "Childress"
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
id: "dev-neelima",
|
|
757
|
+
email: "neelima@codedrifters.com",
|
|
758
|
+
firstName: "Neelima",
|
|
759
|
+
lastName: "Ramaraju"
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
id: "dev-garon",
|
|
763
|
+
email: "garon@codedrifters.com",
|
|
764
|
+
firstName: "Garon",
|
|
765
|
+
lastName: "Bailey"
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
id: "dev-dave",
|
|
769
|
+
email: "dave@codedrifters.com",
|
|
770
|
+
firstName: "Dave",
|
|
771
|
+
lastName: "Finlay"
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
id: "dev-drew",
|
|
775
|
+
email: "drew@codedrifters.com",
|
|
776
|
+
firstName: "Drew",
|
|
777
|
+
lastName: "Morris"
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
id: "dev-jessica",
|
|
781
|
+
email: "jessica@codedrifters.com",
|
|
782
|
+
firstName: "Jessica",
|
|
783
|
+
lastName: "Branks"
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
id: "dev-jared",
|
|
787
|
+
email: "jared@codedrifters.com",
|
|
788
|
+
firstName: "Jared",
|
|
789
|
+
lastName: "Trotter"
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
id: "dev-goddess",
|
|
793
|
+
email: "goddess@codedrifters.com",
|
|
794
|
+
firstName: "Goddess",
|
|
795
|
+
lastName: "Culberson"
|
|
796
|
+
},
|
|
750
797
|
// Dedicated end-to-end test principal for admin-console Playwright
|
|
751
798
|
// specs (issue #1275). Reuses the standard DEV_USERS plumbing
|
|
752
799
|
// (Cognito user + DynamoDB User + per-tenant Memberships +
|
|
@@ -756,78 +803,3233 @@ var DEV_USERS = [
|
|
|
756
803
|
// /openhi/seed/users/e2e-admin-console_at_codedrifters.com/password
|
|
757
804
|
// out of band, and the seeded Cognito user picks it up via
|
|
758
805
|
// AdminSetUserPassword on every seed run.
|
|
759
|
-
{
|
|
806
|
+
{
|
|
807
|
+
id: "dev-e2e-admin-console",
|
|
808
|
+
email: "e2e-admin-console@codedrifters.com",
|
|
809
|
+
firstName: "E2E",
|
|
810
|
+
lastName: "AdminConsole"
|
|
811
|
+
}
|
|
812
|
+
];
|
|
813
|
+
var DEMO_TENANT_SPECS = [
|
|
814
|
+
{
|
|
815
|
+
scenario: "placeholder",
|
|
816
|
+
tenantId: PLACEHOLDER_TENANT_ID,
|
|
817
|
+
tenantName: "OpenHI Placeholder Tenant",
|
|
818
|
+
workspaces: [
|
|
819
|
+
{
|
|
820
|
+
id: PLACEHOLDER_WORKSPACE_ID,
|
|
821
|
+
name: "OpenHI Placeholder Workspace",
|
|
822
|
+
roleSuffix: "workspace"
|
|
823
|
+
}
|
|
824
|
+
]
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
scenario: "on-site-demo",
|
|
828
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
829
|
+
tenantName: "On-Site Medical \u2014 Demo",
|
|
830
|
+
workspaces: [
|
|
831
|
+
{
|
|
832
|
+
id: ON_SITE_DEMO_WORKSPACE_ID,
|
|
833
|
+
name: "On-Site Medical \u2014 Primary Workspace",
|
|
834
|
+
roleSuffix: "workspace"
|
|
835
|
+
}
|
|
836
|
+
]
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
scenario: "demo-wound-care",
|
|
840
|
+
tenantId: "demo-wound-care-tenant",
|
|
841
|
+
tenantName: "Cedarbrook Wound Healing Institute",
|
|
842
|
+
workspaces: [
|
|
843
|
+
{
|
|
844
|
+
id: "demo-wound-care-workspace",
|
|
845
|
+
name: "Cedarbrook Outpatient Wound Clinic",
|
|
846
|
+
roleSuffix: "workspace"
|
|
847
|
+
}
|
|
848
|
+
]
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
scenario: "demo-primary-care",
|
|
852
|
+
tenantId: "demo-primary-care-tenant",
|
|
853
|
+
tenantName: "Maple Ridge Family Medicine",
|
|
854
|
+
workspaces: [
|
|
855
|
+
{
|
|
856
|
+
id: "demo-primary-care-workspace",
|
|
857
|
+
name: "Maple Ridge Main Street Office",
|
|
858
|
+
roleSuffix: "workspace"
|
|
859
|
+
}
|
|
860
|
+
]
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
scenario: "demo-mixed",
|
|
864
|
+
tenantId: "demo-mixed-tenant",
|
|
865
|
+
tenantName: "Northbridge Health Network",
|
|
866
|
+
workspaces: [
|
|
867
|
+
{
|
|
868
|
+
id: "demo-mixed-workspace-wound-care",
|
|
869
|
+
name: "Northbridge Wound Care Center",
|
|
870
|
+
roleSuffix: "workspace-wound-care"
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
id: "demo-mixed-workspace-primary-care",
|
|
874
|
+
name: "Northbridge Family Practice",
|
|
875
|
+
roleSuffix: "workspace-primary-care"
|
|
876
|
+
}
|
|
877
|
+
]
|
|
878
|
+
}
|
|
879
|
+
];
|
|
880
|
+
var demoMembershipId = (devUserId, tenantId) => `demo-membership-${devUserId}-${tenantId}`;
|
|
881
|
+
var demoRoleAssignmentId = (devUserId, tenantId, roleCode) => `demo-roleassignment-${devUserId}-${tenantId}-${roleCode}`;
|
|
882
|
+
var demoScenarioIdentifier = (scenario, roleSuffix) => ({
|
|
883
|
+
system: DEMO_URN_SYSTEM,
|
|
884
|
+
value: `${scenario}:${roleSuffix}`
|
|
885
|
+
});
|
|
886
|
+
var openhiResourceIdentifier = (params) => ({
|
|
887
|
+
use: "unversioned",
|
|
888
|
+
system: OPENHI_RESOURCE_URN_SYSTEM,
|
|
889
|
+
value: `urn:ohi:${params.tenantId}:${params.workspaceId}:${params.resourceType}:${params.id}`
|
|
890
|
+
});
|
|
891
|
+
var demoRolesForUserInTenant = (_user, _tenantId) => {
|
|
892
|
+
void _user;
|
|
893
|
+
void _tenantId;
|
|
894
|
+
return [import_types.PLATFORM_ROLE_CODE.TENANT_ADMIN];
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-facilities.ts
|
|
898
|
+
var DIRECTOR_OF_NURSING_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/director-of-nursing";
|
|
899
|
+
var DIRECTOR_OF_NURSING_NAME_EXTENSION_URL = "name";
|
|
900
|
+
var DIRECTOR_OF_NURSING_PHONE_EXTENSION_URL = "phone";
|
|
901
|
+
var DIRECTOR_OF_NURSING_EMAIL_EXTENSION_URL = "email";
|
|
902
|
+
var ON_SITE_SCENARIO = "on-site-demo";
|
|
903
|
+
var FACILITY_SPECS = [
|
|
904
|
+
{
|
|
905
|
+
id: "on-site-demo-facility-001",
|
|
906
|
+
name: "Druid Hills Skilled Nursing",
|
|
907
|
+
phone: "+14045550301",
|
|
908
|
+
email: "frontdesk@druidhills.on-site-demo.example.com",
|
|
909
|
+
addressLine: "1455 Clifton Road NE",
|
|
910
|
+
addressCity: "Atlanta",
|
|
911
|
+
addressState: "GA",
|
|
912
|
+
addressPostalCode: "30322",
|
|
913
|
+
directorOfNursingName: "Patricia Lambert, RN",
|
|
914
|
+
directorOfNursingPhone: "+14045550311",
|
|
915
|
+
directorOfNursingEmail: "p.lambert@druidhills.on-site-demo.example.com"
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
id: "on-site-demo-facility-002",
|
|
919
|
+
name: "Buckhead Rehabilitation Center",
|
|
920
|
+
phone: "+14045550302",
|
|
921
|
+
email: "frontdesk@buckhead.on-site-demo.example.com",
|
|
922
|
+
addressLine: "3193 Howell Mill Road NW",
|
|
923
|
+
addressCity: "Atlanta",
|
|
924
|
+
addressState: "GA",
|
|
925
|
+
addressPostalCode: "30327",
|
|
926
|
+
directorOfNursingName: "Karen Whitfield, RN",
|
|
927
|
+
directorOfNursingPhone: "+14045550312",
|
|
928
|
+
directorOfNursingEmail: "k.whitfield@buckhead.on-site-demo.example.com"
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
id: "on-site-demo-facility-003",
|
|
932
|
+
name: "Decatur Senior Living",
|
|
933
|
+
phone: "+14045550303",
|
|
934
|
+
email: "frontdesk@decatur.on-site-demo.example.com",
|
|
935
|
+
addressLine: "920 Church Street",
|
|
936
|
+
addressCity: "Decatur",
|
|
937
|
+
addressState: "GA",
|
|
938
|
+
addressPostalCode: "30030",
|
|
939
|
+
directorOfNursingName: "Monique Beaumont, RN",
|
|
940
|
+
directorOfNursingPhone: "+14045550313",
|
|
941
|
+
directorOfNursingEmail: "m.beaumont@decatur.on-site-demo.example.com"
|
|
942
|
+
}
|
|
943
|
+
];
|
|
944
|
+
var buildIdentifierPair = (locationId, roleSuffix) => [
|
|
945
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO, roleSuffix),
|
|
946
|
+
openhiResourceIdentifier({
|
|
947
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
948
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
949
|
+
resourceType: "Location",
|
|
950
|
+
id: locationId
|
|
951
|
+
})
|
|
952
|
+
];
|
|
953
|
+
var buildFacilityResource = (spec) => ({
|
|
954
|
+
resourceType: "Location",
|
|
955
|
+
id: spec.id,
|
|
956
|
+
status: "active",
|
|
957
|
+
name: spec.name,
|
|
958
|
+
identifier: buildIdentifierPair(spec.id, `facility-${spec.id}`),
|
|
959
|
+
type: [{ text: "facility" }],
|
|
960
|
+
telecom: [
|
|
961
|
+
{ system: "phone", value: spec.phone, use: "work" },
|
|
962
|
+
{ system: "email", value: spec.email, use: "work" }
|
|
963
|
+
],
|
|
964
|
+
address: {
|
|
965
|
+
use: "work",
|
|
966
|
+
line: [spec.addressLine],
|
|
967
|
+
city: spec.addressCity,
|
|
968
|
+
state: spec.addressState,
|
|
969
|
+
postalCode: spec.addressPostalCode,
|
|
970
|
+
country: "US"
|
|
971
|
+
},
|
|
972
|
+
extension: [
|
|
973
|
+
{
|
|
974
|
+
url: DIRECTOR_OF_NURSING_EXTENSION_URL,
|
|
975
|
+
extension: [
|
|
976
|
+
{
|
|
977
|
+
url: DIRECTOR_OF_NURSING_NAME_EXTENSION_URL,
|
|
978
|
+
valueString: spec.directorOfNursingName
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
url: DIRECTOR_OF_NURSING_PHONE_EXTENSION_URL,
|
|
982
|
+
valueString: spec.directorOfNursingPhone
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
url: DIRECTOR_OF_NURSING_EMAIL_EXTENSION_URL,
|
|
986
|
+
valueString: spec.directorOfNursingEmail
|
|
987
|
+
}
|
|
988
|
+
]
|
|
989
|
+
}
|
|
990
|
+
]
|
|
991
|
+
});
|
|
992
|
+
var ON_SITE_DEMO_FACILITIES = FACILITY_SPECS.map(buildFacilityResource);
|
|
993
|
+
var ON_SITE_DEMO_FACILITY_IDS = FACILITY_SPECS.map((f) => f.id);
|
|
994
|
+
|
|
995
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-blocks.ts
|
|
996
|
+
var ON_SITE_DEMO_BLOCK_CAPACITY_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/block-capacity";
|
|
997
|
+
var ON_SITE_APPOINTMENT_TYPE_SYSTEM = "https://onsite-medical.org/appointment-type";
|
|
998
|
+
var BLOCK_OCCURRENCE_WEEKS_PAST = 4;
|
|
999
|
+
var BLOCK_OCCURRENCE_WEEKS_FUTURE = 8;
|
|
1000
|
+
var BLOCK_OCCURRENCES_PER_TEMPLATE = BLOCK_OCCURRENCE_WEEKS_PAST + 1 + BLOCK_OCCURRENCE_WEEKS_FUTURE;
|
|
1001
|
+
var BLOCK_TEMPLATES = [
|
|
1002
|
+
{
|
|
1003
|
+
id: "on-site-demo-block-001",
|
|
1004
|
+
facilityId: "on-site-demo-facility-001",
|
|
1005
|
+
// Druid Hills
|
|
1006
|
+
displayName: "Druid Hills \u2014 Tuesday rounds",
|
|
1007
|
+
dayOfWeek: 2,
|
|
1008
|
+
// Tuesday
|
|
1009
|
+
startHourUtc: 14,
|
|
1010
|
+
// 09:00 ET (EST: 14:00 UTC; EDT: 13:00 UTC) — fixed UTC keeps demo deterministic
|
|
1011
|
+
endHourUtc: 18,
|
|
1012
|
+
// 4-hour block
|
|
1013
|
+
doctorId: "on-site-demo-doctor-001",
|
|
1014
|
+
scribeId: "on-site-demo-scribe-001",
|
|
1015
|
+
capacity: 16
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
id: "on-site-demo-block-002",
|
|
1019
|
+
facilityId: "on-site-demo-facility-001",
|
|
1020
|
+
// Druid Hills (same facility, different weekday)
|
|
1021
|
+
displayName: "Druid Hills \u2014 Thursday rounds",
|
|
1022
|
+
dayOfWeek: 4,
|
|
1023
|
+
// Thursday
|
|
1024
|
+
startHourUtc: 14,
|
|
1025
|
+
endHourUtc: 18,
|
|
1026
|
+
doctorId: "on-site-demo-doctor-002",
|
|
1027
|
+
scribeId: "on-site-demo-scribe-002",
|
|
1028
|
+
capacity: 16
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
id: "on-site-demo-block-003",
|
|
1032
|
+
facilityId: "on-site-demo-facility-002",
|
|
1033
|
+
// Buckhead
|
|
1034
|
+
displayName: "Buckhead \u2014 Wednesday rounds",
|
|
1035
|
+
dayOfWeek: 3,
|
|
1036
|
+
// Wednesday
|
|
1037
|
+
startHourUtc: 14,
|
|
1038
|
+
endHourUtc: 18,
|
|
1039
|
+
doctorId: "on-site-demo-doctor-003",
|
|
1040
|
+
scribeId: "on-site-demo-scribe-003",
|
|
1041
|
+
capacity: 14
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
id: "on-site-demo-block-004",
|
|
1045
|
+
facilityId: "on-site-demo-facility-003",
|
|
1046
|
+
// Decatur
|
|
1047
|
+
displayName: "Decatur \u2014 Monday rounds",
|
|
1048
|
+
dayOfWeek: 1,
|
|
1049
|
+
// Monday
|
|
1050
|
+
startHourUtc: 14,
|
|
1051
|
+
endHourUtc: 18,
|
|
1052
|
+
doctorId: "on-site-demo-doctor-004",
|
|
1053
|
+
scribeId: "on-site-demo-scribe-004",
|
|
1054
|
+
capacity: 12
|
|
1055
|
+
}
|
|
1056
|
+
];
|
|
1057
|
+
var validateBlockTemplateReferences = () => {
|
|
1058
|
+
const facilitySet = new Set(ON_SITE_DEMO_FACILITY_IDS);
|
|
1059
|
+
const doctorSet = new Set(ON_SITE_DEMO_DOCTOR_IDS);
|
|
1060
|
+
const scribeSet = new Set(ON_SITE_DEMO_SCRIBE_IDS);
|
|
1061
|
+
for (const template of BLOCK_TEMPLATES) {
|
|
1062
|
+
if (!facilitySet.has(template.facilityId)) {
|
|
1063
|
+
throw new Error(
|
|
1064
|
+
`Block template "${template.id}" references unknown facility id "${template.facilityId}".`
|
|
1065
|
+
);
|
|
1066
|
+
}
|
|
1067
|
+
if (!doctorSet.has(template.doctorId)) {
|
|
1068
|
+
throw new Error(
|
|
1069
|
+
`Block template "${template.id}" references unknown doctor id "${template.doctorId}".`
|
|
1070
|
+
);
|
|
1071
|
+
}
|
|
1072
|
+
if (!scribeSet.has(template.scribeId)) {
|
|
1073
|
+
throw new Error(
|
|
1074
|
+
`Block template "${template.id}" references unknown scribe id "${template.scribeId}".`
|
|
1075
|
+
);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
var ON_SITE_DEMO_BLOCK_TEMPLATE_IDS = BLOCK_TEMPLATES.map((t) => t.id);
|
|
1080
|
+
var ON_SITE_SCENARIO2 = "on-site-demo";
|
|
1081
|
+
var mondayOfIsoWeekUtc = (referenceIso) => {
|
|
1082
|
+
const ref = new Date(referenceIso);
|
|
1083
|
+
if (Number.isNaN(ref.getTime())) {
|
|
1084
|
+
throw new Error(
|
|
1085
|
+
`mondayOfIsoWeekUtc: invalid reference date "${referenceIso}".`
|
|
1086
|
+
);
|
|
1087
|
+
}
|
|
1088
|
+
const utcDay = ref.getUTCDay() === 0 ? 7 : ref.getUTCDay();
|
|
1089
|
+
const monday = new Date(
|
|
1090
|
+
Date.UTC(ref.getUTCFullYear(), ref.getUTCMonth(), ref.getUTCDate())
|
|
1091
|
+
);
|
|
1092
|
+
monday.setUTCDate(monday.getUTCDate() - (utcDay - 1));
|
|
1093
|
+
return monday;
|
|
1094
|
+
};
|
|
1095
|
+
var occurrenceId = (templateId, weekOffset) => {
|
|
1096
|
+
const sign = weekOffset >= 0 ? "p" : "m";
|
|
1097
|
+
const magnitude = Math.abs(weekOffset).toString().padStart(2, "0");
|
|
1098
|
+
return `${templateId}-w${sign}${magnitude}`;
|
|
1099
|
+
};
|
|
1100
|
+
var buildIdentifierPair2 = (appointmentId, roleSuffix) => [
|
|
1101
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO2, roleSuffix),
|
|
1102
|
+
openhiResourceIdentifier({
|
|
1103
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
1104
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
1105
|
+
resourceType: "Appointment",
|
|
1106
|
+
id: appointmentId
|
|
1107
|
+
})
|
|
1108
|
+
];
|
|
1109
|
+
var toIsoZ = (d) => (
|
|
1110
|
+
// toISOString() always emits a `Z` suffix on UTC times.
|
|
1111
|
+
d.toISOString()
|
|
1112
|
+
);
|
|
1113
|
+
var buildOccurrenceAppointment = (template, anchorMondayUtc, weekOffset) => {
|
|
1114
|
+
const occurrenceDay = new Date(anchorMondayUtc);
|
|
1115
|
+
occurrenceDay.setUTCDate(
|
|
1116
|
+
occurrenceDay.getUTCDate() + weekOffset * 7 + (template.dayOfWeek - 1)
|
|
1117
|
+
);
|
|
1118
|
+
const start = new Date(occurrenceDay);
|
|
1119
|
+
start.setUTCHours(template.startHourUtc, 0, 0, 0);
|
|
1120
|
+
const end = new Date(occurrenceDay);
|
|
1121
|
+
end.setUTCHours(template.endHourUtc, 0, 0, 0);
|
|
1122
|
+
const id = occurrenceId(template.id, weekOffset);
|
|
1123
|
+
return {
|
|
1124
|
+
resourceType: "Appointment",
|
|
1125
|
+
id,
|
|
1126
|
+
status: "booked",
|
|
1127
|
+
identifier: buildIdentifierPair2(id, `block-${id}`),
|
|
1128
|
+
appointmentType: {
|
|
1129
|
+
coding: [
|
|
1130
|
+
{
|
|
1131
|
+
system: ON_SITE_APPOINTMENT_TYPE_SYSTEM,
|
|
1132
|
+
code: "block",
|
|
1133
|
+
display: "Block"
|
|
1134
|
+
}
|
|
1135
|
+
],
|
|
1136
|
+
text: "Block"
|
|
1137
|
+
},
|
|
1138
|
+
description: template.displayName,
|
|
1139
|
+
start: toIsoZ(start),
|
|
1140
|
+
end: toIsoZ(end),
|
|
1141
|
+
minutesDuration: (template.endHourUtc - template.startHourUtc) * 60,
|
|
1142
|
+
participant: [
|
|
1143
|
+
{
|
|
1144
|
+
actor: {
|
|
1145
|
+
reference: `Location/${template.facilityId}`,
|
|
1146
|
+
type: "Location"
|
|
1147
|
+
},
|
|
1148
|
+
status: "accepted"
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
actor: {
|
|
1152
|
+
reference: `Practitioner/${template.doctorId}`,
|
|
1153
|
+
type: "Practitioner"
|
|
1154
|
+
},
|
|
1155
|
+
status: "accepted"
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
actor: {
|
|
1159
|
+
reference: `Practitioner/${template.scribeId}`,
|
|
1160
|
+
type: "Practitioner"
|
|
1161
|
+
},
|
|
1162
|
+
status: "accepted"
|
|
1163
|
+
}
|
|
1164
|
+
],
|
|
1165
|
+
extension: [
|
|
1166
|
+
{
|
|
1167
|
+
url: ON_SITE_DEMO_BLOCK_CAPACITY_EXTENSION_URL,
|
|
1168
|
+
valueInteger: template.capacity
|
|
1169
|
+
}
|
|
1170
|
+
]
|
|
1171
|
+
};
|
|
1172
|
+
};
|
|
1173
|
+
var buildOnSiteDemoBlockAppointments = (referenceIso) => {
|
|
1174
|
+
validateBlockTemplateReferences();
|
|
1175
|
+
const anchorMonday = mondayOfIsoWeekUtc(referenceIso);
|
|
1176
|
+
const out = [];
|
|
1177
|
+
for (const template of BLOCK_TEMPLATES) {
|
|
1178
|
+
for (let weekOffset = -BLOCK_OCCURRENCE_WEEKS_PAST; weekOffset <= BLOCK_OCCURRENCE_WEEKS_FUTURE; weekOffset += 1) {
|
|
1179
|
+
out.push(buildOccurrenceAppointment(template, anchorMonday, weekOffset));
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
return out;
|
|
1183
|
+
};
|
|
1184
|
+
var findOnSiteDemoBlockTemplate = (templateId) => {
|
|
1185
|
+
const t = BLOCK_TEMPLATES.find((tt) => tt.id === templateId);
|
|
1186
|
+
if (!t) {
|
|
1187
|
+
return void 0;
|
|
1188
|
+
}
|
|
1189
|
+
return {
|
|
1190
|
+
id: t.id,
|
|
1191
|
+
facilityId: t.facilityId,
|
|
1192
|
+
displayName: t.displayName,
|
|
1193
|
+
doctorId: t.doctorId,
|
|
1194
|
+
scribeId: t.scribeId,
|
|
1195
|
+
capacity: t.capacity,
|
|
1196
|
+
dayOfWeek: t.dayOfWeek
|
|
1197
|
+
};
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1200
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-facility-patients.ts
|
|
1201
|
+
var PATIENT_DEFAULT_CARE_SETTING_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-default-care-setting";
|
|
1202
|
+
var PATIENT_DEFAULT_CARE_LOCATION_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-default-care-location";
|
|
1203
|
+
var PATIENT_RESIDENCY_ADMISSION_DATE_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-residency-admission-date";
|
|
1204
|
+
var PATIENT_RESIDENCY_ROOM_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-residency-room";
|
|
1205
|
+
var PATIENT_ASSIGNED_BLOCK_TEMPLATE_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-assigned-block-template";
|
|
1206
|
+
var PATIENT_HOSPICE_STATUS_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-hospice-status";
|
|
1207
|
+
var HOSPICE_STATUS_VALUE_SUB_EXTENSION_URL = "status";
|
|
1208
|
+
var HOSPICE_EFFECTIVE_DATE_SUB_EXTENSION_URL = "effectiveDate";
|
|
1209
|
+
var COVERAGE_VERIFICATION_DATE_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/coverage-verification-date";
|
|
1210
|
+
var COVERAGE_QMB_STATUS_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/coverage-qmb-status";
|
|
1211
|
+
var QMB_STATUS_VALUE_SUB_EXTENSION_URL = "status";
|
|
1212
|
+
var QMB_EFFECTIVE_DATE_SUB_EXTENSION_URL = "effectiveDate";
|
|
1213
|
+
var COVERAGE_PAYOR_TYPE_SYSTEM = "https://on-site-medical.app/fhir/CodeSystem/coverage-payor-type";
|
|
1214
|
+
var PAYOR_TYPE_COMMERCIAL = "commercial";
|
|
1215
|
+
var PAYOR_TYPE_MEDICARE = "medicare";
|
|
1216
|
+
var PAYOR_TYPE_MEDICARE_ADVANTAGE = "medicare-advantage";
|
|
1217
|
+
var PATIENTS_PER_BLOCK = [
|
|
1218
|
+
{ blockTemplateId: "on-site-demo-block-001", count: 16 },
|
|
1219
|
+
{ blockTemplateId: "on-site-demo-block-002", count: 14 },
|
|
1220
|
+
{ blockTemplateId: "on-site-demo-block-003", count: 18 },
|
|
1221
|
+
{ blockTemplateId: "on-site-demo-block-004", count: 12 }
|
|
1222
|
+
];
|
|
1223
|
+
var INTAKE_ONLY_PATIENTS_PER_FACILITY = 2;
|
|
1224
|
+
var PRIMARY_PAYOR_OPTIONS = [
|
|
1225
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Aetna PPO" },
|
|
1226
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Blue Cross Blue Shield of Georgia" },
|
|
1227
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "UnitedHealthcare Choice Plus" },
|
|
1228
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Cigna OAP" },
|
|
1229
|
+
{ type: PAYOR_TYPE_MEDICARE, display: "Medicare Part B" },
|
|
1230
|
+
{ type: PAYOR_TYPE_MEDICARE_ADVANTAGE, display: "Humana Medicare Advantage" },
|
|
1231
|
+
{
|
|
1232
|
+
type: PAYOR_TYPE_MEDICARE_ADVANTAGE,
|
|
1233
|
+
display: "Wellcare by Allwell HMO"
|
|
1234
|
+
}
|
|
1235
|
+
];
|
|
1236
|
+
var SECONDARY_PAYOR_OPTIONS = [
|
|
1237
|
+
{ display: "AARP Medigap Plan G" },
|
|
1238
|
+
{ display: "Mutual of Omaha Medicare Supplement" },
|
|
1239
|
+
{ display: "Cigna Supplemental Health" },
|
|
1240
|
+
{ display: "AFLAC Supplemental" }
|
|
1241
|
+
];
|
|
1242
|
+
var PATIENT_LAST_NAMES = [
|
|
1243
|
+
"Anderson",
|
|
1244
|
+
"Bennett",
|
|
1245
|
+
"Brennan",
|
|
1246
|
+
"Carter",
|
|
1247
|
+
"Chen",
|
|
1248
|
+
"Coleman",
|
|
1249
|
+
"Cooper",
|
|
1250
|
+
"Davis",
|
|
1251
|
+
"Diaz",
|
|
1252
|
+
"Edwards",
|
|
1253
|
+
"Fisher",
|
|
1254
|
+
"Foster",
|
|
1255
|
+
"Garcia",
|
|
1256
|
+
"Garrett",
|
|
1257
|
+
"Gonzalez",
|
|
1258
|
+
"Graham",
|
|
1259
|
+
"Greene",
|
|
1260
|
+
"Hall",
|
|
1261
|
+
"Harper",
|
|
1262
|
+
"Harris",
|
|
1263
|
+
"Hayes",
|
|
1264
|
+
"Hernandez",
|
|
1265
|
+
"Holloway",
|
|
1266
|
+
"Hughes",
|
|
1267
|
+
"Jackson",
|
|
1268
|
+
"Jenkins",
|
|
1269
|
+
"Johnson",
|
|
1270
|
+
"Jones",
|
|
1271
|
+
"Kelly",
|
|
1272
|
+
"Kim",
|
|
1273
|
+
"Lambert",
|
|
1274
|
+
"Lawson",
|
|
1275
|
+
"Lee",
|
|
1276
|
+
"Lopez",
|
|
1277
|
+
"Marshall",
|
|
1278
|
+
"Martin",
|
|
1279
|
+
"Mason",
|
|
1280
|
+
"McKenzie",
|
|
1281
|
+
"Mendez",
|
|
1282
|
+
"Miller",
|
|
1283
|
+
"Mitchell",
|
|
1284
|
+
"Moore",
|
|
1285
|
+
"Morgan",
|
|
1286
|
+
"Morris",
|
|
1287
|
+
"Murphy",
|
|
1288
|
+
"Nguyen",
|
|
1289
|
+
"Nichols",
|
|
1290
|
+
"Norton",
|
|
1291
|
+
"O'Brien",
|
|
1292
|
+
"Ortiz",
|
|
1293
|
+
"Owens",
|
|
1294
|
+
"Park",
|
|
1295
|
+
"Patel",
|
|
1296
|
+
"Pearson",
|
|
1297
|
+
"Perez",
|
|
1298
|
+
"Phillips",
|
|
1299
|
+
"Porter",
|
|
1300
|
+
"Powell",
|
|
1301
|
+
"Ramirez",
|
|
1302
|
+
"Reed",
|
|
1303
|
+
"Reyes",
|
|
1304
|
+
"Robinson",
|
|
1305
|
+
"Rodriguez",
|
|
1306
|
+
"Russell",
|
|
1307
|
+
"Sanders",
|
|
1308
|
+
"Schultz",
|
|
1309
|
+
"Singh",
|
|
1310
|
+
"Stewart",
|
|
1311
|
+
"Sullivan",
|
|
1312
|
+
"Tanaka",
|
|
1313
|
+
"Taylor",
|
|
1314
|
+
"Thompson",
|
|
1315
|
+
"Torres",
|
|
1316
|
+
"Walker",
|
|
1317
|
+
"Wallace",
|
|
1318
|
+
"Watson",
|
|
1319
|
+
"Webb",
|
|
1320
|
+
"Williams",
|
|
1321
|
+
"Wilson",
|
|
1322
|
+
"Wong",
|
|
1323
|
+
"Wright"
|
|
1324
|
+
];
|
|
1325
|
+
var PATIENT_FIRST_NAMES = [
|
|
1326
|
+
{ name: "Margaret", gender: "female" },
|
|
1327
|
+
{ name: "Robert", gender: "male" },
|
|
1328
|
+
{ name: "Dorothy", gender: "female" },
|
|
1329
|
+
{ name: "William", gender: "male" },
|
|
1330
|
+
{ name: "Helen", gender: "female" },
|
|
1331
|
+
{ name: "Charles", gender: "male" },
|
|
1332
|
+
{ name: "Patricia", gender: "female" },
|
|
1333
|
+
{ name: "Richard", gender: "male" },
|
|
1334
|
+
{ name: "Barbara", gender: "female" },
|
|
1335
|
+
{ name: "James", gender: "male" },
|
|
1336
|
+
{ name: "Linda", gender: "female" },
|
|
1337
|
+
{ name: "George", gender: "male" },
|
|
1338
|
+
{ name: "Mary", gender: "female" },
|
|
1339
|
+
{ name: "Joseph", gender: "male" },
|
|
1340
|
+
{ name: "Elizabeth", gender: "female" },
|
|
1341
|
+
{ name: "Thomas", gender: "male" },
|
|
1342
|
+
{ name: "Susan", gender: "female" },
|
|
1343
|
+
{ name: "Frank", gender: "male" },
|
|
1344
|
+
{ name: "Ruth", gender: "female" },
|
|
1345
|
+
{ name: "Walter", gender: "male" },
|
|
1346
|
+
{ name: "Carol", gender: "female" },
|
|
1347
|
+
{ name: "Donald", gender: "male" },
|
|
1348
|
+
{ name: "Janet", gender: "female" },
|
|
1349
|
+
{ name: "Harold", gender: "male" },
|
|
1350
|
+
{ name: "Joan", gender: "female" },
|
|
1351
|
+
{ name: "Edward", gender: "male" },
|
|
1352
|
+
{ name: "Nancy", gender: "female" },
|
|
1353
|
+
{ name: "Henry", gender: "male" },
|
|
1354
|
+
{ name: "Betty", gender: "female" },
|
|
1355
|
+
{ name: "Arthur", gender: "male" }
|
|
1356
|
+
];
|
|
1357
|
+
var ON_SITE_SCENARIO3 = "on-site-demo";
|
|
1358
|
+
var PATIENT_ANCHOR_DATE = "2026-05-01T00:00:00Z";
|
|
1359
|
+
var padIndex = (n) => n.toString().padStart(3, "0");
|
|
1360
|
+
var deterministicBirthDate = (index) => {
|
|
1361
|
+
const baseYear = 1935;
|
|
1362
|
+
const yearSpan = 30;
|
|
1363
|
+
const year = baseYear + index % yearSpan;
|
|
1364
|
+
const month = index * 7 % 12 + 1;
|
|
1365
|
+
const day = index * 11 % 28 + 1;
|
|
1366
|
+
const mm = month.toString().padStart(2, "0");
|
|
1367
|
+
const dd = day.toString().padStart(2, "0");
|
|
1368
|
+
return `${year}-${mm}-${dd}`;
|
|
1369
|
+
};
|
|
1370
|
+
var deterministicVerificationDate = (index) => {
|
|
1371
|
+
const dayOffset = index % 30 + 1;
|
|
1372
|
+
const anchor = new Date(PATIENT_ANCHOR_DATE);
|
|
1373
|
+
const verifyAt = new Date(anchor);
|
|
1374
|
+
verifyAt.setUTCDate(verifyAt.getUTCDate() - dayOffset);
|
|
1375
|
+
return verifyAt.toISOString();
|
|
1376
|
+
};
|
|
1377
|
+
var deterministicAdmissionDate = (index) => {
|
|
1378
|
+
const dayOffset = index * 13 % 365 + 1;
|
|
1379
|
+
const anchor = new Date(PATIENT_ANCHOR_DATE);
|
|
1380
|
+
const admitAt = new Date(anchor);
|
|
1381
|
+
admitAt.setUTCDate(admitAt.getUTCDate() - dayOffset);
|
|
1382
|
+
return admitAt.toISOString().slice(0, 10);
|
|
1383
|
+
};
|
|
1384
|
+
var deterministicPhone = (index) => {
|
|
1385
|
+
const last4 = (400 + index).toString().padStart(4, "0");
|
|
1386
|
+
return `+1404555${last4}`;
|
|
1387
|
+
};
|
|
1388
|
+
var deterministicEmail = (firstName, lastName, index) => {
|
|
1389
|
+
const local = `${firstName}.${lastName}.${padIndex(index)}`.toLowerCase().replace(/[^a-z0-9.]/g, "");
|
|
1390
|
+
return `${local}@on-site-demo.example.com`;
|
|
1391
|
+
};
|
|
1392
|
+
var FACILITY_STREET_NAMES = [
|
|
1393
|
+
"Peachtree Street NE",
|
|
1394
|
+
"Ponce de Leon Avenue",
|
|
1395
|
+
"Piedmont Avenue",
|
|
1396
|
+
"Howell Mill Road NW",
|
|
1397
|
+
"Northside Drive NW",
|
|
1398
|
+
"Edgewood Avenue SE",
|
|
1399
|
+
"Spring Street NW",
|
|
1400
|
+
"Clifton Road NE"
|
|
1401
|
+
];
|
|
1402
|
+
var deterministicAddressLine = (index) => {
|
|
1403
|
+
const houseNumber = 100 + index * 7;
|
|
1404
|
+
const streetIndex = index % FACILITY_STREET_NAMES.length;
|
|
1405
|
+
return `${houseNumber} ${FACILITY_STREET_NAMES[streetIndex]}`;
|
|
1406
|
+
};
|
|
1407
|
+
var deterministicPrimaryPayor = (index) => {
|
|
1408
|
+
const bucket = index % 10;
|
|
1409
|
+
if (bucket <= 3) {
|
|
1410
|
+
return PRIMARY_PAYOR_OPTIONS[bucket % 4];
|
|
1411
|
+
}
|
|
1412
|
+
if (bucket <= 6) {
|
|
1413
|
+
return PRIMARY_PAYOR_OPTIONS[4];
|
|
1414
|
+
}
|
|
1415
|
+
return PRIMARY_PAYOR_OPTIONS[5 + (bucket - 7) % 2];
|
|
1416
|
+
};
|
|
1417
|
+
var hasSecondaryCoverage = (index) => {
|
|
1418
|
+
return index % 5 < 2;
|
|
1419
|
+
};
|
|
1420
|
+
var hasQmbStatus = (index) => {
|
|
1421
|
+
return index % 2 === 0;
|
|
1422
|
+
};
|
|
1423
|
+
var isHospicePatient = (index) => {
|
|
1424
|
+
return index % 5 === 0;
|
|
1425
|
+
};
|
|
1426
|
+
var buildIdentifierPair3 = (patientId, roleSuffix) => [
|
|
1427
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO3, roleSuffix),
|
|
1428
|
+
openhiResourceIdentifier({
|
|
1429
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
1430
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
1431
|
+
resourceType: "Patient",
|
|
1432
|
+
id: patientId
|
|
1433
|
+
})
|
|
1434
|
+
];
|
|
1435
|
+
var buildCoverageIdentifierPair = (coverageId, roleSuffix) => [
|
|
1436
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO3, roleSuffix),
|
|
1437
|
+
openhiResourceIdentifier({
|
|
1438
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
1439
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
1440
|
+
resourceType: "Coverage",
|
|
1441
|
+
id: coverageId
|
|
1442
|
+
})
|
|
1443
|
+
];
|
|
1444
|
+
var buildFacilityPatientResource = (spec) => {
|
|
1445
|
+
const firstNameEntry = PATIENT_FIRST_NAMES[spec.index % PATIENT_FIRST_NAMES.length];
|
|
1446
|
+
const lastName = PATIENT_LAST_NAMES[spec.index * 3 % PATIENT_LAST_NAMES.length];
|
|
1447
|
+
const fullText = `${firstNameEntry.name} ${lastName}`;
|
|
1448
|
+
const admissionDate = deterministicAdmissionDate(spec.index);
|
|
1449
|
+
const blockExtension = spec.blockTemplateId ? [
|
|
1450
|
+
{
|
|
1451
|
+
url: PATIENT_ASSIGNED_BLOCK_TEMPLATE_EXTENSION_URL,
|
|
1452
|
+
valueString: spec.blockTemplateId
|
|
1453
|
+
}
|
|
1454
|
+
] : [];
|
|
1455
|
+
const hospiceExtension = isHospicePatient(spec.index) ? [
|
|
1456
|
+
{
|
|
1457
|
+
url: PATIENT_HOSPICE_STATUS_EXTENSION_URL,
|
|
1458
|
+
extension: [
|
|
1459
|
+
{
|
|
1460
|
+
url: HOSPICE_STATUS_VALUE_SUB_EXTENSION_URL,
|
|
1461
|
+
valueCode: "in_hospice"
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
url: HOSPICE_EFFECTIVE_DATE_SUB_EXTENSION_URL,
|
|
1465
|
+
valueDate: admissionDate
|
|
1466
|
+
}
|
|
1467
|
+
]
|
|
1468
|
+
}
|
|
1469
|
+
] : [];
|
|
1470
|
+
return {
|
|
1471
|
+
resourceType: "Patient",
|
|
1472
|
+
id: spec.id,
|
|
1473
|
+
active: true,
|
|
1474
|
+
identifier: buildIdentifierPair3(spec.id, `patient-${spec.id}`),
|
|
1475
|
+
name: [
|
|
1476
|
+
{
|
|
1477
|
+
use: "official",
|
|
1478
|
+
text: fullText,
|
|
1479
|
+
given: [firstNameEntry.name],
|
|
1480
|
+
family: lastName
|
|
1481
|
+
}
|
|
1482
|
+
],
|
|
1483
|
+
gender: firstNameEntry.gender,
|
|
1484
|
+
birthDate: deterministicBirthDate(spec.index),
|
|
1485
|
+
telecom: [
|
|
1486
|
+
{
|
|
1487
|
+
system: "phone",
|
|
1488
|
+
value: deterministicPhone(spec.index),
|
|
1489
|
+
use: "home"
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
system: "email",
|
|
1493
|
+
value: deterministicEmail(firstNameEntry.name, lastName, spec.index),
|
|
1494
|
+
use: "home"
|
|
1495
|
+
}
|
|
1496
|
+
],
|
|
1497
|
+
address: [
|
|
1498
|
+
{
|
|
1499
|
+
use: "home",
|
|
1500
|
+
line: [deterministicAddressLine(spec.index)],
|
|
1501
|
+
city: "Atlanta",
|
|
1502
|
+
state: "GA",
|
|
1503
|
+
postalCode: "30303",
|
|
1504
|
+
country: "US"
|
|
1505
|
+
}
|
|
1506
|
+
],
|
|
1507
|
+
extension: [
|
|
1508
|
+
{
|
|
1509
|
+
url: PATIENT_DEFAULT_CARE_SETTING_EXTENSION_URL,
|
|
1510
|
+
valueCode: "facility"
|
|
1511
|
+
},
|
|
1512
|
+
{
|
|
1513
|
+
url: PATIENT_DEFAULT_CARE_LOCATION_EXTENSION_URL,
|
|
1514
|
+
valueReference: { reference: `Location/${spec.facilityId}` }
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
url: PATIENT_RESIDENCY_ADMISSION_DATE_EXTENSION_URL,
|
|
1518
|
+
valueDate: admissionDate
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
url: PATIENT_RESIDENCY_ROOM_EXTENSION_URL,
|
|
1522
|
+
// Pad to 3 digits so room numbers look like 100..600.
|
|
1523
|
+
valueString: `${100 + spec.index % 500}`
|
|
1524
|
+
},
|
|
1525
|
+
...blockExtension,
|
|
1526
|
+
...hospiceExtension
|
|
1527
|
+
]
|
|
1528
|
+
};
|
|
1529
|
+
};
|
|
1530
|
+
var buildPrimaryCoverageResource = (spec) => {
|
|
1531
|
+
const id = `${spec.id}-coverage-primary`;
|
|
1532
|
+
const payor = deterministicPrimaryPayor(spec.index);
|
|
1533
|
+
const verificationDate = deterministicVerificationDate(spec.index);
|
|
1534
|
+
const isMedicarePrimary = payor.type === PAYOR_TYPE_MEDICARE;
|
|
1535
|
+
const qmbExtension = isMedicarePrimary && hasQmbStatus(spec.index) ? [
|
|
1536
|
+
{
|
|
1537
|
+
url: COVERAGE_QMB_STATUS_EXTENSION_URL,
|
|
1538
|
+
extension: [
|
|
1539
|
+
{
|
|
1540
|
+
url: QMB_STATUS_VALUE_SUB_EXTENSION_URL,
|
|
1541
|
+
valueCode: "active"
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
url: QMB_EFFECTIVE_DATE_SUB_EXTENSION_URL,
|
|
1545
|
+
valueDate: deterministicAdmissionDate(spec.index)
|
|
1546
|
+
}
|
|
1547
|
+
]
|
|
1548
|
+
}
|
|
1549
|
+
] : [];
|
|
1550
|
+
return {
|
|
1551
|
+
resourceType: "Coverage",
|
|
1552
|
+
id,
|
|
1553
|
+
status: "active",
|
|
1554
|
+
identifier: buildCoverageIdentifierPair(id, `coverage-primary-${spec.id}`),
|
|
1555
|
+
beneficiary: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
1556
|
+
subscriber: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
1557
|
+
subscriberId: `MBR-${padIndex(spec.index)}-PRI`,
|
|
1558
|
+
relationship: { text: "self" },
|
|
1559
|
+
payor: [
|
|
1560
|
+
{
|
|
1561
|
+
display: payor.display
|
|
1562
|
+
}
|
|
1563
|
+
],
|
|
1564
|
+
type: {
|
|
1565
|
+
coding: [
|
|
1566
|
+
{
|
|
1567
|
+
system: COVERAGE_PAYOR_TYPE_SYSTEM,
|
|
1568
|
+
code: payor.type,
|
|
1569
|
+
display: payor.display
|
|
1570
|
+
}
|
|
1571
|
+
],
|
|
1572
|
+
text: payor.display
|
|
1573
|
+
},
|
|
1574
|
+
order: 1,
|
|
1575
|
+
extension: [
|
|
1576
|
+
{
|
|
1577
|
+
url: COVERAGE_VERIFICATION_DATE_EXTENSION_URL,
|
|
1578
|
+
valueDateTime: verificationDate
|
|
1579
|
+
},
|
|
1580
|
+
...qmbExtension
|
|
1581
|
+
]
|
|
1582
|
+
};
|
|
1583
|
+
};
|
|
1584
|
+
var buildSecondaryCoverageResource = (spec) => {
|
|
1585
|
+
if (!hasSecondaryCoverage(spec.index)) {
|
|
1586
|
+
return void 0;
|
|
1587
|
+
}
|
|
1588
|
+
const id = `${spec.id}-coverage-secondary`;
|
|
1589
|
+
const payor = SECONDARY_PAYOR_OPTIONS[spec.index % SECONDARY_PAYOR_OPTIONS.length];
|
|
1590
|
+
const verificationDate = deterministicVerificationDate(spec.index);
|
|
1591
|
+
return {
|
|
1592
|
+
resourceType: "Coverage",
|
|
1593
|
+
id,
|
|
1594
|
+
status: "active",
|
|
1595
|
+
identifier: buildCoverageIdentifierPair(
|
|
1596
|
+
id,
|
|
1597
|
+
`coverage-secondary-${spec.id}`
|
|
1598
|
+
),
|
|
1599
|
+
beneficiary: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
1600
|
+
subscriber: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
1601
|
+
subscriberId: `MBR-${padIndex(spec.index)}-SEC`,
|
|
1602
|
+
relationship: { text: "self" },
|
|
1603
|
+
payor: [
|
|
1604
|
+
{
|
|
1605
|
+
display: payor.display
|
|
1606
|
+
}
|
|
1607
|
+
],
|
|
1608
|
+
type: {
|
|
1609
|
+
text: payor.display
|
|
1610
|
+
},
|
|
1611
|
+
order: 2,
|
|
1612
|
+
extension: [
|
|
1613
|
+
{
|
|
1614
|
+
url: COVERAGE_VERIFICATION_DATE_EXTENSION_URL,
|
|
1615
|
+
valueDateTime: verificationDate
|
|
1616
|
+
}
|
|
1617
|
+
]
|
|
1618
|
+
};
|
|
1619
|
+
};
|
|
1620
|
+
var buildAllFacilityPatientSpecs = () => {
|
|
1621
|
+
validateBlockReferences();
|
|
1622
|
+
const specs = [];
|
|
1623
|
+
let nextIndex = 0;
|
|
1624
|
+
for (const { blockTemplateId, count } of PATIENTS_PER_BLOCK) {
|
|
1625
|
+
const template = findOnSiteDemoBlockTemplate(blockTemplateId);
|
|
1626
|
+
if (!template) {
|
|
1627
|
+
throw new Error(
|
|
1628
|
+
`Block template "${blockTemplateId}" not found while seeding facility patients.`
|
|
1629
|
+
);
|
|
1630
|
+
}
|
|
1631
|
+
for (let i = 0; i < count; i += 1) {
|
|
1632
|
+
const index = nextIndex;
|
|
1633
|
+
specs.push({
|
|
1634
|
+
id: `on-site-demo-facility-patient-${padIndex(index + 1)}`,
|
|
1635
|
+
index,
|
|
1636
|
+
facilityId: template.facilityId,
|
|
1637
|
+
blockTemplateId
|
|
1638
|
+
});
|
|
1639
|
+
nextIndex += 1;
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
for (const facilityId of ON_SITE_DEMO_FACILITY_IDS) {
|
|
1643
|
+
for (let i = 0; i < INTAKE_ONLY_PATIENTS_PER_FACILITY; i += 1) {
|
|
1644
|
+
const index = nextIndex;
|
|
1645
|
+
specs.push({
|
|
1646
|
+
id: `on-site-demo-facility-patient-${padIndex(index + 1)}`,
|
|
1647
|
+
index,
|
|
1648
|
+
facilityId,
|
|
1649
|
+
blockTemplateId: void 0
|
|
1650
|
+
});
|
|
1651
|
+
nextIndex += 1;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
return specs;
|
|
1655
|
+
};
|
|
1656
|
+
var validateBlockReferences = () => {
|
|
1657
|
+
const blockSet = new Set(ON_SITE_DEMO_BLOCK_TEMPLATE_IDS);
|
|
1658
|
+
for (const entry of PATIENTS_PER_BLOCK) {
|
|
1659
|
+
if (!blockSet.has(entry.blockTemplateId)) {
|
|
1660
|
+
throw new Error(
|
|
1661
|
+
`Facility-patient generator references unknown block template id "${entry.blockTemplateId}".`
|
|
1662
|
+
);
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
};
|
|
1666
|
+
var cachedSpecs;
|
|
1667
|
+
var getFacilityPatientSpecs = () => {
|
|
1668
|
+
if (!cachedSpecs) {
|
|
1669
|
+
cachedSpecs = buildAllFacilityPatientSpecs();
|
|
1670
|
+
}
|
|
1671
|
+
return cachedSpecs;
|
|
1672
|
+
};
|
|
1673
|
+
var buildOnSiteDemoFacilityPatients = () => getFacilityPatientSpecs().map(buildFacilityPatientResource);
|
|
1674
|
+
var buildOnSiteDemoFacilityCoverages = () => {
|
|
1675
|
+
const out = [];
|
|
1676
|
+
for (const spec of getFacilityPatientSpecs()) {
|
|
1677
|
+
out.push(buildPrimaryCoverageResource(spec));
|
|
1678
|
+
const secondary = buildSecondaryCoverageResource(spec);
|
|
1679
|
+
if (secondary) {
|
|
1680
|
+
out.push(secondary);
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
return out;
|
|
1684
|
+
};
|
|
1685
|
+
var onSiteDemoScheduledFacilityPatientIds = () => getFacilityPatientSpecs().filter((s) => s.blockTemplateId !== void 0).map((s) => s.id);
|
|
1686
|
+
var facilityPatientsForBlock = (blockTemplateId) => getFacilityPatientSpecs().filter((s) => s.blockTemplateId === blockTemplateId).map((s) => s.id);
|
|
1687
|
+
|
|
1688
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-home-health-patients.ts
|
|
1689
|
+
var PATIENT_ASSIGNED_HOME_HEALTH_PROVIDER_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/patient-assigned-home-health-provider";
|
|
1690
|
+
var HOME_HEALTH_VISIT_CADENCE_DAYS_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/home-health-visit-cadence-days";
|
|
1691
|
+
var HOME_HEALTH_VISIT_CADENCE_OPTIONS = [
|
|
1692
|
+
7,
|
|
1693
|
+
14,
|
|
1694
|
+
28
|
|
1695
|
+
];
|
|
1696
|
+
var SCHEDULED_HOME_HEALTH_PATIENTS = 17;
|
|
1697
|
+
var INTAKE_ONLY_HOME_HEALTH_PATIENTS = 3;
|
|
1698
|
+
var TOTAL_HOME_HEALTH_PATIENTS = SCHEDULED_HOME_HEALTH_PATIENTS + INTAKE_ONLY_HOME_HEALTH_PATIENTS;
|
|
1699
|
+
var PRIMARY_PAYOR_OPTIONS2 = [
|
|
1700
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Aetna PPO" },
|
|
1701
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Blue Cross Blue Shield of Georgia" },
|
|
1702
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "UnitedHealthcare Choice Plus" },
|
|
1703
|
+
{ type: PAYOR_TYPE_COMMERCIAL, display: "Cigna OAP" },
|
|
1704
|
+
{ type: PAYOR_TYPE_MEDICARE, display: "Medicare Part B" },
|
|
1705
|
+
{ type: PAYOR_TYPE_MEDICARE_ADVANTAGE, display: "Humana Medicare Advantage" },
|
|
1706
|
+
{
|
|
1707
|
+
type: PAYOR_TYPE_MEDICARE_ADVANTAGE,
|
|
1708
|
+
display: "Wellcare by Allwell HMO"
|
|
1709
|
+
}
|
|
1710
|
+
];
|
|
1711
|
+
var SECONDARY_PAYOR_OPTIONS2 = [
|
|
1712
|
+
{ display: "AARP Medigap Plan G" },
|
|
1713
|
+
{ display: "Mutual of Omaha Medicare Supplement" },
|
|
1714
|
+
{ display: "Cigna Supplemental Health" },
|
|
1715
|
+
{ display: "AFLAC Supplemental" }
|
|
1716
|
+
];
|
|
1717
|
+
var PATIENT_LAST_NAMES2 = [
|
|
1718
|
+
"Acosta",
|
|
1719
|
+
"Barnett",
|
|
1720
|
+
"Bryant",
|
|
1721
|
+
"Castillo",
|
|
1722
|
+
"Conway",
|
|
1723
|
+
"Delgado",
|
|
1724
|
+
"Eldridge",
|
|
1725
|
+
"Fitzgerald",
|
|
1726
|
+
"Garza",
|
|
1727
|
+
"Hicks",
|
|
1728
|
+
"Ingram",
|
|
1729
|
+
"Jensen",
|
|
1730
|
+
"Klein",
|
|
1731
|
+
"Larson",
|
|
1732
|
+
"McCarthy",
|
|
1733
|
+
"Nash",
|
|
1734
|
+
"O'Connor",
|
|
1735
|
+
"Pierce",
|
|
1736
|
+
"Quintana",
|
|
1737
|
+
"Reilly",
|
|
1738
|
+
"Salazar",
|
|
1739
|
+
"Tate",
|
|
1740
|
+
"Underwood",
|
|
1741
|
+
"Vega",
|
|
1742
|
+
"Whitaker"
|
|
1743
|
+
];
|
|
1744
|
+
var PATIENT_FIRST_NAMES2 = [
|
|
1745
|
+
{ name: "Eleanor", gender: "female" },
|
|
1746
|
+
{ name: "Albert", gender: "male" },
|
|
1747
|
+
{ name: "Florence", gender: "female" },
|
|
1748
|
+
{ name: "Bernard", gender: "male" },
|
|
1749
|
+
{ name: "Marjorie", gender: "female" },
|
|
1750
|
+
{ name: "Stanley", gender: "male" },
|
|
1751
|
+
{ name: "Gladys", gender: "female" },
|
|
1752
|
+
{ name: "Norman", gender: "male" },
|
|
1753
|
+
{ name: "Pauline", gender: "female" },
|
|
1754
|
+
{ name: "Raymond", gender: "male" },
|
|
1755
|
+
{ name: "Lillian", gender: "female" },
|
|
1756
|
+
{ name: "Howard", gender: "male" },
|
|
1757
|
+
{ name: "Mildred", gender: "female" },
|
|
1758
|
+
{ name: "Russell", gender: "male" },
|
|
1759
|
+
{ name: "Frances", gender: "female" },
|
|
1760
|
+
{ name: "Eugene", gender: "male" },
|
|
1761
|
+
{ name: "Bernice", gender: "female" },
|
|
1762
|
+
{ name: "Leonard", gender: "male" },
|
|
1763
|
+
{ name: "Eileen", gender: "female" },
|
|
1764
|
+
{ name: "Clifford", gender: "male" }
|
|
1765
|
+
];
|
|
1766
|
+
var ON_SITE_SCENARIO4 = "on-site-demo";
|
|
1767
|
+
var PATIENT_ANCHOR_DATE2 = "2026-05-01T00:00:00Z";
|
|
1768
|
+
var padIndex2 = (n) => n.toString().padStart(3, "0");
|
|
1769
|
+
var deterministicBirthDate2 = (index) => {
|
|
1770
|
+
const baseYear = 1932;
|
|
1771
|
+
const yearSpan = 25;
|
|
1772
|
+
const year = baseYear + index % yearSpan;
|
|
1773
|
+
const month = index * 7 % 12 + 1;
|
|
1774
|
+
const day = index * 11 % 28 + 1;
|
|
1775
|
+
const mm = month.toString().padStart(2, "0");
|
|
1776
|
+
const dd = day.toString().padStart(2, "0");
|
|
1777
|
+
return `${year}-${mm}-${dd}`;
|
|
1778
|
+
};
|
|
1779
|
+
var deterministicVerificationDate2 = (index) => {
|
|
1780
|
+
const dayOffset = index % 30 + 1;
|
|
1781
|
+
const anchor = new Date(PATIENT_ANCHOR_DATE2);
|
|
1782
|
+
const verifyAt = new Date(anchor);
|
|
1783
|
+
verifyAt.setUTCDate(verifyAt.getUTCDate() - dayOffset);
|
|
1784
|
+
return verifyAt.toISOString();
|
|
1785
|
+
};
|
|
1786
|
+
var deterministicEffectiveDate = (index) => {
|
|
1787
|
+
const dayOffset = index * 13 % 365 + 1;
|
|
1788
|
+
const anchor = new Date(PATIENT_ANCHOR_DATE2);
|
|
1789
|
+
const eff = new Date(anchor);
|
|
1790
|
+
eff.setUTCDate(eff.getUTCDate() - dayOffset);
|
|
1791
|
+
return eff.toISOString().slice(0, 10);
|
|
1792
|
+
};
|
|
1793
|
+
var deterministicPhone2 = (index) => {
|
|
1794
|
+
const last4 = (600 + index).toString().padStart(4, "0");
|
|
1795
|
+
return `+1404555${last4}`;
|
|
1796
|
+
};
|
|
1797
|
+
var deterministicEmail2 = (firstName, lastName, index) => {
|
|
1798
|
+
const local = `${firstName}.${lastName}.${padIndex2(index)}`.toLowerCase().replace(/[^a-z0-9.]/g, "");
|
|
1799
|
+
return `${local}@on-site-demo.example.com`;
|
|
1800
|
+
};
|
|
1801
|
+
var HOME_STREET_NAMES = [
|
|
1802
|
+
"Briarcliff Road NE",
|
|
1803
|
+
"Cheshire Bridge Road",
|
|
1804
|
+
"Dekalb Avenue NE",
|
|
1805
|
+
"Lavista Road",
|
|
1806
|
+
"Memorial Drive SE",
|
|
1807
|
+
"Moreland Avenue NE",
|
|
1808
|
+
"North Decatur Road",
|
|
1809
|
+
"Roswell Road",
|
|
1810
|
+
"Virginia Avenue NE",
|
|
1811
|
+
"West Paces Ferry Road"
|
|
1812
|
+
];
|
|
1813
|
+
var deterministicAddressLine2 = (index) => {
|
|
1814
|
+
const houseNumber = 200 + index * 11;
|
|
1815
|
+
const streetIndex = index % HOME_STREET_NAMES.length;
|
|
1816
|
+
return `${houseNumber} ${HOME_STREET_NAMES[streetIndex]}`;
|
|
1817
|
+
};
|
|
1818
|
+
var HOME_POSTAL_CODES = [
|
|
1819
|
+
"30306",
|
|
1820
|
+
"30307",
|
|
1821
|
+
"30324",
|
|
1822
|
+
"30329",
|
|
1823
|
+
"30033",
|
|
1824
|
+
"30030",
|
|
1825
|
+
"30342",
|
|
1826
|
+
"30327",
|
|
1827
|
+
"30319",
|
|
1828
|
+
"30305"
|
|
1829
|
+
];
|
|
1830
|
+
var deterministicPostalCode = (index) => HOME_POSTAL_CODES[index % HOME_POSTAL_CODES.length];
|
|
1831
|
+
var deterministicPrimaryPayor2 = (index) => {
|
|
1832
|
+
const bucket = index % 10;
|
|
1833
|
+
if (bucket <= 3) {
|
|
1834
|
+
return PRIMARY_PAYOR_OPTIONS2[bucket % 4];
|
|
1835
|
+
}
|
|
1836
|
+
if (bucket <= 6) {
|
|
1837
|
+
return PRIMARY_PAYOR_OPTIONS2[4];
|
|
1838
|
+
}
|
|
1839
|
+
return PRIMARY_PAYOR_OPTIONS2[5 + (bucket - 7) % 2];
|
|
1840
|
+
};
|
|
1841
|
+
var hasSecondaryCoverage2 = (index) => {
|
|
1842
|
+
return index % 5 < 2;
|
|
1843
|
+
};
|
|
1844
|
+
var hasQmbStatus2 = (index) => {
|
|
1845
|
+
return index % 2 === 0;
|
|
1846
|
+
};
|
|
1847
|
+
var isHospicePatient2 = (index) => {
|
|
1848
|
+
return index % 5 === 0;
|
|
1849
|
+
};
|
|
1850
|
+
var deterministicVisitCadenceDays = (index) => HOME_HEALTH_VISIT_CADENCE_OPTIONS[index % HOME_HEALTH_VISIT_CADENCE_OPTIONS.length];
|
|
1851
|
+
var buildIdentifierPair4 = (patientId, roleSuffix) => [
|
|
1852
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO4, roleSuffix),
|
|
1853
|
+
openhiResourceIdentifier({
|
|
1854
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
1855
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
1856
|
+
resourceType: "Patient",
|
|
1857
|
+
id: patientId
|
|
1858
|
+
})
|
|
1859
|
+
];
|
|
1860
|
+
var buildCoverageIdentifierPair2 = (coverageId, roleSuffix) => [
|
|
1861
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO4, roleSuffix),
|
|
1862
|
+
openhiResourceIdentifier({
|
|
1863
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
1864
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
1865
|
+
resourceType: "Coverage",
|
|
1866
|
+
id: coverageId
|
|
1867
|
+
})
|
|
1868
|
+
];
|
|
1869
|
+
var buildHomeHealthPatientResource = (spec) => {
|
|
1870
|
+
const firstNameEntry = PATIENT_FIRST_NAMES2[spec.index % PATIENT_FIRST_NAMES2.length];
|
|
1871
|
+
const lastName = PATIENT_LAST_NAMES2[spec.index * 3 % PATIENT_LAST_NAMES2.length];
|
|
1872
|
+
const fullText = `${firstNameEntry.name} ${lastName}`;
|
|
1873
|
+
const effectiveDate = deterministicEffectiveDate(spec.index);
|
|
1874
|
+
const providerExtension = spec.providerId ? [
|
|
1875
|
+
{
|
|
1876
|
+
url: PATIENT_ASSIGNED_HOME_HEALTH_PROVIDER_EXTENSION_URL,
|
|
1877
|
+
valueReference: {
|
|
1878
|
+
reference: `Practitioner/${spec.providerId}`,
|
|
1879
|
+
type: "Practitioner"
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
] : [];
|
|
1883
|
+
const cadenceExtension = typeof spec.visitCadenceDays === "number" ? [
|
|
1884
|
+
{
|
|
1885
|
+
url: HOME_HEALTH_VISIT_CADENCE_DAYS_EXTENSION_URL,
|
|
1886
|
+
valueInteger: spec.visitCadenceDays
|
|
1887
|
+
}
|
|
1888
|
+
] : [];
|
|
1889
|
+
const hospiceExtension = isHospicePatient2(spec.index) ? [
|
|
1890
|
+
{
|
|
1891
|
+
url: PATIENT_HOSPICE_STATUS_EXTENSION_URL,
|
|
1892
|
+
extension: [
|
|
1893
|
+
{
|
|
1894
|
+
url: HOSPICE_STATUS_VALUE_SUB_EXTENSION_URL,
|
|
1895
|
+
valueCode: "in_hospice"
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
url: HOSPICE_EFFECTIVE_DATE_SUB_EXTENSION_URL,
|
|
1899
|
+
valueDate: effectiveDate
|
|
1900
|
+
}
|
|
1901
|
+
]
|
|
1902
|
+
}
|
|
1903
|
+
] : [];
|
|
1904
|
+
return {
|
|
1905
|
+
resourceType: "Patient",
|
|
1906
|
+
id: spec.id,
|
|
1907
|
+
active: true,
|
|
1908
|
+
identifier: buildIdentifierPair4(spec.id, `patient-${spec.id}`),
|
|
1909
|
+
name: [
|
|
1910
|
+
{
|
|
1911
|
+
use: "official",
|
|
1912
|
+
text: fullText,
|
|
1913
|
+
given: [firstNameEntry.name],
|
|
1914
|
+
family: lastName
|
|
1915
|
+
}
|
|
1916
|
+
],
|
|
1917
|
+
gender: firstNameEntry.gender,
|
|
1918
|
+
birthDate: deterministicBirthDate2(spec.index),
|
|
1919
|
+
telecom: [
|
|
1920
|
+
{
|
|
1921
|
+
system: "phone",
|
|
1922
|
+
value: deterministicPhone2(spec.index),
|
|
1923
|
+
use: "home"
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
system: "email",
|
|
1927
|
+
value: deterministicEmail2(firstNameEntry.name, lastName, spec.index),
|
|
1928
|
+
use: "home"
|
|
1929
|
+
}
|
|
1930
|
+
],
|
|
1931
|
+
address: [
|
|
1932
|
+
{
|
|
1933
|
+
use: "home",
|
|
1934
|
+
line: [deterministicAddressLine2(spec.index)],
|
|
1935
|
+
city: "Atlanta",
|
|
1936
|
+
state: "GA",
|
|
1937
|
+
postalCode: deterministicPostalCode(spec.index),
|
|
1938
|
+
country: "US"
|
|
1939
|
+
}
|
|
1940
|
+
],
|
|
1941
|
+
extension: [
|
|
1942
|
+
{
|
|
1943
|
+
url: PATIENT_DEFAULT_CARE_SETTING_EXTENSION_URL,
|
|
1944
|
+
valueCode: "home"
|
|
1945
|
+
},
|
|
1946
|
+
// No `patient-default-care-location` extension — home-health
|
|
1947
|
+
// patients have no facility Location reference (mirrors the
|
|
1948
|
+
// on-site `buildDefaultCareSettingExtensions` helper, which
|
|
1949
|
+
// only emits the location extension when setting === "facility").
|
|
1950
|
+
...providerExtension,
|
|
1951
|
+
...cadenceExtension,
|
|
1952
|
+
...hospiceExtension
|
|
1953
|
+
]
|
|
1954
|
+
};
|
|
1955
|
+
};
|
|
1956
|
+
var buildPrimaryCoverageResource2 = (spec) => {
|
|
1957
|
+
const id = `${spec.id}-coverage-primary`;
|
|
1958
|
+
const payor = deterministicPrimaryPayor2(spec.index);
|
|
1959
|
+
const verificationDate = deterministicVerificationDate2(spec.index);
|
|
1960
|
+
const isMedicarePrimary = payor.type === PAYOR_TYPE_MEDICARE;
|
|
1961
|
+
const qmbExtension = isMedicarePrimary && hasQmbStatus2(spec.index) ? [
|
|
1962
|
+
{
|
|
1963
|
+
url: COVERAGE_QMB_STATUS_EXTENSION_URL,
|
|
1964
|
+
extension: [
|
|
1965
|
+
{
|
|
1966
|
+
url: QMB_STATUS_VALUE_SUB_EXTENSION_URL,
|
|
1967
|
+
valueCode: "active"
|
|
1968
|
+
},
|
|
1969
|
+
{
|
|
1970
|
+
url: QMB_EFFECTIVE_DATE_SUB_EXTENSION_URL,
|
|
1971
|
+
valueDate: deterministicEffectiveDate(spec.index)
|
|
1972
|
+
}
|
|
1973
|
+
]
|
|
1974
|
+
}
|
|
1975
|
+
] : [];
|
|
1976
|
+
return {
|
|
1977
|
+
resourceType: "Coverage",
|
|
1978
|
+
id,
|
|
1979
|
+
status: "active",
|
|
1980
|
+
identifier: buildCoverageIdentifierPair2(id, `coverage-primary-${spec.id}`),
|
|
1981
|
+
beneficiary: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
1982
|
+
subscriber: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
1983
|
+
subscriberId: `MBR-HH-${padIndex2(spec.index)}-PRI`,
|
|
1984
|
+
relationship: { text: "self" },
|
|
1985
|
+
payor: [
|
|
1986
|
+
{
|
|
1987
|
+
display: payor.display
|
|
1988
|
+
}
|
|
1989
|
+
],
|
|
1990
|
+
type: {
|
|
1991
|
+
coding: [
|
|
1992
|
+
{
|
|
1993
|
+
system: COVERAGE_PAYOR_TYPE_SYSTEM,
|
|
1994
|
+
code: payor.type,
|
|
1995
|
+
display: payor.display
|
|
1996
|
+
}
|
|
1997
|
+
],
|
|
1998
|
+
text: payor.display
|
|
1999
|
+
},
|
|
2000
|
+
order: 1,
|
|
2001
|
+
extension: [
|
|
2002
|
+
{
|
|
2003
|
+
url: COVERAGE_VERIFICATION_DATE_EXTENSION_URL,
|
|
2004
|
+
valueDateTime: verificationDate
|
|
2005
|
+
},
|
|
2006
|
+
...qmbExtension
|
|
2007
|
+
]
|
|
2008
|
+
};
|
|
2009
|
+
};
|
|
2010
|
+
var buildSecondaryCoverageResource2 = (spec) => {
|
|
2011
|
+
if (!hasSecondaryCoverage2(spec.index)) {
|
|
2012
|
+
return void 0;
|
|
2013
|
+
}
|
|
2014
|
+
const id = `${spec.id}-coverage-secondary`;
|
|
2015
|
+
const payor = SECONDARY_PAYOR_OPTIONS2[spec.index % SECONDARY_PAYOR_OPTIONS2.length];
|
|
2016
|
+
const verificationDate = deterministicVerificationDate2(spec.index);
|
|
2017
|
+
return {
|
|
2018
|
+
resourceType: "Coverage",
|
|
2019
|
+
id,
|
|
2020
|
+
status: "active",
|
|
2021
|
+
identifier: buildCoverageIdentifierPair2(
|
|
2022
|
+
id,
|
|
2023
|
+
`coverage-secondary-${spec.id}`
|
|
2024
|
+
),
|
|
2025
|
+
beneficiary: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
2026
|
+
subscriber: { reference: `Patient/${spec.id}`, type: "Patient" },
|
|
2027
|
+
subscriberId: `MBR-HH-${padIndex2(spec.index)}-SEC`,
|
|
2028
|
+
relationship: { text: "self" },
|
|
2029
|
+
payor: [
|
|
2030
|
+
{
|
|
2031
|
+
display: payor.display
|
|
2032
|
+
}
|
|
2033
|
+
],
|
|
2034
|
+
type: {
|
|
2035
|
+
text: payor.display
|
|
2036
|
+
},
|
|
2037
|
+
order: 2,
|
|
2038
|
+
extension: [
|
|
2039
|
+
{
|
|
2040
|
+
url: COVERAGE_VERIFICATION_DATE_EXTENSION_URL,
|
|
2041
|
+
valueDateTime: verificationDate
|
|
2042
|
+
}
|
|
2043
|
+
]
|
|
2044
|
+
};
|
|
2045
|
+
};
|
|
2046
|
+
var buildAllHomeHealthPatientSpecs = () => {
|
|
2047
|
+
const eligibleDoctors = homeHealthEligibleDoctors();
|
|
2048
|
+
if (eligibleDoctors.length === 0) {
|
|
2049
|
+
throw new Error(
|
|
2050
|
+
"No home-health-eligible doctors found \u2014 cannot seed home-health patients."
|
|
2051
|
+
);
|
|
2052
|
+
}
|
|
2053
|
+
const specs = [];
|
|
2054
|
+
for (let i = 0; i < SCHEDULED_HOME_HEALTH_PATIENTS; i += 1) {
|
|
2055
|
+
const index = i;
|
|
2056
|
+
const providerId = eligibleDoctors[i % eligibleDoctors.length].id;
|
|
2057
|
+
if (!providerId) {
|
|
2058
|
+
throw new Error(
|
|
2059
|
+
"Home-health-eligible doctor is missing an id; cannot seed."
|
|
2060
|
+
);
|
|
2061
|
+
}
|
|
2062
|
+
specs.push({
|
|
2063
|
+
id: `on-site-demo-home-health-patient-${padIndex2(index + 1)}`,
|
|
2064
|
+
index,
|
|
2065
|
+
providerId,
|
|
2066
|
+
visitCadenceDays: deterministicVisitCadenceDays(index)
|
|
2067
|
+
});
|
|
2068
|
+
}
|
|
2069
|
+
for (let i = 0; i < INTAKE_ONLY_HOME_HEALTH_PATIENTS; i += 1) {
|
|
2070
|
+
const index = SCHEDULED_HOME_HEALTH_PATIENTS + i;
|
|
2071
|
+
specs.push({
|
|
2072
|
+
id: `on-site-demo-home-health-patient-${padIndex2(index + 1)}`,
|
|
2073
|
+
index,
|
|
2074
|
+
providerId: void 0,
|
|
2075
|
+
visitCadenceDays: void 0
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
return specs;
|
|
2079
|
+
};
|
|
2080
|
+
var cachedSpecs2;
|
|
2081
|
+
var getHomeHealthPatientSpecs = () => {
|
|
2082
|
+
if (!cachedSpecs2) {
|
|
2083
|
+
cachedSpecs2 = buildAllHomeHealthPatientSpecs();
|
|
2084
|
+
}
|
|
2085
|
+
return cachedSpecs2;
|
|
2086
|
+
};
|
|
2087
|
+
var buildOnSiteDemoHomeHealthPatients = () => getHomeHealthPatientSpecs().map(buildHomeHealthPatientResource);
|
|
2088
|
+
var buildOnSiteDemoHomeHealthCoverages = () => {
|
|
2089
|
+
const out = [];
|
|
2090
|
+
for (const spec of getHomeHealthPatientSpecs()) {
|
|
2091
|
+
out.push(buildPrimaryCoverageResource2(spec));
|
|
2092
|
+
const secondary = buildSecondaryCoverageResource2(spec);
|
|
2093
|
+
if (secondary) {
|
|
2094
|
+
out.push(secondary);
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
return out;
|
|
2098
|
+
};
|
|
2099
|
+
var onSiteDemoScheduledHomeHealthPatientIds = () => getHomeHealthPatientSpecs().filter((s) => s.providerId !== void 0).map((s) => s.id);
|
|
2100
|
+
var findOnSiteDemoHomeHealthPatientProvider = (patientId) => {
|
|
2101
|
+
const spec = getHomeHealthPatientSpecs().find((s) => s.id === patientId);
|
|
2102
|
+
return spec?.providerId;
|
|
2103
|
+
};
|
|
2104
|
+
var findOnSiteDemoHomeHealthPatientVisitCadenceDays = (patientId) => {
|
|
2105
|
+
const spec = getHomeHealthPatientSpecs().find((s) => s.id === patientId);
|
|
2106
|
+
return spec?.visitCadenceDays;
|
|
2107
|
+
};
|
|
2108
|
+
|
|
2109
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-encounters.ts
|
|
2110
|
+
var ENCOUNTER_CLASS_SYSTEM = "http://terminology.hl7.org/CodeSystem/v3-ActCode";
|
|
2111
|
+
var ENCOUNTER_CLASS_FACILITY = {
|
|
2112
|
+
system: ENCOUNTER_CLASS_SYSTEM,
|
|
2113
|
+
code: "IMP",
|
|
2114
|
+
display: "Facility"
|
|
2115
|
+
};
|
|
2116
|
+
var ENCOUNTER_CLASS_HOME_HEALTH = {
|
|
2117
|
+
system: ENCOUNTER_CLASS_SYSTEM,
|
|
2118
|
+
code: "HH",
|
|
2119
|
+
display: "Home Health"
|
|
2120
|
+
};
|
|
2121
|
+
var LOINC_SYSTEM = "http://loinc.org";
|
|
2122
|
+
var SNOMED_SYSTEM = "http://snomed.info/sct";
|
|
2123
|
+
var CPT_SYSTEM = "http://www.ama-assn.org/go/cpt";
|
|
2124
|
+
var WOUND_EXAM_PANEL_CODE = "39135-9";
|
|
2125
|
+
var WOUND_EXAM_PANEL_DISPLAY = "Wound assessment panel";
|
|
2126
|
+
var WOUND_LENGTH_CODE = "39126-8";
|
|
2127
|
+
var WOUND_WIDTH_CODE = "39125-0";
|
|
2128
|
+
var WOUND_DEPTH_CODE = "39127-6";
|
|
2129
|
+
var WOUND_STATUS_CODE = "72311-4";
|
|
2130
|
+
var CONDITION_CLINICAL_STATUS_SYSTEM = "http://terminology.hl7.org/CodeSystem/condition-clinical";
|
|
2131
|
+
var HOME_HEALTH_VISITS_PAST = 4;
|
|
2132
|
+
var WOUND_BEARING_PATIENT_THRESHOLD = 70;
|
|
2133
|
+
var WOUND_PROCEDURE_PATIENT_THRESHOLD = 25;
|
|
2134
|
+
var WOUND_TYPE_OPTIONS = [
|
|
2135
|
+
{ code: "421076008", display: "Pressure ulcer" },
|
|
2136
|
+
{ code: "402863003", display: "Venous stasis ulcer" },
|
|
2137
|
+
{ code: "371087003", display: "Diabetic foot ulcer" },
|
|
2138
|
+
{ code: "262528002", display: "Arterial ulcer of lower extremity" },
|
|
2139
|
+
{ code: "283682007", display: "Traumatic wound of lower extremity" }
|
|
2140
|
+
];
|
|
2141
|
+
var WOUND_BODY_SITE_OPTIONS = [
|
|
2142
|
+
{ code: "118473006", display: "Left lower limb" },
|
|
2143
|
+
{ code: "32153003", display: "Left foot" },
|
|
2144
|
+
{ code: "239043009", display: "Left heel" },
|
|
2145
|
+
{ code: "61685007", display: "Lower limb" },
|
|
2146
|
+
{ code: "118474000", display: "Right lower limb" },
|
|
2147
|
+
{ code: "78791008", display: "Right foot" },
|
|
2148
|
+
{ code: "239044003", display: "Right heel" }
|
|
2149
|
+
];
|
|
2150
|
+
var WOUND_DEBRIDEMENT_PRESETS = [
|
|
2151
|
+
{ id: "sharp-debridement", display: "Sharp Debridement", cptCode: "97597" },
|
|
2152
|
+
{
|
|
2153
|
+
id: "enzymatic-debridement",
|
|
2154
|
+
display: "Enzymatic Debridement",
|
|
2155
|
+
cptCode: "97602"
|
|
2156
|
+
},
|
|
2157
|
+
{ id: "wound-irrigation", display: "Wound Irrigation", cptCode: "97605" },
|
|
2158
|
+
{
|
|
2159
|
+
id: "skin-substitute",
|
|
2160
|
+
display: "Skin Substitute Application",
|
|
2161
|
+
cptCode: "15271"
|
|
2162
|
+
}
|
|
2163
|
+
];
|
|
2164
|
+
var ON_SITE_SCENARIO5 = "on-site-demo";
|
|
2165
|
+
var padIndex3 = (n) => n.toString().padStart(3, "0");
|
|
2166
|
+
var hashString = (input) => {
|
|
2167
|
+
let h = 0;
|
|
2168
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
2169
|
+
h = h * 31 + input.charCodeAt(i) | 0;
|
|
2170
|
+
}
|
|
2171
|
+
return Math.abs(h);
|
|
2172
|
+
};
|
|
2173
|
+
var isWoundBearingPatient = (patientId) => hashString(`${patientId}:wound-bearing`) % 100 < WOUND_BEARING_PATIENT_THRESHOLD;
|
|
2174
|
+
var getsWoundProcedure = (patientId) => hashString(`${patientId}:procedure`) % 100 < WOUND_PROCEDURE_PATIENT_THRESHOLD;
|
|
2175
|
+
var getWoundTrajectory = (patientId) => hashString(`${patientId}:trajectory`) % 5 < 3 ? "healing" : "worsening";
|
|
2176
|
+
var getWoundType = (patientId) => WOUND_TYPE_OPTIONS[hashString(`${patientId}:type`) % WOUND_TYPE_OPTIONS.length];
|
|
2177
|
+
var getWoundBodySite = (patientId) => WOUND_BODY_SITE_OPTIONS[hashString(`${patientId}:bodysite`) % WOUND_BODY_SITE_OPTIONS.length];
|
|
2178
|
+
var getWoundProcedurePreset = (patientId) => WOUND_DEBRIDEMENT_PRESETS[hashString(`${patientId}:cpt`) % WOUND_DEBRIDEMENT_PRESETS.length];
|
|
2179
|
+
var woundConditionIdForPatient = (patientId) => `${patientId}-wound-001`;
|
|
2180
|
+
var buildIdentifierPair5 = (resourceType, resourceId, roleSuffix) => [
|
|
2181
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO5, roleSuffix),
|
|
2182
|
+
openhiResourceIdentifier({
|
|
2183
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
2184
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
2185
|
+
resourceType,
|
|
2186
|
+
id: resourceId
|
|
2187
|
+
})
|
|
2188
|
+
];
|
|
2189
|
+
var mondayOfIsoWeekUtc2 = (referenceIso) => {
|
|
2190
|
+
const ref = new Date(referenceIso);
|
|
2191
|
+
if (Number.isNaN(ref.getTime())) {
|
|
2192
|
+
throw new Error(
|
|
2193
|
+
`mondayOfIsoWeekUtc: invalid reference date "${referenceIso}".`
|
|
2194
|
+
);
|
|
2195
|
+
}
|
|
2196
|
+
const utcDay = ref.getUTCDay() === 0 ? 7 : ref.getUTCDay();
|
|
2197
|
+
const monday = new Date(
|
|
2198
|
+
Date.UTC(ref.getUTCFullYear(), ref.getUTCMonth(), ref.getUTCDate())
|
|
2199
|
+
);
|
|
2200
|
+
monday.setUTCDate(monday.getUTCDate() - (utcDay - 1));
|
|
2201
|
+
return monday;
|
|
2202
|
+
};
|
|
2203
|
+
var toIsoZ2 = (d) => d.toISOString();
|
|
2204
|
+
var buildFacilityEncounterSpecs = (referenceIso) => {
|
|
2205
|
+
const anchorMonday = mondayOfIsoWeekUtc2(referenceIso);
|
|
2206
|
+
const out = [];
|
|
2207
|
+
for (const patientId of onSiteDemoScheduledFacilityPatientIds()) {
|
|
2208
|
+
const block = findBlockForPatient(patientId);
|
|
2209
|
+
if (!block) {
|
|
2210
|
+
continue;
|
|
2211
|
+
}
|
|
2212
|
+
const total = BLOCK_OCCURRENCE_WEEKS_PAST;
|
|
2213
|
+
for (let i = 0; i < total; i += 1) {
|
|
2214
|
+
const weekOffset = -(BLOCK_OCCURRENCE_WEEKS_PAST - i);
|
|
2215
|
+
const occurrenceDay = new Date(anchorMonday);
|
|
2216
|
+
occurrenceDay.setUTCDate(
|
|
2217
|
+
occurrenceDay.getUTCDate() + weekOffset * 7 + (block.dayOfWeek - 1)
|
|
2218
|
+
);
|
|
2219
|
+
const start = new Date(occurrenceDay);
|
|
2220
|
+
start.setUTCHours(14, 0, 0, 0);
|
|
2221
|
+
const end = new Date(occurrenceDay);
|
|
2222
|
+
end.setUTCHours(18, 0, 0, 0);
|
|
2223
|
+
const sign = "m";
|
|
2224
|
+
const magnitude = Math.abs(weekOffset).toString().padStart(2, "0");
|
|
2225
|
+
const appointmentId = `${block.id}-w${sign}${magnitude}`;
|
|
2226
|
+
out.push({
|
|
2227
|
+
id: `${patientId}-encounter-${padIndex3(i + 1)}`,
|
|
2228
|
+
patientId,
|
|
2229
|
+
sequence: i + 1,
|
|
2230
|
+
totalEncounters: total,
|
|
2231
|
+
periodStart: toIsoZ2(start),
|
|
2232
|
+
periodEnd: toIsoZ2(end),
|
|
2233
|
+
doctorId: block.doctorId,
|
|
2234
|
+
scribeId: block.scribeId,
|
|
2235
|
+
classCoding: ENCOUNTER_CLASS_FACILITY,
|
|
2236
|
+
facilityId: block.facilityId,
|
|
2237
|
+
appointmentId
|
|
2238
|
+
});
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
return out;
|
|
2242
|
+
};
|
|
2243
|
+
var patientToBlockCache;
|
|
2244
|
+
var findBlockForPatient = (patientId) => {
|
|
2245
|
+
if (!patientToBlockCache) {
|
|
2246
|
+
const cache = /* @__PURE__ */ new Map();
|
|
2247
|
+
const scheduledIds = new Set(onSiteDemoScheduledFacilityPatientIds());
|
|
2248
|
+
const blockIds = [
|
|
2249
|
+
"on-site-demo-block-001",
|
|
2250
|
+
"on-site-demo-block-002",
|
|
2251
|
+
"on-site-demo-block-003",
|
|
2252
|
+
"on-site-demo-block-004"
|
|
2253
|
+
];
|
|
2254
|
+
for (const blockId of blockIds) {
|
|
2255
|
+
const block = findOnSiteDemoBlockTemplate(blockId);
|
|
2256
|
+
if (!block) {
|
|
2257
|
+
continue;
|
|
2258
|
+
}
|
|
2259
|
+
for (const pid of facilityPatientsForBlock(blockId)) {
|
|
2260
|
+
if (scheduledIds.has(pid)) {
|
|
2261
|
+
cache.set(pid, block);
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
patientToBlockCache = cache;
|
|
2266
|
+
}
|
|
2267
|
+
return patientToBlockCache.get(patientId);
|
|
2268
|
+
};
|
|
2269
|
+
var buildHomeHealthEncounterSpecs = (referenceIso) => {
|
|
2270
|
+
const reference = new Date(referenceIso);
|
|
2271
|
+
if (Number.isNaN(reference.getTime())) {
|
|
2272
|
+
throw new Error(
|
|
2273
|
+
`buildHomeHealthEncounterSpecs: invalid reference date "${referenceIso}".`
|
|
2274
|
+
);
|
|
2275
|
+
}
|
|
2276
|
+
const out = [];
|
|
2277
|
+
for (const patientId of onSiteDemoScheduledHomeHealthPatientIds()) {
|
|
2278
|
+
const providerId = findOnSiteDemoHomeHealthPatientProvider(patientId);
|
|
2279
|
+
const cadenceDays = findOnSiteDemoHomeHealthPatientVisitCadenceDays(patientId);
|
|
2280
|
+
if (!providerId || typeof cadenceDays !== "number") {
|
|
2281
|
+
continue;
|
|
2282
|
+
}
|
|
2283
|
+
const total = HOME_HEALTH_VISITS_PAST;
|
|
2284
|
+
for (let i = 0; i < total; i += 1) {
|
|
2285
|
+
const visitsBack = total - i;
|
|
2286
|
+
const visitDay = new Date(reference);
|
|
2287
|
+
visitDay.setUTCDate(visitDay.getUTCDate() - visitsBack * cadenceDays);
|
|
2288
|
+
const start = new Date(visitDay);
|
|
2289
|
+
start.setUTCHours(14, 0, 0, 0);
|
|
2290
|
+
const end = new Date(visitDay);
|
|
2291
|
+
end.setUTCHours(15, 0, 0, 0);
|
|
2292
|
+
out.push({
|
|
2293
|
+
id: `${patientId}-encounter-${padIndex3(i + 1)}`,
|
|
2294
|
+
patientId,
|
|
2295
|
+
sequence: i + 1,
|
|
2296
|
+
totalEncounters: total,
|
|
2297
|
+
periodStart: toIsoZ2(start),
|
|
2298
|
+
periodEnd: toIsoZ2(end),
|
|
2299
|
+
doctorId: providerId,
|
|
2300
|
+
scribeId: void 0,
|
|
2301
|
+
classCoding: ENCOUNTER_CLASS_HOME_HEALTH,
|
|
2302
|
+
facilityId: void 0,
|
|
2303
|
+
appointmentId: void 0
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
return out;
|
|
2308
|
+
};
|
|
2309
|
+
var buildEncounterResource = (spec) => {
|
|
2310
|
+
const participant = [
|
|
2311
|
+
{
|
|
2312
|
+
individual: {
|
|
2313
|
+
reference: `Practitioner/${spec.doctorId}`,
|
|
2314
|
+
type: "Practitioner"
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
];
|
|
2318
|
+
if (spec.scribeId) {
|
|
2319
|
+
participant.push({
|
|
2320
|
+
individual: {
|
|
2321
|
+
reference: `Practitioner/${spec.scribeId}`,
|
|
2322
|
+
type: "Practitioner"
|
|
2323
|
+
}
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
const encounter = {
|
|
2327
|
+
resourceType: "Encounter",
|
|
2328
|
+
id: spec.id,
|
|
2329
|
+
identifier: buildIdentifierPair5(
|
|
2330
|
+
"Encounter",
|
|
2331
|
+
spec.id,
|
|
2332
|
+
`encounter-${spec.id}`
|
|
2333
|
+
),
|
|
2334
|
+
status: "finished",
|
|
2335
|
+
class: { ...spec.classCoding },
|
|
2336
|
+
subject: { reference: `Patient/${spec.patientId}`, type: "Patient" },
|
|
2337
|
+
period: { start: spec.periodStart, end: spec.periodEnd },
|
|
2338
|
+
participant
|
|
2339
|
+
};
|
|
2340
|
+
if (spec.facilityId) {
|
|
2341
|
+
encounter.location = [
|
|
2342
|
+
{
|
|
2343
|
+
location: {
|
|
2344
|
+
reference: `Location/${spec.facilityId}`,
|
|
2345
|
+
type: "Location"
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
];
|
|
2349
|
+
}
|
|
2350
|
+
if (spec.appointmentId) {
|
|
2351
|
+
encounter.appointment = [
|
|
2352
|
+
{
|
|
2353
|
+
reference: `Appointment/${spec.appointmentId}`,
|
|
2354
|
+
type: "Appointment"
|
|
2355
|
+
}
|
|
2356
|
+
];
|
|
2357
|
+
}
|
|
2358
|
+
return encounter;
|
|
2359
|
+
};
|
|
2360
|
+
var buildWoundConditionResource = (patientId, firstEncounterStart) => {
|
|
2361
|
+
const woundType = getWoundType(patientId);
|
|
2362
|
+
const bodySite = getWoundBodySite(patientId);
|
|
2363
|
+
const id = woundConditionIdForPatient(patientId);
|
|
2364
|
+
return {
|
|
2365
|
+
resourceType: "Condition",
|
|
2366
|
+
id,
|
|
2367
|
+
identifier: buildIdentifierPair5("Condition", id, `wound-${patientId}`),
|
|
2368
|
+
clinicalStatus: {
|
|
2369
|
+
coding: [
|
|
2370
|
+
{
|
|
2371
|
+
system: CONDITION_CLINICAL_STATUS_SYSTEM,
|
|
2372
|
+
code: "active",
|
|
2373
|
+
display: "Active"
|
|
2374
|
+
}
|
|
2375
|
+
]
|
|
2376
|
+
},
|
|
2377
|
+
category: [{ text: "wound" }],
|
|
2378
|
+
code: {
|
|
2379
|
+
text: woundType.display,
|
|
2380
|
+
coding: [
|
|
2381
|
+
{
|
|
2382
|
+
system: SNOMED_SYSTEM,
|
|
2383
|
+
code: woundType.code,
|
|
2384
|
+
display: woundType.display
|
|
2385
|
+
}
|
|
2386
|
+
]
|
|
2387
|
+
},
|
|
2388
|
+
bodySite: [
|
|
2389
|
+
{
|
|
2390
|
+
coding: [
|
|
2391
|
+
{
|
|
2392
|
+
system: SNOMED_SYSTEM,
|
|
2393
|
+
code: bodySite.code,
|
|
2394
|
+
display: bodySite.display
|
|
2395
|
+
}
|
|
2396
|
+
],
|
|
2397
|
+
text: bodySite.display
|
|
2398
|
+
}
|
|
2399
|
+
],
|
|
2400
|
+
subject: { reference: `Patient/${patientId}`, type: "Patient" },
|
|
2401
|
+
onsetDateTime: firstEncounterStart,
|
|
2402
|
+
recordedDate: firstEncounterStart
|
|
2403
|
+
};
|
|
2404
|
+
};
|
|
2405
|
+
var woundSizeAtSequence = (patientId, sequence, totalEncounters) => {
|
|
2406
|
+
const baseLength = 4 + hashString(`${patientId}:length`) % 4;
|
|
2407
|
+
const baseWidth = 3 + hashString(`${patientId}:width`) % 3;
|
|
2408
|
+
const baseDepthTenths = 3 + hashString(`${patientId}:depth`) % 6;
|
|
2409
|
+
const trajectory = getWoundTrajectory(patientId);
|
|
2410
|
+
const denom = Math.max(1, totalEncounters - 1);
|
|
2411
|
+
const progress = (sequence - 1) / denom;
|
|
2412
|
+
const sign = trajectory === "healing" ? -1 : 1;
|
|
2413
|
+
const shrinkOrGrow = trajectory === "healing" ? 0.4 : 0.3;
|
|
2414
|
+
const length = +(baseLength * (1 + sign * shrinkOrGrow * progress)).toFixed(
|
|
2415
|
+
1
|
|
2416
|
+
);
|
|
2417
|
+
const width = +(baseWidth * (1 + sign * shrinkOrGrow * progress)).toFixed(1);
|
|
2418
|
+
const depth = +(baseDepthTenths / 10 * (1 + sign * shrinkOrGrow * progress)).toFixed(2);
|
|
2419
|
+
const status = trajectory === "healing" && sequence > 1 ? "improving" : trajectory === "worsening" && sequence > 1 ? "declining" : "stagnant";
|
|
2420
|
+
return { length, width, depth, status };
|
|
2421
|
+
};
|
|
2422
|
+
var buildWoundExamObservation = (patientId, encounterId, sequence, totalEncounters, effectiveDateTime) => {
|
|
2423
|
+
const size = woundSizeAtSequence(patientId, sequence, totalEncounters);
|
|
2424
|
+
const woundConditionId = woundConditionIdForPatient(patientId);
|
|
2425
|
+
const id = `${encounterId}-wound-exam`;
|
|
2426
|
+
return {
|
|
2427
|
+
resourceType: "Observation",
|
|
2428
|
+
id,
|
|
2429
|
+
identifier: buildIdentifierPair5(
|
|
2430
|
+
"Observation",
|
|
2431
|
+
id,
|
|
2432
|
+
`wound-exam-${encounterId}`
|
|
2433
|
+
),
|
|
2434
|
+
status: "final",
|
|
2435
|
+
code: {
|
|
2436
|
+
coding: [
|
|
2437
|
+
{
|
|
2438
|
+
system: LOINC_SYSTEM,
|
|
2439
|
+
code: WOUND_EXAM_PANEL_CODE,
|
|
2440
|
+
display: WOUND_EXAM_PANEL_DISPLAY
|
|
2441
|
+
}
|
|
2442
|
+
]
|
|
2443
|
+
},
|
|
2444
|
+
subject: { reference: `Patient/${patientId}`, type: "Patient" },
|
|
2445
|
+
encounter: { reference: `Encounter/${encounterId}`, type: "Encounter" },
|
|
2446
|
+
focus: [
|
|
2447
|
+
{
|
|
2448
|
+
reference: `Condition/${woundConditionId}`,
|
|
2449
|
+
type: "Condition"
|
|
2450
|
+
}
|
|
2451
|
+
],
|
|
2452
|
+
effectiveDateTime,
|
|
2453
|
+
component: [
|
|
2454
|
+
{
|
|
2455
|
+
code: {
|
|
2456
|
+
coding: [
|
|
2457
|
+
{
|
|
2458
|
+
system: LOINC_SYSTEM,
|
|
2459
|
+
code: WOUND_LENGTH_CODE,
|
|
2460
|
+
display: "Length"
|
|
2461
|
+
}
|
|
2462
|
+
]
|
|
2463
|
+
},
|
|
2464
|
+
valueQuantity: { value: size.length, unit: "cm" }
|
|
2465
|
+
},
|
|
2466
|
+
{
|
|
2467
|
+
code: {
|
|
2468
|
+
coding: [
|
|
2469
|
+
{ system: LOINC_SYSTEM, code: WOUND_WIDTH_CODE, display: "Width" }
|
|
2470
|
+
]
|
|
2471
|
+
},
|
|
2472
|
+
valueQuantity: { value: size.width, unit: "cm" }
|
|
2473
|
+
},
|
|
2474
|
+
{
|
|
2475
|
+
code: {
|
|
2476
|
+
coding: [
|
|
2477
|
+
{ system: LOINC_SYSTEM, code: WOUND_DEPTH_CODE, display: "Depth" }
|
|
2478
|
+
]
|
|
2479
|
+
},
|
|
2480
|
+
valueQuantity: { value: size.depth, unit: "cm" }
|
|
2481
|
+
},
|
|
2482
|
+
{
|
|
2483
|
+
code: {
|
|
2484
|
+
coding: [
|
|
2485
|
+
{
|
|
2486
|
+
system: LOINC_SYSTEM,
|
|
2487
|
+
code: WOUND_STATUS_CODE,
|
|
2488
|
+
display: "Status"
|
|
2489
|
+
}
|
|
2490
|
+
]
|
|
2491
|
+
},
|
|
2492
|
+
valueCodeableConcept: {
|
|
2493
|
+
coding: [{ code: size.status, display: size.status }]
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
]
|
|
2497
|
+
};
|
|
2498
|
+
};
|
|
2499
|
+
var buildWoundProcedureResource = (patientId, encounterId, performedDateTime) => {
|
|
2500
|
+
const preset = getWoundProcedurePreset(patientId);
|
|
2501
|
+
const woundConditionId = woundConditionIdForPatient(patientId);
|
|
2502
|
+
const id = `${encounterId}-procedure`;
|
|
2503
|
+
return {
|
|
2504
|
+
resourceType: "Procedure",
|
|
2505
|
+
id,
|
|
2506
|
+
identifier: buildIdentifierPair5(
|
|
2507
|
+
"Procedure",
|
|
2508
|
+
id,
|
|
2509
|
+
`procedure-${encounterId}`
|
|
2510
|
+
),
|
|
2511
|
+
status: "completed",
|
|
2512
|
+
code: {
|
|
2513
|
+
text: preset.display,
|
|
2514
|
+
coding: [
|
|
2515
|
+
{
|
|
2516
|
+
system: CPT_SYSTEM,
|
|
2517
|
+
code: preset.cptCode,
|
|
2518
|
+
display: preset.display
|
|
2519
|
+
}
|
|
2520
|
+
]
|
|
2521
|
+
},
|
|
2522
|
+
subject: { reference: `Patient/${patientId}`, type: "Patient" },
|
|
2523
|
+
encounter: { reference: `Encounter/${encounterId}`, type: "Encounter" },
|
|
2524
|
+
reasonReference: [
|
|
2525
|
+
{
|
|
2526
|
+
reference: `Condition/${woundConditionId}`,
|
|
2527
|
+
type: "Condition"
|
|
2528
|
+
}
|
|
2529
|
+
],
|
|
2530
|
+
performedDateTime
|
|
2531
|
+
};
|
|
2532
|
+
};
|
|
2533
|
+
var encounterSpecsCache = /* @__PURE__ */ new Map();
|
|
2534
|
+
var getAllEncounterSpecs = (referenceIso) => {
|
|
2535
|
+
const cached = encounterSpecsCache.get(referenceIso);
|
|
2536
|
+
if (cached) {
|
|
2537
|
+
return cached;
|
|
2538
|
+
}
|
|
2539
|
+
const all = [
|
|
2540
|
+
...buildFacilityEncounterSpecs(referenceIso),
|
|
2541
|
+
...buildHomeHealthEncounterSpecs(referenceIso)
|
|
2542
|
+
];
|
|
2543
|
+
encounterSpecsCache.set(referenceIso, all);
|
|
2544
|
+
return all;
|
|
2545
|
+
};
|
|
2546
|
+
var buildOnSiteDemoEncounters = (referenceIso) => getAllEncounterSpecs(referenceIso).map(buildEncounterResource);
|
|
2547
|
+
var buildOnSiteDemoWoundConditions = (referenceIso) => {
|
|
2548
|
+
const specs = getAllEncounterSpecs(referenceIso);
|
|
2549
|
+
const firstByPatient = /* @__PURE__ */ new Map();
|
|
2550
|
+
for (const spec of specs) {
|
|
2551
|
+
if (!isWoundBearingPatient(spec.patientId)) {
|
|
2552
|
+
continue;
|
|
2553
|
+
}
|
|
2554
|
+
const existing = firstByPatient.get(spec.patientId);
|
|
2555
|
+
if (!existing || spec.periodStart < existing) {
|
|
2556
|
+
firstByPatient.set(spec.patientId, spec.periodStart);
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
const out = [];
|
|
2560
|
+
for (const [patientId, firstStart] of firstByPatient.entries()) {
|
|
2561
|
+
out.push(buildWoundConditionResource(patientId, firstStart));
|
|
2562
|
+
}
|
|
2563
|
+
return out;
|
|
2564
|
+
};
|
|
2565
|
+
var buildOnSiteDemoWoundObservations = (referenceIso) => {
|
|
2566
|
+
const specs = getAllEncounterSpecs(referenceIso);
|
|
2567
|
+
const out = [];
|
|
2568
|
+
for (const spec of specs) {
|
|
2569
|
+
if (!isWoundBearingPatient(spec.patientId)) {
|
|
2570
|
+
continue;
|
|
2571
|
+
}
|
|
2572
|
+
out.push(
|
|
2573
|
+
buildWoundExamObservation(
|
|
2574
|
+
spec.patientId,
|
|
2575
|
+
spec.id,
|
|
2576
|
+
spec.sequence,
|
|
2577
|
+
spec.totalEncounters,
|
|
2578
|
+
spec.periodStart
|
|
2579
|
+
)
|
|
2580
|
+
);
|
|
2581
|
+
}
|
|
2582
|
+
return out;
|
|
2583
|
+
};
|
|
2584
|
+
var buildOnSiteDemoWoundProcedures = (referenceIso) => {
|
|
2585
|
+
const specs = getAllEncounterSpecs(referenceIso);
|
|
2586
|
+
const lastByPatient = /* @__PURE__ */ new Map();
|
|
2587
|
+
for (const spec of specs) {
|
|
2588
|
+
if (!isWoundBearingPatient(spec.patientId)) {
|
|
2589
|
+
continue;
|
|
2590
|
+
}
|
|
2591
|
+
if (!getsWoundProcedure(spec.patientId)) {
|
|
2592
|
+
continue;
|
|
2593
|
+
}
|
|
2594
|
+
const existing = lastByPatient.get(spec.patientId);
|
|
2595
|
+
if (!existing || spec.sequence > existing.sequence) {
|
|
2596
|
+
lastByPatient.set(spec.patientId, spec);
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
const out = [];
|
|
2600
|
+
for (const spec of lastByPatient.values()) {
|
|
2601
|
+
out.push(
|
|
2602
|
+
buildWoundProcedureResource(spec.patientId, spec.id, spec.periodStart)
|
|
2603
|
+
);
|
|
2604
|
+
}
|
|
2605
|
+
return out;
|
|
2606
|
+
};
|
|
2607
|
+
var onSiteDemoEncounterMetadata = (referenceIso) => {
|
|
2608
|
+
const specs = getAllEncounterSpecs(referenceIso);
|
|
2609
|
+
const lastEncounterByPatient = /* @__PURE__ */ new Map();
|
|
2610
|
+
for (const spec of specs) {
|
|
2611
|
+
const existing = lastEncounterByPatient.get(spec.patientId);
|
|
2612
|
+
if (!existing) {
|
|
2613
|
+
lastEncounterByPatient.set(spec.patientId, spec.id);
|
|
2614
|
+
continue;
|
|
2615
|
+
}
|
|
2616
|
+
if (spec.sequence > specs.find((s) => s.id === existing).sequence) {
|
|
2617
|
+
lastEncounterByPatient.set(spec.patientId, spec.id);
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
const procedurePatients = new Set(onSiteDemoWoundProcedurePatientIds());
|
|
2621
|
+
return specs.map((spec) => ({
|
|
2622
|
+
id: spec.id,
|
|
2623
|
+
patientId: spec.patientId,
|
|
2624
|
+
sequence: spec.sequence,
|
|
2625
|
+
totalEncounters: spec.totalEncounters,
|
|
2626
|
+
periodStart: spec.periodStart,
|
|
2627
|
+
hasWoundProcedure: procedurePatients.has(spec.patientId) && lastEncounterByPatient.get(spec.patientId) === spec.id
|
|
2628
|
+
}));
|
|
2629
|
+
};
|
|
2630
|
+
var onSiteDemoWoundBearingPatientIds = () => {
|
|
2631
|
+
const out = [];
|
|
2632
|
+
for (const id of onSiteDemoScheduledFacilityPatientIds()) {
|
|
2633
|
+
if (isWoundBearingPatient(id)) {
|
|
2634
|
+
out.push(id);
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
for (const id of onSiteDemoScheduledHomeHealthPatientIds()) {
|
|
2638
|
+
if (isWoundBearingPatient(id)) {
|
|
2639
|
+
out.push(id);
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
return out;
|
|
2643
|
+
};
|
|
2644
|
+
var onSiteDemoWoundProcedurePatientIds = () => onSiteDemoWoundBearingPatientIds().filter((id) => getsWoundProcedure(id));
|
|
2645
|
+
|
|
2646
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-claims.ts
|
|
2647
|
+
var CLAIM_WORKFLOW_STATUS_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/claim-workflow-status";
|
|
2648
|
+
var CLAIM_WORKFLOW_STATUS_VALUE_SUB_EXTENSION_URL = "status";
|
|
2649
|
+
var CLAIM_WORKFLOW_STATUS_LAST_TRANSITION_SUB_EXTENSION_URL = "lastTransition";
|
|
2650
|
+
var CLAIM_WORKFLOW_STATUS = {
|
|
2651
|
+
SUBMITTED: "submitted",
|
|
2652
|
+
ACCEPTED: "accepted",
|
|
2653
|
+
REJECTED: "rejected",
|
|
2654
|
+
REWORKED: "reworked",
|
|
2655
|
+
RESUBMITTED: "resubmitted"
|
|
2656
|
+
};
|
|
2657
|
+
var PAYMENT_STATUS = {
|
|
2658
|
+
PARTIAL: "partial",
|
|
2659
|
+
FULL: "full",
|
|
2660
|
+
WRITE_OFF: "write-off"
|
|
2661
|
+
};
|
|
2662
|
+
var PAYMENT_STATUS_SYSTEM = "https://on-site-medical.app/fhir/CodeSystem/payment-status";
|
|
2663
|
+
var EM_VISIT_CODES = [
|
|
2664
|
+
{
|
|
2665
|
+
code: "99213",
|
|
2666
|
+
display: "Office visit, established patient, low",
|
|
2667
|
+
amount: 110
|
|
2668
|
+
},
|
|
2669
|
+
{
|
|
2670
|
+
code: "99214",
|
|
2671
|
+
display: "Office visit, established patient, moderate",
|
|
2672
|
+
amount: 165
|
|
2673
|
+
},
|
|
2674
|
+
{
|
|
2675
|
+
code: "99215",
|
|
2676
|
+
display: "Office visit, established patient, high",
|
|
2677
|
+
amount: 220
|
|
2678
|
+
}
|
|
2679
|
+
];
|
|
2680
|
+
var PROCEDURE_CPT_AMOUNTS = {
|
|
2681
|
+
"97597": { display: "Sharp Debridement", amount: 145 },
|
|
2682
|
+
"97602": { display: "Enzymatic Debridement", amount: 95 },
|
|
2683
|
+
"97605": { display: "Wound Irrigation (NPWT)", amount: 175 },
|
|
2684
|
+
"15271": { display: "Skin Substitute Application", amount: 410 }
|
|
2685
|
+
};
|
|
2686
|
+
var ON_SITE_SCENARIO6 = "on-site-demo";
|
|
2687
|
+
var hashString2 = (input) => {
|
|
2688
|
+
let h = 0;
|
|
2689
|
+
for (let i = 0; i < input.length; i += 1) {
|
|
2690
|
+
h = h * 31 + input.charCodeAt(i) | 0;
|
|
2691
|
+
}
|
|
2692
|
+
return Math.abs(h);
|
|
2693
|
+
};
|
|
2694
|
+
var UNBILLED_BUCKET_THRESHOLD = 15;
|
|
2695
|
+
var SUBMITTED_BUCKET_THRESHOLD = 35;
|
|
2696
|
+
var ACCEPTED_BUCKET_THRESHOLD = 80;
|
|
2697
|
+
var REJECTED_BUCKET_THRESHOLD = 90;
|
|
2698
|
+
var REWORKED_BUCKET_THRESHOLD = 100;
|
|
2699
|
+
var isEncounterUnbilled = (encounterId) => hashString2(`${encounterId}:billed`) % 100 < UNBILLED_BUCKET_THRESHOLD;
|
|
2700
|
+
var workflowStatusForEncounter = (encounterId) => {
|
|
2701
|
+
const bucket = hashString2(`${encounterId}:status`) % 100;
|
|
2702
|
+
if (bucket < SUBMITTED_BUCKET_THRESHOLD - UNBILLED_BUCKET_THRESHOLD) {
|
|
2703
|
+
return CLAIM_WORKFLOW_STATUS.SUBMITTED;
|
|
2704
|
+
}
|
|
2705
|
+
if (bucket < ACCEPTED_BUCKET_THRESHOLD - UNBILLED_BUCKET_THRESHOLD) {
|
|
2706
|
+
return CLAIM_WORKFLOW_STATUS.ACCEPTED;
|
|
2707
|
+
}
|
|
2708
|
+
if (bucket < REJECTED_BUCKET_THRESHOLD - UNBILLED_BUCKET_THRESHOLD) {
|
|
2709
|
+
return CLAIM_WORKFLOW_STATUS.REJECTED;
|
|
2710
|
+
}
|
|
2711
|
+
if (bucket < REWORKED_BUCKET_THRESHOLD - UNBILLED_BUCKET_THRESHOLD) {
|
|
2712
|
+
return CLAIM_WORKFLOW_STATUS.REWORKED;
|
|
2713
|
+
}
|
|
2714
|
+
return CLAIM_WORKFLOW_STATUS.RESUBMITTED;
|
|
2715
|
+
};
|
|
2716
|
+
var paymentStatusForEncounter = (encounterId) => {
|
|
2717
|
+
const bucket = hashString2(`${encounterId}:payment`) % 10;
|
|
2718
|
+
if (bucket < 4) {
|
|
2719
|
+
return PAYMENT_STATUS.PARTIAL;
|
|
2720
|
+
}
|
|
2721
|
+
if (bucket < 8) {
|
|
2722
|
+
return PAYMENT_STATUS.FULL;
|
|
2723
|
+
}
|
|
2724
|
+
return PAYMENT_STATUS.WRITE_OFF;
|
|
2725
|
+
};
|
|
2726
|
+
var cachedPrimaryCoverageByPatient;
|
|
2727
|
+
var getPrimaryCoverageByPatient = () => {
|
|
2728
|
+
if (!cachedPrimaryCoverageByPatient) {
|
|
2729
|
+
const map = /* @__PURE__ */ new Map();
|
|
2730
|
+
const allCoverages = [
|
|
2731
|
+
...buildOnSiteDemoFacilityCoverages(),
|
|
2732
|
+
...buildOnSiteDemoHomeHealthCoverages()
|
|
2733
|
+
];
|
|
2734
|
+
for (const cov of allCoverages) {
|
|
2735
|
+
if (cov.order !== 1) {
|
|
2736
|
+
continue;
|
|
2737
|
+
}
|
|
2738
|
+
const ref = cov.beneficiary.reference;
|
|
2739
|
+
if (typeof ref !== "string") {
|
|
2740
|
+
continue;
|
|
2741
|
+
}
|
|
2742
|
+
const patientId = ref.replace(/^Patient\//, "");
|
|
2743
|
+
map.set(patientId, cov);
|
|
2744
|
+
}
|
|
2745
|
+
cachedPrimaryCoverageByPatient = map;
|
|
2746
|
+
}
|
|
2747
|
+
return cachedPrimaryCoverageByPatient;
|
|
2748
|
+
};
|
|
2749
|
+
var buildIdentifierPair6 = (resourceType, resourceId, roleSuffix) => [
|
|
2750
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO6, roleSuffix),
|
|
2751
|
+
openhiResourceIdentifier({
|
|
2752
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
2753
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
2754
|
+
resourceType,
|
|
2755
|
+
id: resourceId
|
|
2756
|
+
})
|
|
2757
|
+
];
|
|
2758
|
+
var emCodeForEncounter = (encounterId) => EM_VISIT_CODES[hashString2(`${encounterId}:em`) % EM_VISIT_CODES.length];
|
|
2759
|
+
var cptForProcedureEncounter = (encounterId) => {
|
|
2760
|
+
const cptKeys = Object.keys(PROCEDURE_CPT_AMOUNTS);
|
|
2761
|
+
const code = cptKeys[hashString2(`${encounterId}:procedure-cpt`) % cptKeys.length];
|
|
2762
|
+
const entry = PROCEDURE_CPT_AMOUNTS[code];
|
|
2763
|
+
if (!entry) {
|
|
2764
|
+
return EM_VISIT_CODES[0];
|
|
2765
|
+
}
|
|
2766
|
+
return { code, display: entry.display, amount: entry.amount };
|
|
2767
|
+
};
|
|
2768
|
+
var usdMoney = (amount) => ({
|
|
2769
|
+
value: +amount.toFixed(2),
|
|
2770
|
+
currency: "USD"
|
|
2771
|
+
});
|
|
2772
|
+
var buildClaimResource = (meta, status, primaryCoverageId, insurerDisplay) => {
|
|
2773
|
+
const claimId = `${meta.id}-claim`;
|
|
2774
|
+
const line = meta.hasWoundProcedure ? cptForProcedureEncounter(meta.id) : emCodeForEncounter(meta.id);
|
|
2775
|
+
const total = usdMoney(line.amount);
|
|
2776
|
+
const lastTransition = meta.periodStart;
|
|
2777
|
+
return {
|
|
2778
|
+
resourceType: "Claim",
|
|
2779
|
+
id: claimId,
|
|
2780
|
+
identifier: buildIdentifierPair6("Claim", claimId, `claim-${meta.id}`),
|
|
2781
|
+
status: "active",
|
|
2782
|
+
type: {
|
|
2783
|
+
coding: [
|
|
2784
|
+
{
|
|
2785
|
+
system: "http://terminology.hl7.org/CodeSystem/claim-type",
|
|
2786
|
+
code: "professional",
|
|
2787
|
+
display: "Professional"
|
|
2788
|
+
}
|
|
2789
|
+
],
|
|
2790
|
+
text: "Professional"
|
|
2791
|
+
},
|
|
2792
|
+
use: "claim",
|
|
2793
|
+
patient: { reference: `Patient/${meta.patientId}`, type: "Patient" },
|
|
2794
|
+
created: meta.periodStart,
|
|
2795
|
+
insurer: { display: insurerDisplay },
|
|
2796
|
+
provider: { reference: `Patient/${meta.patientId}`, type: "Patient" },
|
|
2797
|
+
priority: {
|
|
2798
|
+
coding: [
|
|
2799
|
+
{
|
|
2800
|
+
system: "http://terminology.hl7.org/CodeSystem/processpriority",
|
|
2801
|
+
code: "normal",
|
|
2802
|
+
display: "Normal"
|
|
2803
|
+
}
|
|
2804
|
+
],
|
|
2805
|
+
text: "Normal"
|
|
2806
|
+
},
|
|
2807
|
+
insurance: [
|
|
2808
|
+
{
|
|
2809
|
+
sequence: 1,
|
|
2810
|
+
focal: true,
|
|
2811
|
+
coverage: {
|
|
2812
|
+
reference: `Coverage/${primaryCoverageId}`,
|
|
2813
|
+
type: "Coverage"
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
],
|
|
2817
|
+
item: [
|
|
2818
|
+
{
|
|
2819
|
+
sequence: 1,
|
|
2820
|
+
productOrService: {
|
|
2821
|
+
coding: [
|
|
2822
|
+
{ system: CPT_SYSTEM, code: line.code, display: line.display }
|
|
2823
|
+
],
|
|
2824
|
+
text: line.display
|
|
2825
|
+
},
|
|
2826
|
+
servicedDate: meta.periodStart.slice(0, 10),
|
|
2827
|
+
unitPrice: total,
|
|
2828
|
+
net: total,
|
|
2829
|
+
encounter: [{ reference: `Encounter/${meta.id}`, type: "Encounter" }]
|
|
2830
|
+
}
|
|
2831
|
+
],
|
|
2832
|
+
total,
|
|
2833
|
+
extension: [
|
|
2834
|
+
{
|
|
2835
|
+
url: CLAIM_WORKFLOW_STATUS_EXTENSION_URL,
|
|
2836
|
+
extension: [
|
|
2837
|
+
{
|
|
2838
|
+
url: CLAIM_WORKFLOW_STATUS_VALUE_SUB_EXTENSION_URL,
|
|
2839
|
+
valueCode: status
|
|
2840
|
+
},
|
|
2841
|
+
{
|
|
2842
|
+
url: CLAIM_WORKFLOW_STATUS_LAST_TRANSITION_SUB_EXTENSION_URL,
|
|
2843
|
+
valueDateTime: lastTransition
|
|
2844
|
+
}
|
|
2845
|
+
]
|
|
2846
|
+
}
|
|
2847
|
+
]
|
|
2848
|
+
};
|
|
2849
|
+
};
|
|
2850
|
+
var buildPaymentNoticeResource = (meta, status, claimId, totalCharged, insurerDisplay) => {
|
|
2851
|
+
const paymentId = `${meta.id}-payment`;
|
|
2852
|
+
const charged = totalCharged.value ?? 0;
|
|
2853
|
+
let paid;
|
|
2854
|
+
if (status === PAYMENT_STATUS.FULL) {
|
|
2855
|
+
paid = charged;
|
|
2856
|
+
} else if (status === PAYMENT_STATUS.PARTIAL) {
|
|
2857
|
+
const fraction = 0.4 + hashString2(`${meta.id}:partial`) % 31 / 100;
|
|
2858
|
+
paid = +(charged * fraction).toFixed(2);
|
|
2859
|
+
} else {
|
|
2860
|
+
paid = 0;
|
|
2861
|
+
}
|
|
2862
|
+
return {
|
|
2863
|
+
resourceType: "PaymentNotice",
|
|
2864
|
+
id: paymentId,
|
|
2865
|
+
identifier: buildIdentifierPair6(
|
|
2866
|
+
"PaymentNotice",
|
|
2867
|
+
paymentId,
|
|
2868
|
+
`payment-${meta.id}`
|
|
2869
|
+
),
|
|
2870
|
+
status: "active",
|
|
2871
|
+
request: { reference: `Claim/${claimId}`, type: "Claim" },
|
|
2872
|
+
created: meta.periodStart,
|
|
2873
|
+
// FHIR R4 PaymentNotice.payment is Reference(PaymentReconciliation).
|
|
2874
|
+
// Demo seeding does not produce PaymentReconciliation resources;
|
|
2875
|
+
// we point at the Claim so the reference is at least resolvable on
|
|
2876
|
+
// read paths. The `request` field above is the FHIR-correct link
|
|
2877
|
+
// from PaymentNotice back to the originating Claim.
|
|
2878
|
+
payment: { reference: `Claim/${claimId}`, type: "Claim" },
|
|
2879
|
+
paymentDate: meta.periodStart.slice(0, 10),
|
|
2880
|
+
recipient: { display: insurerDisplay },
|
|
2881
|
+
amount: usdMoney(paid),
|
|
2882
|
+
paymentStatus: {
|
|
2883
|
+
coding: [
|
|
2884
|
+
{
|
|
2885
|
+
system: PAYMENT_STATUS_SYSTEM,
|
|
2886
|
+
code: status,
|
|
2887
|
+
display: status
|
|
2888
|
+
}
|
|
2889
|
+
],
|
|
2890
|
+
text: status
|
|
2891
|
+
}
|
|
2892
|
+
};
|
|
2893
|
+
};
|
|
2894
|
+
var insurerDisplayForCoverage = (cov) => {
|
|
2895
|
+
const payor = cov.payor?.[0];
|
|
2896
|
+
if (payor && typeof payor.display === "string" && payor.display.length > 0) {
|
|
2897
|
+
return payor.display;
|
|
2898
|
+
}
|
|
2899
|
+
if (typeof cov.type?.text === "string" && cov.type.text.length > 0) {
|
|
2900
|
+
return cov.type.text;
|
|
2901
|
+
}
|
|
2902
|
+
return "Unknown Insurer";
|
|
2903
|
+
};
|
|
2904
|
+
var buildOnSiteDemoClaims = (referenceIso) => {
|
|
2905
|
+
const primaryByPatient = getPrimaryCoverageByPatient();
|
|
2906
|
+
const out = [];
|
|
2907
|
+
for (const meta of onSiteDemoEncounterMetadata(referenceIso)) {
|
|
2908
|
+
if (isEncounterUnbilled(meta.id)) {
|
|
2909
|
+
continue;
|
|
2910
|
+
}
|
|
2911
|
+
const coverage = primaryByPatient.get(meta.patientId);
|
|
2912
|
+
if (!coverage || !coverage.id) {
|
|
2913
|
+
continue;
|
|
2914
|
+
}
|
|
2915
|
+
const status = workflowStatusForEncounter(meta.id);
|
|
2916
|
+
out.push(
|
|
2917
|
+
buildClaimResource(
|
|
2918
|
+
meta,
|
|
2919
|
+
status,
|
|
2920
|
+
coverage.id,
|
|
2921
|
+
insurerDisplayForCoverage(coverage)
|
|
2922
|
+
)
|
|
2923
|
+
);
|
|
2924
|
+
}
|
|
2925
|
+
return out;
|
|
2926
|
+
};
|
|
2927
|
+
var buildOnSiteDemoPaymentNotices = (referenceIso) => {
|
|
2928
|
+
const primaryByPatient = getPrimaryCoverageByPatient();
|
|
2929
|
+
const out = [];
|
|
2930
|
+
for (const meta of onSiteDemoEncounterMetadata(referenceIso)) {
|
|
2931
|
+
if (isEncounterUnbilled(meta.id)) {
|
|
2932
|
+
continue;
|
|
2933
|
+
}
|
|
2934
|
+
const status = workflowStatusForEncounter(meta.id);
|
|
2935
|
+
if (status !== CLAIM_WORKFLOW_STATUS.ACCEPTED) {
|
|
2936
|
+
continue;
|
|
2937
|
+
}
|
|
2938
|
+
const coverage = primaryByPatient.get(meta.patientId);
|
|
2939
|
+
if (!coverage || !coverage.id) {
|
|
2940
|
+
continue;
|
|
2941
|
+
}
|
|
2942
|
+
const paymentStatus = paymentStatusForEncounter(meta.id);
|
|
2943
|
+
const line = meta.hasWoundProcedure ? cptForProcedureEncounter(meta.id) : emCodeForEncounter(meta.id);
|
|
2944
|
+
const total = usdMoney(line.amount);
|
|
2945
|
+
const claimId = `${meta.id}-claim`;
|
|
2946
|
+
out.push(
|
|
2947
|
+
buildPaymentNoticeResource(
|
|
2948
|
+
meta,
|
|
2949
|
+
paymentStatus,
|
|
2950
|
+
claimId,
|
|
2951
|
+
total,
|
|
2952
|
+
insurerDisplayForCoverage(coverage)
|
|
2953
|
+
)
|
|
2954
|
+
);
|
|
2955
|
+
}
|
|
2956
|
+
return out;
|
|
2957
|
+
};
|
|
2958
|
+
|
|
2959
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-directory.ts
|
|
2960
|
+
var ON_SITE_SCENARIO7 = "on-site-demo";
|
|
2961
|
+
var FHIR_ORGANIZATION_TYPE_SYSTEM = "http://terminology.hl7.org/CodeSystem/organization-type";
|
|
2962
|
+
var ON_SITE_DIRECTORY_CATEGORY_SYSTEM = "https://on-site-medical.app/fhir/CodeSystem/directory-category";
|
|
2963
|
+
var DME_SUPPLIER_CATEGORY_CODE = "dme-supplier";
|
|
2964
|
+
var INSURANCE_PAYOR_CATEGORY_CODE = "insurance-payor";
|
|
2965
|
+
var INSURANCE_PAYOR_PLAN_TYPE_SYSTEM = "https://on-site-medical.app/fhir/CodeSystem/payor-plan-type";
|
|
2966
|
+
var PAYOR_PLAN_TYPE_COMMERCIAL = "commercial";
|
|
2967
|
+
var PAYOR_PLAN_TYPE_MEDICARE = "medicare";
|
|
2968
|
+
var PAYOR_PLAN_TYPE_MEDICARE_ADVANTAGE = "medicare-advantage";
|
|
2969
|
+
var PRACTITIONER_CREDENTIALING_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/practitioner-credentialing";
|
|
2970
|
+
var PRACTITIONER_CREDENTIALING_STATE_SUB_EXTENSION_URL = "state";
|
|
2971
|
+
var PRACTITIONER_CREDENTIALING_STATUS_SUB_EXTENSION_URL = "status";
|
|
2972
|
+
var CREDENTIALING_STATUS = {
|
|
2973
|
+
ACTIVE: "active",
|
|
2974
|
+
SUSPENDED: "suspended",
|
|
2975
|
+
EXPIRED: "expired"
|
|
2976
|
+
};
|
|
2977
|
+
var STATE_MEDICAL_LICENSE_SYSTEM = "https://on-site-medical.app/fhir/sid/state-medical-license";
|
|
2978
|
+
var DME_SUPPLIER_SPECS = [
|
|
2979
|
+
{
|
|
2980
|
+
id: "on-site-demo-dme-supplier-001",
|
|
2981
|
+
name: "Apria Healthcare",
|
|
2982
|
+
phone: "+18004554111",
|
|
2983
|
+
email: "orders@apria.on-site-demo.example.com",
|
|
2984
|
+
addressLine: "12230 El Camino Real",
|
|
2985
|
+
addressCity: "San Diego",
|
|
2986
|
+
addressState: "CA",
|
|
2987
|
+
addressPostalCode: "92130",
|
|
2988
|
+
contactName: "Marcus Whitfield",
|
|
2989
|
+
contactPhone: "+18004554112",
|
|
2990
|
+
contactEmail: "m.whitfield@apria.on-site-demo.example.com"
|
|
2991
|
+
},
|
|
2992
|
+
{
|
|
2993
|
+
id: "on-site-demo-dme-supplier-002",
|
|
2994
|
+
name: "Lincare Holdings",
|
|
2995
|
+
phone: "+17275301700",
|
|
2996
|
+
email: "intake@lincare.on-site-demo.example.com",
|
|
2997
|
+
addressLine: "19387 US Highway 19 North",
|
|
2998
|
+
addressCity: "Clearwater",
|
|
2999
|
+
addressState: "FL",
|
|
3000
|
+
addressPostalCode: "33764",
|
|
3001
|
+
contactName: "Rachel Donovan",
|
|
3002
|
+
contactPhone: "+17275301701",
|
|
3003
|
+
contactEmail: "r.donovan@lincare.on-site-demo.example.com"
|
|
3004
|
+
},
|
|
3005
|
+
{
|
|
3006
|
+
id: "on-site-demo-dme-supplier-003",
|
|
3007
|
+
name: "AdaptHealth",
|
|
3008
|
+
phone: "+16104840700",
|
|
3009
|
+
email: "referrals@adapthealth.on-site-demo.example.com",
|
|
3010
|
+
addressLine: "220 West Germantown Pike",
|
|
3011
|
+
addressCity: "Plymouth Meeting",
|
|
3012
|
+
addressState: "PA",
|
|
3013
|
+
addressPostalCode: "19462",
|
|
3014
|
+
contactName: "Brian Calloway",
|
|
3015
|
+
contactPhone: "+16104840701",
|
|
3016
|
+
contactEmail: "b.calloway@adapthealth.on-site-demo.example.com"
|
|
3017
|
+
},
|
|
3018
|
+
{
|
|
3019
|
+
id: "on-site-demo-dme-supplier-004",
|
|
3020
|
+
name: "Rotech Healthcare",
|
|
3021
|
+
phone: "+14072629230",
|
|
3022
|
+
email: "support@rotech.on-site-demo.example.com",
|
|
3023
|
+
addressLine: "3600 Vineland Road",
|
|
3024
|
+
addressCity: "Orlando",
|
|
3025
|
+
addressState: "FL",
|
|
3026
|
+
addressPostalCode: "32811",
|
|
3027
|
+
contactName: "Elena Marsh",
|
|
3028
|
+
contactPhone: "+14072629231",
|
|
3029
|
+
contactEmail: "e.marsh@rotech.on-site-demo.example.com"
|
|
3030
|
+
},
|
|
3031
|
+
{
|
|
3032
|
+
id: "on-site-demo-dme-supplier-005",
|
|
3033
|
+
name: "Byram Healthcare",
|
|
3034
|
+
phone: "+18004220606",
|
|
3035
|
+
email: "orders@byram.on-site-demo.example.com",
|
|
3036
|
+
addressLine: "120 Bloomingdale Road",
|
|
3037
|
+
addressCity: "White Plains",
|
|
3038
|
+
addressState: "NY",
|
|
3039
|
+
addressPostalCode: "10605",
|
|
3040
|
+
contactName: "Thomas Pritchard",
|
|
3041
|
+
contactPhone: "+18004220607",
|
|
3042
|
+
contactEmail: "t.pritchard@byram.on-site-demo.example.com"
|
|
3043
|
+
},
|
|
3044
|
+
{
|
|
3045
|
+
id: "on-site-demo-dme-supplier-006",
|
|
3046
|
+
name: "Medline Industries",
|
|
3047
|
+
phone: "+18476434400",
|
|
3048
|
+
email: "wound-care@medline.on-site-demo.example.com",
|
|
3049
|
+
addressLine: "Three Lakes Drive",
|
|
3050
|
+
addressCity: "Northfield",
|
|
3051
|
+
addressState: "IL",
|
|
3052
|
+
addressPostalCode: "60093",
|
|
3053
|
+
contactName: "Jacqueline Vance",
|
|
3054
|
+
contactPhone: "+18476434401",
|
|
3055
|
+
contactEmail: "j.vance@medline.on-site-demo.example.com"
|
|
3056
|
+
},
|
|
3057
|
+
{
|
|
3058
|
+
id: "on-site-demo-dme-supplier-007",
|
|
3059
|
+
name: "McKesson Medical-Surgical",
|
|
3060
|
+
phone: "+18044703300",
|
|
3061
|
+
email: "service@mckesson-ms.on-site-demo.example.com",
|
|
3062
|
+
addressLine: "9954 Mayland Drive",
|
|
3063
|
+
addressCity: "Richmond",
|
|
3064
|
+
addressState: "VA",
|
|
3065
|
+
addressPostalCode: "23233",
|
|
3066
|
+
contactName: "Andre Holloway",
|
|
3067
|
+
contactPhone: "+18044703301",
|
|
3068
|
+
contactEmail: "a.holloway@mckesson-ms.on-site-demo.example.com"
|
|
3069
|
+
},
|
|
3070
|
+
{
|
|
3071
|
+
id: "on-site-demo-dme-supplier-008",
|
|
3072
|
+
name: "Cardinal Health at-Home Solutions",
|
|
3073
|
+
phone: "+16147573030",
|
|
3074
|
+
email: "home@cardinal.on-site-demo.example.com",
|
|
3075
|
+
addressLine: "7000 Cardinal Place",
|
|
3076
|
+
addressCity: "Dublin",
|
|
3077
|
+
addressState: "OH",
|
|
3078
|
+
addressPostalCode: "43017",
|
|
3079
|
+
contactName: "Naomi Sutherland",
|
|
3080
|
+
contactPhone: "+16147573031",
|
|
3081
|
+
contactEmail: "n.sutherland@cardinal.on-site-demo.example.com"
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
id: "on-site-demo-dme-supplier-009",
|
|
3085
|
+
name: "Edgepark Medical Supplies",
|
|
3086
|
+
phone: "+18003217828",
|
|
3087
|
+
email: "orders@edgepark.on-site-demo.example.com",
|
|
3088
|
+
addressLine: "1810 Summit Commerce Park",
|
|
3089
|
+
addressCity: "Twinsburg",
|
|
3090
|
+
addressState: "OH",
|
|
3091
|
+
addressPostalCode: "44087",
|
|
3092
|
+
contactName: "Derek Ashford",
|
|
3093
|
+
contactPhone: "+18003217829",
|
|
3094
|
+
contactEmail: "d.ashford@edgepark.on-site-demo.example.com"
|
|
3095
|
+
},
|
|
3096
|
+
{
|
|
3097
|
+
id: "on-site-demo-dme-supplier-010",
|
|
3098
|
+
name: "Numotion",
|
|
3099
|
+
phone: "+18006240498",
|
|
3100
|
+
email: "intake@numotion.on-site-demo.example.com",
|
|
3101
|
+
addressLine: "5117 W Terrace Drive",
|
|
3102
|
+
addressCity: "Brentwood",
|
|
3103
|
+
addressState: "TN",
|
|
3104
|
+
addressPostalCode: "37027",
|
|
3105
|
+
contactName: "Sienna Lockhart",
|
|
3106
|
+
contactPhone: "+18006240499",
|
|
3107
|
+
contactEmail: "s.lockhart@numotion.on-site-demo.example.com"
|
|
3108
|
+
},
|
|
3109
|
+
{
|
|
3110
|
+
id: "on-site-demo-dme-supplier-011",
|
|
3111
|
+
name: "Pride Mobility",
|
|
3112
|
+
phone: "+18008003636",
|
|
3113
|
+
email: "service@pridemobility.on-site-demo.example.com",
|
|
3114
|
+
addressLine: "182 Susquehanna Avenue",
|
|
3115
|
+
addressCity: "Exeter",
|
|
3116
|
+
addressState: "PA",
|
|
3117
|
+
addressPostalCode: "18643",
|
|
3118
|
+
contactName: "Vincent Marlowe",
|
|
3119
|
+
contactPhone: "+18008003637",
|
|
3120
|
+
contactEmail: "v.marlowe@pridemobility.on-site-demo.example.com"
|
|
3121
|
+
},
|
|
3122
|
+
{
|
|
3123
|
+
id: "on-site-demo-dme-supplier-012",
|
|
3124
|
+
name: "Hollister Wound Care",
|
|
3125
|
+
phone: "+18003234060",
|
|
3126
|
+
email: "wound@hollister.on-site-demo.example.com",
|
|
3127
|
+
addressLine: "2000 Hollister Drive",
|
|
3128
|
+
addressCity: "Libertyville",
|
|
3129
|
+
addressState: "IL",
|
|
3130
|
+
addressPostalCode: "60048",
|
|
3131
|
+
contactName: "Priscilla Hawthorne",
|
|
3132
|
+
contactPhone: "+18003234061",
|
|
3133
|
+
contactEmail: "p.hawthorne@hollister.on-site-demo.example.com"
|
|
3134
|
+
},
|
|
3135
|
+
{
|
|
3136
|
+
id: "on-site-demo-dme-supplier-013",
|
|
3137
|
+
name: "Smith & Nephew Advanced Wound Management",
|
|
3138
|
+
phone: "+18008765556",
|
|
3139
|
+
email: "wound@smith-nephew.on-site-demo.example.com",
|
|
3140
|
+
addressLine: "5600 Clearfork Main Street",
|
|
3141
|
+
addressCity: "Fort Worth",
|
|
3142
|
+
addressState: "TX",
|
|
3143
|
+
addressPostalCode: "76109",
|
|
3144
|
+
contactName: "Gregory Eastland",
|
|
3145
|
+
contactPhone: "+18008765557",
|
|
3146
|
+
contactEmail: "g.eastland@smith-nephew.on-site-demo.example.com"
|
|
3147
|
+
}
|
|
3148
|
+
];
|
|
3149
|
+
var INSURANCE_PAYOR_SPECS = [
|
|
3150
|
+
{
|
|
3151
|
+
id: "on-site-demo-insurance-payor-001",
|
|
3152
|
+
name: "Aetna",
|
|
3153
|
+
planType: PAYOR_PLAN_TYPE_COMMERCIAL,
|
|
3154
|
+
phone: "+18008721414",
|
|
3155
|
+
email: "provider-services@aetna.on-site-demo.example.com",
|
|
3156
|
+
addressLine: "151 Farmington Avenue",
|
|
3157
|
+
addressCity: "Hartford",
|
|
3158
|
+
addressState: "CT",
|
|
3159
|
+
addressPostalCode: "06156",
|
|
3160
|
+
contactName: "Stephanie Wakefield",
|
|
3161
|
+
contactPhone: "+18008721415",
|
|
3162
|
+
contactEmail: "s.wakefield@aetna.on-site-demo.example.com"
|
|
3163
|
+
},
|
|
3164
|
+
{
|
|
3165
|
+
id: "on-site-demo-insurance-payor-002",
|
|
3166
|
+
name: "Cigna Healthcare",
|
|
3167
|
+
planType: PAYOR_PLAN_TYPE_COMMERCIAL,
|
|
3168
|
+
phone: "+18002442488",
|
|
3169
|
+
email: "provider-services@cigna.on-site-demo.example.com",
|
|
3170
|
+
addressLine: "900 Cottage Grove Road",
|
|
3171
|
+
addressCity: "Bloomfield",
|
|
3172
|
+
addressState: "CT",
|
|
3173
|
+
addressPostalCode: "06002",
|
|
3174
|
+
contactName: "Howard Greenberg",
|
|
3175
|
+
contactPhone: "+18002442489",
|
|
3176
|
+
contactEmail: "h.greenberg@cigna.on-site-demo.example.com"
|
|
3177
|
+
},
|
|
3178
|
+
{
|
|
3179
|
+
id: "on-site-demo-insurance-payor-003",
|
|
3180
|
+
name: "UnitedHealthcare",
|
|
3181
|
+
planType: PAYOR_PLAN_TYPE_COMMERCIAL,
|
|
3182
|
+
phone: "+18778425539",
|
|
3183
|
+
email: "provider-services@uhc.on-site-demo.example.com",
|
|
3184
|
+
addressLine: "9900 Bren Road East",
|
|
3185
|
+
addressCity: "Minnetonka",
|
|
3186
|
+
addressState: "MN",
|
|
3187
|
+
addressPostalCode: "55343",
|
|
3188
|
+
contactName: "Cassandra Bellamy",
|
|
3189
|
+
contactPhone: "+18778425540",
|
|
3190
|
+
contactEmail: "c.bellamy@uhc.on-site-demo.example.com"
|
|
3191
|
+
},
|
|
3192
|
+
{
|
|
3193
|
+
id: "on-site-demo-insurance-payor-004",
|
|
3194
|
+
name: "Anthem Blue Cross Blue Shield",
|
|
3195
|
+
planType: PAYOR_PLAN_TYPE_COMMERCIAL,
|
|
3196
|
+
phone: "+18004504000",
|
|
3197
|
+
email: "provider-services@anthem.on-site-demo.example.com",
|
|
3198
|
+
addressLine: "220 Virginia Avenue",
|
|
3199
|
+
addressCity: "Indianapolis",
|
|
3200
|
+
addressState: "IN",
|
|
3201
|
+
addressPostalCode: "46204",
|
|
3202
|
+
contactName: "Maurice Pendleton",
|
|
3203
|
+
contactPhone: "+18004504001",
|
|
3204
|
+
contactEmail: "m.pendleton@anthem.on-site-demo.example.com"
|
|
3205
|
+
},
|
|
3206
|
+
{
|
|
3207
|
+
id: "on-site-demo-insurance-payor-005",
|
|
3208
|
+
name: "CMS \u2014 Medicare",
|
|
3209
|
+
planType: PAYOR_PLAN_TYPE_MEDICARE,
|
|
3210
|
+
phone: "+18006334227",
|
|
3211
|
+
email: "provider-services@cms.on-site-demo.example.com",
|
|
3212
|
+
addressLine: "7500 Security Boulevard",
|
|
3213
|
+
addressCity: "Baltimore",
|
|
3214
|
+
addressState: "MD",
|
|
3215
|
+
addressPostalCode: "21244",
|
|
3216
|
+
contactName: "Theresa Kavanagh",
|
|
3217
|
+
contactPhone: "+18006334228",
|
|
3218
|
+
contactEmail: "t.kavanagh@cms.on-site-demo.example.com"
|
|
3219
|
+
},
|
|
3220
|
+
{
|
|
3221
|
+
id: "on-site-demo-insurance-payor-006",
|
|
3222
|
+
name: "Humana Medicare Advantage",
|
|
3223
|
+
planType: PAYOR_PLAN_TYPE_MEDICARE_ADVANTAGE,
|
|
3224
|
+
phone: "+18004574708",
|
|
3225
|
+
email: "provider-services@humana.on-site-demo.example.com",
|
|
3226
|
+
addressLine: "500 West Main Street",
|
|
3227
|
+
addressCity: "Louisville",
|
|
3228
|
+
addressState: "KY",
|
|
3229
|
+
addressPostalCode: "40202",
|
|
3230
|
+
contactName: "Lawrence Whitmore",
|
|
3231
|
+
contactPhone: "+18004574709",
|
|
3232
|
+
contactEmail: "l.whitmore@humana.on-site-demo.example.com"
|
|
3233
|
+
},
|
|
3234
|
+
{
|
|
3235
|
+
id: "on-site-demo-insurance-payor-007",
|
|
3236
|
+
name: "Wellcare by Centene",
|
|
3237
|
+
planType: PAYOR_PLAN_TYPE_MEDICARE_ADVANTAGE,
|
|
3238
|
+
phone: "+18886353224",
|
|
3239
|
+
email: "provider-services@wellcare.on-site-demo.example.com",
|
|
3240
|
+
addressLine: "8735 Henderson Road",
|
|
3241
|
+
addressCity: "Tampa",
|
|
3242
|
+
addressState: "FL",
|
|
3243
|
+
addressPostalCode: "33634",
|
|
3244
|
+
contactName: "Yolanda Caldwell",
|
|
3245
|
+
contactPhone: "+18886353225",
|
|
3246
|
+
contactEmail: "y.caldwell@wellcare.on-site-demo.example.com"
|
|
3247
|
+
},
|
|
3248
|
+
{
|
|
3249
|
+
id: "on-site-demo-insurance-payor-008",
|
|
3250
|
+
name: "Kaiser Permanente",
|
|
3251
|
+
planType: PAYOR_PLAN_TYPE_COMMERCIAL,
|
|
3252
|
+
phone: "+18004646000",
|
|
3253
|
+
email: "provider-services@kaiser.on-site-demo.example.com",
|
|
3254
|
+
addressLine: "1 Kaiser Plaza",
|
|
3255
|
+
addressCity: "Oakland",
|
|
3256
|
+
addressState: "CA",
|
|
3257
|
+
addressPostalCode: "94612",
|
|
3258
|
+
contactName: "Bradford Tennyson",
|
|
3259
|
+
contactPhone: "+18004646001",
|
|
3260
|
+
contactEmail: "b.tennyson@kaiser.on-site-demo.example.com"
|
|
3261
|
+
}
|
|
3262
|
+
];
|
|
3263
|
+
var buildOrganizationIdentifierPair = (organizationId, roleSuffix) => [
|
|
3264
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO7, roleSuffix),
|
|
3265
|
+
openhiResourceIdentifier({
|
|
3266
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
3267
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
3268
|
+
resourceType: "Organization",
|
|
3269
|
+
id: organizationId
|
|
3270
|
+
})
|
|
3271
|
+
];
|
|
3272
|
+
var buildDmeSupplierResource = (spec) => ({
|
|
3273
|
+
resourceType: "Organization",
|
|
3274
|
+
id: spec.id,
|
|
3275
|
+
active: true,
|
|
3276
|
+
identifier: buildOrganizationIdentifierPair(
|
|
3277
|
+
spec.id,
|
|
3278
|
+
`dme-supplier-${spec.id}`
|
|
3279
|
+
),
|
|
3280
|
+
name: spec.name,
|
|
3281
|
+
type: [
|
|
3282
|
+
{
|
|
3283
|
+
coding: [
|
|
3284
|
+
{
|
|
3285
|
+
system: FHIR_ORGANIZATION_TYPE_SYSTEM,
|
|
3286
|
+
code: "prov",
|
|
3287
|
+
display: "Healthcare Provider"
|
|
3288
|
+
},
|
|
3289
|
+
{
|
|
3290
|
+
system: ON_SITE_DIRECTORY_CATEGORY_SYSTEM,
|
|
3291
|
+
code: DME_SUPPLIER_CATEGORY_CODE,
|
|
3292
|
+
display: "DME Supplier"
|
|
3293
|
+
}
|
|
3294
|
+
],
|
|
3295
|
+
text: "DME Supplier"
|
|
3296
|
+
}
|
|
3297
|
+
],
|
|
3298
|
+
telecom: [
|
|
3299
|
+
{ system: "phone", value: spec.phone, use: "work" },
|
|
3300
|
+
{ system: "email", value: spec.email, use: "work" }
|
|
3301
|
+
],
|
|
3302
|
+
address: [
|
|
3303
|
+
{
|
|
3304
|
+
use: "work",
|
|
3305
|
+
line: [spec.addressLine],
|
|
3306
|
+
city: spec.addressCity,
|
|
3307
|
+
state: spec.addressState,
|
|
3308
|
+
postalCode: spec.addressPostalCode,
|
|
3309
|
+
country: "US"
|
|
3310
|
+
}
|
|
3311
|
+
],
|
|
3312
|
+
contact: [
|
|
3313
|
+
{
|
|
3314
|
+
purpose: { text: "Primary Contact" },
|
|
3315
|
+
name: {
|
|
3316
|
+
text: spec.contactName,
|
|
3317
|
+
given: [spec.contactName.split(" ")[0] ?? spec.contactName],
|
|
3318
|
+
family: spec.contactName.split(" ").slice(-1)[0] ?? spec.contactName
|
|
3319
|
+
},
|
|
3320
|
+
telecom: [
|
|
3321
|
+
{ system: "phone", value: spec.contactPhone, use: "work" },
|
|
3322
|
+
{ system: "email", value: spec.contactEmail, use: "work" }
|
|
3323
|
+
]
|
|
3324
|
+
}
|
|
3325
|
+
]
|
|
3326
|
+
});
|
|
3327
|
+
var planTypeDisplayLabel = (planType) => {
|
|
3328
|
+
if (planType === PAYOR_PLAN_TYPE_COMMERCIAL) {
|
|
3329
|
+
return "Commercial";
|
|
3330
|
+
}
|
|
3331
|
+
if (planType === PAYOR_PLAN_TYPE_MEDICARE) {
|
|
3332
|
+
return "Medicare";
|
|
3333
|
+
}
|
|
3334
|
+
return "Medicare Advantage";
|
|
3335
|
+
};
|
|
3336
|
+
var buildInsurancePayorResource = (spec) => ({
|
|
3337
|
+
resourceType: "Organization",
|
|
3338
|
+
id: spec.id,
|
|
3339
|
+
active: true,
|
|
3340
|
+
identifier: buildOrganizationIdentifierPair(
|
|
3341
|
+
spec.id,
|
|
3342
|
+
`insurance-payor-${spec.id}`
|
|
3343
|
+
),
|
|
3344
|
+
name: spec.name,
|
|
3345
|
+
type: [
|
|
3346
|
+
{
|
|
3347
|
+
coding: [
|
|
3348
|
+
{
|
|
3349
|
+
system: FHIR_ORGANIZATION_TYPE_SYSTEM,
|
|
3350
|
+
code: "pay",
|
|
3351
|
+
display: "Payer"
|
|
3352
|
+
},
|
|
3353
|
+
{
|
|
3354
|
+
system: ON_SITE_DIRECTORY_CATEGORY_SYSTEM,
|
|
3355
|
+
code: INSURANCE_PAYOR_CATEGORY_CODE,
|
|
3356
|
+
display: "Insurance Payor"
|
|
3357
|
+
},
|
|
3358
|
+
{
|
|
3359
|
+
system: INSURANCE_PAYOR_PLAN_TYPE_SYSTEM,
|
|
3360
|
+
code: spec.planType,
|
|
3361
|
+
display: planTypeDisplayLabel(spec.planType)
|
|
3362
|
+
}
|
|
3363
|
+
],
|
|
3364
|
+
text: planTypeDisplayLabel(spec.planType)
|
|
3365
|
+
}
|
|
3366
|
+
],
|
|
3367
|
+
telecom: [
|
|
3368
|
+
{ system: "phone", value: spec.phone, use: "work" },
|
|
3369
|
+
{ system: "email", value: spec.email, use: "work" }
|
|
3370
|
+
],
|
|
3371
|
+
address: [
|
|
3372
|
+
{
|
|
3373
|
+
use: "work",
|
|
3374
|
+
line: [spec.addressLine],
|
|
3375
|
+
city: spec.addressCity,
|
|
3376
|
+
state: spec.addressState,
|
|
3377
|
+
postalCode: spec.addressPostalCode,
|
|
3378
|
+
country: "US"
|
|
3379
|
+
}
|
|
3380
|
+
],
|
|
3381
|
+
contact: [
|
|
3382
|
+
{
|
|
3383
|
+
purpose: { text: "Provider Services" },
|
|
3384
|
+
name: {
|
|
3385
|
+
text: spec.contactName,
|
|
3386
|
+
given: [spec.contactName.split(" ")[0] ?? spec.contactName],
|
|
3387
|
+
family: spec.contactName.split(" ").slice(-1)[0] ?? spec.contactName
|
|
3388
|
+
},
|
|
3389
|
+
telecom: [
|
|
3390
|
+
{ system: "phone", value: spec.contactPhone, use: "work" },
|
|
3391
|
+
{ system: "email", value: spec.contactEmail, use: "work" }
|
|
3392
|
+
]
|
|
3393
|
+
}
|
|
3394
|
+
]
|
|
3395
|
+
});
|
|
3396
|
+
var ON_SITE_DEMO_DME_SUPPLIERS = DME_SUPPLIER_SPECS.map(buildDmeSupplierResource);
|
|
3397
|
+
var ON_SITE_DEMO_INSURANCE_PAYORS = INSURANCE_PAYOR_SPECS.map(buildInsurancePayorResource);
|
|
3398
|
+
var ON_SITE_DEMO_DIRECTORY_ORGANIZATIONS = [...ON_SITE_DEMO_DME_SUPPLIERS, ...ON_SITE_DEMO_INSURANCE_PAYORS];
|
|
3399
|
+
var PRACTITIONER_CREDENTIALING_BY_DOCTOR = {
|
|
3400
|
+
"on-site-demo-doctor-001": [
|
|
3401
|
+
{
|
|
3402
|
+
state: "GA",
|
|
3403
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3404
|
+
licenseNumber: "GA-MD-082431",
|
|
3405
|
+
issued: "2014-06-12",
|
|
3406
|
+
expires: "2027-06-30",
|
|
3407
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3408
|
+
},
|
|
3409
|
+
{
|
|
3410
|
+
state: "AL",
|
|
3411
|
+
stateBoardDisplay: "Alabama Board of Medical Examiners",
|
|
3412
|
+
licenseNumber: "AL-MD-MD031298",
|
|
3413
|
+
issued: "2016-04-02",
|
|
3414
|
+
expires: "2026-12-31",
|
|
3415
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3416
|
+
},
|
|
3417
|
+
{
|
|
3418
|
+
state: "TN",
|
|
3419
|
+
stateBoardDisplay: "Tennessee Board of Medical Examiners",
|
|
3420
|
+
licenseNumber: "TN-MD-MD51227",
|
|
3421
|
+
issued: "2017-09-21",
|
|
3422
|
+
expires: "2026-09-30",
|
|
3423
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3424
|
+
}
|
|
3425
|
+
],
|
|
3426
|
+
"on-site-demo-doctor-002": [
|
|
3427
|
+
{
|
|
3428
|
+
state: "GA",
|
|
3429
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3430
|
+
licenseNumber: "GA-MD-076120",
|
|
3431
|
+
issued: "2012-08-04",
|
|
3432
|
+
expires: "2027-08-31",
|
|
3433
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3434
|
+
},
|
|
3435
|
+
{
|
|
3436
|
+
state: "FL",
|
|
3437
|
+
stateBoardDisplay: "Florida Board of Medicine",
|
|
3438
|
+
licenseNumber: "FL-MD-ME128443",
|
|
3439
|
+
issued: "2018-02-18",
|
|
3440
|
+
expires: "2026-02-28",
|
|
3441
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3442
|
+
}
|
|
3443
|
+
],
|
|
3444
|
+
"on-site-demo-doctor-003": [
|
|
3445
|
+
{
|
|
3446
|
+
state: "GA",
|
|
3447
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3448
|
+
licenseNumber: "GA-MD-091047",
|
|
3449
|
+
issued: "2015-11-22",
|
|
3450
|
+
expires: "2027-11-30",
|
|
3451
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3452
|
+
},
|
|
3453
|
+
{
|
|
3454
|
+
state: "SC",
|
|
3455
|
+
stateBoardDisplay: "South Carolina Board of Medical Examiners",
|
|
3456
|
+
licenseNumber: "SC-MD-32788",
|
|
3457
|
+
issued: "2019-05-10",
|
|
3458
|
+
expires: "2027-05-31",
|
|
3459
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3460
|
+
}
|
|
3461
|
+
],
|
|
3462
|
+
"on-site-demo-doctor-004": [
|
|
3463
|
+
{
|
|
3464
|
+
state: "GA",
|
|
3465
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3466
|
+
licenseNumber: "GA-MD-064118",
|
|
3467
|
+
issued: "2009-07-14",
|
|
3468
|
+
expires: "2027-07-31",
|
|
3469
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3470
|
+
},
|
|
3471
|
+
{
|
|
3472
|
+
state: "NC",
|
|
3473
|
+
stateBoardDisplay: "North Carolina Medical Board",
|
|
3474
|
+
licenseNumber: "NC-MD-2014-00892",
|
|
3475
|
+
issued: "2014-03-08",
|
|
3476
|
+
expires: "2027-03-31",
|
|
3477
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3478
|
+
}
|
|
3479
|
+
],
|
|
3480
|
+
"on-site-demo-doctor-005": [
|
|
3481
|
+
{
|
|
3482
|
+
state: "GA",
|
|
3483
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3484
|
+
licenseNumber: "GA-MD-098712",
|
|
3485
|
+
issued: "2017-01-19",
|
|
3486
|
+
expires: "2027-01-31",
|
|
3487
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3488
|
+
},
|
|
3489
|
+
{
|
|
3490
|
+
state: "AL",
|
|
3491
|
+
stateBoardDisplay: "Alabama Board of Medical Examiners",
|
|
3492
|
+
licenseNumber: "AL-MD-MD040115",
|
|
3493
|
+
issued: "2020-06-30",
|
|
3494
|
+
expires: "2026-06-30",
|
|
3495
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3496
|
+
}
|
|
3497
|
+
],
|
|
3498
|
+
"on-site-demo-doctor-006": [
|
|
3499
|
+
{
|
|
3500
|
+
state: "GA",
|
|
3501
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3502
|
+
licenseNumber: "GA-MD-052901",
|
|
3503
|
+
issued: "2004-09-02",
|
|
3504
|
+
expires: "2027-09-30",
|
|
3505
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3506
|
+
},
|
|
3507
|
+
{
|
|
3508
|
+
state: "TN",
|
|
3509
|
+
stateBoardDisplay: "Tennessee Board of Medical Examiners",
|
|
3510
|
+
licenseNumber: "TN-MD-MD43091",
|
|
3511
|
+
issued: "2011-05-15",
|
|
3512
|
+
expires: "2027-05-31",
|
|
3513
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3514
|
+
}
|
|
3515
|
+
],
|
|
3516
|
+
"on-site-demo-doctor-007": [
|
|
3517
|
+
{
|
|
3518
|
+
state: "GA",
|
|
3519
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3520
|
+
licenseNumber: "GA-MD-073445",
|
|
3521
|
+
issued: "2013-04-27",
|
|
3522
|
+
expires: "2027-04-30",
|
|
3523
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3524
|
+
},
|
|
3525
|
+
{
|
|
3526
|
+
state: "FL",
|
|
3527
|
+
stateBoardDisplay: "Florida Board of Medicine",
|
|
3528
|
+
licenseNumber: "FL-MD-ME119001",
|
|
3529
|
+
issued: "2015-12-12",
|
|
3530
|
+
expires: "2026-12-31",
|
|
3531
|
+
status: CREDENTIALING_STATUS.SUSPENDED
|
|
3532
|
+
}
|
|
3533
|
+
],
|
|
3534
|
+
"on-site-demo-doctor-008": [
|
|
3535
|
+
{
|
|
3536
|
+
state: "GA",
|
|
3537
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3538
|
+
licenseNumber: "GA-MD-101203",
|
|
3539
|
+
issued: "2018-08-09",
|
|
3540
|
+
expires: "2027-08-31",
|
|
3541
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3542
|
+
},
|
|
3543
|
+
{
|
|
3544
|
+
state: "SC",
|
|
3545
|
+
stateBoardDisplay: "South Carolina Board of Medical Examiners",
|
|
3546
|
+
licenseNumber: "SC-MD-35112",
|
|
3547
|
+
issued: "2021-02-01",
|
|
3548
|
+
expires: "2027-02-28",
|
|
3549
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3550
|
+
}
|
|
3551
|
+
],
|
|
3552
|
+
"on-site-demo-doctor-009": [
|
|
3553
|
+
{
|
|
3554
|
+
state: "GA",
|
|
3555
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3556
|
+
licenseNumber: "GA-MD-061887",
|
|
3557
|
+
issued: "2010-11-30",
|
|
3558
|
+
expires: "2026-11-30",
|
|
3559
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3560
|
+
},
|
|
3561
|
+
{
|
|
3562
|
+
state: "TN",
|
|
3563
|
+
stateBoardDisplay: "Tennessee Board of Medical Examiners",
|
|
3564
|
+
licenseNumber: "TN-MD-MD38712",
|
|
3565
|
+
issued: "2012-06-04",
|
|
3566
|
+
expires: "2024-06-30",
|
|
3567
|
+
status: CREDENTIALING_STATUS.EXPIRED
|
|
3568
|
+
}
|
|
3569
|
+
],
|
|
3570
|
+
"on-site-demo-doctor-010": [
|
|
3571
|
+
{
|
|
3572
|
+
state: "GA",
|
|
3573
|
+
stateBoardDisplay: "Georgia Composite Medical Board",
|
|
3574
|
+
licenseNumber: "GA-MD-108901",
|
|
3575
|
+
issued: "2020-03-15",
|
|
3576
|
+
expires: "2027-03-31",
|
|
3577
|
+
status: CREDENTIALING_STATUS.ACTIVE
|
|
3578
|
+
}
|
|
3579
|
+
]
|
|
3580
|
+
};
|
|
3581
|
+
var practitionerCredentialingForDoctor = (practitionerId) => PRACTITIONER_CREDENTIALING_BY_DOCTOR[practitionerId] ?? [];
|
|
3582
|
+
var buildCredentialingQualifications = (practitionerId) => practitionerCredentialingForDoctor(practitionerId).map((cred) => ({
|
|
3583
|
+
identifier: [
|
|
3584
|
+
{
|
|
3585
|
+
system: STATE_MEDICAL_LICENSE_SYSTEM,
|
|
3586
|
+
value: cred.licenseNumber
|
|
3587
|
+
}
|
|
3588
|
+
],
|
|
3589
|
+
code: {
|
|
3590
|
+
text: "Medical License"
|
|
3591
|
+
},
|
|
3592
|
+
period: {
|
|
3593
|
+
start: cred.issued,
|
|
3594
|
+
end: cred.expires
|
|
3595
|
+
},
|
|
3596
|
+
issuer: {
|
|
3597
|
+
display: cred.stateBoardDisplay
|
|
3598
|
+
},
|
|
3599
|
+
extension: [
|
|
3600
|
+
{
|
|
3601
|
+
url: PRACTITIONER_CREDENTIALING_EXTENSION_URL,
|
|
3602
|
+
extension: [
|
|
3603
|
+
{
|
|
3604
|
+
url: PRACTITIONER_CREDENTIALING_STATE_SUB_EXTENSION_URL,
|
|
3605
|
+
valueCode: cred.state
|
|
3606
|
+
},
|
|
3607
|
+
{
|
|
3608
|
+
url: PRACTITIONER_CREDENTIALING_STATUS_SUB_EXTENSION_URL,
|
|
3609
|
+
valueCode: cred.status
|
|
3610
|
+
}
|
|
3611
|
+
]
|
|
3612
|
+
}
|
|
3613
|
+
]
|
|
3614
|
+
}));
|
|
3615
|
+
|
|
3616
|
+
// src/workflows/control-plane/seed-demo-data/on-site-demo-fixtures.ts
|
|
3617
|
+
var US_NPI_SYSTEM = "http://hl7.org/fhir/sid/us-npi";
|
|
3618
|
+
var HOME_HEALTH_ELIGIBLE_EXTENSION_URL = "https://on-site-medical.app/fhir/StructureDefinition/home-health-eligible";
|
|
3619
|
+
var PRACTITIONER_ROLE_PHYSICIAN = "Physician";
|
|
3620
|
+
var PRACTITIONER_ROLE_SCRIBE = "Scribe";
|
|
3621
|
+
var ON_SITE_STAFF_ID_SYSTEM = "https://on-site-medical.app/fhir/sid/staff-id";
|
|
3622
|
+
var DOCTOR_SPECS = [
|
|
3623
|
+
{
|
|
3624
|
+
id: "on-site-demo-doctor-001",
|
|
3625
|
+
firstName: "Sarah",
|
|
3626
|
+
lastName: "Patel",
|
|
3627
|
+
suffix: "MD",
|
|
3628
|
+
gender: "female",
|
|
3629
|
+
birthDate: "1978-03-14",
|
|
3630
|
+
phone: "+14045550101",
|
|
3631
|
+
email: "sarah.patel@on-site-demo.example.com",
|
|
3632
|
+
npi: "1003000001",
|
|
3633
|
+
addressLine: "120 Peachtree Street NE",
|
|
3634
|
+
addressCity: "Atlanta",
|
|
3635
|
+
addressState: "GA",
|
|
3636
|
+
addressPostalCode: "30303",
|
|
3637
|
+
homeHealthEligible: true
|
|
3638
|
+
},
|
|
3639
|
+
{
|
|
3640
|
+
id: "on-site-demo-doctor-002",
|
|
3641
|
+
firstName: "Michael",
|
|
3642
|
+
lastName: "Brennan",
|
|
3643
|
+
suffix: "DO",
|
|
3644
|
+
gender: "male",
|
|
3645
|
+
birthDate: "1972-08-22",
|
|
3646
|
+
phone: "+14045550102",
|
|
3647
|
+
email: "michael.brennan@on-site-demo.example.com",
|
|
3648
|
+
npi: "1003000002",
|
|
3649
|
+
addressLine: "300 Ponce de Leon Avenue",
|
|
3650
|
+
addressCity: "Atlanta",
|
|
3651
|
+
addressState: "GA",
|
|
3652
|
+
addressPostalCode: "30308",
|
|
3653
|
+
homeHealthEligible: true
|
|
3654
|
+
},
|
|
3655
|
+
{
|
|
3656
|
+
id: "on-site-demo-doctor-003",
|
|
3657
|
+
firstName: "Linda",
|
|
3658
|
+
lastName: "Nguyen",
|
|
3659
|
+
suffix: "MD",
|
|
3660
|
+
gender: "female",
|
|
3661
|
+
birthDate: "1981-11-05",
|
|
3662
|
+
phone: "+14045550103",
|
|
3663
|
+
email: "linda.nguyen@on-site-demo.example.com",
|
|
3664
|
+
npi: "1003000003",
|
|
3665
|
+
addressLine: "75 Piedmont Avenue",
|
|
3666
|
+
addressCity: "Atlanta",
|
|
3667
|
+
addressState: "GA",
|
|
3668
|
+
addressPostalCode: "30303",
|
|
3669
|
+
homeHealthEligible: true
|
|
3670
|
+
},
|
|
3671
|
+
{
|
|
3672
|
+
id: "on-site-demo-doctor-004",
|
|
3673
|
+
firstName: "James",
|
|
3674
|
+
lastName: "Ortiz",
|
|
3675
|
+
suffix: "MD",
|
|
3676
|
+
gender: "male",
|
|
3677
|
+
birthDate: "1969-04-30",
|
|
3678
|
+
phone: "+14045550104",
|
|
3679
|
+
email: "james.ortiz@on-site-demo.example.com",
|
|
3680
|
+
npi: "1003000004",
|
|
3681
|
+
addressLine: "1825 Howell Mill Road",
|
|
3682
|
+
addressCity: "Atlanta",
|
|
3683
|
+
addressState: "GA",
|
|
3684
|
+
addressPostalCode: "30318",
|
|
3685
|
+
homeHealthEligible: true
|
|
3686
|
+
},
|
|
3687
|
+
{
|
|
3688
|
+
id: "on-site-demo-doctor-005",
|
|
3689
|
+
firstName: "Olivia",
|
|
3690
|
+
lastName: "Carter",
|
|
3691
|
+
suffix: "MD",
|
|
3692
|
+
gender: "female",
|
|
3693
|
+
birthDate: "1985-07-19",
|
|
3694
|
+
phone: "+14045550105",
|
|
3695
|
+
email: "olivia.carter@on-site-demo.example.com",
|
|
3696
|
+
npi: "1003000005",
|
|
3697
|
+
addressLine: "999 Peachtree Street NE",
|
|
3698
|
+
addressCity: "Atlanta",
|
|
3699
|
+
addressState: "GA",
|
|
3700
|
+
addressPostalCode: "30309",
|
|
3701
|
+
homeHealthEligible: true
|
|
3702
|
+
},
|
|
3703
|
+
{
|
|
3704
|
+
id: "on-site-demo-doctor-006",
|
|
3705
|
+
firstName: "David",
|
|
3706
|
+
lastName: "Sullivan",
|
|
3707
|
+
suffix: "MD",
|
|
3708
|
+
gender: "male",
|
|
3709
|
+
birthDate: "1965-12-02",
|
|
3710
|
+
phone: "+14045550106",
|
|
3711
|
+
email: "david.sullivan@on-site-demo.example.com",
|
|
3712
|
+
npi: "1003000006",
|
|
3713
|
+
addressLine: "550 Pharr Road",
|
|
3714
|
+
addressCity: "Atlanta",
|
|
3715
|
+
addressState: "GA",
|
|
3716
|
+
addressPostalCode: "30305",
|
|
3717
|
+
homeHealthEligible: false
|
|
3718
|
+
},
|
|
3719
|
+
{
|
|
3720
|
+
id: "on-site-demo-doctor-007",
|
|
3721
|
+
firstName: "Maria",
|
|
3722
|
+
lastName: "Hernandez",
|
|
3723
|
+
suffix: "MD",
|
|
3724
|
+
gender: "female",
|
|
3725
|
+
birthDate: "1976-06-11",
|
|
3726
|
+
phone: "+14045550107",
|
|
3727
|
+
email: "maria.hernandez@on-site-demo.example.com",
|
|
3728
|
+
npi: "1003000007",
|
|
3729
|
+
addressLine: "2200 Northside Drive NW",
|
|
3730
|
+
addressCity: "Atlanta",
|
|
3731
|
+
addressState: "GA",
|
|
3732
|
+
addressPostalCode: "30318",
|
|
3733
|
+
homeHealthEligible: false
|
|
3734
|
+
},
|
|
3735
|
+
{
|
|
3736
|
+
id: "on-site-demo-doctor-008",
|
|
3737
|
+
firstName: "Robert",
|
|
3738
|
+
lastName: "Kim",
|
|
3739
|
+
suffix: "DO",
|
|
3740
|
+
gender: "male",
|
|
3741
|
+
birthDate: "1983-02-27",
|
|
3742
|
+
phone: "+14045550108",
|
|
3743
|
+
email: "robert.kim@on-site-demo.example.com",
|
|
3744
|
+
npi: "1003000008",
|
|
3745
|
+
addressLine: "400 West Peachtree Street",
|
|
3746
|
+
addressCity: "Atlanta",
|
|
3747
|
+
addressState: "GA",
|
|
3748
|
+
addressPostalCode: "30308",
|
|
3749
|
+
homeHealthEligible: false
|
|
3750
|
+
},
|
|
3751
|
+
{
|
|
3752
|
+
id: "on-site-demo-doctor-009",
|
|
3753
|
+
firstName: "Jennifer",
|
|
3754
|
+
lastName: "Williams",
|
|
3755
|
+
suffix: "MD",
|
|
3756
|
+
gender: "female",
|
|
3757
|
+
birthDate: "1970-10-16",
|
|
3758
|
+
phone: "+14045550109",
|
|
3759
|
+
email: "jennifer.williams@on-site-demo.example.com",
|
|
3760
|
+
npi: "1003000009",
|
|
3761
|
+
addressLine: "1364 Clifton Road NE",
|
|
3762
|
+
addressCity: "Atlanta",
|
|
3763
|
+
addressState: "GA",
|
|
3764
|
+
addressPostalCode: "30322",
|
|
3765
|
+
homeHealthEligible: false
|
|
3766
|
+
},
|
|
3767
|
+
{
|
|
3768
|
+
id: "on-site-demo-doctor-010",
|
|
3769
|
+
firstName: "Thomas",
|
|
3770
|
+
lastName: "Anderson",
|
|
3771
|
+
suffix: "MD",
|
|
3772
|
+
gender: "male",
|
|
3773
|
+
birthDate: "1988-09-08",
|
|
3774
|
+
phone: "+14045550110",
|
|
3775
|
+
email: "thomas.anderson@on-site-demo.example.com",
|
|
3776
|
+
npi: "1003000010",
|
|
3777
|
+
addressLine: "1900 The Exchange SE",
|
|
3778
|
+
addressCity: "Atlanta",
|
|
3779
|
+
addressState: "GA",
|
|
3780
|
+
addressPostalCode: "30339",
|
|
3781
|
+
homeHealthEligible: false
|
|
3782
|
+
}
|
|
760
3783
|
];
|
|
761
|
-
var
|
|
3784
|
+
var SCRIBE_SPECS = [
|
|
762
3785
|
{
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
3786
|
+
id: "on-site-demo-scribe-001",
|
|
3787
|
+
firstName: "Emily",
|
|
3788
|
+
lastName: "Reed",
|
|
3789
|
+
gender: "female",
|
|
3790
|
+
birthDate: "1995-01-23",
|
|
3791
|
+
phone: "+14045550201",
|
|
3792
|
+
email: "emily.reed@on-site-demo.example.com",
|
|
3793
|
+
staffId: "SCR-0001",
|
|
3794
|
+
addressLine: "240 Edgewood Avenue SE",
|
|
3795
|
+
addressCity: "Atlanta",
|
|
3796
|
+
addressState: "GA",
|
|
3797
|
+
addressPostalCode: "30303"
|
|
773
3798
|
},
|
|
774
3799
|
{
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
3800
|
+
id: "on-site-demo-scribe-002",
|
|
3801
|
+
firstName: "Daniel",
|
|
3802
|
+
lastName: "Foster",
|
|
3803
|
+
gender: "male",
|
|
3804
|
+
birthDate: "1993-05-17",
|
|
3805
|
+
phone: "+14045550202",
|
|
3806
|
+
email: "daniel.foster@on-site-demo.example.com",
|
|
3807
|
+
staffId: "SCR-0002",
|
|
3808
|
+
addressLine: "780 Boulevard SE",
|
|
3809
|
+
addressCity: "Atlanta",
|
|
3810
|
+
addressState: "GA",
|
|
3811
|
+
addressPostalCode: "30312"
|
|
785
3812
|
},
|
|
786
3813
|
{
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
3814
|
+
id: "on-site-demo-scribe-003",
|
|
3815
|
+
firstName: "Ashley",
|
|
3816
|
+
lastName: "Garrett",
|
|
3817
|
+
gender: "female",
|
|
3818
|
+
birthDate: "1997-11-29",
|
|
3819
|
+
phone: "+14045550203",
|
|
3820
|
+
email: "ashley.garrett@on-site-demo.example.com",
|
|
3821
|
+
staffId: "SCR-0003",
|
|
3822
|
+
addressLine: "55 Allen Plaza",
|
|
3823
|
+
addressCity: "Atlanta",
|
|
3824
|
+
addressState: "GA",
|
|
3825
|
+
addressPostalCode: "30308"
|
|
797
3826
|
},
|
|
798
3827
|
{
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
3828
|
+
id: "on-site-demo-scribe-004",
|
|
3829
|
+
firstName: "Brandon",
|
|
3830
|
+
lastName: "Murray",
|
|
3831
|
+
gender: "male",
|
|
3832
|
+
birthDate: "1991-07-04",
|
|
3833
|
+
phone: "+14045550204",
|
|
3834
|
+
email: "brandon.murray@on-site-demo.example.com",
|
|
3835
|
+
staffId: "SCR-0004",
|
|
3836
|
+
addressLine: "1100 Spring Street NW",
|
|
3837
|
+
addressCity: "Atlanta",
|
|
3838
|
+
addressState: "GA",
|
|
3839
|
+
addressPostalCode: "30309"
|
|
3840
|
+
},
|
|
3841
|
+
{
|
|
3842
|
+
id: "on-site-demo-scribe-005",
|
|
3843
|
+
firstName: "Sofia",
|
|
3844
|
+
lastName: "Bennett",
|
|
3845
|
+
gender: "female",
|
|
3846
|
+
birthDate: "1999-03-12",
|
|
3847
|
+
phone: "+14045550205",
|
|
3848
|
+
email: "sofia.bennett@on-site-demo.example.com",
|
|
3849
|
+
staffId: "SCR-0005",
|
|
3850
|
+
addressLine: "165 Courtland Street NE",
|
|
3851
|
+
addressCity: "Atlanta",
|
|
3852
|
+
addressState: "GA",
|
|
3853
|
+
addressPostalCode: "30303"
|
|
3854
|
+
}
|
|
3855
|
+
];
|
|
3856
|
+
var ON_SITE_SCENARIO8 = "on-site-demo";
|
|
3857
|
+
var buildIdentifierPair7 = (practitionerId, roleSuffix) => [
|
|
3858
|
+
demoScenarioIdentifier(ON_SITE_SCENARIO8, roleSuffix),
|
|
3859
|
+
openhiResourceIdentifier({
|
|
3860
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
3861
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
3862
|
+
resourceType: "Practitioner",
|
|
3863
|
+
id: practitionerId
|
|
3864
|
+
})
|
|
3865
|
+
];
|
|
3866
|
+
var buildDoctorResource = (spec) => {
|
|
3867
|
+
const fullText = `${spec.firstName} ${spec.lastName}${spec.suffix ? `, ${spec.suffix}` : ""}`;
|
|
3868
|
+
const baseIdentifiers = buildIdentifierPair7(
|
|
3869
|
+
spec.id,
|
|
3870
|
+
`practitioner-${spec.id}`
|
|
3871
|
+
);
|
|
3872
|
+
return {
|
|
3873
|
+
resourceType: "Practitioner",
|
|
3874
|
+
id: spec.id,
|
|
3875
|
+
active: true,
|
|
3876
|
+
identifier: [
|
|
3877
|
+
...baseIdentifiers ?? [],
|
|
803
3878
|
{
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
3879
|
+
system: US_NPI_SYSTEM,
|
|
3880
|
+
value: spec.npi
|
|
3881
|
+
}
|
|
3882
|
+
],
|
|
3883
|
+
name: [
|
|
3884
|
+
{
|
|
3885
|
+
use: "official",
|
|
3886
|
+
text: fullText,
|
|
3887
|
+
given: [spec.firstName],
|
|
3888
|
+
family: spec.lastName,
|
|
3889
|
+
prefix: ["Dr."],
|
|
3890
|
+
...spec.suffix ? { suffix: [spec.suffix] } : {}
|
|
3891
|
+
}
|
|
3892
|
+
],
|
|
3893
|
+
gender: spec.gender,
|
|
3894
|
+
birthDate: spec.birthDate,
|
|
3895
|
+
telecom: [
|
|
3896
|
+
{ system: "phone", value: spec.phone, use: "work" },
|
|
3897
|
+
{ system: "email", value: spec.email, use: "work" }
|
|
3898
|
+
],
|
|
3899
|
+
address: [
|
|
3900
|
+
{
|
|
3901
|
+
use: "work",
|
|
3902
|
+
line: [spec.addressLine],
|
|
3903
|
+
city: spec.addressCity,
|
|
3904
|
+
state: spec.addressState,
|
|
3905
|
+
postalCode: spec.addressPostalCode,
|
|
3906
|
+
country: "US"
|
|
3907
|
+
}
|
|
3908
|
+
],
|
|
3909
|
+
qualification: [
|
|
3910
|
+
{
|
|
3911
|
+
code: {
|
|
3912
|
+
text: PRACTITIONER_ROLE_PHYSICIAN
|
|
3913
|
+
}
|
|
807
3914
|
},
|
|
3915
|
+
// Per-state credentialing entries appended after the role
|
|
3916
|
+
// label (#1308). Each on-site doctor carries 1-3 state
|
|
3917
|
+
// licenses with status / period / issuer fields populated
|
|
3918
|
+
// for the directory UI's credentialing column.
|
|
3919
|
+
...buildCredentialingQualifications(spec.id)
|
|
3920
|
+
],
|
|
3921
|
+
...spec.homeHealthEligible ? {
|
|
3922
|
+
extension: [
|
|
3923
|
+
{
|
|
3924
|
+
url: HOME_HEALTH_ELIGIBLE_EXTENSION_URL,
|
|
3925
|
+
valueBoolean: true
|
|
3926
|
+
}
|
|
3927
|
+
]
|
|
3928
|
+
} : {}
|
|
3929
|
+
};
|
|
3930
|
+
};
|
|
3931
|
+
var buildScribeResource = (spec) => {
|
|
3932
|
+
const fullText = `${spec.firstName} ${spec.lastName}`;
|
|
3933
|
+
const baseIdentifiers = buildIdentifierPair7(
|
|
3934
|
+
spec.id,
|
|
3935
|
+
`practitioner-${spec.id}`
|
|
3936
|
+
);
|
|
3937
|
+
return {
|
|
3938
|
+
resourceType: "Practitioner",
|
|
3939
|
+
id: spec.id,
|
|
3940
|
+
active: true,
|
|
3941
|
+
identifier: [
|
|
3942
|
+
...baseIdentifiers ?? [],
|
|
808
3943
|
{
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
3944
|
+
system: ON_SITE_STAFF_ID_SYSTEM,
|
|
3945
|
+
value: spec.staffId
|
|
3946
|
+
}
|
|
3947
|
+
],
|
|
3948
|
+
name: [
|
|
3949
|
+
{
|
|
3950
|
+
use: "official",
|
|
3951
|
+
text: fullText,
|
|
3952
|
+
given: [spec.firstName],
|
|
3953
|
+
family: spec.lastName
|
|
3954
|
+
}
|
|
3955
|
+
],
|
|
3956
|
+
gender: spec.gender,
|
|
3957
|
+
birthDate: spec.birthDate,
|
|
3958
|
+
telecom: [
|
|
3959
|
+
{ system: "phone", value: spec.phone, use: "work" },
|
|
3960
|
+
{ system: "email", value: spec.email, use: "work" }
|
|
3961
|
+
],
|
|
3962
|
+
address: [
|
|
3963
|
+
{
|
|
3964
|
+
use: "work",
|
|
3965
|
+
line: [spec.addressLine],
|
|
3966
|
+
city: spec.addressCity,
|
|
3967
|
+
state: spec.addressState,
|
|
3968
|
+
postalCode: spec.addressPostalCode,
|
|
3969
|
+
country: "US"
|
|
3970
|
+
}
|
|
3971
|
+
],
|
|
3972
|
+
qualification: [
|
|
3973
|
+
{
|
|
3974
|
+
code: {
|
|
3975
|
+
text: PRACTITIONER_ROLE_SCRIBE
|
|
3976
|
+
}
|
|
812
3977
|
}
|
|
813
3978
|
]
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
var
|
|
817
|
-
var
|
|
818
|
-
var
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
3979
|
+
};
|
|
3980
|
+
};
|
|
3981
|
+
var ON_SITE_DEMO_DOCTORS = DOCTOR_SPECS.map(buildDoctorResource);
|
|
3982
|
+
var ON_SITE_DEMO_SCRIBES = SCRIBE_SPECS.map(buildScribeResource);
|
|
3983
|
+
var ON_SITE_DEMO_DOCTOR_IDS = DOCTOR_SPECS.map(
|
|
3984
|
+
(d) => d.id
|
|
3985
|
+
);
|
|
3986
|
+
var ON_SITE_DEMO_SCRIBE_IDS = SCRIBE_SPECS.map(
|
|
3987
|
+
(s) => s.id
|
|
3988
|
+
);
|
|
3989
|
+
var homeHealthEligibleDoctors = () => ON_SITE_DEMO_DOCTORS.filter(
|
|
3990
|
+
(p) => (p.extension ?? []).some(
|
|
3991
|
+
(ext) => ext.url === HOME_HEALTH_ELIGIBLE_EXTENSION_URL && ext.valueBoolean === true
|
|
3992
|
+
)
|
|
3993
|
+
);
|
|
3994
|
+
var ON_SITE_DEMO_FIXTURES = {
|
|
3995
|
+
tenantId: ON_SITE_DEMO_TENANT_ID,
|
|
3996
|
+
workspaceId: ON_SITE_DEMO_WORKSPACE_ID,
|
|
3997
|
+
scenario: ON_SITE_SCENARIO8,
|
|
3998
|
+
// Patients + Coverages are materialised lazily via the
|
|
3999
|
+
// `buildPatients` / `buildCoverages` hooks below. Module-level
|
|
4000
|
+
// arrays would force a TDZ on the cross-module imports between
|
|
4001
|
+
// `on-site-demo-fixtures.ts`, `on-site-demo-blocks.ts`, and
|
|
4002
|
+
// `on-site-demo-facility-patients.ts`.
|
|
4003
|
+
patients: [],
|
|
4004
|
+
practitioners: [...ON_SITE_DEMO_DOCTORS, ...ON_SITE_DEMO_SCRIBES],
|
|
4005
|
+
observations: [],
|
|
4006
|
+
encounters: [],
|
|
4007
|
+
accounts: [],
|
|
4008
|
+
locations: [...ON_SITE_DEMO_FACILITIES],
|
|
4009
|
+
organizations: [...ON_SITE_DEMO_DIRECTORY_ORGANIZATIONS],
|
|
4010
|
+
buildPatients: () => [
|
|
4011
|
+
...buildOnSiteDemoFacilityPatients(),
|
|
4012
|
+
...buildOnSiteDemoHomeHealthPatients()
|
|
4013
|
+
],
|
|
4014
|
+
buildCoverages: () => [
|
|
4015
|
+
...buildOnSiteDemoFacilityCoverages(),
|
|
4016
|
+
...buildOnSiteDemoHomeHealthCoverages()
|
|
4017
|
+
],
|
|
4018
|
+
buildAppointments: (baseContext) => buildOnSiteDemoBlockAppointments(
|
|
4019
|
+
baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
4020
|
+
),
|
|
4021
|
+
buildConditions: (baseContext) => buildOnSiteDemoWoundConditions(
|
|
4022
|
+
baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
4023
|
+
),
|
|
4024
|
+
buildEncounters: (baseContext) => buildOnSiteDemoEncounters(baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()),
|
|
4025
|
+
buildObservations: (baseContext) => buildOnSiteDemoWoundObservations(
|
|
4026
|
+
baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
4027
|
+
),
|
|
4028
|
+
buildProcedures: (baseContext) => buildOnSiteDemoWoundProcedures(
|
|
4029
|
+
baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
4030
|
+
),
|
|
4031
|
+
buildClaims: (baseContext) => buildOnSiteDemoClaims(baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString()),
|
|
4032
|
+
buildPaymentNotices: (baseContext) => buildOnSiteDemoPaymentNotices(baseContext.date ?? (/* @__PURE__ */ new Date()).toISOString())
|
|
831
4033
|
};
|
|
832
4034
|
|
|
833
4035
|
// src/workflows/control-plane/seed-demo-data/data-plane-fixtures.ts
|
|
@@ -1197,6 +4399,10 @@ var buildPrimaryCareFixtures = (scenario, tenantId, workspaceId, idPrefix) => ({
|
|
|
1197
4399
|
]
|
|
1198
4400
|
});
|
|
1199
4401
|
var DEMO_DATA_PLANE_FIXTURES = [
|
|
4402
|
+
// On-site-medical UAT demo workspace — practitioners only (issue
|
|
4403
|
+
// #1302). Patients, encounters, and other data-plane resources for
|
|
4404
|
+
// this tenant land in later tickets.
|
|
4405
|
+
ON_SITE_DEMO_FIXTURES,
|
|
1200
4406
|
buildWoundCareFixtures(
|
|
1201
4407
|
"demo-wound-care",
|
|
1202
4408
|
"demo-wound-care-tenant",
|
|
@@ -4839,35 +8045,175 @@ async function createWorkspaceOperation(params) {
|
|
|
4839
8045
|
await service.entities.workspace.put({
|
|
4840
8046
|
tenantId,
|
|
4841
8047
|
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
|
-
return { id, resource, meta: { lastUpdated, versionId: vid } };
|
|
8048
|
+
resource: JSON.stringify(resource),
|
|
8049
|
+
summary,
|
|
8050
|
+
vid,
|
|
8051
|
+
lastUpdated
|
|
8052
|
+
}).go();
|
|
8053
|
+
const workspaceName = typeof parsedResource.name === "string" ? parsedResource.name : void 0;
|
|
8054
|
+
await provisionOrganizationForWorkspaceOperation({
|
|
8055
|
+
context,
|
|
8056
|
+
workspaceId: id,
|
|
8057
|
+
workspaceName,
|
|
8058
|
+
tableName
|
|
8059
|
+
});
|
|
8060
|
+
return { id, resource, meta: { lastUpdated, versionId: vid } };
|
|
8061
|
+
}
|
|
8062
|
+
|
|
8063
|
+
// src/data/operations/data/account/account-create-operation.ts
|
|
8064
|
+
var import_ulid = require("ulid");
|
|
8065
|
+
async function createAccountOperation(params) {
|
|
8066
|
+
const { context, body, tableName } = params;
|
|
8067
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8068
|
+
const id = body.id ?? (0, import_ulid.ulid)();
|
|
8069
|
+
const meta = {
|
|
8070
|
+
...body.meta ?? {},
|
|
8071
|
+
lastUpdated: date,
|
|
8072
|
+
versionId: "1"
|
|
8073
|
+
};
|
|
8074
|
+
const accountWithAudit = {
|
|
8075
|
+
...body,
|
|
8076
|
+
resourceType: "Account",
|
|
8077
|
+
id,
|
|
8078
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8079
|
+
createdDate: date,
|
|
8080
|
+
createdById: actorId,
|
|
8081
|
+
createdByName: actorName,
|
|
8082
|
+
modifiedDate: date,
|
|
8083
|
+
modifiedById: actorId,
|
|
8084
|
+
modifiedByName: actorName
|
|
8085
|
+
})
|
|
8086
|
+
};
|
|
8087
|
+
const service = getDynamoDataService(tableName);
|
|
8088
|
+
return createDataEntityRecord(
|
|
8089
|
+
service.entities.account,
|
|
8090
|
+
tenantId,
|
|
8091
|
+
workspaceId,
|
|
8092
|
+
id,
|
|
8093
|
+
accountWithAudit,
|
|
8094
|
+
date
|
|
8095
|
+
);
|
|
8096
|
+
}
|
|
8097
|
+
|
|
8098
|
+
// src/data/operations/data/appointment/appointment-create-operation.ts
|
|
8099
|
+
var import_ulid2 = require("ulid");
|
|
8100
|
+
async function createAppointmentOperation(params) {
|
|
8101
|
+
const { context, body, tableName } = params;
|
|
8102
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8103
|
+
const id = body.id ?? (0, import_ulid2.ulid)();
|
|
8104
|
+
const meta = {
|
|
8105
|
+
...body.meta ?? {},
|
|
8106
|
+
lastUpdated: date,
|
|
8107
|
+
versionId: "1"
|
|
8108
|
+
};
|
|
8109
|
+
const resourceWithAudit = {
|
|
8110
|
+
...body,
|
|
8111
|
+
resourceType: "Appointment",
|
|
8112
|
+
id,
|
|
8113
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8114
|
+
createdDate: date,
|
|
8115
|
+
createdById: actorId,
|
|
8116
|
+
createdByName: actorName,
|
|
8117
|
+
modifiedDate: date,
|
|
8118
|
+
modifiedById: actorId,
|
|
8119
|
+
modifiedByName: actorName
|
|
8120
|
+
})
|
|
8121
|
+
};
|
|
8122
|
+
const service = getDynamoDataService(tableName);
|
|
8123
|
+
return createDataEntityRecord(
|
|
8124
|
+
service.entities.appointment,
|
|
8125
|
+
tenantId,
|
|
8126
|
+
workspaceId,
|
|
8127
|
+
id,
|
|
8128
|
+
resourceWithAudit,
|
|
8129
|
+
date
|
|
8130
|
+
);
|
|
8131
|
+
}
|
|
8132
|
+
|
|
8133
|
+
// src/data/operations/data/claim/claim-create-operation.ts
|
|
8134
|
+
var import_ulid3 = require("ulid");
|
|
8135
|
+
async function createClaimOperation(params) {
|
|
8136
|
+
const { context, body, tableName } = params;
|
|
8137
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8138
|
+
const id = body.id ?? (0, import_ulid3.ulid)();
|
|
8139
|
+
const meta = {
|
|
8140
|
+
...body.meta ?? {},
|
|
8141
|
+
lastUpdated: date,
|
|
8142
|
+
versionId: "1"
|
|
8143
|
+
};
|
|
8144
|
+
const resourceWithAudit = {
|
|
8145
|
+
...body,
|
|
8146
|
+
resourceType: "Claim",
|
|
8147
|
+
id,
|
|
8148
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8149
|
+
createdDate: date,
|
|
8150
|
+
createdById: actorId,
|
|
8151
|
+
createdByName: actorName,
|
|
8152
|
+
modifiedDate: date,
|
|
8153
|
+
modifiedById: actorId,
|
|
8154
|
+
modifiedByName: actorName
|
|
8155
|
+
})
|
|
8156
|
+
};
|
|
8157
|
+
const service = getDynamoDataService(tableName);
|
|
8158
|
+
return createDataEntityRecord(
|
|
8159
|
+
service.entities.claim,
|
|
8160
|
+
tenantId,
|
|
8161
|
+
workspaceId,
|
|
8162
|
+
id,
|
|
8163
|
+
resourceWithAudit,
|
|
8164
|
+
date
|
|
8165
|
+
);
|
|
8166
|
+
}
|
|
8167
|
+
|
|
8168
|
+
// src/data/operations/data/condition/condition-create-operation.ts
|
|
8169
|
+
var import_ulid4 = require("ulid");
|
|
8170
|
+
async function createConditionOperation(params) {
|
|
8171
|
+
const { context, body, tableName } = params;
|
|
8172
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8173
|
+
const id = body.id ?? (0, import_ulid4.ulid)();
|
|
8174
|
+
const meta = {
|
|
8175
|
+
...body.meta ?? {},
|
|
8176
|
+
lastUpdated: date,
|
|
8177
|
+
versionId: "1"
|
|
8178
|
+
};
|
|
8179
|
+
const resourceWithAudit = {
|
|
8180
|
+
...body,
|
|
8181
|
+
resourceType: "Condition",
|
|
8182
|
+
id,
|
|
8183
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8184
|
+
createdDate: date,
|
|
8185
|
+
createdById: actorId,
|
|
8186
|
+
createdByName: actorName,
|
|
8187
|
+
modifiedDate: date,
|
|
8188
|
+
modifiedById: actorId,
|
|
8189
|
+
modifiedByName: actorName
|
|
8190
|
+
})
|
|
8191
|
+
};
|
|
8192
|
+
const service = getDynamoDataService(tableName);
|
|
8193
|
+
return createDataEntityRecord(
|
|
8194
|
+
service.entities.condition,
|
|
8195
|
+
tenantId,
|
|
8196
|
+
workspaceId,
|
|
8197
|
+
id,
|
|
8198
|
+
resourceWithAudit,
|
|
8199
|
+
date
|
|
8200
|
+
);
|
|
4855
8201
|
}
|
|
4856
8202
|
|
|
4857
|
-
// src/data/operations/data/
|
|
4858
|
-
var
|
|
4859
|
-
async function
|
|
8203
|
+
// src/data/operations/data/coverage/coverage-create-operation.ts
|
|
8204
|
+
var import_ulid5 = require("ulid");
|
|
8205
|
+
async function createCoverageOperation(params) {
|
|
4860
8206
|
const { context, body, tableName } = params;
|
|
4861
8207
|
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4862
|
-
const id = body.id ?? (0,
|
|
8208
|
+
const id = body.id ?? (0, import_ulid5.ulid)();
|
|
4863
8209
|
const meta = {
|
|
4864
8210
|
...body.meta ?? {},
|
|
4865
8211
|
lastUpdated: date,
|
|
4866
8212
|
versionId: "1"
|
|
4867
8213
|
};
|
|
4868
|
-
const
|
|
8214
|
+
const resourceWithAudit = {
|
|
4869
8215
|
...body,
|
|
4870
|
-
resourceType: "
|
|
8216
|
+
resourceType: "Coverage",
|
|
4871
8217
|
id,
|
|
4872
8218
|
meta: mergeAuditIntoMeta(meta, {
|
|
4873
8219
|
createdDate: date,
|
|
@@ -4880,21 +8226,21 @@ async function createAccountOperation(params) {
|
|
|
4880
8226
|
};
|
|
4881
8227
|
const service = getDynamoDataService(tableName);
|
|
4882
8228
|
return createDataEntityRecord(
|
|
4883
|
-
service.entities.
|
|
8229
|
+
service.entities.coverage,
|
|
4884
8230
|
tenantId,
|
|
4885
8231
|
workspaceId,
|
|
4886
8232
|
id,
|
|
4887
|
-
|
|
8233
|
+
resourceWithAudit,
|
|
4888
8234
|
date
|
|
4889
8235
|
);
|
|
4890
8236
|
}
|
|
4891
8237
|
|
|
4892
8238
|
// src/data/operations/data/encounter/encounter-create-operation.ts
|
|
4893
|
-
var
|
|
8239
|
+
var import_ulid6 = require("ulid");
|
|
4894
8240
|
async function createEncounterOperation(params) {
|
|
4895
8241
|
const { context, body, tableName } = params;
|
|
4896
8242
|
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4897
|
-
const id = body.id ?? (0,
|
|
8243
|
+
const id = body.id ?? (0, import_ulid6.ulid)();
|
|
4898
8244
|
const meta = {
|
|
4899
8245
|
...body.meta ?? {},
|
|
4900
8246
|
lastUpdated: date,
|
|
@@ -4924,12 +8270,47 @@ async function createEncounterOperation(params) {
|
|
|
4924
8270
|
);
|
|
4925
8271
|
}
|
|
4926
8272
|
|
|
8273
|
+
// src/data/operations/data/location/location-create-operation.ts
|
|
8274
|
+
var import_ulid7 = require("ulid");
|
|
8275
|
+
async function createLocationOperation(params) {
|
|
8276
|
+
const { context, body, tableName } = params;
|
|
8277
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8278
|
+
const id = body.id ?? (0, import_ulid7.ulid)();
|
|
8279
|
+
const meta = {
|
|
8280
|
+
...body.meta ?? {},
|
|
8281
|
+
lastUpdated: date,
|
|
8282
|
+
versionId: "1"
|
|
8283
|
+
};
|
|
8284
|
+
const resourceWithAudit = {
|
|
8285
|
+
...body,
|
|
8286
|
+
resourceType: "Location",
|
|
8287
|
+
id,
|
|
8288
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8289
|
+
createdDate: date,
|
|
8290
|
+
createdById: actorId,
|
|
8291
|
+
createdByName: actorName,
|
|
8292
|
+
modifiedDate: date,
|
|
8293
|
+
modifiedById: actorId,
|
|
8294
|
+
modifiedByName: actorName
|
|
8295
|
+
})
|
|
8296
|
+
};
|
|
8297
|
+
const service = getDynamoDataService(tableName);
|
|
8298
|
+
return createDataEntityRecord(
|
|
8299
|
+
service.entities.location,
|
|
8300
|
+
tenantId,
|
|
8301
|
+
workspaceId,
|
|
8302
|
+
id,
|
|
8303
|
+
resourceWithAudit,
|
|
8304
|
+
date
|
|
8305
|
+
);
|
|
8306
|
+
}
|
|
8307
|
+
|
|
4927
8308
|
// src/data/operations/data/observation/observation-create-operation.ts
|
|
4928
|
-
var
|
|
8309
|
+
var import_ulid8 = require("ulid");
|
|
4929
8310
|
async function createObservationOperation(params) {
|
|
4930
8311
|
const { context, body, tableName } = params;
|
|
4931
8312
|
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4932
|
-
const id = body.id ?? (0,
|
|
8313
|
+
const id = body.id ?? (0, import_ulid8.ulid)();
|
|
4933
8314
|
const meta = {
|
|
4934
8315
|
...body.meta ?? {},
|
|
4935
8316
|
lastUpdated: date,
|
|
@@ -4959,12 +8340,47 @@ async function createObservationOperation(params) {
|
|
|
4959
8340
|
);
|
|
4960
8341
|
}
|
|
4961
8342
|
|
|
8343
|
+
// src/data/operations/data/organization/organization-create-operation.ts
|
|
8344
|
+
var import_ulid9 = require("ulid");
|
|
8345
|
+
async function createOrganizationOperation(params) {
|
|
8346
|
+
const { context, body, tableName } = params;
|
|
8347
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8348
|
+
const id = body.id ?? (0, import_ulid9.ulid)();
|
|
8349
|
+
const meta = {
|
|
8350
|
+
...body.meta ?? {},
|
|
8351
|
+
lastUpdated: date,
|
|
8352
|
+
versionId: "1"
|
|
8353
|
+
};
|
|
8354
|
+
const resourceWithAudit = {
|
|
8355
|
+
...body,
|
|
8356
|
+
resourceType: "Organization",
|
|
8357
|
+
id,
|
|
8358
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8359
|
+
createdDate: date,
|
|
8360
|
+
createdById: actorId,
|
|
8361
|
+
createdByName: actorName,
|
|
8362
|
+
modifiedDate: date,
|
|
8363
|
+
modifiedById: actorId,
|
|
8364
|
+
modifiedByName: actorName
|
|
8365
|
+
})
|
|
8366
|
+
};
|
|
8367
|
+
const service = getDynamoDataService(tableName);
|
|
8368
|
+
return createDataEntityRecord(
|
|
8369
|
+
service.entities.organization,
|
|
8370
|
+
tenantId,
|
|
8371
|
+
workspaceId,
|
|
8372
|
+
id,
|
|
8373
|
+
resourceWithAudit,
|
|
8374
|
+
date
|
|
8375
|
+
);
|
|
8376
|
+
}
|
|
8377
|
+
|
|
4962
8378
|
// src/data/operations/data/patient/patient-create-operation.ts
|
|
4963
|
-
var
|
|
8379
|
+
var import_ulid10 = require("ulid");
|
|
4964
8380
|
async function createPatientOperation(params) {
|
|
4965
8381
|
const { context, body, tableName } = params;
|
|
4966
8382
|
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
4967
|
-
const id = body.id ?? (0,
|
|
8383
|
+
const id = body.id ?? (0, import_ulid10.ulid)();
|
|
4968
8384
|
const meta = {
|
|
4969
8385
|
...body.meta ?? {},
|
|
4970
8386
|
lastUpdated: date,
|
|
@@ -4994,12 +8410,47 @@ async function createPatientOperation(params) {
|
|
|
4994
8410
|
);
|
|
4995
8411
|
}
|
|
4996
8412
|
|
|
8413
|
+
// src/data/operations/data/paymentnotice/paymentnotice-create-operation.ts
|
|
8414
|
+
var import_ulid11 = require("ulid");
|
|
8415
|
+
async function createPaymentNoticeOperation(params) {
|
|
8416
|
+
const { context, body, tableName } = params;
|
|
8417
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8418
|
+
const id = body.id ?? (0, import_ulid11.ulid)();
|
|
8419
|
+
const meta = {
|
|
8420
|
+
...body.meta ?? {},
|
|
8421
|
+
lastUpdated: date,
|
|
8422
|
+
versionId: "1"
|
|
8423
|
+
};
|
|
8424
|
+
const resourceWithAudit = {
|
|
8425
|
+
...body,
|
|
8426
|
+
resourceType: "PaymentNotice",
|
|
8427
|
+
id,
|
|
8428
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8429
|
+
createdDate: date,
|
|
8430
|
+
createdById: actorId,
|
|
8431
|
+
createdByName: actorName,
|
|
8432
|
+
modifiedDate: date,
|
|
8433
|
+
modifiedById: actorId,
|
|
8434
|
+
modifiedByName: actorName
|
|
8435
|
+
})
|
|
8436
|
+
};
|
|
8437
|
+
const service = getDynamoDataService(tableName);
|
|
8438
|
+
return createDataEntityRecord(
|
|
8439
|
+
service.entities.paymentnotice,
|
|
8440
|
+
tenantId,
|
|
8441
|
+
workspaceId,
|
|
8442
|
+
id,
|
|
8443
|
+
resourceWithAudit,
|
|
8444
|
+
date
|
|
8445
|
+
);
|
|
8446
|
+
}
|
|
8447
|
+
|
|
4997
8448
|
// src/data/operations/data/practitioner/practitioner-create-operation.ts
|
|
4998
|
-
var
|
|
8449
|
+
var import_ulid12 = require("ulid");
|
|
4999
8450
|
async function createPractitionerOperation(params) {
|
|
5000
8451
|
const { context, body, tableName } = params;
|
|
5001
8452
|
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
5002
|
-
const id = body.id ?? (0,
|
|
8453
|
+
const id = body.id ?? (0, import_ulid12.ulid)();
|
|
5003
8454
|
const meta = {
|
|
5004
8455
|
...body.meta ?? {},
|
|
5005
8456
|
lastUpdated: date,
|
|
@@ -5029,6 +8480,41 @@ async function createPractitionerOperation(params) {
|
|
|
5029
8480
|
);
|
|
5030
8481
|
}
|
|
5031
8482
|
|
|
8483
|
+
// src/data/operations/data/procedure/procedure-create-operation.ts
|
|
8484
|
+
var import_ulid13 = require("ulid");
|
|
8485
|
+
async function createProcedureOperation(params) {
|
|
8486
|
+
const { context, body, tableName } = params;
|
|
8487
|
+
const { tenantId, workspaceId, date, actorId, actorName } = context;
|
|
8488
|
+
const id = body.id ?? (0, import_ulid13.ulid)();
|
|
8489
|
+
const meta = {
|
|
8490
|
+
...body.meta ?? {},
|
|
8491
|
+
lastUpdated: date,
|
|
8492
|
+
versionId: "1"
|
|
8493
|
+
};
|
|
8494
|
+
const resourceWithAudit = {
|
|
8495
|
+
...body,
|
|
8496
|
+
resourceType: "Procedure",
|
|
8497
|
+
id,
|
|
8498
|
+
meta: mergeAuditIntoMeta(meta, {
|
|
8499
|
+
createdDate: date,
|
|
8500
|
+
createdById: actorId,
|
|
8501
|
+
createdByName: actorName,
|
|
8502
|
+
modifiedDate: date,
|
|
8503
|
+
modifiedById: actorId,
|
|
8504
|
+
modifiedByName: actorName
|
|
8505
|
+
})
|
|
8506
|
+
};
|
|
8507
|
+
const service = getDynamoDataService(tableName);
|
|
8508
|
+
return createDataEntityRecord(
|
|
8509
|
+
service.entities.procedure,
|
|
8510
|
+
tenantId,
|
|
8511
|
+
workspaceId,
|
|
8512
|
+
id,
|
|
8513
|
+
resourceWithAudit,
|
|
8514
|
+
date
|
|
8515
|
+
);
|
|
8516
|
+
}
|
|
8517
|
+
|
|
5032
8518
|
// src/workflows/control-plane/seed-demo-data/seed-demo-data.handler.ts
|
|
5033
8519
|
var SEED_DEMO_DATA_USER_POOL_ID_ENV_VAR = "SEED_DEMO_DATA_USER_POOL_ID";
|
|
5034
8520
|
var errorMessage = (err) => {
|
|
@@ -5146,11 +8632,18 @@ var roleAssignmentResourceBody = (scenario, tenantId, user, roleCode, roleAssign
|
|
|
5146
8632
|
var userResourceBody = (user, cognitoSub) => ({
|
|
5147
8633
|
resourceType: "User",
|
|
5148
8634
|
id: user.id,
|
|
5149
|
-
name: [
|
|
8635
|
+
name: [
|
|
8636
|
+
{
|
|
8637
|
+
text: `${user.firstName} ${user.lastName}`,
|
|
8638
|
+
given: [user.firstName],
|
|
8639
|
+
family: user.lastName
|
|
8640
|
+
}
|
|
8641
|
+
],
|
|
8642
|
+
telecom: [{ system: "email", value: user.email }],
|
|
5150
8643
|
status: "active",
|
|
5151
8644
|
cognitoSub,
|
|
5152
|
-
currentTenant: { reference: `Tenant/${
|
|
5153
|
-
currentWorkspace: { reference: `Workspace/${
|
|
8645
|
+
currentTenant: { reference: `Tenant/${ON_SITE_DEMO_TENANT_ID}` },
|
|
8646
|
+
currentWorkspace: { reference: `Workspace/${ON_SITE_DEMO_WORKSPACE_ID}` }
|
|
5154
8647
|
});
|
|
5155
8648
|
var upsertUser = async (context, user, cognitoSub) => {
|
|
5156
8649
|
const service = getDynamoControlService();
|
|
@@ -5172,7 +8665,34 @@ var seedWorkspaceDataPlane = async (baseContext, group, failures) => {
|
|
|
5172
8665
|
workspaceId: group.workspaceId
|
|
5173
8666
|
};
|
|
5174
8667
|
const scope = `${group.tenantId}/${group.workspaceId}`;
|
|
5175
|
-
for (const
|
|
8668
|
+
for (const location of group.locations ?? []) {
|
|
8669
|
+
await tryRun(
|
|
8670
|
+
failures,
|
|
8671
|
+
"phase-3",
|
|
8672
|
+
scope,
|
|
8673
|
+
"Location",
|
|
8674
|
+
location.id ?? "",
|
|
8675
|
+
() => createLocationOperation({
|
|
8676
|
+
context: workspaceContext,
|
|
8677
|
+
body: location
|
|
8678
|
+
})
|
|
8679
|
+
);
|
|
8680
|
+
}
|
|
8681
|
+
for (const organization of group.organizations ?? []) {
|
|
8682
|
+
await tryRun(
|
|
8683
|
+
failures,
|
|
8684
|
+
"phase-3",
|
|
8685
|
+
scope,
|
|
8686
|
+
"Organization",
|
|
8687
|
+
organization.id ?? "",
|
|
8688
|
+
() => createOrganizationOperation({
|
|
8689
|
+
context: workspaceContext,
|
|
8690
|
+
body: organization
|
|
8691
|
+
})
|
|
8692
|
+
);
|
|
8693
|
+
}
|
|
8694
|
+
const patients = group.buildPatients ? group.buildPatients() : group.patients;
|
|
8695
|
+
for (const patient of patients) {
|
|
5176
8696
|
await tryRun(
|
|
5177
8697
|
failures,
|
|
5178
8698
|
"phase-3",
|
|
@@ -5185,6 +8705,20 @@ var seedWorkspaceDataPlane = async (baseContext, group, failures) => {
|
|
|
5185
8705
|
})
|
|
5186
8706
|
);
|
|
5187
8707
|
}
|
|
8708
|
+
const coverages = group.buildCoverages ? group.buildCoverages() : group.coverages ?? [];
|
|
8709
|
+
for (const coverage of coverages) {
|
|
8710
|
+
await tryRun(
|
|
8711
|
+
failures,
|
|
8712
|
+
"phase-3",
|
|
8713
|
+
scope,
|
|
8714
|
+
"Coverage",
|
|
8715
|
+
coverage.id ?? "",
|
|
8716
|
+
() => createCoverageOperation({
|
|
8717
|
+
context: workspaceContext,
|
|
8718
|
+
body: coverage
|
|
8719
|
+
})
|
|
8720
|
+
);
|
|
8721
|
+
}
|
|
5188
8722
|
for (const practitioner of group.practitioners) {
|
|
5189
8723
|
await tryRun(
|
|
5190
8724
|
failures,
|
|
@@ -5198,20 +8732,22 @@ var seedWorkspaceDataPlane = async (baseContext, group, failures) => {
|
|
|
5198
8732
|
})
|
|
5199
8733
|
);
|
|
5200
8734
|
}
|
|
5201
|
-
|
|
8735
|
+
const conditions = group.buildConditions ? group.buildConditions(baseContext) : group.conditions ?? [];
|
|
8736
|
+
for (const condition of conditions) {
|
|
5202
8737
|
await tryRun(
|
|
5203
8738
|
failures,
|
|
5204
8739
|
"phase-3",
|
|
5205
8740
|
scope,
|
|
5206
|
-
"
|
|
5207
|
-
|
|
5208
|
-
() =>
|
|
8741
|
+
"Condition",
|
|
8742
|
+
condition.id ?? "",
|
|
8743
|
+
() => createConditionOperation({
|
|
5209
8744
|
context: workspaceContext,
|
|
5210
|
-
body:
|
|
8745
|
+
body: condition
|
|
5211
8746
|
})
|
|
5212
8747
|
);
|
|
5213
8748
|
}
|
|
5214
|
-
|
|
8749
|
+
const encounters = group.buildEncounters ? group.buildEncounters(baseContext) : group.encounters;
|
|
8750
|
+
for (const encounter of encounters) {
|
|
5215
8751
|
await tryRun(
|
|
5216
8752
|
failures,
|
|
5217
8753
|
"phase-3",
|
|
@@ -5224,6 +8760,62 @@ var seedWorkspaceDataPlane = async (baseContext, group, failures) => {
|
|
|
5224
8760
|
})
|
|
5225
8761
|
);
|
|
5226
8762
|
}
|
|
8763
|
+
const observations = group.buildObservations ? group.buildObservations(baseContext) : group.observations;
|
|
8764
|
+
for (const observation of observations) {
|
|
8765
|
+
await tryRun(
|
|
8766
|
+
failures,
|
|
8767
|
+
"phase-3",
|
|
8768
|
+
scope,
|
|
8769
|
+
"Observation",
|
|
8770
|
+
observation.id ?? "",
|
|
8771
|
+
() => createObservationOperation({
|
|
8772
|
+
context: workspaceContext,
|
|
8773
|
+
body: observation
|
|
8774
|
+
})
|
|
8775
|
+
);
|
|
8776
|
+
}
|
|
8777
|
+
const procedures = group.buildProcedures ? group.buildProcedures(baseContext) : group.procedures ?? [];
|
|
8778
|
+
for (const procedure of procedures) {
|
|
8779
|
+
await tryRun(
|
|
8780
|
+
failures,
|
|
8781
|
+
"phase-3",
|
|
8782
|
+
scope,
|
|
8783
|
+
"Procedure",
|
|
8784
|
+
procedure.id ?? "",
|
|
8785
|
+
() => createProcedureOperation({
|
|
8786
|
+
context: workspaceContext,
|
|
8787
|
+
body: procedure
|
|
8788
|
+
})
|
|
8789
|
+
);
|
|
8790
|
+
}
|
|
8791
|
+
const claims = group.buildClaims ? group.buildClaims(baseContext) : [];
|
|
8792
|
+
for (const claim of claims) {
|
|
8793
|
+
await tryRun(
|
|
8794
|
+
failures,
|
|
8795
|
+
"phase-3",
|
|
8796
|
+
scope,
|
|
8797
|
+
"Claim",
|
|
8798
|
+
claim.id ?? "",
|
|
8799
|
+
() => createClaimOperation({
|
|
8800
|
+
context: workspaceContext,
|
|
8801
|
+
body: claim
|
|
8802
|
+
})
|
|
8803
|
+
);
|
|
8804
|
+
}
|
|
8805
|
+
const paymentNotices = group.buildPaymentNotices ? group.buildPaymentNotices(baseContext) : [];
|
|
8806
|
+
for (const paymentNotice of paymentNotices) {
|
|
8807
|
+
await tryRun(
|
|
8808
|
+
failures,
|
|
8809
|
+
"phase-3",
|
|
8810
|
+
scope,
|
|
8811
|
+
"PaymentNotice",
|
|
8812
|
+
paymentNotice.id ?? "",
|
|
8813
|
+
() => createPaymentNoticeOperation({
|
|
8814
|
+
context: workspaceContext,
|
|
8815
|
+
body: paymentNotice
|
|
8816
|
+
})
|
|
8817
|
+
);
|
|
8818
|
+
}
|
|
5227
8819
|
for (const account of group.accounts) {
|
|
5228
8820
|
await tryRun(
|
|
5229
8821
|
failures,
|
|
@@ -5237,6 +8829,20 @@ var seedWorkspaceDataPlane = async (baseContext, group, failures) => {
|
|
|
5237
8829
|
})
|
|
5238
8830
|
);
|
|
5239
8831
|
}
|
|
8832
|
+
const appointments = group.buildAppointments ? group.buildAppointments(baseContext) : [];
|
|
8833
|
+
for (const appointment of appointments) {
|
|
8834
|
+
await tryRun(
|
|
8835
|
+
failures,
|
|
8836
|
+
"phase-3",
|
|
8837
|
+
scope,
|
|
8838
|
+
"Appointment",
|
|
8839
|
+
appointment.id ?? "",
|
|
8840
|
+
() => createAppointmentOperation({
|
|
8841
|
+
context: workspaceContext,
|
|
8842
|
+
body: appointment
|
|
8843
|
+
})
|
|
8844
|
+
);
|
|
8845
|
+
}
|
|
5240
8846
|
};
|
|
5241
8847
|
var seedDemoGraph = async (params) => {
|
|
5242
8848
|
const { baseContext, devUsers, cognito } = params;
|