MobilityData / mobility-feed-api

Apache License 2.0
9 stars 4 forks source link

Feat: transitFeedSyncProcessing implementation #819

Open AlfredNwolisa opened 1 week ago

AlfredNwolisa commented 1 week ago

Summary:

The pull request addresses feed sync processing, ensuring proper handling and consistency of feed data using Pub/Sub messages. It includes necessary configuration files, comprehensive tests, and documentation.

Key implementations include:

Added support for:

  • Authentication type handling for feeds
  • External ID mapping and management
  • Feed redirection tracking
  • URL duplication checking
  • Feed status management (active/deprecated)

This pull request addresses the functionality described in issue https://github.com/MobilityData/product-tasks/issues/102, which is part of the https://github.com/MobilityData/product-tasks/issues/95 epic.

Expected behavior:

Feed Processing Flow:

  1. The Cloud Function receives a Pub/Sub event containing feed information:
  • Decodes base64 encoded message
  • Validates and parses the payload into a FeedPayload object
  1. For each feed processing request:
  • Checks if feed exists using external ID and source
  • Validates feed URL for duplicates across the system
  1. New Feed Processing:
  • If feed doesn't exist:

  • Generates new UUID and stable ID

  • Creates feed record with active status

  • Creates external ID mapping

  • Publishes to dataset batch topic if not authenticated

  1. Feed Update Processing:
  • If feed exists with different URL:

  • Creates new feed record with updated URL

  • Deprecates old feed record

  • Updates external ID mapping

  • Creates redirect mapping between old and new feed IDs

  • Publishes update to dataset batch topic if not authenticated

  1. Database Transaction Handling:
  1. Error Handling:

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!

cka-y commented 1 week ago

New feeds and feed updates should have operational_status="wip" so they can be manually validated before becoming public.