Problem
Grid-Based sequential stop detection can use canonical h3_cell values as containment areas and produce stop tables without coordinates. Visit attribution currently expects ping or stop coordinates, so callers cannot directly attribute an H3-based stop to a POI and obtain canonical location_id values without manually converting cells into another spatial representation.
NOMAD should provide a direct, efficient H3-to-POI visit-attribution path rather than require each caller to reproduce that conversion and mapping.
Required behavior
- Accept canonical
h3_cell values from a stop table and a POI GeoDataFrame.
- Return canonical
location_id values aligned to the input stops.
- Resolve each unique H3 cell only once and reuse the result for repeated cells.
- Use the simplest native H3 and existing spatial-index operations that provide deterministic POI attribution; callers should not need to construct intermediate cell geometries or coordinate columns.
- Preserve NOMAD's flexible POI identifier and CRS handling.
- Define behavior for missing H3 cells, cells without a POI within the configured distance, empty input, and repeated cells.
- Keep coordinate-based
centroid and ping-based majority visit attribution behavior unchanged.
API design question
Determine whether this belongs as a new point_in_polygon method or as a focused visit-attribution function. Prefer the smaller public contract and avoid exposing implementation-only geometry conversion.
Tests
- Attribute repeated H3 cells to POIs while proving each unique cell is resolved once.
- Cover projected and geographic POI inputs, missing/unmatched cells, empty input, and deterministic ties.
- Verify canonical
h3_cell input and location_id output names, including column overrides through NOMAD's existing schema helpers.
This pull request includes code written with the assistance of AI. The code has not yet been reviewed by a human (remove this disclosure after human review).
Problem
Grid-Based sequential stop detection can use canonical
h3_cellvalues as containment areas and produce stop tables without coordinates. Visit attribution currently expects ping or stop coordinates, so callers cannot directly attribute an H3-based stop to a POI and obtain canonicallocation_idvalues without manually converting cells into another spatial representation.NOMAD should provide a direct, efficient H3-to-POI visit-attribution path rather than require each caller to reproduce that conversion and mapping.
Required behavior
h3_cellvalues from a stop table and a POI GeoDataFrame.location_idvalues aligned to the input stops.centroidand ping-basedmajorityvisit attribution behavior unchanged.API design question
Determine whether this belongs as a new
point_in_polygonmethod or as a focused visit-attribution function. Prefer the smaller public contract and avoid exposing implementation-only geometry conversion.Tests
h3_cellinput andlocation_idoutput names, including column overrides through NOMAD's existing schema helpers.This pull request includes code written with the assistance of AI. The code has not yet been reviewed by a human (remove this disclosure after human review).