[v0/v1 migration] Move metadata modals in tools to V2#6090
[v0/v1 migration] Move metadata modals in tools to V2#6090nick-nlb merged 10 commits intodatacommonsorg:masterfrom
Conversation
…dal and chart embed. Note that this required some work to correctly resolve the used denom facets
…with a reworking of the facet plumbing within the tool to ensure that the correct (actually used) facets are supplied to the metadata modal.
…ities in the scatter and map.
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 represents the second phase of migrating the website's metadata infrastructure from V1 to V2, specifically targeting the map, scatter, and timeline tools. The core objective is to enhance the precision of metadata presented to users by ensuring that the exact numerator and denominator facets used in chart calculations are correctly identified and passed to the metadata modals. This update improves data transparency and accuracy within these visualization tools. Highlights
Changelog
Activity
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 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 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request continues the migration of website metadata handling from V1 to V2, focusing on the timeline, scatter, and map tools. The changes primarily involve passing entity DCIDs and accurately tracking numerator and denominator facets for metadata display. The implementation is solid, but I've identified a few areas for improvement regarding code duplication and simplification, which would enhance maintainability and readability.
juliawu
left a comment
There was a problem hiding this comment.
Hooray! Thank you for also fixing denominator facet handling in the tools!
## Issue [b/491842059](https://buganizer.corp.google.com/issues/491842059) ## Description This is part three of the conversion of the website metadata handling from V1 to V2. See [6078](#6078) for part 1, which describes the overall purpose. See [6090](#6090) for part 2. This third part: * adds a new `api/metadata/facet` endpoint that enriches the facets using only V2 calls (replicating what was previously done using V1 in the frontend). This is parallel to the recently added `api/metadata` call. * Updates the front end so that entities (or enclosed places and place types) are sent through to the facet selector. ## Notes The use of the observation endpoint to get earliest and latest dates threw a challenge here, because in certain cases (such as with US counties and multiple stat vars), there were too many series and the mixer refused to handle the request. This is parallel to what happens in `series.py`, where this is compensated for with very highly specific triggers that result in batching. We have replicated the same functionality (adjusted to fit our situation) here. A note that I left a TODO to merge the constants between the two file. That can be a small follow-up PR to this later (I didn't want to touch series.py in this PR). Another note is that the changes to metadata.py may appear more significant than they really are (there was some refactoring to use reuse code between the two endpoints. ## Testing For the most part, the facet modal should show the same information as it does in production. The primary point of divergence will be dates. The old facet modal used facet-wide dates, whereas the new V2 endpoints are more accurate, as they incorporate entities. Pages that demonstrate the new facet modal are: * [scatter](http://localhost:8080/tools/scatter#svx%3DDifferenceRelativeToBaseDate2006_Max_Temperature_RCP45%26dx%3DCount_Person%26svy%3DPercent_Person_WithCoronaryHeartDisease%26dy%3DCount_Person%26epd%3Dcountry%2FUSA%26ept%3DCounty%26qd%3D1%26dd%3D1) - with batching! * [explore page](http://localhost:8080/explore?enable_feature=enable_stat_var_autocomplete#q=Jobs%20in%20Texas) * [maps](http://localhost:8080/tools/map#%26sv%3DCount_Person_EducationalAttainmentBachelorsDegreeOrHigher%26pc%3D1%26denom%3DCount_Person%26pd%3DgeoId%2F08%26ept%3DCounty) * [timeline](http://localhost:8080/tools/timeline#&place=geoId/0606000,geoId/2511000,geoId/2603000,geoId/1777005,geoId/1225175,geoId/4815976&statsVar=Median_Income_Person) * Download Tool ## Upcoming This is the second change in a series. Pending changes coming are: * Final cleanup and removal of the non V2 endpoints.
## Issue [b/491842059](https://buganizer.corp.google.com/issues/491842059) ## Description This is part four of the conversion of the website metadata handling from V1 to V2. See [6078](#6078) for part 1, which describes the overall purpose. See [6090](#6090) for part 2. See [6104](#6104) for part 3. This fourth part: * removes the V1 metadata endpoints completely from the frontend. * wires the surface through to the new facet / metadata endpoints. ## Testing This should have no visual or functional effect on the website. ## Codacy Note This PR is failing codacy but in a way we cannot resolve. If we add the explicit type, then ESLint complains. We can ignore codacy here.
Issue
b/491842059
Description
This is part two of the conversion of the website metadata handling from V1 to V2.
See 6078 for part 1, which describes the overall purpose.
This part converts metadata calls related to the three tools (timeline, scatter and map) to use the V2 metadata endpoint.
Solution
The primary change was to send entities up through into the metadata modal and the chart embed for each of the tools.
However, this update (and the general move to V2) highlighted some changes that needed to be made to all three of the tools in order to supply the precisely used numerator and demoninator facets in each of the charts. This is what makes up the majority of the changes in this PR.
Testing
For the most part, the metadata modal should show the same information as it does in production. However, there are certain areas where we can expect divergences. The production metadata modals do not recognize denominator values (and so will not display the chosen denomator. Additionally, the production metadata modals will sometimes show only a single facet when more facets were actually used (ultimately for the same reason).
The following chart demonstrates both of these issues:
Literacy in India
Upcoming
This is the second change in a series. Pending changes coming in later PRs are: