Merged
Conversation
Author
|
Will prob just merge this in but making a PR for visibility / posterity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The long awaited ENUM helper for passing human readable enums into the config instead of integers!
Robo summary 🤖
This pull request refactors the way mode and purpose codes are handled throughout the trip-linking pipeline, shifting from using integer codes to using enum labels for greater clarity and maintainability. It introduces a new utility,
resolve_enum_labels, to convert enum labels to their corresponding code values, and updates function signatures, documentation, and configuration files to use enum labels instead of raw integer codes. This change improves code readability and reduces the risk of errors related to mismatched or unclear code values.Key changes include:
Core pipeline and utilities:
src/utils/enum_helpers.pywith theresolve_enum_labelsfunction, which maps enum labels to their corresponding values using Pydantic model metadata. This utility is now used throughout the trip-linking process.link_trips,link_trip_ids, andaggregate_linked_tripsfunctions insrc/processing/link_trips/link.pyto accept and process enum labels (change_mode_enum,transit_mode_enums) instead of integer codes, resolving them to code values internally. Updated all related docstrings and argument names accordingly. [1] [2] [3] [4] [5] [6] [7] [8]Configuration and documentation:
projects/bats_2019/config.yaml,projects/bats_2023/config.yaml, andREADME.mdfiles) to use enum labels (e.g.,CHANGE_MODE,FERRY,TRANSIT,LONG_DISTANCE) instead of integer codes for trip linking parameters. [1] [2] [3] [4] [5]src/processing/link_trips/README.mdand analysis scripts to reflect the new enum-based parameter names and usage. [1] [2] [3] [4] [5]Tests and fixtures:
change_mode_enumandtransit_mode_enumsparameters, passing enum labels or values as appropriate. [1] [2] [3] [4] [5] [6]These changes collectively make the codebase more robust, easier to understand, and less error-prone by standardizing on enum labels for all mode and purpose code references.
Type of Change
Testing
Checklist
ruff check .without errors)ruff format .)