Skip to content

Rename passenger_events to device_events with expanded scope#251

Open
chrisyamas wants to merge 6 commits into
developfrom
feature/issue-241-device-events
Open

Rename passenger_events to device_events with expanded scope#251
chrisyamas wants to merge 6 commits into
developfrom
feature/issue-241-device-events

Conversation

@chrisyamas

Copy link
Copy Markdown
Contributor

Summary

BREAKING CHANGE: This PR implements a significant architectural change that shifts TIDES from a vehicle-centered to a device-centered model. The passenger_events table is renamed to device_events to accommodate:

  • station-based events such as those from fare gates, turnstiles
  • mobile device events from handheld validators, fare inspectors, and other sources
  • vehicle-mounted device events (the existing APC data)

Resolves #241

Related to:

Changes

Files Renamed

  • spec/passenger_events.schema.json --> spec/device_events.schema.json
  • samples/template/TIDES/passenger_events.csv --> samples/template/TIDES/device_events.csv

Schema Changes (device_events)

Field Renames:

  • passenger_event_id --> device_event_id

Constraint Changes:

  • device_id - now required (was optional)
  • vehicle_id - now optional (was required)
  • trip_stop_sequence - now optional (was required)

New Fields:

  • latitude
  • longitude
  • employee_id - for handheld device operators

Note: this PR utilizes snake_case, as opposed to 'Sentence case', for enum values given the work parallel work occurring in #247

New event types:

  • passenger_entry - for station-based entry events (fare gate passages)
  • passenger_exit - for station-based exit events

Other Files Updated

  • spec/tides-datapackage-profile.json - updated enum
  • samples/template/TIDES/datapackage.json - updated resource references
  • CHANGELOG.md - comprehensive breaking change documentation

Migration Notes

Agencies migrating from v1.x will need to:

  1. rename passenger_events table/file to device_events
  2. rename passenger_event_id column to device_event_id
  3. populate device_id for all records (now required)
  4. convert all event_type values from Title Case to snake_case
  5. add empty columns for new optional fields

Review checklist

Per change management policy, the following must be met before feature branch changes can merge to develop branch:

  • All JSON files validate
  • Reviewed and approved by 2+ contributors or board members

@chrisyamas chrisyamas added this to the v2.0 milestone Jan 8, 2026
@chrisyamas chrisyamas self-assigned this Jan 8, 2026
@chrisyamas chrisyamas requested review from a team as code owners January 8, 2026 16:16
@chrisyamas chrisyamas added 📄 spec Pertains to the specification itself 🔄 normative change A normative change requires approval of TIDES Board labels Jan 8, 2026
@github-actions

github-actions Bot commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

Data Validation Report

Sample Status
./samples/template/TIDES ⚠️

@botanize botanize left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly great! Just a couple of clarifying questions.

"title": "ID referencing devices.device_id",
"description": "Identifies the device that recorded the event. May be null if only a single device is reporting passenger events on a vehicle/ train car and the device_id is not distinct from vehicle_id/train_car_id."
"title": "Employee ID",
"description": "Identifies the employee operating a handheld device, such as a fare inspector or conductor with a mobile validator."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also apply to vehicle-mounted devices? e.g., the bus operator associated with a bus boarding event?

"type": "string",
"title": "ID referencing vehicles.vehicle_id",
"description": "Identifies a vehicle.",
"description": "Identifies a vehicle. Required for vehicle-mounted device events; optional for station-based or mobile device events."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vehicle_id should be optional for all device events, since device_id is required, and device_id links to vehicle_id in the devices table.

"name": "latitude",
"type": "number",
"title": "Latitude",
"description": "Degrees North, in the WGS-84 coordinate system. Used for mobile device events not at a fixed location. References GTFS-Realtime.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure a reference to GTFS-Realtime provides any value. Also for longitude below.

Suggested change
"description": "Degrees North, in the WGS-84 coordinate system. Used for mobile device events not at a fixed location. References GTFS-Realtime.",
"description": "Degrees North, in the WGS-84 coordinate system. Used for mobile device events not at a fixed location.",

"type": "integer",
"title": "Positive integer referencing stop_visits.trip_stop_sequence",
"description": "The actual order of stops visited within a performed trip. The values must start at 1 and must be consecutive along the trip.<br/> Example: A bus departs the first stop and detours around the second and third scheduled stops, visiting one unscheduled stop and resuming regular service at the 4th scheduled stop. The `scheduled_stop_sequence` is [1, null, 4], and the `trip_stop_sequence` is [1, 2, 3].",
"description": "The actual order of stops visited within a performed trip. The values must start at 1 and must be consecutive along the trip. Required for vehicle-based events; optional for station-based or mobile device events not associated with a trip.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the example here? I think the "performed" stop-sequence is a little bit of a strange concept, and the comparison of scheduled_stop_sequence to trip_stop_sequence is potentially helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔄 normative change A normative change requires approval of TIDES Board 📄 spec Pertains to the specification itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants