Skip to content

Commit b8f4d6f

Browse files
committed
Make our session more realistic, with better dates and doubles session, rather than MMR
1 parent 9b58333 commit b8f4d6f

1 file changed

Lines changed: 28 additions & 61 deletions

File tree

lib/create-data.js

Lines changed: 28 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,12 +1031,15 @@ for (const seed of seededMmrPatients) {
10311031
context.patients[patient.uuid] = patient
10321032
}
10331033

1034-
// Current MMR catch-up session for the Y9/Y10 cohort (Alice, Bilal, Chiamaka,
1035-
// Dmitri). Held at a secondary school so the scenario matches their year
1036-
// groups — separate from each patient's historical primary-school sessions.
1034+
// Current catch-up session for the Y9/Y10 cohort (Alice, Bilal, Chiamaka,
1035+
// Dmitri, Farah). Held at a secondary school so the scenario matches their
1036+
// year groups — separate from each patient's historical primary-school
1037+
// sessions. Runs MMR catch-up co-located with the teenage Doubles boosters
1038+
// (MenACWY + Td/IPV) so the SAIS team scenario reflects how these are
1039+
// scheduled together in real life.
10371040
const mmrCatchupSchoolId = '135335' // Grace Academy Coventry
10381041
const mmrCatchupSessionId = 'mmr-catchup-y9y10-current'
1039-
const mmrCatchupSessionDate = addDays(today(), 28)
1042+
const mmrCatchupSessionDate = new Date(today().getFullYear(), 5, 17) // mid-June, summer term
10401043
const mmrCatchupOpenAt = addDays(mmrCatchupSessionDate, -42)
10411044

10421045
context.sessions[mmrCatchupSessionId] = new Session(
@@ -1049,7 +1052,8 @@ context.sessions[mmrCatchupSessionId] = new Session(
10491052
academicYear: getAcademicYear(mmrCatchupSessionDate),
10501053
type: SessionType.School,
10511054
school_id: mmrCatchupSchoolId,
1052-
presetNames: [SessionPresetName.MMR],
1055+
yearGroups: [9, 10],
1056+
presetNames: [SessionPresetName.MMR, SessionPresetName.Doubles],
10531057
registration: true
10541058
},
10551059
context
@@ -1065,18 +1069,24 @@ const mmrCohortUuids = [
10651069

10661070
const mmrCohortPatientSessionUuids = {}
10671071
for (const patient_uuid of mmrCohortUuids) {
1068-
const patientSession = new PatientSession(
1069-
{
1070-
createdAt: mmrCatchupOpenAt,
1071-
patient_uuid,
1072-
programme_id: 'mmr',
1073-
session_id: mmrCatchupSessionId
1074-
},
1075-
context
1076-
)
1077-
context.patientSessions[patientSession.uuid] = patientSession
1078-
context.patients[patient_uuid].patientSession_uuids.push(patientSession.uuid)
1079-
mmrCohortPatientSessionUuids[patient_uuid] = patientSession.uuid
1072+
for (const programme_id of ['mmr', 'menacwy', 'td-ipv']) {
1073+
const patientSession = new PatientSession(
1074+
{
1075+
createdAt: mmrCatchupOpenAt,
1076+
patient_uuid,
1077+
programme_id,
1078+
session_id: mmrCatchupSessionId
1079+
},
1080+
context
1081+
)
1082+
context.patientSessions[patientSession.uuid] = patientSession
1083+
context.patients[patient_uuid].patientSession_uuids.push(
1084+
patientSession.uuid
1085+
)
1086+
if (programme_id === 'mmr') {
1087+
mmrCohortPatientSessionUuids[patient_uuid] = patientSession.uuid
1088+
}
1089+
}
10801090
}
10811091

10821092
// Ensure every cohort member has a parent with at least an email, so consent
@@ -1125,48 +1135,6 @@ const dmitriConsent = new Consent(
11251135
dmitriConsent.linkToPatient(dmitri)
11261136
context.replies[dmitriConsent.uuid] = dmitriConsent
11271137

1128-
// Co-located Doubles session (MenACWY + Td/IPV) at the same school on the
1129-
// same day, so the SAIS team is running MMR catch-up alongside the teenage
1130-
// boosters. The cohort gets consent responses seeded for all three
1131-
// programmes so the research scenario isn't blocked by "no reply yet".
1132-
const doublesCatchupSessionId = 'doubles-catchup-y9y10-current'
1133-
1134-
context.sessions[doublesCatchupSessionId] = new Session(
1135-
{
1136-
id: doublesCatchupSessionId,
1137-
createdAt: mmrCatchupOpenAt,
1138-
createdBy_uid: nurse.uid,
1139-
date: mmrCatchupSessionDate,
1140-
openAt: mmrCatchupOpenAt,
1141-
academicYear: getAcademicYear(mmrCatchupSessionDate),
1142-
type: SessionType.School,
1143-
school_id: mmrCatchupSchoolId,
1144-
presetNames: [SessionPresetName.Doubles],
1145-
registration: true
1146-
},
1147-
context
1148-
)
1149-
1150-
// Add the cohort to the Doubles session (one PatientSession per programme).
1151-
const doublesProgrammeIds = ['menacwy', 'td-ipv']
1152-
for (const patient_uuid of mmrCohortUuids) {
1153-
for (const programme_id of doublesProgrammeIds) {
1154-
const patientSession = new PatientSession(
1155-
{
1156-
createdAt: mmrCatchupOpenAt,
1157-
patient_uuid,
1158-
programme_id,
1159-
session_id: doublesCatchupSessionId
1160-
},
1161-
context
1162-
)
1163-
context.patientSessions[patientSession.uuid] = patientSession
1164-
context.patients[patient_uuid].patientSession_uuids.push(
1165-
patientSession.uuid
1166-
)
1167-
}
1168-
}
1169-
11701138
// Positive consent for every cohort patient × programme, except Dmitri's MMR
11711139
// reply which is already AlreadyVaccinated (above). One Reply per programme
11721140
// mirrors how Mavis stores Doubles responses in the real data.
@@ -1190,8 +1158,7 @@ for (const patient_uuid of mmrCohortUuids) {
11901158
// Dmitri's MMR reply is AlreadyVaccinated, seeded above
11911159
if (programme_id === 'mmr' && patient_uuid === dmitri.uuid) continue
11921160

1193-
const session_id =
1194-
programme_id === 'mmr' ? mmrCatchupSessionId : doublesCatchupSessionId
1161+
const session_id = mmrCatchupSessionId
11951162
const programme = context.programmes[programme_id]
11961163
const idx = programmeReplyIndex[programme_id]
11971164
const uuid = `${patientPrefix}-r${String(idx).padStart(3, '0')}-4000-8000-000000000001`

0 commit comments

Comments
 (0)