-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
feat(explorers): allow referencing indicators by catalog path #3748
Conversation
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 94 (322819) ❌ Edited: 2024-07-02 15:59:43 UTC |
cc209f4
to
cff7994
Compare
181a244
to
6e75b04
Compare
For review purposes: https://github.com/owid/owid-content/tree/explorer-etl-path-review contains two catalog-path-powered explorers: The staging server for this branch also has a catalog-path-based |
I now added an admin-only checkbox that lets one easily switch between viewing the saved or changed explorer config (preview will only work properly using the saved version). CleanShot.2024-07-02.at.16.20.08.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this is a neat feature! Have you adapted the script in automation that imports explorers into the db? If not, can you create an issue and assign it to me?
Fixes #3711.
So!
I worked on using ETL paths in indicator-based explorers for the last few days.
This means that something like this is now valid:
How this works
The way this works is that, at baking time, we resolve all catalog paths contained in the
graphers
andcolumns
sections of the explorer config.The explorer config is then transformed in such a way that any catalog paths are replaced by their indicator IDs, and this transformed explorer config is then baked and shipped to the browser. That is, the browser never really needs to know about the existence of catalog paths.
The fields that are transformed are:
graphers
:yVariableIds
xVariableId
sizeVariableId
colorVariableId
columns
catalogPath
->variableId
As you can see above, most fields have not been renamed. That is, any of
yVariableIds
etc. can now contain either an integer variable ID or a string catalog path (or, in the case ofyVariableIds
, in theory also a mix of both).Error handling
One caveat here is error handling, i.e. when an indicator can't be found for a catalog path.
In that case:
yIndicatorIds
,xIndicatorId
, etc., and just chooses to ignore themThis means: If any of the ETL paths are invalid, a Bugsnag error will be sent at bake time. The explorer will still get baked, but will be partially-broken.
PR tips
On an explorer page, you can get to the baked explorer config using
explorer.explorerProgram.prettify()
in the console. You can then copy this as plaintext (Chrome: "Copy string contents") and inspect it somewhere.Todos
catalogPathPrefix
or so?columns.catalogPath
section. Should we?string
types for some columns now, which are pretty much only present before baking.explorerProgram.chartCreationMode
)localStorage
localStorage
, or switch between localStorage and authored