diff --git a/migration/transform_properties.py b/migration/transform_properties.py index c09977c..58ddf22 100644 --- a/migration/transform_properties.py +++ b/migration/transform_properties.py @@ -164,18 +164,21 @@ def main(): services.append((str(uuid.uuid4()), pid, kind, account, meter, route, due, 1 if active else 0, notes)) - # WATER (primary + extra meters) + # WATER — the CESPT account only. DATMEX has no water meter column. if s(row["agua"]) or flag("water1", False): - svc("WATER", account=s(row["agua"]), meter=s(row["medidor"]), - route=s(row["ruta"]), due=s(row["diagua"]), active=flag("water1")) - for mcol, rcol in (("medidor2", "ruta2"), ("medidor3", "ruta3")): - if s(row[mcol]) or s(row[rcol]): - svc("WATER", meter=s(row[mcol]), route=s(row[rcol]), - notes="secondary meter", active=flag("water1")) - # ELECTRIC (rpu account + extras); luz_tipo as note - for rc in ("rpu", "rpu2", "rpu3"): - if s(row[rc]): - svc("ELECTRIC", account=s(row[rc]), + svc("WATER", account=s(row["agua"]), due=s(row["diagua"]), + active=flag("water1")) + # ELECTRIC — rpu account + the CFE meter and route beside it. MEDIDOR/ + # RUTA are the electric meter, not water: they are filled on exactly + # the 1113 rows that carry an RPU (100% overlap), the meters are CFE's + # alphanumeric `53MT58` form, and every legacy query that reads them is + # a LUZ one (LUZ, FALTANTES DE LUZ, "luz ruta 325 y 329"). They used to + # land on the WATER row, leaving every electric service without a meter. + # Paired by suffix: medidor2/ruta2 belong to rpu2. luz_tipo as note. + for rc, mc, rtc in (("rpu", "medidor", "ruta"), ("rpu2", "medidor2", "ruta2"), + ("rpu3", "medidor3", "ruta3")): + if s(row[rc]) or s(row[mc]): + svc("ELECTRIC", account=s(row[rc]), meter=s(row[mc]), route=s(row[rtc]), notes=s(row["luz_tipo"]) if rc == "rpu" else None, active=flag("electric")) # GAS — the column mixes two things: an account/meter number for 160 of