Remove dependency on api/ranking in sitemap script#6363
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request replaces a live API call to a deprecated endpoint with a static CSV-based approach for generating sitemap entries for the top 100 US cities. By shifting to a local data file and providing clear documentation on how to regenerate that data via Spanner Studio, the process becomes more resilient and maintainable. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request replaces an external API call for retrieving the top 100 US cities with a local CSV file and documents the Spanner SQL query used to generate it. The review feedback highlights critical issues in the SQL query, which incorrectly includes county-level FIPS codes (causing duplicates) and uses historical peak populations instead of current ones. Consequently, the generated CSV contains inaccurate and duplicate data. Additionally, it is recommended to specify UTF-8 encoding when opening the CSV file in Python to prevent potential decoding errors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors get_top_100_us_cities in tools/sitemap/main.py to use the DataCommonsClient for fetching city population data instead of making a direct HTTP request. It also adds deduplication of the collected DCIDs in write_priority_places_sitemap while preserving their order. Feedback was provided to fix the variable_dcids argument in the API call, which expects a list of strings rather than a single string.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This PR updates the logic for generating the sitemap entries for the top 100 cities in the USA to V2 Python API queries instead of a live request to /api/ranking.
/api/ranking will stop working soon with the deprecation of v1/page/ranking, which is why we need this change. The V2 Python API call can take a while (~15 seconds on my machine), but because the sitemaps are not updated frequently and the process is already quite manual, a 15 second call is acceptable.