@@ -113,28 +113,26 @@ def update_or_create_appointment(
113113 nbss_id = row ["Appointment ID" ],
114114 nhs_number = row ["NHS Num" ],
115115 number = row ["Screen Appt num" ],
116- batch_id = row .get (
117- self .handle_aliased_column ("Batch ID" , "BatchID" , row )
118- ),
116+ batch_id = self .handle_aliased_column ("Batch ID" , "BatchID" , row ),
119117 clinic = clinic ,
120118 episode_started_at = datetime .strptime (
121119 row ["Episode Start" ], "%Y%m%d"
122120 ).replace (tzinfo = TZ_INFO ),
123- episode_type = row . get (
124- self . handle_aliased_column ( "Episode Type" , "Epsiode Type" , row )
121+ episode_type = self . handle_aliased_column (
122+ "Episode Type" , "Epsiode Type" , row
125123 ),
126124 starts_at = self .appointment_date_and_time (row ),
127125 status = row ["Status" ],
128126 booked_by = row ["Booked By" ],
129127 booked_at = self .workflow_action_date_and_time (
130128 row ["Action Timestamp" ]
131129 ),
132- assessment = row . get (
130+ assessment = (
133131 self .handle_aliased_column (
134132 "Screen or Assess" , "Screen or Asses" , row
135133 )
136- )
137- == "A" ,
134+ == "A"
135+ ) ,
138136 ),
139137 True ,
140138 )
@@ -174,10 +172,12 @@ def workflow_action_date_and_time(self, timestamp: str) -> datetime:
174172
175173 def handle_aliased_column (
176174 self , expected_name : str , fallback_name : str , row : pandas .Series
177- ) -> str :
175+ ) -> str | None :
178176 if expected_name in row :
179177 return row [expected_name ]
180- return row [fallback_name ]
178+ elif fallback_name in row :
179+ return row [fallback_name ]
180+ return None
181181
182182 def appointment_date_and_time (self , row : pandas .Series ) -> datetime :
183183 dt = datetime .strptime (
0 commit comments