6
6
# ' @export
7
7
# ' @importFrom rlang syms
8
8
make_target_param_grid <- function (param_grid ) {
9
- param_grid %> %
9
+ param_grid %< > %
10
10
select(- any_of(" parent_id" )) %> %
11
11
mutate(forecaster = syms(forecaster )) %> %
12
12
mutate(trainer = syms(trainer ))
@@ -25,7 +25,7 @@ make_target_param_grid <- function(param_grid) {
25
25
lists_of_real_values <- function (param_grid ) {
26
26
full_lists <- transpose(param_grid %> % select(- forecaster , - id ))
27
27
filter_nonvalues <- function (x ) {
28
- Filter(Negate( function (a ) is.null(a ) || is.na(a )), x )
28
+ Filter(function (a ) ! all( is.null(a )) && ! all( is.na(a )), x )
29
29
}
30
30
map(full_lists , filter_nonvalues )
31
31
}
@@ -35,11 +35,6 @@ lists_of_real_values <- function(param_grid) {
35
35
# ' Relies on the following globals:
36
36
# ' - `hhs_signal`
37
37
# ' - `chng_signal`
38
- # ' - `geo_type`
39
- # ' - `time_type`
40
- # ' - `geo_values`
41
- # ' - `time_values`
42
- # ' - `issues`
43
38
# ' - `fetch_args`
44
39
# '
45
40
# ' @export
@@ -51,10 +46,10 @@ make_data_targets <- function() {
51
46
epidatr :: pub_covidcast(
52
47
source = " hhs" ,
53
48
signals = hhs_signal ,
54
- geo_type = geo_type ,
55
- time_type = time_type ,
56
- geo_values = geo_values ,
57
- time_values = time_values ,
49
+ geo_type = " state " ,
50
+ time_type = " day " ,
51
+ geo_values = " * " ,
52
+ time_values = epirange( from = " 2020-01-01 " , to = " 2024-01-01 " ) ,
58
53
fetch_args = fetch_args
59
54
)
60
55
}
@@ -65,10 +60,10 @@ make_data_targets <- function() {
65
60
epidatr :: pub_covidcast(
66
61
source = " chng" ,
67
62
signals = chng_signal ,
68
- geo_type = geo_type ,
69
- time_type = time_type ,
70
- geo_values = geo_values ,
71
- time_values = time_values ,
63
+ geo_type = " state " ,
64
+ time_type = " day " ,
65
+ geo_values = " * " ,
66
+ time_values = epirange( from = " 2020-01-01 " , to = " 2024-01-01 " ) ,
72
67
fetch_args = fetch_args
73
68
)
74
69
}
@@ -86,15 +81,13 @@ make_data_targets <- function() {
86
81
tar_target(
87
82
name = hhs_latest_data_2022 ,
88
83
command = {
89
- hhs_latest_data %> %
90
- filter(time_value > = " 2022-01-01" )
84
+ hhs_latest_data # %>% filter(time_value >= "2022-01-01", time_value < "2022-04-01")
91
85
}
92
86
),
93
87
tar_target(
94
88
name = chng_latest_data_2022 ,
95
89
command = {
96
- chng_latest_data %> %
97
- filter(time_value > = " 2022-01-01" )
90
+ chng_latest_data # %>% filter(time_value >= "2022-01-01", time_value < "2022-04-01")
98
91
}
99
92
),
100
93
tar_target(
@@ -103,11 +96,11 @@ make_data_targets <- function() {
103
96
epidatr :: pub_covidcast(
104
97
source = " hhs" ,
105
98
signals = hhs_signal ,
106
- geo_type = geo_type ,
107
- time_type = time_type ,
108
- geo_values = geo_values ,
109
- time_values = time_values ,
110
- issues = issues ,
99
+ geo_type = " state " ,
100
+ time_type = " day " ,
101
+ geo_values = " * " ,
102
+ time_values = epirange( from = " 20220101 " , to = " 20220401 " ) ,
103
+ issues = " * " ,
111
104
fetch_args = fetch_args
112
105
)
113
106
}
@@ -118,11 +111,11 @@ make_data_targets <- function() {
118
111
epidatr :: pub_covidcast(
119
112
source = " chng" ,
120
113
signals = chng_signal ,
121
- geo_type = geo_type ,
122
- time_type = time_type ,
123
- geo_values = geo_values ,
124
- time_values = time_values ,
125
- issues = issues ,
114
+ geo_type = " state " ,
115
+ time_type = " day " ,
116
+ geo_values = " * " ,
117
+ time_values = epirange( from = " 20220101 " , to = " 20220401 " ) ,
118
+ issues = " * " ,
126
119
fetch_args = fetch_args
127
120
)
128
121
}
@@ -135,17 +128,17 @@ make_data_targets <- function() {
135
128
rename(" hhs" : = value ) %> %
136
129
rename(version = issue ) %> %
137
130
as_epi_archive(
138
- geo_type = geo_type ,
139
- time_type = time_type ,
131
+ geo_type = " state " ,
132
+ time_type = " day " ,
140
133
compactify = TRUE
141
134
)
142
135
chng_archive_data_2022 %<> %
143
136
select(geo_value , time_value , value , issue ) %> %
144
137
rename(" chng" : = value ) %> %
145
138
rename(version = issue ) %> %
146
139
as_epi_archive(
147
- geo_type = geo_type ,
148
- time_type = time_type ,
140
+ geo_type = " state " ,
141
+ time_type = " day " ,
149
142
compactify = TRUE
150
143
)
151
144
epix_merge(hhs_archive_data_2022 , chng_archive_data_2022 , sync = " locf" )$ DT %> %
0 commit comments