Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix duplicate indicators in indicator-based explorers #3944

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

ikesau
Copy link
Member

@ikesau ikesau commented Sep 9, 2024

A naive potential fix for #3943

I don't understand the Explorer data model well enough to know why explorerProgram.grapherConfig has the yVariableIdsthat it does - but it seems this line of code that inserts extra variables into the grapher config to get it to load the indicator data and metadata was assuming there'd be no duplicates.

There's almost certainly a better upstream fix for this, but this can fix the issue in the meantime until someone who understands explorers better can work things out.

@ikesau ikesau requested a review from danyx23 September 9, 2024 19:22
@ikesau ikesau self-assigned this Sep 9, 2024
@owidbot
Copy link
Contributor

owidbot commented Sep 9, 2024

Quick links (staging server):

Site Admin Wizard

Login: ssh owid@staging-site-fix-duplicate-indicators-explorers

SVG tester:

Number of differences (default views): 0 ✅
Number of differences (all views): 0 ✅

Edited: 2024-09-09 19:34:55 UTC
Execution time: 1.16 seconds

@lucasrodes
Copy link
Member

lucasrodes commented Sep 10, 2024

Thanks Ike! I was checking and found some views where the color for different indicators was the same. Also, when hovering over one of these, multiple indicators are highlighted.

It looks to me as this doesn't happen when freshly loading a view, but when changing the selection in the drop-down options. I found this behavior in

Examples

Example 1

Example 2

@lucasrodes
Copy link
Member

lucasrodes commented Sep 10, 2024

I just compared this site version, with one prior to #3793, and it looks like the coloring issue I explained above was there already. Bastian also mentioned that this coloring issue had happened in the past (slack).

Since there are multiple explorers live affected by this issue (Conflict Data Explorer, Conflict Data Source Data Explorer, Population and demography Explorer, Migration Explorer, COVID Explorer) I suggest we merge this and we can open a separate issue for the color issue. cc @danyx23

// Filter out variableIds that are already present in the dimensions array
.filter(
(yVariableId) =>
!dimensions.some((d) => d.variableId === yVariableId)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
!dimensions.some((d) => d.variableId === yVariableId)
!dimensions.some((d) => d.variableId === yVariableId && d.property === DimensionProperty.y)

Some scatters have the same variable as x and y dimensions, so maybe it's worth being more defensive and only filtering out y duplicates at this spot?

@ikesau ikesau force-pushed the fix-duplicate-indicators-explorers branch from 03f4f77 to 0a1544a Compare September 10, 2024 20:27
Copy link
Contributor

@danyx23 danyx23 left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the fix, Ike!

@danyx23
Copy link
Contributor

danyx23 commented Sep 12, 2024

I'll merge this since it leads to errors on today's data insight follow-up link

@danyx23 danyx23 merged commit a83487c into master Sep 12, 2024
20 checks passed
@danyx23 danyx23 deleted the fix-duplicate-indicators-explorers branch September 12, 2024 10:52
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.

5 participants