Skip to content

fix: GBFS duplicated versions#1275

Merged
cka-y merged 1 commit into
mainfrom
feat/1258
Jul 14, 2025
Merged

fix: GBFS duplicated versions#1275
cka-y merged 1 commit into
mainfrom
feat/1258

Conversation

@cka-y

@cka-y cka-y commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

Summary:
This PR introduces enhancements to the GBFS data processor to improve the handling of duplicate GBFS endpoint URLs across different versions. The most important changes include adding a new validation method and updating the endpoint extraction logic to handle duplicates more effectively.

Expected behavior:

  • Duplicate endpoint handling: Updated extract_endpoints_for_all_versions to:
    • Check for duplicate GBFS endpoint URLs during extraction.
    • Log warnings when duplicates are detected.
    • Remove versions with duplicate endpoints from gbfs_versions.

Testing tips:
Result for citiz_developpement
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 linked an issue Jul 8, 2025 that may be closed by this pull request
@cka-y cka-y requested a review from Copilot July 8, 2025 17:07

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.

Pull Request Overview

This PR adds logic to detect and remove GBFS feed versions that duplicate the same gbfs endpoint URL across versions.

  • Introduces validate_gbfs_endpoint_url() to check for existing endpoint URLs.
  • Enhances extract_endpoints_for_all_versions() to warn about and discard duplicate versions.
  • Cleans up self.gbfs_versions by removing detected duplicates.
Comments suppressed due to low confidence (3)

functions-python/gbfs_validator/src/gbfs_data_processor.py:408

  • [nitpick] The method name validate_gbfs_endpoint_url implies an assertion or error; consider renaming to something like endpoint_exists_across_versions or is_duplicate_gbfs_endpoint to clarify that it returns a boolean check.
    def validate_gbfs_endpoint_url(self, endpoint_url: str) -> bool:

functions-python/gbfs_validator/src/gbfs_data_processor.py:449

  • The comment is misleading—these versions are being removed due to duplicated gbfs endpoints, not because of missing endpoints. Please update the comment to reflect the actual reason.
        # Remove versions that had no endpoints extracted

functions-python/gbfs_validator/src/gbfs_data_processor.py:408

  • New logic for duplicate detection and removal should be covered by unit tests—add tests for validate_gbfs_endpoint_url and scenarios in extract_endpoints_for_all_versions where duplicates are logged and removed.
    def validate_gbfs_endpoint_url(self, endpoint_url: str) -> bool:

Comment thread functions-python/gbfs_validator/src/gbfs_data_processor.py

@qcdyx qcdyx 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.

LGTM

@cka-y cka-y merged commit d707c0f into main Jul 14, 2025
3 of 4 checks passed
@cka-y cka-y deleted the feat/1258 branch July 14, 2025 13:23
@richfab

richfab commented Jul 15, 2025

Copy link
Copy Markdown
Contributor

@cka-y I still see 2 results for citiz_developpement on prod. Is this expected? Thanks!
https://mobilitydatabase.org/feeds/gbfs/gbfs-citiz_developpement

cc @emmambd

image

@cka-y

cka-y commented Jul 15, 2025

Copy link
Copy Markdown
Contributor Author

@richfab we haven't release the changes yet so this is expected until we release

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.

GBFS feed URLs duplicated

4 participants