|
| 1 | +library(epidatr) |
| 2 | +library(dplyr) |
| 3 | + |
| 4 | +signals <- c( |
| 5 | + #"covid_ag_raw_pct_positive", #"county", "state" |
| 6 | + #"covid_ag_raw_pct_positive_age_0_4", #"county", "state" |
| 7 | + #"covid_ag_smoothed_pct_positive", #"county", "state" |
| 8 | + #"covid_ag_smoothed_pct_positive_age_0_4", #"county", "state" |
| 9 | + #"covid_ag_smoothed_pct_positive_age_18_49" #"county", "state" |
| 10 | + #"covid_ag_smoothed_pct_positive_age_65plus" #"county", "state" |
| 11 | + |
| 12 | + |
| 13 | + "covid_ag_raw_pct_positive", #"hrr", "msa", "hhs", "nation" |
| 14 | + "covid_ag_smoothed_pct_positive" #"hrr", "msa", "hhs", "nation" |
| 15 | + |
| 16 | + #"raw_pct_negative", #FLU |
| 17 | + #"raw_tests_per_device", #FLU |
| 18 | + #"smoothed_pct_negative", #FLU |
| 19 | + #"smoothed_tests_per_device" #FLU |
| 20 | +) |
| 21 | +names(signals) <- signals |
| 22 | +lapply(signals, function(signal) { |
| 23 | + source <- "quidel" |
| 24 | + signal <- signals |
| 25 | + geo_type <- "msa" #"county", "state", "hrr", "msa", "hhs", "nation" |
| 26 | + time_type <- "day" |
| 27 | + |
| 28 | + print(signal) |
| 29 | + print(geo_type) |
| 30 | + |
| 31 | + epidata <- pub_covidcast( |
| 32 | + source, |
| 33 | + signal, |
| 34 | + geo_type = geo_type, |
| 35 | + geo_values = "*", |
| 36 | + time_type = time_type, |
| 37 | + time_values = c( |
| 38 | + "2021-03-01", |
| 39 | + "2021-03-02", |
| 40 | + "2021-03-03", |
| 41 | + "2021-03-04", |
| 42 | + "2021-03-05", |
| 43 | + "2021-03-06", |
| 44 | + "2021-03-07", |
| 45 | + "2021-03-08", |
| 46 | + "2021-03-09", |
| 47 | + "2021-03-10", |
| 48 | + "2021-03-11", |
| 49 | + "2021-03-12", |
| 50 | + "2021-03-13", |
| 51 | + "2021-03-14", |
| 52 | + "2021-03-15", |
| 53 | + "2021-03-16", |
| 54 | + "2021-03-17", |
| 55 | + "2021-03-18", |
| 56 | + "2021-03-19", |
| 57 | + "2021-03-20", |
| 58 | + "2021-03-21", |
| 59 | + "2021-03-22", |
| 60 | + "2021-03-23", |
| 61 | + "2021-03-24", |
| 62 | + "2021-03-25", |
| 63 | + "2021-03-26", |
| 64 | + "2021-03-27", |
| 65 | + "2021-03-28", |
| 66 | + "2021-03-29", |
| 67 | + "2021-03-30" |
| 68 | + ) |
| 69 | + ) |
| 70 | + |
| 71 | + # Number of locations reported for each reference date |
| 72 | + count_geos_by_date <- count(epidata, time_value) |
| 73 | + # print(count_geos_by_date) |
| 74 | + print(max(count_geos_by_date$n) / 3143 * 100) |
| 75 | + print(mean(count_geos_by_date$n) / 3143 * 100) |
| 76 | + |
| 77 | + return(max(count_geos_by_date$n) / 3143 * 100) |
| 78 | + |
| 79 | +}) |
| 80 | + |
| 81 | +####################################### geo_type = "county" |
| 82 | +# covid_ag_raw_pct_positive |
| 83 | +# "covid_ag_raw_pct_positive" |
| 84 | +# covid_ag_raw_pct_positive_age_0_4 |
| 85 | +# "covid_ag_raw_pct_positive_age_0_4" |
| 86 | +# covid_ag_smoothed_pct_positive |
| 87 | +# "covid_ag_smoothed_pct_positive" |
| 88 | +# covid_ag_smoothed_pct_positive_age_0_4 |
| 89 | +# "covid_ag_smoothed_pct_positive_age_0_4" |
| 90 | +# covid_ag_smoothed_pct_positive_age_18_49 |
| 91 | +# "covid_ag_smoothed_pct_positive_age_18_49" |
| 92 | +# [1] "county" |
| 93 | +# [1] 76.32835 |
| 94 | +# [1] 72.70973 |
| 95 | +# covid_ag_raw_pct_positive |
| 96 | +# "covid_ag_raw_pct_positive" |
| 97 | +# covid_ag_raw_pct_positive_age_0_4 |
| 98 | +# "covid_ag_raw_pct_positive_age_0_4" |
| 99 | +# covid_ag_smoothed_pct_positive |
| 100 | +# "covid_ag_smoothed_pct_positive" |
| 101 | +# covid_ag_smoothed_pct_positive_age_0_4 |
| 102 | +# "covid_ag_smoothed_pct_positive_age_0_4" |
| 103 | +# covid_ag_smoothed_pct_positive_age_18_49 |
| 104 | +# "covid_ag_smoothed_pct_positive_age_18_49" |
| 105 | +# [1] "county" |
| 106 | +# [1] 76.32835 |
| 107 | +# [1] 72.70973 |
| 108 | +# covid_ag_raw_pct_positive |
| 109 | +# "covid_ag_raw_pct_positive" |
| 110 | +# covid_ag_raw_pct_positive_age_0_4 |
| 111 | +# "covid_ag_raw_pct_positive_age_0_4" |
| 112 | +# covid_ag_smoothed_pct_positive |
| 113 | +# "covid_ag_smoothed_pct_positive" |
| 114 | +# covid_ag_smoothed_pct_positive_age_0_4 |
| 115 | +# "covid_ag_smoothed_pct_positive_age_0_4" |
| 116 | +# covid_ag_smoothed_pct_positive_age_18_49 |
| 117 | +# "covid_ag_smoothed_pct_positive_age_18_49" |
| 118 | +# [1] "county" |
| 119 | +# [1] 76.32835 |
| 120 | +# [1] 72.70973 |
| 121 | +# covid_ag_raw_pct_positive |
| 122 | +# "covid_ag_raw_pct_positive" |
| 123 | +# covid_ag_raw_pct_positive_age_0_4 |
| 124 | +# "covid_ag_raw_pct_positive_age_0_4" |
| 125 | +# covid_ag_smoothed_pct_positive |
| 126 | +# "covid_ag_smoothed_pct_positive" |
| 127 | +# covid_ag_smoothed_pct_positive_age_0_4 |
| 128 | +# "covid_ag_smoothed_pct_positive_age_0_4" |
| 129 | +# covid_ag_smoothed_pct_positive_age_18_49 |
| 130 | +# "covid_ag_smoothed_pct_positive_age_18_49" |
| 131 | +# [1] "county" |
| 132 | +# [1] 76.32835 |
| 133 | +# [1] 72.70973 |
| 134 | +# covid_ag_raw_pct_positive |
| 135 | +# "covid_ag_raw_pct_positive" |
| 136 | +# covid_ag_raw_pct_positive_age_0_4 |
| 137 | +# "covid_ag_raw_pct_positive_age_0_4" |
| 138 | +# covid_ag_smoothed_pct_positive |
| 139 | +# "covid_ag_smoothed_pct_positive" |
| 140 | +# covid_ag_smoothed_pct_positive_age_0_4 |
| 141 | +# "covid_ag_smoothed_pct_positive_age_0_4" |
| 142 | +# covid_ag_smoothed_pct_positive_age_18_49 |
| 143 | +# "covid_ag_smoothed_pct_positive_age_18_49" |
| 144 | +# [1] "county" |
| 145 | +# [1] 76.32835 |
| 146 | +# [1] 72.70973 |
| 147 | +# $covid_ag_raw_pct_positive |
| 148 | +# [1] 76.32835 |
| 149 | +# |
| 150 | +# $covid_ag_raw_pct_positive_age_0_4 |
| 151 | +# [1] 76.32835 |
| 152 | +# |
| 153 | +# $covid_ag_smoothed_pct_positive |
| 154 | +# [1] 76.32835 |
| 155 | +# |
| 156 | +# $covid_ag_smoothed_pct_positive_age_0_4 |
| 157 | +# [1] 76.32835 |
| 158 | +# |
| 159 | +# $covid_ag_smoothed_pct_positive_age_18_49 |
| 160 | +# [1] 76.32835 |
| 161 | + |
| 162 | + |
| 163 | + |
| 164 | +####################################### geo_type = "state" |
| 165 | +# covid_ag_raw_pct_positive |
| 166 | +# "covid_ag_raw_pct_positive" |
| 167 | +# covid_ag_raw_pct_positive_age_0_4 |
| 168 | +# "covid_ag_raw_pct_positive_age_0_4" |
| 169 | +# covid_ag_smoothed_pct_positive |
| 170 | +# "covid_ag_smoothed_pct_positive" |
| 171 | +# covid_ag_smoothed_pct_positive_age_0_4 |
| 172 | +# "covid_ag_smoothed_pct_positive_age_0_4" |
| 173 | +# covid_ag_smoothed_pct_positive_age_18_49 |
| 174 | +# "covid_ag_smoothed_pct_positive_age_18_49" |
| 175 | +# [1] "state" |
| 176 | +# [1] 6.04518 |
| 177 | +# [1] 5.738679 |
| 178 | +# covid_ag_raw_pct_positive |
| 179 | +# "covid_ag_raw_pct_positive" |
| 180 | +# covid_ag_raw_pct_positive_age_0_4 |
| 181 | +# "covid_ag_raw_pct_positive_age_0_4" |
| 182 | +# covid_ag_smoothed_pct_positive |
| 183 | +# "covid_ag_smoothed_pct_positive" |
| 184 | +# covid_ag_smoothed_pct_positive_age_0_4 |
| 185 | +# "covid_ag_smoothed_pct_positive_age_0_4" |
| 186 | +# covid_ag_smoothed_pct_positive_age_18_49 |
| 187 | +# "covid_ag_smoothed_pct_positive_age_18_49" |
| 188 | +# [1] "state" |
| 189 | +# [1] 6.04518 |
| 190 | +# [1] 5.738679 |
| 191 | +# covid_ag_raw_pct_positive |
| 192 | +# "covid_ag_raw_pct_positive" |
| 193 | +# covid_ag_raw_pct_positive_age_0_4 |
| 194 | +# "covid_ag_raw_pct_positive_age_0_4" |
| 195 | +# covid_ag_smoothed_pct_positive |
| 196 | +# "covid_ag_smoothed_pct_positive" |
| 197 | +# covid_ag_smoothed_pct_positive_age_0_4 |
| 198 | +# "covid_ag_smoothed_pct_positive_age_0_4" |
| 199 | +# covid_ag_smoothed_pct_positive_age_18_49 |
| 200 | +# "covid_ag_smoothed_pct_positive_age_18_49" |
| 201 | +# [1] "state" |
| 202 | +# [1] 6.04518 |
| 203 | +# [1] 5.738679 |
| 204 | +# covid_ag_raw_pct_positive |
| 205 | +# "covid_ag_raw_pct_positive" |
| 206 | +# covid_ag_raw_pct_positive_age_0_4 |
| 207 | +# "covid_ag_raw_pct_positive_age_0_4" |
| 208 | +# covid_ag_smoothed_pct_positive |
| 209 | +# "covid_ag_smoothed_pct_positive" |
| 210 | +# covid_ag_smoothed_pct_positive_age_0_4 |
| 211 | +# "covid_ag_smoothed_pct_positive_age_0_4" |
| 212 | +# covid_ag_smoothed_pct_positive_age_18_49 |
| 213 | +# "covid_ag_smoothed_pct_positive_age_18_49" |
| 214 | +# [1] "state" |
| 215 | +# [1] 6.04518 |
| 216 | +# [1] 5.738679 |
| 217 | +# covid_ag_raw_pct_positive |
| 218 | +# "covid_ag_raw_pct_positive" |
| 219 | +# covid_ag_raw_pct_positive_age_0_4 |
| 220 | +# "covid_ag_raw_pct_positive_age_0_4" |
| 221 | +# covid_ag_smoothed_pct_positive |
| 222 | +# "covid_ag_smoothed_pct_positive" |
| 223 | +# covid_ag_smoothed_pct_positive_age_0_4 |
| 224 | +# "covid_ag_smoothed_pct_positive_age_0_4" |
| 225 | +# covid_ag_smoothed_pct_positive_age_18_49 |
| 226 | +# "covid_ag_smoothed_pct_positive_age_18_49" |
| 227 | +# [1] "state" |
| 228 | +# [1] 6.04518 |
| 229 | +# [1] 5.738679 |
| 230 | +# $covid_ag_raw_pct_positive |
| 231 | +# [1] 6.04518 |
| 232 | +# |
| 233 | +# $covid_ag_raw_pct_positive_age_0_4 |
| 234 | +# [1] 6.04518 |
| 235 | +# |
| 236 | +# $covid_ag_smoothed_pct_positive |
| 237 | +# [1] 6.04518 |
| 238 | +# |
| 239 | +# $covid_ag_smoothed_pct_positive_age_0_4 |
| 240 | +# [1] 6.04518 |
| 241 | +# |
| 242 | +# $covid_ag_smoothed_pct_positive_age_18_49 |
| 243 | +# [1] 6.04518 |
| 244 | + |
| 245 | +####################################### geo_type = "state" |
| 246 | + |
0 commit comments