attributes#

Pipeline steps that attach reference-dataset evidence to the spine:
  • reconcile_attributes: aggregate source columns from established crosswalks

  • classify_footprint_priority: assign each footprint’s priority on its parcel

Value selection, gap-filling, and occupancy inference run in the curation stage (see openplaces.io.curator), not here.

Functions#

reverse_occ_units(→ str)

Re-classify a summed unit count to the nearest occupancy_type label.

reconcile_attributes(...)

Aggregate reference attributes to the spine via established crosswalks.

classify_footprint_priority(...)

Classify each footprint's priority on its parcel.

Module Contents#

openplaces.io.harmonizer.attributes.reverse_occ_units(total_units: float) str#

Re-classify a summed unit count to the nearest occupancy_type label.

Mirrors the map_to_units logic from Lochhead et al. (2026). Used when multiple NSI points link to the same footprint and their unit counts must be aggregated and re-classified.

openplaces.io.harmonizer.attributes.reconcile_attributes(state: openplaces.io.harmonizer.HarmonizeState, sources: list[dict] | None = None) openplaces.io.harmonizer.HarmonizeState#

Aggregate reference attributes to the spine via established crosswalks.

For each source in sources, looks up the crosswalk in state.crosswalks (resolved via recipe_id or entity_type) and aggregates the requested columns to the spine as source-suffixed evidence columns (e.g. improvement_value_parcel, occupancy_type_building_nsi).

This step only attributes evidence; between-source value selection, gap-filling, and occupancy inference now run in the curation stage (see openplaces.io.curator).

Parameters:

sources (list of dict) –

Each dict describes one reference source and may contain:

recipe_id (str, optional)

Explicit crosswalk key in state.crosswalks.

entity_type (str, optional)

Selects all matching crosswalks via state.reference_types; used when recipe_id is absent.

columns (list of str, optional)

Columns to aggregate. Defaults to all available columns from the corresponding default column list.

remap_id (str, optional)

Recipe id of a two-column value crosswalk (raw -> canonical) applied in place to the matching reference column before aggregation (e.g. canonicalizing FEMA occupancy_type via its occupancy-type-remap).

openplaces.io.harmonizer.attributes.classify_footprint_priority(state: openplaces.io.harmonizer.HarmonizeState, entity_type: str | None = None, thresholds: dict | None = None, **_params) openplaces.io.harmonizer.HarmonizeState#

Classify each footprint’s priority on its parcel.

Assigns priority_on_parcel as 'primary', 'secondary', or 'unknown'.

Uses dwelling-point and building-point evidence to assign roles within each parcel (Lochhead et al. 2026, Table 4):

  1. If any footprint on the parcel has dwelling-point evidence (SourceGeometryType.single_dwelling_point), those footprints are 'primary'; all others on the same parcel are 'secondary'.

  2. Else if any footprint has single-building-point evidence (SourceGeometryType.single_building_point, e.g. NSI), those are 'primary'; all others are 'secondary'.

  3. If no footprint on a multi-footprint parcel has evidence, all are 'secondary'.

  4. Footprints that are the sole geometry on their parcel are always 'primary'.

  5. Footprints not linked to any parcel are 'unknown', unless they carry dwelling-point evidence — those are promoted to 'primary'.

  6. A synthetic, parcel-derived fallback geometry (geometry_source starting with '{entity_type}.', set by infer_spine_additions()) is always 'primary', overriding the above: it stands in for the parcel’s one inferred building and was never eligible for the crosswalk-seeded evidence rules (it postdates the footprint-parcel crosswalk that seeds them).

Parameters:
  • entity_type (str, optional) – Entity type used to locate the parcel crosswalk in state.crosswalks. Defaults to 'parcel'.

  • thresholds (dict, optional) – Not currently used; retained for recipe compatibility.