owid / owid-grapher

A platform for creating interactive data visualizations
https://ourworldindata.org
MIT License
1.37k stars 230 forks source link

Include income groups in `regions.json` #3517

Open marcelgerber opened 5 months ago

marcelgerber commented 5 months ago

Core problem

We would like to have income groups as part of "your local entities" in the redesigned entity selector.

CleanShot 2024-04-19 at 11 31 38

To do this, we would want to have these income groups in our regions.json file, and in the detect-country CF worker.

Proposed solution

Our own regions.json are being taken from ETL, and in particular from the ouput of ETL step grapher/regions/latest.

It would make sense to bundle the latest wb/.../income_groups steps into that, too, and to create additional rows that look something like OWID_INC_H,High-income countries,High-income-countries,aggregate, [...], USA;DEU;FRA;[...] to the regions.csv file.

Note that this would also entail assigning OWID entity codes to these income groups, which I think makes sense. But I'm not married to the OWID_INC_... scheme, we could also go with OWID_WB_HIC or something similar.

Alternatives

An alternative would be to create another grapher/latest/ step for income groups; something like grapher/latest/income_groups.

Context

There's a Slack discussion on the entity selector feature, and one on the proposed update of the regions dataset.

danyx23 commented 4 months ago

@marcelgerber what is the status of this work? Is the PR still relevant and will be merged? Is that work on hold unti the end of the cycle?

marcelgerber commented 4 months ago

Hi Daniel! The current status is that the remaining work for this (which consists mostly of providing a nice tooltip with more information) will take a few more hours, and so I've deferred it for after the multiD project.

The work on the etl side and on the cloudflare-workers side has already been completed and is ready for primetime.

I should also mention that there has been some further discussion on Slack about this between Ed and Pablo R, but I think the outcome of that discussion was basically that we should be good to go ahead.

Ah, and one more thing, I'm not entirely sure how/if the tooltip here could be related to Region DoDs (#3333)? If our custom tooltip mostly just links to the definition of an income group, then Region DoDs could do that too.

danyx23 commented 4 months ago

Cool, sounds good! I just chatted with Sophia about the Region DoDs and we think it makes sense to finish both of these features separately and then consider adding a special case for the intersection.