Skip to content

Commit e24be81

Browse files
authored
FIX: add additional columns (#214)
* rename with additional columns * add cols to test * fix partial matching * update versions * fix ascii error
1 parent 0410aba commit e24be81

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: tidyhydat
22
Title: Extract and Tidy Canadian 'Hydrometric' Data
3-
Version: 0.7.0
3+
Version: 0.7.0.9999
44
Authors@R: c(person("Sam", "Albers", email = "sam.albers@gmail.com", role = c("aut", "cre"),
55
comment = c(ORCID = "0000-0002-9270-7884")),
66
person("David", "Hutchinson", email = "david.hutchinson@canada.ca", role = "ctb"),

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# tidyhydat 0.7.0.9999
2+
- add columns added by a webservice update (#213)
3+
- fix some partial matching in `realtime_add_local_datetime` internals
4+
15
# tidyhydat 0.7.0
26
- bump minimum R version to 4.2.0
37
- dropped httr in favour of httr2

R/realtime-webservice.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,16 @@ realtime_ws <- function(station_number,
167167
}
168168

169169
## Rename columns to reflect tidyhydat naming
170-
colnames(csv_df) <- c("STATION_NUMBER", "Date", "Parameter", "Value", "Grade", "Symbol", "Approval")
170+
csv_df = dplyr::rename(csv_df,
171+
STATION_NUMBER = ID,
172+
Parameter = "Parameter/Param\u00e8tre",
173+
Value = "Value/Valeur",
174+
Qualifier = "Qualifier/Qualificatif",
175+
Symbol = "Symbol/Symbole",
176+
Approval = "Approval/Approbation",
177+
Grade = "Grade/Classification" ,
178+
Qualifiers = "Qualifiers/Qualificatifs"
179+
)
171180

172181
csv_df <- dplyr::left_join(
173182
csv_df,
@@ -176,7 +185,7 @@ realtime_ws <- function(station_number,
176185
)
177186
csv_df <- dplyr::select(
178187
csv_df, STATION_NUMBER, Date, Name_En, Value, Unit,
179-
Grade, Symbol, Approval, Parameter, Code
188+
Grade, Symbol, Approval, Parameter, Code, Qualifier, Qualifiers
180189
)
181190

182191
## What stations were missed?

R/realtime.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ realtime_add_local_datetime <- function(.data, set_tz = NULL) {
167167
tz_used <- set_tz
168168
}
169169

170-
timezone_data$local_datetime <- lubridate::with_tz(timezone_data$Date, tz = tz_used)
170+
timezone_data$local_datetime <- lubridate::with_tz(timezone_data$Date, tzone = tz_used)
171171

172172
timezone_data$tz_used <- tz_used
173173

tests/testthat/test-realtime-webservice.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test_that("realtime_ws returns the correct data header", {
1212
colnames(ws_test),
1313
c(
1414
"STATION_NUMBER", "Date", "Name_En", "Value", "Unit", "Grade",
15-
"Symbol", "Approval", "Parameter", "Code"
15+
"Symbol", "Approval", "Parameter", "Code", "Qualifier", "Qualifiers"
1616
)
1717
)
1818

0 commit comments

Comments
 (0)