Skip to content

Conversation

sgratzl
Copy link
Member

@sgratzl sgratzl commented Jun 23, 2021

my approach on #117

image

Allows to download the current filtered/selected data frame as CSV file with a progress handler

Moreover, it automatically removes some trailing white space and I extracted the export logic to its own file

@sgratzl sgratzl added the enhancement New feature or request label Jun 23, 2021
@sgratzl sgratzl requested a review from kateharwood June 23, 2021 19:56
@sgratzl sgratzl self-assigned this Jun 23, 2021
@kateharwood
Copy link
Contributor

Thanks Sam! Maybe you can give a quick demo at the viz meeting tomorrow?

filter(ahead %in% horizon) %>%
filter(forecaster %in% forecasters)
if (loc != TOTAL_LOCATIONS) {
scoreDf = scoreDf %>% filter(geo_value == tolower(loc))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should include somewhere what locations are included when the user has selected total locations (not all of the locations are included - it is based on what forecasters are selected and which locations they have in common). But maybe that is not necessary...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this information currently shown in the user interface?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it is shown at the bottom like this:
Screen Shot 2021-06-30 at 12 42 30 PM

@sgratzl
Copy link
Member Author

sgratzl commented Jun 24, 2021

Thanks Sam! Maybe you can give a quick demo at the viz meeting tomorrow?

what do you mean? you press the button, you get the CSV.

filter(signal == signalFilter) %>%
filter(ahead %in% horizon) %>%
filter(forecaster %in% forecasters)
if (loc != TOTAL_LOCATIONS) {
Copy link
Contributor

@kateharwood kateharwood Jun 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that if loc == TOTAL_LOCATIONS, this download actually includes all locations. The downloaded file (with just the initial selections on app load selected) included AS, although it technically shouldn't since the baseline nor ensemble forecasters have data for that. It also technically shouldn't include the US, since that is not included in the plot either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is probably a cleaner way of doing it, but this is what I did in the app to find and reduce by the locations that all forecasters have data for:

      locationDf = filteredScoreDf %>% group_by(Forecaster, Week_End_Date, ahead) %>%
        summarize(location_list = paste(sort(unique(geo_value)),collapse=","))

      # Create a list containing each row's location list
      locationList = sapply(locationDf$location_list, function(x) strsplit(x, ","))
      locationList = lapply(locationList, function(x) x[x != 'us'])

      # Get the intersection of all the locations in these lists
      locationsIntersect = unique(Reduce(intersect, locationList))
      filteredScoreDf = filteredScoreDf %>% filter(geo_value %in% locationsIntersect)```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also now that I am adding hospitalizations which require even more data preprocessing (because of the difference in how the aheads work) this export function will probably need even more adjustments and require more decisions of what we actually want to show (the raw data vs the processed/filtered data that is shown in the plot). I can bring this up in our next meeting to get thoughts on what we want users to download.

@sgratzl
Copy link
Member Author

sgratzl commented Jul 20, 2021

superseded by #143

@sgratzl sgratzl closed this Jul 20, 2021
@sgratzl sgratzl deleted the sgratzl/exportscores branch October 1, 2021 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants