-
Notifications
You must be signed in to change notification settings - Fork 3
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
Improve handling for URL-based signals & support COVIDcast EpiWeeks #53
Conversation
src/api/EpiData.ts
Outdated
@@ -34,7 +34,7 @@ export function epiRange(from: string | number, to: string | number): string { | |||
|
|||
// find the current epiweek and date | |||
const date = new Date(); | |||
const epidate = new EpiDate(date.getFullYear() + 1900, date.getMonth() + 1, date.getDate()); | |||
const epidate = new EpiDate(date.getFullYear(), date.getMonth() + 1, date.getDate()); |
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.
Currently epivis makes queries with 3924 set as the end year 🤔
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.
Yeah, that has been a curious artifact. I'm not sure how it slipped through QA, but it has no real ill effect, and it let us track epivis-based requests to the API servers. It looks like it came from an older piece of javascript where it presumably did the right thing (¯\_(ツ)_/¯). I am leaning towards leaving it as-is until #38 is done (especially so we can see the effect in our logs of more eyes on epivis with the signal discovery app's release). Do you have strong feelings either way?
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 believe this is already done by logging the referrer/origin in the delphi-epidata server? https://github.com/cmu-delphi/delphi-epidata/blob/dev/src/server/_common.py#L70-L71
If we want an even more reliable way to track API requests, a cleaner option is to
(a) start logging a certain custom HTTP header (like Delphi-Api-Origin
) in the logging method I linked above;
(b) set that header in EpiVis, and in other apps that we would like to keep track of - like the client, for instance.
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.
That server logging would do it if, as cmu-delphi/delphi-epidata#1386 (comment) mentions and #38 references, we update the Referrer-Policy
for epivis. Im not suggesting that adding 1900y is "clean", but can we leave it there for now and note that it should come out with #38?
As a test for #42, use this link. #43 can be tested by:
|
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 is great, and im impressed that you could get it done with this small of a diff!
src/api/EpiData.ts
Outdated
@@ -34,7 +34,7 @@ export function epiRange(from: string | number, to: string | number): string { | |||
|
|||
// find the current epiweek and date | |||
const date = new Date(); | |||
const epidate = new EpiDate(date.getFullYear() + 1900, date.getMonth() + 1, date.getDate()); | |||
const epidate = new EpiDate(date.getFullYear(), date.getMonth() + 1, date.getDate()); |
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.
Yeah, that has been a curious artifact. I'm not sure how it slipped through QA, but it has no real ill effect, and it let us track epivis-based requests to the API servers. It looks like it came from an older piece of javascript where it presumably did the right thing (¯\_(ツ)_/¯). I am leaning towards leaving it as-is until #38 is done (especially so we can see the effect in our logs of more eyes on epivis with the signal discovery app's release). Do you have strong feelings either way?
@@ -150,13 +150,17 @@ export function loadDataSet( | |||
}); | |||
} | |||
|
|||
export function fetchCOVIDcastMeta(): Promise<{ geo_type: string; signal: string; data_source: string }[]> { | |||
export function fetchCOVIDcastMeta(): Promise< | |||
{ geo_type: string; signal: string; data_source: string; time_type?: string }[] |
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.
Was this filled in by your IDE because you use the .time_type
member accessed in COVIDcast.svelte
?
Why is the time_type
marked "optional" with the question mark modifier? Is that just inherited from the importCOVIDcast()
call signature definition? Or is it because the argument has a default value for time_type
?
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.
Was this filled in by your IDE because you use the .time_type member accessed in COVIDcast.svelte?
yes!
Was this filled in by your IDE because you use the .time_type member accessed in COVIDcast.svelte? Why is the time_type marked "optional" with the question mark modifier? Is that just inherited from the importCOVIDcast() call signature definition? Or is it because the argument has a default value for time_type?
Just inherited from that call.
src/deriveLinkDefaults.ts
Outdated
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions | ||
d.title = `${d.params._endpoint} | ${d.params.regions} | ${d.title}`; | ||
d.title = `${Object.values(d.params).join(' > ')} > ${d.title}`; |
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 is a definite improvement and works well for now, but i wouldnt call this a full solution for #42 ... It lacks clarity and doesnt reproduce the normal/typical LeftMenu
for a COVIDcast-type signal.
instead of:
covidcast > doctor-visits > smoothed_cli > day > state > ar > value
,
it would be preferable to have something more like:
covidcast > doctor-visits:smoothed_cli > state:ar
for brevity and expressiveness
(lets leave it the way it is for now in this PR and return to it later when other higher-priority PRs are out of the way)
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 implemented this now, as it's fairly straightforward to modify the template. lmk what you think!
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.
Looks great for now. We should keep #42 open to later support reproducing the full form dropdown with value/stderr/sample_size.
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.
A couple little things, and then this'll be ready to go!
src/api/EpiData.ts
Outdated
@@ -34,7 +34,7 @@ export function epiRange(from: string | number, to: string | number): string { | |||
|
|||
// find the current epiweek and date | |||
const date = new Date(); | |||
const epidate = new EpiDate(date.getFullYear() + 1900, date.getMonth() + 1, date.getDate()); | |||
const epidate = new EpiDate(date.getFullYear(), date.getMonth() + 1, date.getDate()); |
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.
That server logging would do it if, as cmu-delphi/delphi-epidata#1386 (comment) mentions and #38 references, we update the Referrer-Policy
for epivis. Im not suggesting that adding 1900y is "clean", but can we leave it there for now and note that it should come out with #38?
src/deriveLinkDefaults.ts
Outdated
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions | ||
d.title = `${d.params._endpoint} | ${d.params.regions} | ${d.title}`; | ||
d.title = `${Object.values(d.params).join(' > ')} > ${d.title}`; |
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.
Looks great for now. We should keep #42 open to later support reproducing the full form dropdown with value/stderr/sample_size.
@melange396 updated this! |
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 work!
Closes #43, partially addresses #42:
time_type
specified in the meta endpoint, and works for both URL-provided signals as well as those selected in the signal picker.