schema-join
See docs/reference/README.md for the MUST/SHOULD/MAY convention, and
docs/reference/shared.md for rules schema-join shares with other tools.
Inputs¶
schema-joinMUST read one child file and one parent file, reprojecting both to EPSG:4326 the same way every other tool does, viacore.assign.load_children()/load_parent().schema-joinMAY take the samename_field/code_fieldpairschema-maptakes (each containing a{n}placeholder); both MUST be given together, or both omitted. When given, the parent's hierarchy columns MUST be every column in a{n}-numbered family undercode_field's prefix, for every leveldetect_levels()finds on the parent, raisingValueErrorunder the same missing-level rules asschema-fill.- When
name_field/code_fieldare omitted,schema-joinMUST instead structurally auto-detect the parent's hierarchy columns (every level's identity columns fromcore.schema_map's cardinality/containment matcher, no naming convention assumed), raisingValueErrorif no level is detected. - Only the parent's hierarchy columns are ever copied; any other parent column MUST be ignored.
Assignment¶
schema-joinMUST assign each child to the single parent it shares the most area with (core.assign.assign_many(), per-child plurality, ties broken by lowest parent fid), measured inEQUAL_AREA_CRS.- A child overlapping no parent MUST stay in the output, with every copied parent column NULL.
Joining¶
For each parent hierarchy column:
- absent from the child:
schema-joinMUST add it, filled from the child's assigned parent; - present on the child and equal (
IS NOT DISTINCT FROM) on every assigned child:schema-joinMUST skip it, leaving the child's column as-is; - present on the child and different on any assigned child:
schema-joinMUST leave the child's column untouched and add the parent's values under the next free numbered sibling name (adm2_name1, thenadm2_name2ifadm2_name1is taken on either layer), logging a warning with the differing row count.
schema-join MUST NOT raise on a conflicting value, and MUST NOT
overwrite any child value (see docs/adr/0109).
Outputs¶
schema-joinMUST NOT modify geometry, and so performs no topology hard gate at all.- The output MUST keep every child row, in input order: the child's own columns first, then every added column, then geometry.
schema-joinMUST write an issues file in the shared issues-table column schema, with one row per:no-parent: a child overlapping no parent;low-overlap: a child whose assigned parent covers less thanmin_overlapof its own area, witharea_m2set to the child's area outside that parent andreasonstating the covered share;value-mismatch: a child and column where the child's value and its parent's value are both non-NULL and differ, withreasonnaming the column and both values.schema-joinMUST NOT write an empty issues file, and MUST remove a stale one at the issues path instead.
Configuration (api.schema_join.join() / CLI)¶
schema-joinMUST process exactly one child file and one parent file per call; either MAY be anhttp:///https://URL to a.parquetfile.- The output path MUST default to the child path with a
_joinstem suffix, and the issues path to the output path with an_issuesstem suffix (issues_path/--issues-outputto override). schema-joinMUST raiseFileExistsErrorif either the output or the issues path already exists and overwriting wasn't requested.min_overlap/--min-overlapMUST default to0.5and MUST raiseValueErroroutside(0, 1].step, if given, MUST be one ofinputs,assign,join,outputs; any other value MUST raiseValueError.