Skip to content
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

update: Change time window on Location & Situation Report component to rely on API calls #633

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

@olekkorob olekkorob changed the title update: Change time window on Location Report component to rely on API calls update: Change time window on Location & Situation Report component to rely on API calls Feb 17, 2023
@flaneuse
Copy link
Collaborator

@olekkorob :

On /situation-reports:

  1. On the default page load, the min_date and max_date parameters aren't being set, so all the data is loading for all time. max_date should be today, and min_date should be today - 6 months.
  2. If you change the 3 month / 6 month / 1 year / all time buttons, API calls are queried, but the min_date max_date are unset.
  3. If you load a page with a specified date range, it should read from the parameters, like http://localhost:8080/situation-reports?xmin=2022-11-21&xmax=2023-02-21&pango=BF.7&selected=USA
  4. The map/dot plot should be linked to the min_date/max_date parameters in the route and in the time plot, like it is for the Location Reports. When you change dates, the dates should also change. Add buttons to select the dates, like you added on the location page. Note that there are 2 input boxes to change (one with the map, one with the dot plot).

Screenshot 2023-02-21 at 3 35 07 PM

  1. Adjust the summary box:
    • Change the sentence to read "As of 21 February 2023 11:30 AM,61,556 sequences in the BF.7 lineage have been detected between {min_date} and {max_date}.
    • change the word "total" to "count"
    • add {min_date} - {max_date} below "BF.7 found"
    • remove the "first found" column
    • change "when found**" to "when found in date range**"
    • Change the annotation to read: * Apparent cumulative prevalence is the ratio of the sequences containing BF.7 to all sequences collected within the selected time window
    • Above the map, change the sentence to say "The strain has been detected in at least 100 countries and 54 U.S. states between {min_date} and {max_date}"

Screenshot 2023-02-21 at 3 40 35 PM

On /location-reports:

  1. On the default page load, the min_date and max_date parameters aren't being set, so all the data is loading for all time. max_date should be today, and min_date should be today - 6 months.
  2. If you load a page with a specified date range, it doesn't read from the parameters, like http://localhost:8080/location-reports?xmin=2022-02-21&xmax=2023-02-21&loc=USA&selected=BQ.1.1&selected=XBB.1
  3. The calls within "Tracked lineages over time" have undefined dates like https://api.outbreak.info/genomics/prevalence-by-location?pangolin_lineage=BQ.1.1&location_id=USA&min_date=undefined&max_date=undefined:

Screenshot 2023-02-21 at 3 12 24 PM

  1. The content of the maps don't seem to be changing, though the API call does change. The maps should change color when you change the date range.
  2. On the legend for the maps: "est. prevalence over the last 60 days" should change based on the time window selected. For simplicity, you can use like "Est. prevalence 2022-11-21 - 2023-02-21".

Screenshot 2023-02-21 at 3 16 23 PM

  1. On the table, if no date is specified, say "all time" instead of "-"
  2. On the table:
    • change "total" to "count" (I think total is misleading since it's not over all time)
    • move the date range below "lineage found", since the date range applies both to count and cumulative prevalence.
    • delete the "first" column
    • change the header to read "when found in date range**"
  3. Routing from the table to Situation Reports is broken. For instance, if you click on BF.7 in the table, it creates an error.

Thanks!

@flaneuse
Copy link
Collaborator

flaneuse commented Mar 1, 2023

Thanks @olekkorob . Things that are still issues:

/situation-reports

  1. If you change the 3 month / 6 month / 1 year / all time buttons, API calls are queried, but the min_date max_date are unset.
  • min_date and max_date are now set, but they're always a six month window, rather than the date specified by the button
  • similarly, if you use the zoom in functionality, the API parameters don't update.
  1. Adjust the summary box:
  • It doesn't look like the dates are changing in the API call here either.

/location-reports

  1. On the default page load, the min_date and max_date parameters aren't being set, so all the data is loading for all time. max_date should be today, and min_date should be today - 6 months.
  1. If you load a page with a specified date range, it doesn't read from the parameters, like http://localhost:8080/location-reports?xmin=2022-02-21&xmax=2023-02-21&loc=USA&selected=BQ.1.1&selected=XBB.1
  • This doesn't seem to be fixed.

The maps on both are still issues as we discussed on Slack, but that will require an API update. Thanks!

@flaneuse
Copy link
Collaborator

On the default page load, the min_date and max_date parameters aren't being set, so all the data is loading for all time. max_date should be today, and min_date should be today - 6 months.

When you load http://localhost:8080/location-reports?loc=USA, the min_date and max_date are still unset for the API calls

If you load a page with a specified date range, it doesn't read from the parameters, like http://localhost:8080/location-reports?xmin=2022-02-21&xmax=2023-02-21&loc=USA&selected=BQ.1.1&selected=XBB.1

This doesn't seem to be fixed.

If I'm missing something, please let me know. Thanks.

@olekkorob
Copy link
Contributor Author

Only in location-reports, they are not working?

@flaneuse
Copy link
Collaborator

Yes, just in location reports.

@olekkorob
Copy link
Contributor Author

Got it. Thank you.

@olekkorob
Copy link
Contributor Author

olekkorob commented Mar 23, 2023

If you load a page with a specified date range, it doesn't read from the parameters, like http://localhost:8080/location-reports?xmin=2022-02-21&xmax=2023-02-21&loc=USA&selected=BQ.1.1&selected=XBB.1

Could you explain about this? I didn't get it. If you can give me a example, it would be great.

@olekkorob
Copy link
Contributor Author

olekkorob commented Mar 23, 2023

Hi, @flaneuse , And could you please check if you can produce this error?
Sometimes I am getting such strange error when zoom in, but not always. I want to confirm you can get this error, too.

Just in location report page.

Lineage prevalence report zoom action is crashing page.

Screenshot_4

image

@flaneuse
Copy link
Collaborator

@olekkorob I don't get that error on zooming in on either the Location Report or Variant Report page with the latest pull from #633 -- not sure if that's more helpful or not!

@olekkorob
Copy link
Contributor Author

@olekkorob I don't get that error on zooming in on either the Location Report or Variant Report page with the latest pull from #633 -- not sure if that's more helpful or not!

Okay, thank you for checking it. It must be my local machine problem. Currently max_date and min_date should be set in initial loading. Did you check it?

@flaneuse
Copy link
Collaborator

It looks like it's setting the default to be the last 6 months in the API call, but it's not reading from the URL. If the URL is http://localhost:8080/location-reports?xmin=2023-01-16&xmax=2023-02-19&loc=USA

it should set min_date=2023-01-16 and max_date=2023-02-19 but instead it's using the last 6 months as the date in the API call (but then filtering later?)

Screenshot 2023-03-23 at 9 03 43 AM

@flaneuse
Copy link
Collaborator

@olekkorob I spoke too soon -- I was able to recreate the _ is not iterable error.

filtering http://localhost:8080/location-reports?loc=USA&pango=XBB.1.9.1&selected=XBB.1&selected=XBB.1.9.1

to
http://localhost:8080/location-reports?loc=USA&pango=XBB.1.9.1&selected=XBB.1&selected=XBB.1.9.1&xmin=2022-11-06&xmax=2022-12-07

triggers the error. i'm wondering if it happens if one of the selected lineages does not exist in that range? if you filter those lineages between Feb - March 2023, it's fine, but if you try to zoom in on Nov - Dec 2022 (when there's data for XBB.1 but not XBB.1.9.1), it throws the error. I think it's an issue with not having data to set the scale.

@olekkorob
Copy link
Contributor Author

@flaneuse , Yes, I think so. This must be fixed. Could you check if you can see that error in prod?

@flaneuse
Copy link
Collaborator

@olekkorob it's not an issue with prod (I assume since it's filtering the data on the front-end).

There are a few requests throwing 500s which might be worth checking:
https://api.outbreak.info/genomics/prevalence-by-location-all-lineages?location_id=USA&other_threshold=0.03&nday_threshold=5&ndays=60&max_date=2022-11-29&min_date=2022-11-12 -- this should resolve.

https://api.outbreak.info/genomics/prevalence-by-location?pangolin_lineage=XBB.1.9.1&location_id=USA&min_date=&max_date= -- this should have min/max date set too, not sure where it's being called.

@olekkorob
Copy link
Contributor Author

I will fix it soon. Thank you for taking time to check. That would be really helpful for me.

@olekkorob
Copy link
Contributor Author

@flaneuse , I updated again. Would you like to check again?

@olekkorob olekkorob closed this Mar 23, 2023
@olekkorob olekkorob reopened this Mar 23, 2023
@olekkorob
Copy link
Contributor Author

https://api.outbreak.info/genomics/prevalence-by-location?pangolin_lineage=XBB.1.9.1&location_id=USA&min_date=&max_date= -- this should have min/max date set too, not sure where it's being called.

This should be fixed right now, @flaneuse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants