Skip to content

feat: add auto assign calls when a feed is added#1651

Draft
davidgamez wants to merge 2 commits intomainfrom
auto_assing_licenses
Draft

feat: add auto assign calls when a feed is added#1651
davidgamez wants to merge 2 commits intomainfrom
auto_assing_licenses

Conversation

@davidgamez
Copy link
Copy Markdown
Member

From our AI friend

This pull request introduces automated license assignment for feeds based on their license_url, improving data quality and reducing manual review. The core change is the new assign_license_by_url function, which resolves and assigns a license to a feed if a confident match is found, and records the assignment with a verification status. The implementation is integrated into both the database population scripts and the API feed creation endpoints. Additionally, a new verified column is added to the feed_license_change table to track whether an assignment was auto-verified or requires human review. Comprehensive unit tests are included for the new assignment logic.

Automated license assignment and verification:

  • Added assign_license_by_url to license_utils.py, which resolves and assigns a license to a feed using its license_url, auto-verifies high-confidence matches, and records the assignment in feed_license_changes with a verified flag.
  • Updated GTFS and GBFS database population scripts (populate_db_gtfs.py, populate_db_gbfs.py) to call assign_license_by_url when adding new feeds with a license_url. [1] [2]
  • Integrated license assignment into the API endpoints for GTFS and GTFS-RT feed creation, ensuring licenses are assigned and committed after feed creation. [1] [2]

Database and model updates:

  • Added a verified column to the feed_license_change table to indicate whether a license assignment was auto-verified or needs human review.
  • Updated the task executor's assign_feed_license to set the verified flag using the same confidence threshold logic as assign_license_by_url. [1] [2]

Testing and reliability:

  • Added comprehensive unit tests for assign_license_by_url covering all key behaviors, including no match, single/multiple matches, verification threshold, and duplicate assignment prevention.

These changes automate and standardize license assignment for feeds, improving accuracy and auditability while reducing manual intervention.

Summary:

Summarize the changes in the pull request including how it relates to any issues (include the #number, or link them).

Expected behavior:

Explain and/or show screenshots for how you expect the pull request to work in your testing (in case other devices exhibit different behavior).

Testing tips:

Provide tips, procedures and sample files on how to test the feature.
Testers are invited to follow the tips AND to try anything they deem relevant outside the bounds of the testing tips.

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with ./scripts/api-tests.sh to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

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