Skip to content

[v0/v1 migration] Replace /v1/bulk/info/variable#6113

Merged
nick-nlb merged 5 commits intodatacommonsorg:masterfrom
nick-nlb:v2_migration_bulk_info_variable
Mar 25, 2026
Merged

[v0/v1 migration] Replace /v1/bulk/info/variable#6113
nick-nlb merged 5 commits intodatacommonsorg:masterfrom
nick-nlb:v2_migration_bulk_info_variable

Conversation

@nick-nlb
Copy link
Copy Markdown
Contributor

@nick-nlb nick-nlb commented Mar 23, 2026

Issue

b/459855424

Related PR

Mixer: 1818

🚨 The mixer PR must be merged in before this PR.

Description

This PR converts the usage of /v1/bulk/info/variable to /v2/bulk/info/variable.

Notes

With the conversion to v2, certain fields (notably place related fields) have been dropped from the mixer response. Some of that functionality will be restored in a different way with v3; however, for the v2 migration, we are just dropping those fields from the frontend.

Once the v2 migration is complete and the v3 endpoint is ready, we can bring in some of the information brought in by the v3 endpoint. However, the priority for now is in completing the v1 to v2 migration.

Testing

To test this PR, you must set your local mixer branch to the above related PR (and run the website against your local mixer).

Stat Var Explorer

Screenshots

Note the top place section is now removed, as well as the right-hand column in the series keys. WIth the later v3 migration, the right-hand column can be recreated (but will be different than what v1 provided).

Screenshot 2026-03-23 at 11 23 56 AM

@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 updates the frontend to consume the /v2/bulk/info/variable API endpoint, replacing its version 1 counterpart. This migration necessitated adjustments to the user interface, primarily involving the removal of place-related data and associated display elements, as these fields are no longer provided by the updated API.

Highlights

  • API Endpoint Migration: The backend service call for retrieving variable information was migrated from the /v1/bulk/info/variable endpoint to the new /v2/bulk/info/variable endpoint.
  • Frontend UI Simplification: Place-related information, including the 'Places' section and the 'Total number of places' display, was removed from the Stat Var Explorer user interface, reflecting changes in the v2 API response.
  • CSS Adjustments: Column widths within the provenance summary section were updated to align with the removal of certain data fields and columns.
  • Provenance Section Refinement: The 'Release frequency' detail and the 'Place Types' column were removed from the provenance table display.
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 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 counter productive. 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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 updates the variable_info API call from v1 to v2 and adjusts the corresponding endpoint configuration. It also involves a significant refactoring of the Stat Var Explorer UI, specifically removing the "Places" section and related components, and streamlining the "Provenance" section by removing "Release frequency" and "Place Types" information, along with associated CSS adjustments. There is no feedback to provide.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

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 updates the /bulk/info/variable API endpoint from v1 to v2 and refactors the Stat Var Explorer UI. The 'Places' component and its related functionality have been removed, and the 'Provenance' component has been simplified by removing the display of releaseFrequency and 'Place Types'. CSS classes were also updated to reflect these UI changes. The review suggests removing releaseFrequency and placeTypeSummary from the ProvenanceSummary interface in static/js/shared/types.ts to maintain consistency and improve maintainability, recommending verification of their usage across the application before removal.

I am having trouble creating individual review comments. Click here to see my feedback.

static/js/tools/stat_var/provenance.tsx (66-68)

medium

Since releaseFrequency is being removed from the UI, it would be good practice to also remove it from the ProvenanceSummary interface in static/js/shared/types.ts to keep the type definition in sync with the API response. The same applies to placeTypeSummary, which is also no longer used. However, please verify their usage across the entire application before removal, as they might be used in other features not directly related to the current changes. This can be done in a follow-up change to improve maintainability.

References
  1. Before suggesting to remove a function as dead code, verify its usage across the entire application, as it might be used in other features not directly related to the current changes (e.g., disaster maps, place search).

@nick-nlb nick-nlb marked this pull request as ready for review March 23, 2026 18:31
Copy link
Copy Markdown
Contributor

@juliawu juliawu left a comment

Choose a reason for hiding this comment

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

LGTM, approved from ENG standpoint

Copy link
Copy Markdown
Contributor

@n-h-diaz n-h-diaz left a comment

Choose a reason for hiding this comment

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

Thanks!

Not needed for this PR, but just wanted to call out

  • I had removed release_frequency from the V2 response since it was tricky to fetch via BQ federation and possible to get these directly from V2 node instead. If we still want to display these, they can be fetched via "sourceReleaseFrequency" property, something like
    https://api.datacommons.org/v2/node?key=<API_KEY>&nodes=dc/base/Argentina_Census&property=-%3EsourceReleaseFrequency (would this be okay?)
  • Let me know if we still want the per facet place types (it looks like we're dropping these from the display)

@nick-nlb
Copy link
Copy Markdown
Contributor Author

  • Let me know if we still want the per facet place types (it looks like we're dropping these from the display)

We definitely want the per facet place types! They're dropped from the display because the V2 endpoint clears them out (we talk about this a bit in the chat with @miss-o-soup).

I've added this as a topic for when we meet later today.

@nick-nlb nick-nlb merged commit cc82a09 into datacommonsorg:master Mar 25, 2026
13 checks passed
nick-nlb added a commit that referenced this pull request Apr 1, 2026
## Issue

[b/459855424](https://buganizer.corp.google.com/issues/459855424)

## Related PR

[6113](#6113)

## Description

This PR does the following:

* Restores v1 functionality in Flask, gating the v2 call under the
migration feature flag
* Restores v1 functionality on the frontend, likewise gating the v2
updates under the feature flag
* As part of the frontend updates, it consolidates various disparate
calls to the same endpoint into the same utility function (making it
easier to apply the sending of flag overrides back to the backend).
* Fixes the tooltip issue in V2
* Sets the migration flag to true in local, autopush and dev

## Notes

Although the diff might look sizable, a lot of this functionality simply
restores frontend V1 code removed in the linked PR. This will leave this
PR functionally as a noop against prod. This code will be removed only
once the functionality is fully deployed and the flags have been
dropped. The actual new lines of code introduced here are few:

* `static/js/tools/stat_var/explorer.tsx` Most changes here are just
restoration of v1 frontend
* `static/js/tools/stat_var/places.tsx` This whole file is just a
restoration of v1 frontend
* 

## Testing

[Stat Var Explorer](http://localhost:8080/tools/statvar#sv=Count_Person)

Locally, by default, the v2 flag is set to be true. 

The above page should show the v2 version (i.e., with no overall place
table at the top of the page). Additionally, the v2 endpoint should be
called by flask (this can be verified by either reviewing the trimmed
down payload that comes into the front end, or by adding logs to the
Flask control flow.

To verify that the flag override process works:

* Set your local `use_v2_api` to false. 
* Restart your Flask server and refresh the page
* You should now see the V1 version (where the place summary appears at
the top and the tooltips show place types).
* Add the flag override to the URL: [Stat Var Explorer with Flag
Override](http://localhost:8080/tools/statvar?enable_feature=use_v2_api#sv=Count_Person)
* You should now see the v2 version without the place overview section
at the top and without the place types in the tooltip.

Other pages that have been touched include the other tools (map,
scatter, timeline), as these also have stat var hierarchies. These
should show the correct tooltips in their respective feature flag mode
as above.


## Screenshots

See the related PR above for screenshots of what the v1 version and v2
version will look like.

## Autoreview Bot

Gemini's comments all related to code that was not really new to this PR
(but was restored with v1 functionality pending the migration feature
flags being turned down). The code will be removed again later, and we
should not do anything other than restore the working code as it was. I
ignored the comments.
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