From 8352efe3b06eb71ccd1f6625ea4537c4f834f7c4 Mon Sep 17 00:00:00 2001 From: Tony Locke Date: Mon, 14 Oct 2024 19:08:05 +0100 Subject: [PATCH] i --- chellow/e/hh_parser_edf_csv.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/chellow/e/hh_parser_edf_csv.py b/chellow/e/hh_parser_edf_csv.py index 67f23dbc3..60dbe4274 100644 --- a/chellow/e/hh_parser_edf_csv.py +++ b/chellow/e/hh_parser_edf_csv.py @@ -62,13 +62,20 @@ def _find_data(shredder): if value_str == "-": break - status_str = values[val_idx + 50] + status_idx = val_idx + 50 + status_str = values[status_idx] + try: + status = STATUS_LOOKUP[status_str] + except KeyError: + raise BadRequest( + f"Unrecognized status {status_str} at index {status_idx}." + ) yield { "mpan_core": mpan_core, "channel_type": channel_type, "start_date": to_utc(start_day_ct + HH * i), "value": Decimal(value_str), - "status": STATUS_LOOKUP[status_str], + "status": status, } except BadRequest as e: e.description = (