Skip to content

PNUM hard-coded and Vehicle table creation bug fix #953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dhensle
Copy link
Contributor

@dhensle dhensle commented Jun 11, 2025

Fixes for #951 and #952

This pull request addresses robustness and fallback mechanisms in the activitysim codebase by ensuring proper handling of missing columns (PNUM and auto_ownership) in key functions. The changes improve the stability and reliability of the model by adding conditional checks and alternative logic.

Enhancements to column handling:

  • joint_tour_frequency_composition.py: Added a fallback mechanism to handle cases where the PNUM column is missing. If PNUM is unavailable, the first person in each household is selected using stable ordering and grouping by household_id.

  • joint_tour_participation.py: Introduced logic to create a PNUM column dynamically for candidates if it is missing, ensuring that participant IDs can still be assigned correctly.

  • vehicles.py: Added a check for the presence of the auto_ownership column in the households DataFrame. If missing, the function retrieves the proto_households table as a fallback to ensure compatibility during disaggregate accessibility calculations.

dhensle added 3 commits June 2, 2025 11:09
Required to maintain backwards compatibility in tour indexes in SANDAG models
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant