Skip to content

Remove dependency on api/ranking in sitemap script#6363

Open
juliawu wants to merge 7 commits into
datacommonsorg:masterfrom
juliawu:sitemap-top-100-us-cities-csv
Open

Remove dependency on api/ranking in sitemap script#6363
juliawu wants to merge 7 commits into
datacommonsorg:masterfrom
juliawu:sitemap-top-100-us-cities-csv

Conversation

@juliawu

@juliawu juliawu commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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.

@juliawu juliawu requested a review from nick-nlb June 11, 2026 21:20
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Dependency Removal: Removed the dependency on the deprecated /api/ranking endpoint for fetching top 100 US cities.
  • Data Source Migration: Introduced a local CSV file (top_100_us_cities.csv) to store city data, ensuring stability against API changes.
  • Documentation Update: Added a Spanner Studio SQL query to the README to facilitate future updates to the city population data.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot 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.

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.

Comment thread tools/sitemap/README.md Outdated
Comment thread tools/sitemap/README.md Outdated
Comment thread tools/sitemap/top_100_us_cities.csv Outdated
Comment thread tools/sitemap/main.py Outdated
@juliawu juliawu marked this pull request as draft June 11, 2026 21:24
@juliawu

juliawu commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot 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.

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.

Comment thread tools/sitemap/main.py Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@juliawu juliawu marked this pull request as ready for review June 12, 2026 02:19
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.

1 participant