fix: convert NaN/NULL to None and restore record properties structure in tap.py #48

Merged
tudor merged 1 commits from feature/ingest-independent-schools into main 2026-07-16 07:40:28 +00:00
Owner
No description provided.
tudor added 1 commit 2026-07-16 07:34:54 +00:00
fix: convert NaN/NULL to None and restore record properties structure in tap.py
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m2s
PR Checks / Backend Smoke (pull_request) Successful in 7s
PR Checks / Build Backend (no push) (pull_request) Successful in 12s
PR Checks / Build Frontend (no push) (pull_request) Successful in 42s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 47s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 1m46s
95f10bf352

🤖 AI Code Review (Claude Code)

The diff fixes real bugs in the Ofsted tap: it converts pandas NaN (which can occur when reading the .ods fallback with dtype=str) to None instead of leaving raw floats in records, and makes the URN cast tolerant of a missing 'urn' key via .get() instead of indexing. It also drops the prior loop that pre-populated every schema property with None before overwriting — verified against stg_ofsted_inspections.sql, which sources from a schema-driven Postgres table where every property is already a column, so omitted optional keys still land as NULL and behavior is unchanged.

🟡 Minor

  • pipeline/plugins/extractors/tap-uk-ofsted/tap_uk_ofsted/tap.py: pd.isna(val) is called on a value obtained via row.get(col); if the source file ever has duplicate column headers, row.get(col) returns a Series instead of a scalar and pd.isna(...) in the or expression raises 'truth value of a Series is ambiguous', aborting the whole row loop. Low likelihood given controlled GOV.UK source files, but there's no guard against it.
## 🤖 AI Code Review (Claude Code) The diff fixes real bugs in the Ofsted tap: it converts pandas NaN (which can occur when reading the .ods fallback with dtype=str) to None instead of leaving raw floats in records, and makes the URN cast tolerant of a missing 'urn' key via .get() instead of indexing. It also drops the prior loop that pre-populated every schema property with None before overwriting — verified against stg_ofsted_inspections.sql, which sources from a schema-driven Postgres table where every property is already a column, so omitted optional keys still land as NULL and behavior is unchanged. ### 🟡 Minor - **pipeline/plugins/extractors/tap-uk-ofsted/tap_uk_ofsted/tap.py**: pd.isna(val) is called on a value obtained via row.get(col); if the source file ever has duplicate column headers, row.get(col) returns a Series instead of a scalar and pd.isna(...) in the `or` expression raises 'truth value of a Series is ambiguous', aborting the whole row loop. Low likelihood given controlled GOV.UK source files, but there's no guard against it.
tudor merged commit 4bfcd9ba9a into main 2026-07-16 07:40:28 +00:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tudor/school_compare#48