fix(migration): the CFE meter and route belong to the electric service
DATMEX.MEDIDOR/RUTA were unpivoted onto the WATER row, so every electric service arrived without a meter and water carried CFE's. They are filled on exactly the 1113 rows that carry an RPU (100% overlap), the meters are CFE's alphanumeric form (53MT58), and every legacy query that reads them is a LUZ one. medidor2/ruta2 pair with rpu2 the same way. Takes effect on the next reimport. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
36158ae761
commit
2cf07ed5ee
1 file changed
+14
-11
@@ -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
|
||||
|
||||
Reference in new issue
Block a user