signaturescience / fiphde

Forecasting Influenza in Support of Public Health Decision Making
https://signaturescience.github.io/fiphde/
GNU General Public License v3.0
3 stars 1 forks source link

archive ilinearby data, make unexported package data fixes #161 #165

Closed stephenturner closed 1 year ago

stephenturner commented 1 year ago

fixes #161

data saved as a csv in data-raw and as unexported package data (ilinearby).

Note we have data covering the critical window between where ilinet starts and ilinearby ends (right hand side of the plot, overlapping green tiles).

Showing the first cut at this in fd636f5:

library(tidyverse)
library(fiphde)

ilidat <- get_cdc_ili(region="state")

ilidat %>% 
  filter(abbreviation=="FL") %>% 
  left_join(fiphde:::ilinearby) %>% 
  select(week_start, weighted_ili, weighted_ili_now) %>% 
  mutate(across(starts_with("weighted_"), ~!is.na(.))) %>% 
  gather(ilisource, hasdata, -week_start) %>% 
  ggplot(aes(week_start, ilisource)) + geom_tile(aes(fill=hasdata)) + 
  theme_bw() +
  theme(legend.position = "bottom", 
        panel.spacing = margin(2, 2, 2, 2, "cm"),
        # legend.title = element_blank(), 
        panel.grid = element_blank(), 
        panel.border = element_blank(), 
        axis.ticks = element_blank()) +
  guides(fill=guide_legend(nrow=1,byrow=TRUE)) + 
  labs(x = NULL, y = NULL, title="Florida", fill="Has data?") + 
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

image

If you look closely enough, you'll see we still have that that weird thing happening at 2020:53

We dealt with this with a quick "impute" method in the function:

https://github.com/signaturescience/fiphde/blob/87c8d97c607c93c3ff47f3727056df597bf5505c/R/utils.R#L108-L113

I dealt with this in generate_sysdata in 83e179eea097c92f8e2390662aad0f660d665d40.

Now we have complete data for FL going back to ~2011.

image

stephenturner commented 1 year ago

@vpnagraj check that you like the thing I did in that last commit described above. I'd rather do this once here than try to remember to do this median imputation whenever we do this in a submission script after #159

── R CMD check results ───────────────────────────────────────────────────────────────── fiphde 0.3.4 ────
Duration: 41.6s

0 errors ✔ | 0 warnings ✔ | 0 notes ✔

R CMD check succeeded
vpnagraj commented 1 year ago

looks great!