Skip to content
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

feat: tl scraping function #847

Merged
merged 10 commits into from
Dec 6, 2024
Merged

feat: tl scraping function #847

merged 10 commits into from
Dec 6, 2024

Conversation

cka-y
Copy link
Contributor

@cka-y cka-y commented Dec 2, 2024

Summary:
This pull request introduces several enhancements and fixes to improve error handling, logging, and data extraction in the functions-python project. Key changes include robust error handling in the process_dataset function, updates to the TransitFeedSyncProcessor for better feed URL handling, and refactoring of test functions to align with the updated codebase.

Closes https://github.com/MobilityData/product-tasks/issues/103)](https://github.com/MobilityData/product-tasks/issues/103


What was fixed:

  • Corrected handling of authentication information.
  • Enhanced generation of feed stable_id values.
  • Improved processing of GTFS real-time feeds, including proper management of entity types.
  • Fixed SQLAlchemy population for GTFS and GTFS-RT feeds (ensuring child and parent classes are properly populated).
  • Updated DataFrame processing to include all feeds (previously, some feeds were incorrectly filtered out).
  • Ensured correct message formatting when sending data to the batch processing function.
  • Updated triggers to account for tld-* feed IDs alongside mdb-* feed IDs.

Additional updates:

  • Added infrastructure deployment code.
  • Performed end-to-end (e2e) testing for the first population of feeds.

Out of scope:

  • E2E testing for subsequent runs: Since the TransitLand API does not provide updates between consecutive runs, this was not feasible to test at this stage. However, this should be prioritized before the next run to ensure consistent behavior.

Expected behavior:

  • Successfully scrape over 1,200 feeds from the TransitLand API, including approximately 400 GTFS real-time feeds.
    image

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)

@cka-y cka-y marked this pull request as ready for review December 2, 2024 20:04
@cka-y cka-y requested a review from AlfredNwolisa December 2, 2024 20:10
@cka-y
Copy link
Contributor Author

cka-y commented Dec 2, 2024

Added @AlfredNwolisa for visibility

@cka-y cka-y requested a review from davidgamez December 5, 2024 19:21
:return: feed_url in mbd if exists, otherwise None
"""
results = (
db_session.query(Gtfsfeed)
.filter(Gtfsfeed.externalids.any(associated_id=external_id))
db_session.query(Feed)
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@davidgamez davidgamez left a comment

Choose a reason for hiding this comment

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

🥇

functions-python/feed_sync_process_transitland/src/main.py Outdated Show resolved Hide resolved
@cka-y cka-y merged commit 73ea4bc into main Dec 6, 2024
3 checks passed
@cka-y cka-y deleted the feat/pt-103 branch December 6, 2024 19:33
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.

2 participants