Skip to content

Forward custom passthrough aggregations through stop-table APIs #433

Description

@paco-barreras

Problem

nomad.stop_detection.utils.summarize_stops supports custom aggregation of passthrough columns through passthrough_agg, but the public direct-to-stop-table APIs do not expose and forward that argument consistently. Callers therefore fall back to label APIs and external stop summarization when a stop-level field such as an attributed location_id needs modal aggregation.

Grid-Based has an additional gap: summarize_stop_grid always takes the first passthrough value, so its direct stop-table API cannot apply the same custom aggregation as other stop-detection families.

Required behavior

  • Add an explicit passthrough_agg=None parameter to the public single-user direct-to-stop-table APIs and their *_per_user wrappers.
  • Forward it from each per-user wrapper to its single-user stop-table function, and from there only to stop summarization.
  • Do not forward summarization arguments into label APIs.
  • Extend summarize_stop_grid, grid_based, and grid_based_per_user with equivalent custom passthrough aggregation behavior.
  • Preserve existing first-value behavior for passthrough columns without a custom aggregator.
  • Preserve canonical user_id passthrough behavior and empty stop-table schemas.

Tests

  • Cover a modal nullable string and integer location_id through representative direct and per-user stop-table APIs.
  • Cover Grid-Based explicitly, including populated and all-noise results.
  • Verify the label APIs are not given passthrough_agg.
  • Verify existing calls using only passthrough_cols remain unchanged.

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions