Skip to content

feat: include GBFS feeds in the CSV export - #1888

Open
raman325 wants to merge 2 commits into
MobilityData:mainfrom
raman325:gbfs-csv-export
Open

raman325 wants to merge 2 commits into
MobilityData:mainfrom
raman325:gbfs-csv-export

Conversation

@raman325

@raman325 raman325 commented Nov 6, 2026 •

Copy link
Copy Markdown

Summary:

Adds published GBFS feeds to the CSV export (feeds_v2.csv) as data_type=gbfs rows, so people can find bike, scooter and car share systems by location without an API token, the same way the CSV already works for GTFS. The database already has what's needed: GBFS feeds carry a bounding box, locations and the auto-discovery URL.

  • New get_all_gbfs_feeds() in shared/common/db_utils.py, mirroring get_all_gtfs_feeds() (batched, streamed, same published_only and extracted-location passes).
  • New get_gbfs_feed_csv_data() in export_csv, reusing get_feed_csv_data() for the common columns:
    • urls.direct_download is the auto-discovery URL (gbfs.json), i.e. the feed's producer_url.
    • The bounding box comes from gbfsfeed.bounding_box, with bounding_box_generated_at as extracted_on. That column is stored without a time zone, so it's marked as UTC to match the GTFS rows' format.
    • GTFS-only columns (entity_type, static_reference, urls.latest, features) stay empty, as they already are for the types they don't apply to.
  • Documents the gbfs rows in docs/SpreadsheetSchemaV2.md.

Compatibility: no columns are added, removed or reordered, but the file gains a third data_type. Consumers that assume only gtfs/gtfs_rt rows, or that urls.direct_download is always a zip, would see the new rows. If you'd prefer to keep feeds_v2.csv unchanged, the same rows could go to a separate file instead; happy to rework it that way.

Context: I'm adding Home Assistant integrations for GTFS and GBFS that use this catalog to discover feeds near a user's home. GTFS discovery works from the public CSV today; GBFS currently needs the authenticated API.

Expected behavior:

feeds_v2.csv contains one row per published GBFS feed, sorted with the others by id, with the location, provider, auto-discovery URL, license, status and bounding box filled in. Unpublished GBFS feeds are excluded.

Testing tips:

scripts/api-tests.sh --folder functions-python/export_csv. The fixtures add three GBFS feeds: one published with a bounding box and an extracted location, one published without either, and one unpublished that must not appear.

  • 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)

🤖 Generated with Claude Code

Add published GBFS feeds to feeds_v2.csv as data_type=gbfs rows using the
existing columns: urls.direct_download is the auto-discovery URL and the
bounding box comes from gbfsfeed.bounding_box / bounding_box_generated_at.
GTFS-only columns (entity_type, static_reference, urls.latest, features)
are left empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 6, 2026 04:46
@CLAassistant

CLAassistant commented Nov 6, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The change alters the public feeds_v2.csv contract and redefines direct_download for a new feed class, so downstream compatibility and rollout expectations require maintainer confirmation.

No open issues 🎉

What changed in this PR

Adds published GBFS feeds to the public feeds_v2.csv export alongside GTFS and GTFS-Realtime feeds, including location, provider, auto-discovery URL, license, status, and bounding-box data.

Changes:

  • Adds batched retrieval of published GBFS feeds with extracted-location support.
  • Maps GBFS metadata, auto-discovery URLs, locations, and bounding boxes into CSV rows.
  • Extends fixtures, expected output, and README documentation for GBFS support.

Review note: Nit: Update docs/SpreadsheetSchemaV2.md to document the new gbfs data type and its populated and empty fields.

File Description
functions-python/​export_csv/​tests/​test_export_csv_main.py Adds expected GBFS CSV rows and verifies unpublished feeds are excluded.
functions-python/​export_csv/​tests/​conftest.py Seeds published and unpublished GBFS fixtures with location and bounding-box variations.
functions-python/​export_csv/​src/​main.py Processes GBFS feeds and formats their metadata and bounding boxes for export.
functions-python/​export_csv/​README.md Documents GBFS as an exported feed type.
api/​src/​shared/​common/​db_utils.py Adds batched GBFS feed retrieval matching the existing GTFS export workflow.

Review effort: Lite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

3 participants