Skip to content

Commit 50263eb

Browse files
committed
Fall back to column names with typos
Hitachi may or may not have time to fix typos in their dat file column headings to match their own spec. Use a fallback to typo headings if the row doesn't contain the heading name as per the spec.
1 parent c03f349 commit 50263eb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

manage_breast_screening/notifications/management/commands/create_appointments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ def update_or_create_appointment(
111111
nbss_id=row["Appointment ID"],
112112
nhs_number=row["NHS Num"],
113113
number=row["Screen Appt num"],
114-
batch_id=row["Batch ID"],
114+
batch_id=row.get("Batch ID", row.get("BatchID")),
115115
clinic=clinic,
116116
episode_started_at=datetime.strptime(
117117
row["Episode Start"], "%Y%m%d"
118118
).replace(tzinfo=TZ_INFO),
119-
episode_type=row["Episode Type"],
119+
episode_type=row.get("Episode Type", row.get("Epsiode Type")),
120120
starts_at=self.appointment_date_and_time(row),
121121
status=row["Status"],
122122
booked_by=row["Booked By"],

manage_breast_screening/notifications/tests/fixtures/ABC_20241202091221_APPT_106.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"NBSSAPPT_HDR"|"00000013"|"20250128"|"170922"|"000003"
2-
"NBSSAPPT_FLDS"|"Sequence"|"BSO"|"Action"|"Clinic Code"|"Holding Clinic"|"Status"|"Attended Not Scr"|"Appointment ID"|"NHS Num"|"Episode Type"|"Episode Start"|"Batch ID"|"Screen or Asses"|"Screen Appt num"|"Booked By"|"Cancelled By"|"Appt Date"|"Appt Time"|"Location"|"Clinic Name"|"Clinic Name (Let)"|"Clinic Address 1"|"Clinic Address 2"|"Clinic Address 3"|"Clinic Address 4"|"Clinic Address 5"|"Postcode"|"Action Timestamp"
2+
"NBSSAPPT_FLDS"|"Sequence"|"BSO"|"Action"|"Clinic Code"|"Holding Clinic"|"Status"|"Attended Not Scr"|"Appointment ID"|"NHS Num"|"Epsiode Type"|"Episode Start"|"BatchID"|"Screen or Asses"|"Screen Appt num"|"Booked By"|"Cancelled By"|"Appt Date"|"Appt Time"|"Location"|"Clinic Name"|"Clinic Name (Let)"|"Clinic Address 1"|"Clinic Address 2"|"Clinic Address 3"|"Clinic Address 4"|"Clinic Address 5"|"Postcode"|"Action Timestamp"
33
"NBSSAPPT_DATA"|"000001"|"KMK"|"C"|"BU003"|"N"|"C"|"N"|"BU003-67215-RA1-DN-Z2222-1"|"9449304424"|"S"|"20250102"|"KMKS02441"|"S"|""|"C"|"H"|"20250110"|"0845"|"MKGH"|"BREAST CARE UNIT"|"BREAST CARE UNIT"|"BREAST CARE UNIT"|"MILTON KEYNES HOSPITAL"|"STANDING WAY"|"MILTON KEYNES"|"MK6 5LD"|"MK6 5LD"|"20250123-121433"
44
"NBSSAPPT_DATA"|"000002"|"KMK"|"B"|"BU011"|"N"|"B"|"N"|"BU011-67278-RA1-DN-Y1111-1"|"9449305552"|"S"|"20250128"|"KMK001326"|"S"|"1"|"H"|""|"20250314"|"1345"|"MKGH"|"BREAST CARE UNIT"|"BREAST CARE UNIT"|"BREAST CARE UNIT"|"MILTON KEYNES HOSPITAL"|"STANDING WAY"|"MILTON KEYNES"|"MK6 5LD"|"MK6 5LD"|"20250128-154003"
55
"NBSSAPPT_DATA"|"000003"|"KMK"|"B"|"BU011"|"N"|"B"|"N"|"BU011-67278-RA1-DN-X0000-1"|"9449306621"|"F"|"20250128"|"KMK001326"|"A"|"3"|"H"|""|"20250314"|"1445"|"MKGH"|"BREAST CARE UNIT"|"BREAST CARE UNIT"|"BREAST CARE UNIT"|"MILTON KEYNES HOSPITAL"|"STANDING WAY"|"MILTON KEYNES"|"MK6 5LD"|"MK6 5LD"|"20250128-154004"

0 commit comments

Comments
 (0)