-
Notifications
You must be signed in to change notification settings - Fork 2
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
Set COVIDcast export values based on URL parameters #1244
Conversation
✅ Preview link ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Not bad so far!
- Date field population does not seem to be working.
- We should also allow specification of
as_of
as well, if thats easy enough to do (ie, if its done the same way as the other date fields). - Can we use the same url parameters as the API uses? (like
geo_value
instead ofgeo_id
) - Add an optional field for an api key to allow access to restricted signals (in the ui as well as in the url). The key should also be used to retrieve metadata.
- The selected data source is not shown when specifying an "inactive" source (see https://deploy-preview-1244--cmu-delphi-covidcast.netlify.app/export/?source=covid-act-now&sensor=covid-act-now-pcr_specimen_total_tests&start=2024-01-01&end=2024-02-02&geo_type=state )
Notes from the meeting:
|
@melange396 fixed up all your suggestions (except the API key to allow access to restricted signals - I think that's best done in a separate PR, since it's not really related to URL params) Here's a new URL to test out the fix to the issue you've mentioned: In short - this was a bug with inactive sensors in particular, where the datetime selector was incorrectly set to current (e.g. 2024) dates for inactive sensors (so e.g. only running between 2020-2021). It was possible to reset the dates to valid ones by re-selecting the date on the picker, but a bit unintuitive. I fixed this by setting the datetime selector to the sensor's minimum and maximum start time, if it's inactive. |
@@ -27,18 +27,55 @@ | |||
} | |||
} | |||
|
|||
// Pre-fill the form from URL parameters. | |||
// Supported parameters: source, sensor, start, end, geo_type, geo_id |
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.
change these to match new parameter names
// Populate region based on URL params... but let the user override this later | ||
if (urlParams.has('geo_value') && !geoURLSet) { |
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.
would it remove the need for geoURLSet
if we put this outside of the $: {}
block?
} | ||
if ( | ||
urlParams.has('end_day') && | ||
new Date(urlParams.get('end_day')) <= sensor.meta.minTime && |
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.
new Date(urlParams.get('end_day')) <= sensor.meta.minTime && | |
new Date(urlParams.get('end_day')) >= sensor.meta.minTime && |
if (sensor && !sensor.active) { | ||
// If the sensor is inactive, set the start and end dates to its historical range rather than current date | ||
if ( | ||
urlParams.has('start_day') && |
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.
Im not sure we want to clamp these values to the active range if theyve been specified in the URL... The principle of least surprise suggests showing the user what they asked for.
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.
This looks good enough to merge to me. Since this feature will have a "silent" release for now and none of the changes are hard to revert or modify, we can keep iterating on it live.
After syncing with Rostyslav on Slack and trying out some features out in the browser, we have a list of a few outstanding issues that Rostyslav will address in the next PR:
geo_value=CA
is allowed, butgeo_value=ca
causes the page to hang; this is the opposite of the API behavior and needs a workaround (like dynamically lower-casing or upper-casing as needed)- when browsing on the dashboard, the URL parameters I noticed were
sensor
,region
, anddate
; we will need to convertsensor
intodata_source
andsignal
(should be doable with a split on "-"),region
intogeo_value
anddate
intostart_date
/end_date
Let's make sure those tasks are captured in whatever issue is tracking this work.
// Also normalize the dates to the current timezone | ||
startDate = new Date(startDate.getTime() - startDate.getTimezoneOffset() * -60000); | ||
endDate = new Date(endDate.getTime() - endDate.getTimezoneOffset() * -60000); |
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.
Let's add a comment about the Javascript string parsing + negative timezone edge cases here. If this is a common fix, maybe we can include a link instead of writing the full explanation out.
Why was this merged? There are still unaddressed concerns, plus there is no reason to release bugged and undertested functionality. |
I thought Rostyslav addressed most of the concerns from your previous review? My personal preference here is to not let the perfect be the enemy of the good. Rostyslav made an issue on Jira to track TODOs on this feature. |
But as a broader point, I'm not clear about our approval process for these PRs. In general, Rostyslav, we should probably wait for George's input, even if I give a more recent review. I'm writing my reviews from my personal perspective on the issue, but I'd like to give George the opportunity to give his take. I'm a bit out of the loop on things on the front-end / dev side, always happy to give input and take some burden off of George, but I do think that George has a better view on what needs to get done and when things are ready to merge. |
Things to fix up:
|
Also this one:
|
Prerequisites:
dev
branchdev
Summary
Fills in the form values on the COVIDcast Export Data page based on URL parameters. This will be used to integrate the export UI with e.g. the EpiVis dashboard or signal documentation, with certain values being pre-filled based on parameters selected on another section of the website.
To test this out, visit the export dashboard on the preview website, then append this set of parameters to the URL: