Skip to content

FiboaBaseConverter: drop what cannot validate, bounded, and fetch schemas first - #264

Open
ivorbosloper wants to merge 1 commit into
mainfrom
split/base-drops
Open

FiboaBaseConverter: drop what cannot validate, bounded, and fetch schemas first#264
ivorbosloper wants to merge 1 commit into
mainfrom
split/base-drops

Conversation

@ivorbosloper

Copy link
Copy Markdown
Collaborator

First of the structural PRs in the publish-portolan split (datasets: #231-#263). Two rules that every converter needs and none had.

Rows that cannot validate are dropped, up to 1% of the file

A row with no id or no crop:code fails validation at the very end of a conversion, after everything has been read and written — as does a row with an empty or missing geometry, which geopandas refuses to Hilbert-sort. Hours of work discarded for a handful of rows.

Dropping them silently would hide a broken mapping, so the share is bounded: above 1% the conversion fails and says which column and how many rows, because that is a converter bug rather than a few bad rows in the source. The lookup happens before columns are renamed, so the message names the source column a reader will actually find in the data.

This is not hypothetical. It is how si 2019 was caught publishing 820,151 fields with no id at all (#231), and how the empty-geometry rows in several Spanish regions stopped killing conversions at the last step.

Schemas are fetched before any real work

vecorel.org and fiboa.org fail intermittently, and a blip after a long download killed the conversion at the write step. Eight attempts with exponential backoff, before the first byte of source data is read; load_file caches per process, so a successful pre-warm makes the write network-free.

One converter comes along

The new rule exposes it: Europe-LAND's LT 2024 ships an entirely empty crop_code column beside a populated crop_name, so every row would be dropped. The name is the best available code there, and is used as one. Without this the lt test fails on 100 of 100 rows.

Original commits: 992f15b, b322fa3, d22b603, b92251a, d5287db, b154cf4.

#265 builds on this (the identity checks share the file).

🤖 Generated with Claude Code

https://claude.ai/code/session_01DVx9uQV2QPM8ecPAY3ZjXG

…emas first

Two rules that every converter needs and none had.

**Rows that cannot validate are dropped, up to 1% of the file.** A row with no
`id` or no `crop:code` fails validation at the very end of a conversion, after
everything has been read and written; the same goes for a row with an empty or
missing geometry, which geopandas also refuses to Hilbert-sort. Dropping them
silently would hide a broken mapping, so the share is bounded: above 1% the
conversion fails and says which column and how many rows, because that is a
converter bug rather than a few bad rows in the source.

The lookup happens before columns are renamed, so the message names the source
column a reader will find in the data.

**Schemas are fetched before any real work.** The schema hosts (vecorel.org,
fiboa.org) fail intermittently, and a blip after a long download used to kill
the conversion at the write step, discarding hours of work. Eight attempts with
exponential backoff, before the first byte of source data is read; `load_file`
caches per process, so a successful pre-warm makes the write network-free.

The Europe-LAND base converter comes along because the new rule exposes it:
LT 2024 ships an entirely empty `crop_code` column beside a populated
`crop_name`, so every row would be dropped. The name is the best available code
there, and is used as one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DVx9uQV2QPM8ecPAY3ZjXG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant