-
-
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
✨ Add filter information to readme and metadata #4229
Conversation
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.
If you fix the TypeError this is good to go. I'll leave it up to you (and lars?) to make the call re: whitelisting.
// delete url query params that the download api uses but that are not related to grapher | ||
delete params.v1 | ||
delete params.csvType | ||
delete params.useColumnShortNames |
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.
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.
Good point! It means that when we do this for MDims we'll have to expand the whitelist but it's probably the better way to do things.
functions/_common/urlTools.ts
Outdated
@@ -0,0 +1,12 @@ | |||
export function getGrapherFilters( | |||
searchParams: URLSearchParams | |||
): Record<string, unknown> { |
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.
I think it's actually not possible to get anything but a string
as one of the values here.
functions/_common/readmeTools.ts
Outdated
yield `### Active Filters` | ||
yield "" | ||
yield `A filtered subset of the full data was downloaded. The following filters were applied:` | ||
for (const entry of Object.entries(filterSettings)) { |
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.
If getGrapherFilters
was typed with Record<string, string>
then you could do the sugary thing of
for (const [key, val] of Object.entries(filterSettings)) {
which is 100% absolutely completely not necessary. I'm just sharing coz I think it's neat 🙂
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.
True, this is nicer :)
When using the download API, add information about active filters to the metadata and readme.