Skip to content

Add raw property with unmapped source columns - #5

Merged
MiniCodeMonkey merged 1 commit into
masterfrom
feat/raw-properties
Oct 5, 2026
Merged

MiniCodeMonkey merged 1 commit into
masterfrom
feat/raw-properties

Conversation

@MiniCodeMonkey

Copy link
Copy Markdown
Member

Why

ChopChop will map new source fields itself through a layer-level extract, so the fork never needs another per-field change. The first user is UPRN/USRN for gb/countrywide (ENG-1529). For that, every output feature carries the source row's columns.

What changed

  • openaddr/conform.py: row_transform_and_convert copies the unmapped source columns with the new row_raw_columns before any conform function runs (row_fxn_chain writes back into the row), and sets properties.raw on the feature. Applies to every layer type.
  • openaddr/cache.py: the ESRI cache writes every field from the layer metadata instead of only the fields the conform names. Conform fields missing from the metadata are still written as empty columns (so functions that index them keep working) and logged once.
  • Tests: new test_raw_properties; expected values updated where raw now appears, and where ESRI row hashes and fingerprints change (see below).

Exclusion rule

For every key in the layer's SCHEMA plus lat and lon: if the conform value is a string, that column is excluded; if it is a list, each column name in it is excluded. Columns referenced only inside function objects (regexp, format, map, join, chain, first_non_empty, constant, ...) stay in raw with their original values. Columns whose name starts with oa: (any case) and empty values (None or '') are skipped. Names are verbatim and values are the strings the CSV round trip produced.

Testing

  • python3 -m unittest openaddr.tests.conform: 83 tests, OK.
  • Full suite (python3 test.py in Docker): 129 tests, OK (master: 128, OK).
  • ESRI row hash values and cache fingerprints in 5 existing tests changed because the ESRI CSV now holds all fields (hash covers the whole row). Nothing downstream reads hash.

Rollout

ChopChop must ship its decorate strip of raw and Combine file-streaming first. Then: amd64 build, push registry.geocod.io/geocodio/batch-machine:latest, and docker pull on the proxy host.

https://claude.ai/code/session_01M9dZ4UWYaMwr9e9cwwKpyS

…eature

Each output feature gets properties.raw, a JSON object of the source row's
columns, so downstream can map any field without further fork changes.

Columns the conform maps directly (a column name, or a list of column
names, for any SCHEMA key or lat/lon) are left out because their values
are already output properties. Columns used only inside conform functions
stay, with their original pre-function values. Columns starting with oa:
and empty values are skipped.

The ESRI cache now writes every field from the layer metadata instead of
only the fields the conform names. Conform fields missing from the
metadata are still written as empty columns and logged once.

Claude-Session: https://claude.ai/code/session_01M9dZ4UWYaMwr9e9cwwKpyS
@MiniCodeMonkey
MiniCodeMonkey merged commit a9c4b84 into master Oct 5, 2026
1 check passed
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