datacommonsorg / website

Code for the Data Commons website
https://datacommons.org
Apache License 2.0
21 stars 76 forks source link

[Custom DC] Fix Disappearing Stat Var bug on Map and Scatter tool #4251

Closed juliawu closed 1 month ago

juliawu commented 2 months ago

This PR fixes some bugs in the map and scatter tool on Custom DC

Bug 1: Disappearing stat vars

When a user selects a place + child place type in the dropdowns, the custom variables sometimes disappear from the sidebar. For example, when using the default OECD preview data, the OECD variables disappear from the sidebar when selecting "Asia" and "Country" in the dropdowns.

This happens because the custom variables don't have enough geographic coverage to meet the 10 place minimum set in PR #2314.

This PR sets this minimum to 1 place for custom DC (so that variables with no places are still filtered out) and leaves the 10 place minimum unchanged on main DC.

Screenshot 2024-05-17 at 4 06 45 PM

Screenshot 2024-05-28 at 3 03 55 PM

Screenshot 2024-05-28 at 3 04 25 PM

Screenshot 2024-05-28 at 3 04 50 PM

Bug 2: ResizeObserver error

This PR also fixes a console error on the scatter tool encountered while debugging: Screenshot 2024-05-17 at 4 31 53 PM

juliawu commented 1 month ago

Thanks for the review! Because Custom DC now uses the new visualization tools by default, I also fixed this bug in the new visualization tools. Client (npm) tests have been updated to reflect the new default numEntitiesExistence = 1 when the flask config variable is not set.

juliawu commented 1 month ago

Thanks for the reviews!

For our records: took beet's advice and switched to setting the filter value in the config, and renamed the variable name to "MIN_STAT_VAR_GEO_COVERAGE"