load historic epc from csv 🟢

This commit is contained in:
Jun-te Kim 2026-05-07 16:26:29 +00:00
parent 74b7b87de6
commit 32bf1cc98d

View file

@ -1,5 +1,18 @@
import csv
from datatypes.epc.schema.historic_epc import HistoricEpc
def _normalise(value: str | None) -> str:
if value is None:
return ""
return value.replace("\xa0", " ")
def read_historic_epc_csv(path: str) -> list[HistoricEpc]:
raise NotImplementedError("read_historic_epc_csv not implemented yet")
with open(path, newline="", encoding="utf-8") as f:
reader = csv.DictReader(f)
return [
HistoricEpc(**{k.lower(): _normalise(v) for k, v in row.items()})
for row in reader
]