Skip to content

Commit 867ef32

Browse files
committed
feat: add flu hosp explore pipeline
1 parent 9da2783 commit 867ef32

File tree

5 files changed

+396
-275
lines changed

5 files changed

+396
-275
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
tmp/
55
extras/**.html
66
*.pdf
7+
.Renviron

covid_hosp_explore/data_targets.R

Lines changed: 110 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,115 @@
1-
data_targets <- local({
2-
geo_type <- "state"
3-
time_type <- "day"
4-
geo_values <- "*"
5-
time_values <- epidatr::epirange(from = "2020-01-01", to = "2024-01-01")
6-
fetch_args <- fetch_args_list(return_empty = TRUE, timeout_seconds = 200)
7-
issues <- "*"
1+
geo_type <- "state"
2+
time_type <- "day"
3+
geo_values <- "*"
4+
time_values <- epidatr::epirange(from = "2020-01-01", to = "2024-01-01")
5+
fetch_args <- epidatr::fetch_args_list(return_empty = TRUE, timeout_seconds = 200)
6+
issues <- "*"
87

9-
list(
10-
tar_target(
11-
name = hhs_latest_data,
12-
command = {
13-
epidatr::pub_covidcast(
14-
source = "hhs",
15-
signals = "confirmed_admissions_covid_1d",
16-
geo_type = geo_type,
17-
time_type = time_type,
18-
geo_values = geo_values,
19-
time_values = time_values,
20-
fetch_args = fetch_args
8+
data_targets <- list(
9+
tar_target(
10+
name = hhs_latest_data,
11+
command = {
12+
epidatr::pub_covidcast(
13+
source = "hhs",
14+
signals = "confirmed_admissions_covid_1d",
15+
geo_type = geo_type,
16+
time_type = time_type,
17+
geo_values = geo_values,
18+
time_values = time_values,
19+
fetch_args = fetch_args
20+
)
21+
}
22+
),
23+
tar_target(
24+
name = chng_latest_data,
25+
command = {
26+
epidatr::pub_covidcast(
27+
source = "chng",
28+
signals = "smoothed_adj_outpatient_covid",
29+
geo_type = geo_type,
30+
time_type = time_type,
31+
geo_values = geo_values,
32+
time_values = time_values,
33+
fetch_args = fetch_args
34+
)
35+
}
36+
),
37+
tar_target(
38+
name = hhs_evaluation_data,
39+
command = {
40+
hhs_latest_data %>%
41+
rename(
42+
actual = value,
43+
target_end_date = time_value
2144
)
22-
}
23-
),
24-
tar_target(
25-
name = chng_latest_data,
26-
command = {
27-
epidatr::pub_covidcast(
28-
source = "chng",
29-
signals = "smoothed_adj_outpatient_covid",
30-
geo_type = geo_type,
31-
time_type = time_type,
32-
geo_values = geo_values,
33-
time_values = time_values,
34-
fetch_args = fetch_args
45+
}
46+
),
47+
tar_target(
48+
name = hhs_latest_data_2022,
49+
command = {
50+
hhs_latest_data %>%
51+
filter(time_value >= "2022-01-01")
52+
}
53+
),
54+
tar_target(
55+
name = chng_latest_data_2022,
56+
command = {
57+
chng_latest_data %>%
58+
filter(time_value >= "2022-01-01")
59+
}
60+
),
61+
tar_target(
62+
name = hhs_archive_data_2022,
63+
command = {
64+
epidatr::pub_covidcast(
65+
source = "hhs",
66+
signals = "confirmed_admissions_covid_1d",
67+
geo_type = geo_type,
68+
time_type = time_type,
69+
geo_values = geo_values,
70+
time_values = time_values,
71+
issues = "*",
72+
fetch_args = fetch_args
73+
)
74+
}
75+
),
76+
tar_target(
77+
name = chng_archive_data_2022,
78+
command = {
79+
epidatr::pub_covidcast(
80+
source = "chng",
81+
signals = "smoothed_adj_outpatient_covid",
82+
geo_type = geo_type,
83+
time_type = time_type,
84+
geo_values = geo_values,
85+
time_values = time_values,
86+
issues = "*",
87+
fetch_args = fetch_args
88+
)
89+
}
90+
),
91+
tar_target(
92+
name = joined_archive_data_2022,
93+
command = {
94+
hhs_archive_data_2022 %<>%
95+
select(geo_value, time_value, value, issue) %>%
96+
rename("hhs" := value) %>%
97+
rename(version = issue) %>%
98+
as_epi_archive(
99+
geo_type = "state",
100+
time_type = "day",
101+
compactify = TRUE
35102
)
36-
}
37-
),
38-
tar_target(
39-
name = hhs_evaluation_data,
40-
command = {
41-
hhs_latest_data %>%
42-
rename(
43-
actual = value,
44-
target_end_date = time_value
45-
)
46-
}
47-
),
48-
tar_target(
49-
name = hhs_latest_data_2022,
50-
command = {
51-
hhs_latest_data %>%
52-
filter(time_value >= "2022-01-01")
53-
}
54-
),
55-
tar_target(
56-
name = chng_latest_data_2022,
57-
command = {
58-
chng_latest_data %>%
59-
filter(time_value >= "2022-01-01")
60-
}
61-
),
62-
tar_target(
63-
name = hhs_archive_data_2022,
64-
command = {
65-
epidatr::pub_covidcast(
66-
source = "hhs",
67-
signals = "confirmed_admissions_covid_1d",
68-
geo_type = geo_type,
69-
time_type = time_type,
70-
geo_values = geo_values,
71-
time_values = time_values,
72-
issues = "*",
73-
fetch_args = fetch_args
103+
chng_archive_data_2022 %<>%
104+
select(geo_value, time_value, value, issue) %>%
105+
rename("chng" := value) %>%
106+
rename(version = issue) %>%
107+
as_epi_archive(
108+
geo_type = "state",
109+
time_type = "day",
110+
compactify = TRUE
74111
)
75-
}
76-
),
77-
tar_target(
78-
name = chng_archive_data_2022,
79-
command = {
80-
epidatr::pub_covidcast(
81-
source = "chng",
82-
signals = "smoothed_adj_outpatient_covid",
83-
geo_type = geo_type,
84-
time_type = time_type,
85-
geo_values = geo_values,
86-
time_values = time_values,
87-
issues = "*",
88-
fetch_args = fetch_args
89-
)
90-
}
91-
),
92-
tar_target(
93-
name = joined_archive_data_2022,
94-
command = {
95-
hhs_archive_data_2022 %<>%
96-
select(geo_value, time_value, value, issue) %>%
97-
rename("hhs" := value) %>%
98-
rename(version = issue) %>%
99-
as_epi_archive(
100-
geo_type = "state",
101-
time_type = "day",
102-
compactify = TRUE
103-
)
104-
chng_archive_data_2022 %<>%
105-
select(geo_value, time_value, value, issue) %>%
106-
rename("chng" := value) %>%
107-
rename(version = issue) %>%
108-
as_epi_archive(
109-
geo_type = "state",
110-
time_type = "day",
111-
compactify = TRUE
112-
)
113-
epix_merge(hhs_archive_data_2022, chng_archive_data_2022, sync = "locf")
114-
}
115-
)
112+
epix_merge(hhs_archive_data_2022, chng_archive_data_2022, sync = "locf")
113+
}
116114
)
117-
})
115+
)

0 commit comments

Comments
 (0)