Skip to content

Commit 60ab167

Browse files
committed
chore: enhance error capturing for DataQuality mapping in water levels transfer
1 parent caa1ad4 commit 60ab167

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

transfers/waterlevels_transfer.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ def _make_observation(
325325
dq_code,
326326
row.GlobalID,
327327
)
328+
self._capture_error(
329+
row.PointID,
330+
f"Mapped DataQuality '{dq_code}' to NaN; stored NULL",
331+
"DataQuality",
332+
)
328333
data_quality = None
329334
else:
330335
mapped_quality_text = str(mapped_quality).strip()
@@ -338,11 +343,21 @@ def _make_observation(
338343
dq_code,
339344
row.GlobalID,
340345
)
346+
self._capture_error(
347+
row.PointID,
348+
f"Mapped DataQuality '{dq_code}' to empty value; stored NULL",
349+
"DataQuality",
350+
)
341351
data_quality = None
342352
except KeyError:
343353
logger.warning(
344354
f"{SPACE_6}Unknown DataQuality code '{dq_code}' for WaterLevels record {row.GlobalID}"
345355
)
356+
self._capture_error(
357+
row.PointID,
358+
f"Unknown DataQuality code '{dq_code}'",
359+
"DataQuality",
360+
)
346361

347362
# TODO: after sensors have been added to the database update sensor_id (or sensor) for waterlevels that come from db sensors (like e probes?)
348363
observation = Observation(

0 commit comments

Comments
 (0)