From 90553c5cb1669fc11c1856bb345845c9be45cebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Gavidia-Calder=C3=B3n?= Date: Tue, 10 Mar 2026 11:12:18 -0300 Subject: [PATCH 1/7] fix: test type more readable --- tests/testthat/test-cetesb_retrieve_met.R | 16 ++++----- tests/testthat/test-cetesb_retrieve_met_pol.R | 28 ++++++++-------- tests/testthat/test-cetesb_retrieve_param.R | 11 +++---- tests/testthat/test-cetesb_retrieve_pol.R | 20 +++++------ tests/testthat/test-monitor_ar_retrieve_met.R | 17 +++++----- .../test-monitor_ar_retrieve_met_pol.R | 29 ++++++++-------- .../testthat/test-monitor_ar_retrieve_param.R | 8 ++--- tests/testthat/test-monitor_ar_retrieve_pol.R | 33 ++++++++++++------- 8 files changed, 86 insertions(+), 76 deletions(-) diff --git a/tests/testthat/test-cetesb_retrieve_met.R b/tests/testthat/test-cetesb_retrieve_met.R index 19cdd6f..ae5a51e 100644 --- a/tests/testthat/test-cetesb_retrieve_met.R +++ b/tests/testthat/test-cetesb_retrieve_met.R @@ -18,12 +18,12 @@ test_that("cetesb_retrieve_met works!", { expect_equal(param_means["wd"] > 238, param_means["wd"] < 239) # Testing data.frame classes - expect_equal(TRUE, "data.frame" %in% class(pin_met)) - expect_equal(TRUE, "character" %in% class(pin_met$aqs)) - expect_equal(TRUE, "POSIXct" %in% class(pin_met$date)) - expect_equal(TRUE, "numeric" %in% class(pin_met$tc)) - expect_equal(TRUE, "numeric" %in% class(pin_met$rh)) - expect_equal(TRUE, "numeric" %in% class(pin_met$ws)) - expect_equal(TRUE, "numeric" %in% class(pin_met$wd)) - expect_equal(TRUE, "numeric" %in% class(pin_met$p)) + expect_s3_class(pin_met, "data.frame") + expect_type(pin_met$aqs, "character") + expect_s3_class(pin_met$date, "POSIXct") + expect_type(pin_met$tc, "double") + expect_type(pin_met$rh, "double") + expect_type(pin_met$ws, "double") + expect_type(pin_met$wd, "double") + expect_type(pin_met$p, "double") }) diff --git a/tests/testthat/test-cetesb_retrieve_met_pol.R b/tests/testthat/test-cetesb_retrieve_met_pol.R index bba4d34..79c64e7 100644 --- a/tests/testthat/test-cetesb_retrieve_met_pol.R +++ b/tests/testthat/test-cetesb_retrieve_met_pol.R @@ -25,18 +25,18 @@ test_that("cetesb_retrieve_met_pol works!", { expect_equal(param_means["pm25"] > 5, param_means["pm25"] < 7) # Testing data.frame classes - expect_equal(TRUE, "data.frame" %in% class(pinheiros)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$tc)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$rh)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$ws)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$wd)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$p)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$o3)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$no)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$no2)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$nox)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$co)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$pm10)) - expect_equal(TRUE, "numeric" %in% class(pinheiros$pm25)) - expect_equal(TRUE, "character" %in% class(pinheiros$aqs)) + expect_s3_class(pinheiros, "data.frame") + expect_type(pinheiros$tc, "double") + expect_type(pinheiros$rh, "double") + expect_type(pinheiros$ws, "double") + expect_type(pinheiros$wd, "double") + expect_type(pinheiros$p, "double") + expect_type(pinheiros$o3, "double") + expect_type(pinheiros$no, "double") + expect_type(pinheiros$no2, "double") + expect_type(pinheiros$nox, "double") + expect_type(pinheiros$co, "double") + expect_type(pinheiros$pm10, "double") + expect_type(pinheiros$pm25, "double") + expect_type(pinheiros$aqs, "character") }) diff --git a/tests/testthat/test-cetesb_retrieve_param.R b/tests/testthat/test-cetesb_retrieve_param.R index d955db9..3eaf6e1 100644 --- a/tests/testthat/test-cetesb_retrieve_param.R +++ b/tests/testthat/test-cetesb_retrieve_param.R @@ -26,10 +26,9 @@ test_that("cetesb_retrieve_param works!", { expect_equal(param_means["ws"] > 1, param_means["ws"] < 2) # Testing data.frame classes - expect_equal(TRUE, "data.frame" %in% class(pin_param)) - expect_equal(TRUE, "character" %in% class(pin_param$aqs)) - expect_equal(TRUE, "POSIXct" %in% class(pin_param$date)) - expect_equal(TRUE, "numeric" %in% class(pin_param$o3)) - expect_equal(TRUE, "numeric" %in% class(pin_param$nox)) - expect_equal(TRUE, "numeric" %in% class(pin_param$ws)) + expect_s3_class(pin_param, 'data.frame') + expect_type(pin_param$aqs, 'character') + expect_type(pin_param$o3, 'double') + expect_type(pin_param$nox, 'double') + expect_type(pin_param$ws, 'double') }) diff --git a/tests/testthat/test-cetesb_retrieve_pol.R b/tests/testthat/test-cetesb_retrieve_pol.R index 5fc57ae..88b271f 100644 --- a/tests/testthat/test-cetesb_retrieve_pol.R +++ b/tests/testthat/test-cetesb_retrieve_pol.R @@ -20,14 +20,14 @@ test_that("cetesb_retrieve_pol works!", { expect_equal(pol_means["pm25"] > 5, pol_means["pm25"] < 6) # Testing data.frame classes - expect_equal(TRUE, "data.frame" %in% class(pin_pol)) - expect_equal(TRUE, "POSIXct" %in% class(pin_pol$date)) - expect_equal(TRUE, "numeric" %in% class(pin_pol$o3)) - expect_equal(TRUE, "numeric" %in% class(pin_pol$no)) - expect_equal(TRUE, "numeric" %in% class(pin_pol$no2)) - expect_equal(TRUE, "numeric" %in% class(pin_pol$nox)) - expect_equal(TRUE, "numeric" %in% class(pin_pol$co)) - expect_equal(TRUE, "numeric" %in% class(pin_pol$pm10)) - expect_equal(TRUE, "numeric" %in% class(pin_pol$pm25)) - expect_equal(TRUE, "character" %in% class(pin_pol$aqs)) + expect_s3_class(pin_pol, 'data.frame') + expect_s3_class(pin_pol$date, 'POSIXct') + expect_type(pin_pol$o3, 'double') + expect_type(pin_pol$no, 'double') + expect_type(pin_pol$no2, 'double') + expect_type(pin_pol$nox, 'double') + expect_type(pin_pol$co, 'double') + expect_type(pin_pol$pm10, 'double') + expect_type(pin_pol$pm25, 'double') + expect_type(pin_pol$aqs, 'character') }) diff --git a/tests/testthat/test-monitor_ar_retrieve_met.R b/tests/testthat/test-monitor_ar_retrieve_met.R index b835345..7e43735 100644 --- a/tests/testthat/test-monitor_ar_retrieve_met.R +++ b/tests/testthat/test-monitor_ar_retrieve_met.R @@ -17,13 +17,12 @@ test_that("monitor_ar_retrieve_met works!", { expect_equal(met_means["p"] > 1007, met_means["p"] < 1008) # Testing data.frame classes - expect_equal(TRUE, "data.frame" %in% class(ca_met)) - expect_equal(TRUE, "character" %in% class(ca_met$aqs)) - expect_equal(TRUE, "POSIXct" %in% class(ca_met$date)) - expect_equal(TRUE, "numeric" %in% class(ca_met$tc)) - expect_equal(TRUE, "numeric" %in% class(ca_met$rh)) - expect_equal(TRUE, "numeric" %in% class(ca_met$ws)) - expect_equal(TRUE, "numeric" %in% class(ca_met$wd)) - expect_equal(TRUE, "numeric" %in% class(ca_met$p)) - + expect_s3_class(ca_met, 'data.frame') + expect_s3_class(ca_met$date, 'POSIXct') + expect_type(ca_met$tc, 'double') + expect_type(ca_met$rh, 'double') + expect_type(ca_met$ws, 'double') + expect_type(ca_met$wd, 'double') + expect_type(ca_met$p, 'double') + expect_type(ca_met$aqs, 'character') }) diff --git a/tests/testthat/test-monitor_ar_retrieve_met_pol.R b/tests/testthat/test-monitor_ar_retrieve_met_pol.R index 7fc8210..0c54e52 100644 --- a/tests/testthat/test-monitor_ar_retrieve_met_pol.R +++ b/tests/testthat/test-monitor_ar_retrieve_met_pol.R @@ -20,18 +20,19 @@ test_that("monitor_ar_retrieve_met_pol works!", { expect_equal(all_means["pm10"] > 22, all_means["pm10"] < 23) # Testing data.frame classes - expect_equal(TRUE, "data.frame" %in% class(ca_all)) - expect_equal(TRUE, "numeric" %in% class(ca_all$tc)) - expect_equal(TRUE, "numeric" %in% class(ca_all$rh)) - expect_equal(TRUE, "numeric" %in% class(ca_all$ws)) - expect_equal(TRUE, "numeric" %in% class(ca_all$wd)) - expect_equal(TRUE, "numeric" %in% class(ca_all$p)) - expect_equal(TRUE, "numeric" %in% class(ca_all$o3)) - expect_equal(TRUE, "numeric" %in% class(ca_all$no)) - expect_equal(TRUE, "numeric" %in% class(ca_all$no2)) - expect_equal(TRUE, "numeric" %in% class(ca_all$nox)) - expect_equal(TRUE, "numeric" %in% class(ca_all$co)) - expect_equal(TRUE, "numeric" %in% class(ca_all$pm10)) - expect_equal(TRUE, "numeric" %in% class(ca_all$pm25)) - expect_equal(TRUE, "character" %in% class(ca_all$aqs)) + expect_s3_class(ca_all, 'data.frame') + expect_s3_class(ca_all$date, 'POSIXct') + expect_type(ca_all$tc, 'double') + expect_type(ca_all$rh, 'double') + expect_type(ca_all$ws, 'double') + expect_type(ca_all$wd, 'double') + expect_type(ca_all$p, 'double') + expect_type(ca_all$o3, 'double') + expect_type(ca_all$no, 'double') + expect_type(ca_all$no2, 'double') + expect_type(ca_all$nox, 'double') + expect_type(ca_all$co, 'double') + expect_type(ca_all$pm10, 'double') + expect_type(ca_all$pm25, 'double') + expect_type(ca_all$aqs, 'character') }) diff --git a/tests/testthat/test-monitor_ar_retrieve_param.R b/tests/testthat/test-monitor_ar_retrieve_param.R index c57d334..80faff2 100644 --- a/tests/testthat/test-monitor_ar_retrieve_param.R +++ b/tests/testthat/test-monitor_ar_retrieve_param.R @@ -25,8 +25,8 @@ test_that("monitor_ar_retrieve works!", { expect_equal(o3_mean > 22, o3_mean < 23) # Testing data.frame classes - expect_equal(TRUE, "data.frame" %in% class(ca_o3)) - expect_equal(TRUE, "character" %in% class(ca_o3$aqs)) - expect_equal(TRUE, "POSIXct" %in% class(ca_o3$date)) - expect_equal(TRUE, "numeric" %in% class(ca_o3$o3)) + expect_s3_class(ca_o3, 'data.frame') + expect_s3_class(ca_o3$date, 'POSIXct') + expect_type(ca_o3$aqs, 'character') + expect_type(ca_o3$o3, 'double') }) diff --git a/tests/testthat/test-monitor_ar_retrieve_pol.R b/tests/testthat/test-monitor_ar_retrieve_pol.R index fdf610b..2d450b0 100644 --- a/tests/testthat/test-monitor_ar_retrieve_pol.R +++ b/tests/testthat/test-monitor_ar_retrieve_pol.R @@ -14,16 +14,27 @@ test_that("monitor_ar_retrieve_pol works!", { expect_equal(pol_means["co"] > 0.5, pol_means["co"] < 0.6) expect_equal(pol_means["pm10"] > 22, pol_means["pm10"] < 23) - # Testind data.frame classes - expect_equal(TRUE, "data.frame" %in% class(ca_pol)) - expect_equal(TRUE, "POSIXct" %in% class(ca_pol$date)) - expect_equal(TRUE, "numeric" %in% class(ca_pol$o3)) - expect_equal(TRUE, "numeric" %in% class(ca_pol$no)) - expect_equal(TRUE, "numeric" %in% class(ca_pol$no2)) - expect_equal(TRUE, "numeric" %in% class(ca_pol$nox)) - expect_equal(TRUE, "numeric" %in% class(ca_pol$co)) - expect_equal(TRUE, "numeric" %in% class(ca_pol$pm10)) - expect_equal(TRUE, "numeric" %in% class(ca_pol$pm25)) - expect_equal(TRUE, "character" %in% class(ca_pol$aqs)) + # Testing data.frame classes + expect_s3_class(ca_pol, 'data.frame') + expect_s3_class(ca_pol$date, 'POSIXct') + expect_type(ca_pol$o3, 'double') + expect_type(ca_pol$no, 'double') + expect_type(ca_pol$no2, 'double') + expect_type(ca_pol$nox, 'double') + expect_type(ca_pol$co, 'double') + expect_type(ca_pol$pm10, 'double') + expect_type(ca_pol$pm25, 'double') + expect_type(ca_pol$aqs, 'character') + + # expect_equal(TRUE, "data.frame" %in% class(ca_pol)) + # expect_equal(TRUE, "POSIXct" %in% class(ca_pol$date)) + # expect_equal(TRUE, "numeric" %in% class(ca_pol$o3)) + # expect_equal(TRUE, "numeric" %in% class(ca_pol$no)) + # expect_equal(TRUE, "numeric" %in% class(ca_pol$no2)) + # expect_equal(TRUE, "numeric" %in% class(ca_pol$nox)) + # expect_equal(TRUE, "numeric" %in% class(ca_pol$co)) + # expect_equal(TRUE, "numeric" %in% class(ca_pol$pm10)) + # expect_equal(TRUE, "numeric" %in% class(ca_pol$pm25)) + # expect_equal(TRUE, "character" %in% class(ca_pol$aqs)) }) From cac5ac996a45f0addfa1813402b18867a084bb3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Gavidia-Calder=C3=B3n?= Date: Tue, 10 Mar 2026 11:24:04 -0300 Subject: [PATCH 2/7] fix: monitor ar pm10 and wind test --- tests/testthat/test-monitor_ar_retrieve_met.R | 2 +- tests/testthat/test-monitor_ar_retrieve_met_pol.R | 2 +- tests/testthat/test-monitor_ar_retrieve_pol.R | 14 +------------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/tests/testthat/test-monitor_ar_retrieve_met.R b/tests/testthat/test-monitor_ar_retrieve_met.R index 7e43735..e61fb2c 100644 --- a/tests/testthat/test-monitor_ar_retrieve_met.R +++ b/tests/testthat/test-monitor_ar_retrieve_met.R @@ -13,7 +13,7 @@ test_that("monitor_ar_retrieve_met works!", { expect_equal(met_means["tc"] > 28, met_means["tc"] < 29) expect_equal(met_means["rh"] > 74, met_means["rh"] < 75) expect_equal(met_means["ws"] > 0.8, met_means["ws"] < 0.9) - expect_equal(met_means["wd"] > 157, met_means["wd"] < 158) + expect_equal(met_means["wd"] > 157, met_means["wd"] < 159) expect_equal(met_means["p"] > 1007, met_means["p"] < 1008) # Testing data.frame classes diff --git a/tests/testthat/test-monitor_ar_retrieve_met_pol.R b/tests/testthat/test-monitor_ar_retrieve_met_pol.R index 0c54e52..e90282a 100644 --- a/tests/testthat/test-monitor_ar_retrieve_met_pol.R +++ b/tests/testthat/test-monitor_ar_retrieve_met_pol.R @@ -17,7 +17,7 @@ test_that("monitor_ar_retrieve_met_pol works!", { expect_equal(all_means["p"] > 1007, all_means["p"] < 1008) expect_equal(all_means["o3"] > 33, all_means["o3"] < 35) expect_equal(all_means["co"] > 0.5, all_means["co"] < 0.6) - expect_equal(all_means["pm10"] > 22, all_means["pm10"] < 23) + expect_equal(all_means["pm10"] > 21, all_means["pm10"] < 23) # Testing data.frame classes expect_s3_class(ca_all, 'data.frame') diff --git a/tests/testthat/test-monitor_ar_retrieve_pol.R b/tests/testthat/test-monitor_ar_retrieve_pol.R index 2d450b0..27f2c94 100644 --- a/tests/testthat/test-monitor_ar_retrieve_pol.R +++ b/tests/testthat/test-monitor_ar_retrieve_pol.R @@ -12,7 +12,7 @@ test_that("monitor_ar_retrieve_pol works!", { pol_means<- colMeans(ca_pol[, 2:8], na.rm = TRUE) expect_equal(pol_means["o3"] > 33, pol_means["o3"] < 35) expect_equal(pol_means["co"] > 0.5, pol_means["co"] < 0.6) - expect_equal(pol_means["pm10"] > 22, pol_means["pm10"] < 23) + expect_equal(pol_means["pm10"] > 21, pol_means["pm10"] < 23) # Testing data.frame classes expect_s3_class(ca_pol, 'data.frame') @@ -25,16 +25,4 @@ test_that("monitor_ar_retrieve_pol works!", { expect_type(ca_pol$pm10, 'double') expect_type(ca_pol$pm25, 'double') expect_type(ca_pol$aqs, 'character') - - # expect_equal(TRUE, "data.frame" %in% class(ca_pol)) - # expect_equal(TRUE, "POSIXct" %in% class(ca_pol$date)) - # expect_equal(TRUE, "numeric" %in% class(ca_pol$o3)) - # expect_equal(TRUE, "numeric" %in% class(ca_pol$no)) - # expect_equal(TRUE, "numeric" %in% class(ca_pol$no2)) - # expect_equal(TRUE, "numeric" %in% class(ca_pol$nox)) - # expect_equal(TRUE, "numeric" %in% class(ca_pol$co)) - # expect_equal(TRUE, "numeric" %in% class(ca_pol$pm10)) - # expect_equal(TRUE, "numeric" %in% class(ca_pol$pm25)) - # expect_equal(TRUE, "character" %in% class(ca_pol$aqs)) - }) From 3a30adc0ff645d4c437e3c37124bbf5a9226e76c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Gavidia-Calder=C3=B3n?= Date: Tue, 10 Mar 2026 12:37:59 -0300 Subject: [PATCH 3/7] fix: using expect_lt expect_gt for checking values --- tests/testthat/test-cetesb_retrieve_met.R | 23 ++++--- tests/testthat/test-cetesb_retrieve_met_pol.R | 41 +++++++---- tests/testthat/test-cetesb_retrieve_param.R | 43 +++++++----- tests/testthat/test-cetesb_retrieve_pol.R | 52 ++++++++------ tests/testthat/test-monitor_ar_retrieve_met.R | 38 +++++----- .../test-monitor_ar_retrieve_met_pol.R | 69 +++++++++++-------- .../testthat/test-monitor_ar_retrieve_param.R | 40 ++++++----- tests/testthat/test-monitor_ar_retrieve_pol.R | 36 +++++----- 8 files changed, 200 insertions(+), 142 deletions(-) diff --git a/tests/testthat/test-cetesb_retrieve_met.R b/tests/testthat/test-cetesb_retrieve_met.R index ae5a51e..38ab609 100644 --- a/tests/testthat/test-cetesb_retrieve_met.R +++ b/tests/testthat/test-cetesb_retrieve_met.R @@ -1,21 +1,26 @@ test_that("cetesb_retrieve_met works!", { - load("sysdata.rda") - pin_met <- cetesb_retrieve_met(u,p,aqs_code = 99, - start_date = "01/01/2020", - end_date = "07/01/2020") + pin_met <- cetesb_retrieve_met(u, p, + aqs_code = 99, + start_date = "01/01/2020", + end_date = "07/01/2020" + ) # Testing data.frame dims expect_equal(ncol(pin_met), 7) expect_equal(nrow(pin_met), 169) # Testing data.frame values - param_means<- colMeans(pin_met[, 2:6], na.rm = TRUE) - expect_equal(param_means["tc"] > 23, param_means["tc"] < 24) - expect_equal(param_means["rh"] > 74, param_means["rh"] < 75) - expect_equal(param_means["ws"] > 1, param_means["ws"] < 2) - expect_equal(param_means["wd"] > 238, param_means["wd"] < 239) + param_means <- colMeans(pin_met[, 2:6], na.rm = TRUE) + expect_gt(param_means["tc"], 23) + expect_lt(param_means["tc"], 24) + expect_gt(param_means["rh"], 74) + expect_lt(param_means["rh"], 75) + expect_gt(param_means["ws"], 1) + expect_lt(param_means["ws"], 2) + expect_gt(param_means["wd"], 238) + expect_lt(param_means["wd"],239) # Testing data.frame classes expect_s3_class(pin_met, "data.frame") diff --git a/tests/testthat/test-cetesb_retrieve_met_pol.R b/tests/testthat/test-cetesb_retrieve_met_pol.R index 79c64e7..06d2124 100644 --- a/tests/testthat/test-cetesb_retrieve_met_pol.R +++ b/tests/testthat/test-cetesb_retrieve_met_pol.R @@ -1,28 +1,39 @@ test_that("cetesb_retrieve_met_pol works!", { - load("sysdata.rda") - pinheiros <- cetesb_retrieve_met_pol(u,p,aqs_code = 99, - start_date = "01/01/2020", - end_date = "07/01/2020") + pinheiros <- cetesb_retrieve_met_pol(u, p, + aqs_code = 99, + start_date = "01/01/2020", + end_date = "07/01/2020" + ) # Testing data.frame dims expect_equal(ncol(pinheiros), 14) expect_equal(nrow(pinheiros), 169) # Testing data.frame values - param_means<- colMeans(pinheiros[, 2:13], na.rm = TRUE) - expect_equal(param_means["tc"] > 23, param_means["tc"] < 24) - expect_equal(param_means["rh"] > 74, param_means["rh"] < 75) - expect_equal(param_means["ws"] > 1, param_means["ws"] < 2) - expect_equal(param_means["wd"] > 238, param_means["wd"] < 239) - expect_equal(param_means["o3"] > 27, param_means["o3"] < 28) - expect_equal(param_means["no"] > 8, param_means["no"] < 9) - expect_equal(param_means["no2"] > 26, param_means["no2"] < 27) - expect_equal(param_means["nox"] > 20, param_means["nox"] < 21) - expect_equal(param_means["co"] > 0.3, param_means["co"] < 0.4) + param_means <- colMeans(pinheiros[, 2:13], na.rm = TRUE) + expect_gt(param_means["tc"], 23) + expect_lt(param_means["tc"], 24) + expect_gt(param_means["rh"], 74) + expect_lt(param_means["rh"], 75) + expect_gt(param_means["ws"], 1) + expect_lt(param_means["ws"], 2) + expect_gt(param_means["wd"], 238) + expect_lt(param_means["wd"], 239) + expect_gt(param_means["o3"], 27) + expect_lt(param_means["o3"], 28) + expect_gt(param_means["no"], 8) + expect_lt(param_means["no"], 9) + expect_gt(param_means["no2"], 26) + expect_lt(param_means["no2"], 27) + expect_gt(param_means["nox"], 20) + expect_lt(param_means["nox"], 21) + expect_gt(param_means["co"], 0.3) + expect_lt(param_means["co"], 0.4) # expect_equal(param_means["pm10"] > 19, param_means["pm10"] < 20) # I tested in a Mac, it worked - expect_equal(param_means["pm25"] > 5, param_means["pm25"] < 7) + expect_gt(param_means["pm25"], 5) + expect_lt(param_means["pm25"], 7) # Testing data.frame classes expect_s3_class(pinheiros, "data.frame") diff --git a/tests/testthat/test-cetesb_retrieve_param.R b/tests/testthat/test-cetesb_retrieve_param.R index 3eaf6e1..3261242 100644 --- a/tests/testthat/test-cetesb_retrieve_param.R +++ b/tests/testthat/test-cetesb_retrieve_param.R @@ -1,34 +1,41 @@ test_that("cetesb_retrieve_param works!", { - load("sysdata.rda") csv_path <- file.path(tempdir(), "cetesb-data2") dir.create(csv_path) - pin_param <- cetesb_retrieve_param(u,p,c("o3","NOX", "VV"), 99, - "01/01/2020", "07/01/2020", - to_csv = TRUE, csv_path = csv_path) + pin_param <- cetesb_retrieve_param(u, p, c("o3", "NOX", "VV"), 99, + "01/01/2020", "07/01/2020", + to_csv = TRUE, csv_path = csv_path + ) # Testing writing output - expect_equal(TRUE, - file.exists( - paste0(csv_path, - "/Pinheiros_O3_NOX_VV_01-01-2020_07-01-2020.csv") - )) + expect_equal( + TRUE, + file.exists( + paste0( + csv_path, + "/Pinheiros_O3_NOX_VV_01-01-2020_07-01-2020.csv" + ) + ) + ) # Testing data.frame dims expect_equal(ncol(pin_param), 5) expect_equal(nrow(pin_param), 169) # Testing data.frame values - param_means<- colMeans(pin_param[, 3:5], na.rm = TRUE) - expect_equal(param_means["nox"] > 20, param_means["nox"] < 21) - expect_equal(param_means["o3"] > 27, param_means["o3"] < 28) - expect_equal(param_means["ws"] > 1, param_means["ws"] < 2) + param_means <- colMeans(pin_param[, 3:5], na.rm = TRUE) + expect_gt(param_means["nox"], 20) + expect_lt(param_means["nox"], 21) + expect_gt(param_means["o3"], 27) + expect_lt(param_means["o3"], 28) + expect_gt(param_means["ws"], 1) + expect_lt(param_means["ws"], 2) # Testing data.frame classes - expect_s3_class(pin_param, 'data.frame') - expect_type(pin_param$aqs, 'character') - expect_type(pin_param$o3, 'double') - expect_type(pin_param$nox, 'double') - expect_type(pin_param$ws, 'double') + expect_s3_class(pin_param, "data.frame") + expect_type(pin_param$aqs, "character") + expect_type(pin_param$o3, "double") + expect_type(pin_param$nox, "double") + expect_type(pin_param$ws, "double") }) diff --git a/tests/testthat/test-cetesb_retrieve_pol.R b/tests/testthat/test-cetesb_retrieve_pol.R index 88b271f..3783bcd 100644 --- a/tests/testthat/test-cetesb_retrieve_pol.R +++ b/tests/testthat/test-cetesb_retrieve_pol.R @@ -1,33 +1,41 @@ test_that("cetesb_retrieve_pol works!", { - load("sysdata.rda") - pin_pol <- cetesb_retrieve_pol(u,p,aqs_code = "Pinheiros", - start_date = "01/01/2020", - end_date = "07/01/2020") + pin_pol <- cetesb_retrieve_pol(u, p, + aqs_code = "Pinheiros", + start_date = "01/01/2020", + end_date = "07/01/2020" + ) # Testing data.frame dims expect_equal(ncol(pin_pol), 9) expect_equal(nrow(pin_pol), 169) # Testing data.frame values - pol_means<- colMeans(pin_pol[, 2:8], na.rm = TRUE) - expect_equal(pol_means["o3"] > 27, pol_means["o3"] < 28) - expect_equal(pol_means["no"] > 8, pol_means["no"] < 9) - expect_equal(pol_means["no2"] > 26, pol_means["no2"] < 27) - expect_equal(pol_means["nox"] > 20, pol_means["nox"] < 21) - expect_equal(pol_means["co"] > 0.3, pol_means["co"] < 0.4) - expect_equal(pol_means["pm10"] > 19, pol_means["pm10"] < 20) - expect_equal(pol_means["pm25"] > 5, pol_means["pm25"] < 6) + pol_means <- colMeans(pin_pol[, 2:8], na.rm = TRUE) + expect_gt(pol_means["o3"], 27) + expect_lt(pol_means["o3"], 28) + expect_gt(pol_means["no"], 8) + expect_lt(pol_means["no"], 9) + expect_gt(pol_means["no2"], 26) + expect_lt(pol_means["no2"], 27) + expect_gt(pol_means["nox"], 20) + expect_lt(pol_means["nox"], 21) + expect_gt(pol_means["co"], 0.3) + expect_lt(pol_means["co"], 0.4) + expect_gt(pol_means["pm10"], 19) + expect_lt(pol_means["pm10"], 20) + expect_gt(pol_means["pm25"], 5) + expect_lt(pol_means["pm25"], 6) # Testing data.frame classes - expect_s3_class(pin_pol, 'data.frame') - expect_s3_class(pin_pol$date, 'POSIXct') - expect_type(pin_pol$o3, 'double') - expect_type(pin_pol$no, 'double') - expect_type(pin_pol$no2, 'double') - expect_type(pin_pol$nox, 'double') - expect_type(pin_pol$co, 'double') - expect_type(pin_pol$pm10, 'double') - expect_type(pin_pol$pm25, 'double') - expect_type(pin_pol$aqs, 'character') + expect_s3_class(pin_pol, "data.frame") + expect_s3_class(pin_pol$date, "POSIXct") + expect_type(pin_pol$o3, "double") + expect_type(pin_pol$no, "double") + expect_type(pin_pol$no2, "double") + expect_type(pin_pol$nox, "double") + expect_type(pin_pol$co, "double") + expect_type(pin_pol$pm10, "double") + expect_type(pin_pol$pm25, "double") + expect_type(pin_pol$aqs, "character") }) diff --git a/tests/testthat/test-monitor_ar_retrieve_met.R b/tests/testthat/test-monitor_ar_retrieve_met.R index e61fb2c..551c71a 100644 --- a/tests/testthat/test-monitor_ar_retrieve_met.R +++ b/tests/testthat/test-monitor_ar_retrieve_met.R @@ -1,28 +1,32 @@ test_that("monitor_ar_retrieve_met works!", { - start_date <- "01/01/2020" - end_date <- "07/01/2020" - ca_met <- monitor_ar_retrieve_met(start_date, end_date, "CA") + end_date <- "07/01/2020" + ca_met <- monitor_ar_retrieve_met(start_date, end_date, "CA") # Testing data.frame dims expect_equal(ncol(ca_met), 7) expect_equal(TRUE, ncol(ca_met) <= 145) # Testing data.frame values - met_means<- colMeans(ca_met[, 2:6], na.rm = TRUE) - expect_equal(met_means["tc"] > 28, met_means["tc"] < 29) - expect_equal(met_means["rh"] > 74, met_means["rh"] < 75) - expect_equal(met_means["ws"] > 0.8, met_means["ws"] < 0.9) - expect_equal(met_means["wd"] > 157, met_means["wd"] < 159) - expect_equal(met_means["p"] > 1007, met_means["p"] < 1008) + met_means <- colMeans(ca_met[, 2:6], na.rm = TRUE) + expect_gt(met_means["tc"], 28) + expect_lt(met_means["tc"], 29) + expect_gt(met_means["rh"], 74) + expect_lt(met_means["rh"], 75) + expect_gt(met_means["ws"], 0.8) + expect_lt(met_means["ws"], 0.9) + expect_gt(met_means["wd"], 157) + expect_lt(met_means["wd"], 159) + expect_gt(met_means["p"], 1007) + expect_lt(met_means["p"], 1008) # Testing data.frame classes - expect_s3_class(ca_met, 'data.frame') - expect_s3_class(ca_met$date, 'POSIXct') - expect_type(ca_met$tc, 'double') - expect_type(ca_met$rh, 'double') - expect_type(ca_met$ws, 'double') - expect_type(ca_met$wd, 'double') - expect_type(ca_met$p, 'double') - expect_type(ca_met$aqs, 'character') + expect_s3_class(ca_met, "data.frame") + expect_s3_class(ca_met$date, "POSIXct") + expect_type(ca_met$tc, "double") + expect_type(ca_met$rh, "double") + expect_type(ca_met$ws, "double") + expect_type(ca_met$wd, "double") + expect_type(ca_met$p, "double") + expect_type(ca_met$aqs, "character") }) diff --git a/tests/testthat/test-monitor_ar_retrieve_met_pol.R b/tests/testthat/test-monitor_ar_retrieve_met_pol.R index e90282a..cbf97e6 100644 --- a/tests/testthat/test-monitor_ar_retrieve_met_pol.R +++ b/tests/testthat/test-monitor_ar_retrieve_met_pol.R @@ -1,38 +1,53 @@ test_that("monitor_ar_retrieve_met_pol works!", { - start_date <- "01/01/2020" - end_date <- "07/01/2020" - ca_all <- monitor_ar_retrieve_met_pol(start_date, end_date, "CA") + end_date <- "07/01/2020" + ca_all <- monitor_ar_retrieve_met_pol(start_date, end_date, "CA") # Testing data.frame dims expect_equal(ncol(ca_all), 14) expect_equal(TRUE, ncol(ca_all) <= 145) # Testing data.frame values - all_means<- colMeans(ca_all[, 2:13], na.rm = TRUE) - expect_equal(all_means["tc"] > 28, all_means["tc"] < 29) - expect_equal(all_means["rh"] > 74, all_means["rh"] < 75) - expect_equal(all_means["ws"] > 0.8, all_means["ws"] < 0.9) - expect_equal(all_means["wd"] > 157, all_means["wd"] < 159) - expect_equal(all_means["p"] > 1007, all_means["p"] < 1008) - expect_equal(all_means["o3"] > 33, all_means["o3"] < 35) - expect_equal(all_means["co"] > 0.5, all_means["co"] < 0.6) - expect_equal(all_means["pm10"] > 21, all_means["pm10"] < 23) + all_means <- colMeans(ca_all[, 2:13], na.rm = TRUE) + expect_gt(all_means["tc"], 28) + expect_lt(all_means["tc"], 29) + expect_gt(all_means["rh"], 74) + expect_lt(all_means["rh"], 75) + expect_gt(all_means["ws"], 0.8) + expect_lt(all_means["ws"], 0.9) + expect_gt(all_means["p"], 1007) + expect_lt(all_means["p"], 1008) + expect_gt(all_means["o3"], 33) + expect_lt(all_means["o3"], 35) + expect_gt(all_means["co"], 0.5) + expect_lt(all_means["co"], 0.6) + expect_gt(all_means["pm10"], 21) + expect_lt(all_means["pm10"], 22) + + + # expect_equal(all_means["tc"] > 28, all_means["tc"] < 29) + # expect_equal(all_means["rh"] > 74, all_means["rh"] < 75) + # expect_equal(all_means["ws"] > 0.8, all_means["ws"] < 0.9) + # expect_equal(all_means["wd"] > 157, all_means["wd"] < 159) + # expect_equal(all_means["p"] > 1007, all_means["p"] < 1008) + # expect_equal(all_means["o3"] > 33, all_means["o3"] < 35) + # expect_equal(all_means["co"] > 0.5, all_means["co"] < 0.6) + # expect_equal(all_means["pm10"] > 21, all_means["pm10"] < 23) # Testing data.frame classes - expect_s3_class(ca_all, 'data.frame') - expect_s3_class(ca_all$date, 'POSIXct') - expect_type(ca_all$tc, 'double') - expect_type(ca_all$rh, 'double') - expect_type(ca_all$ws, 'double') - expect_type(ca_all$wd, 'double') - expect_type(ca_all$p, 'double') - expect_type(ca_all$o3, 'double') - expect_type(ca_all$no, 'double') - expect_type(ca_all$no2, 'double') - expect_type(ca_all$nox, 'double') - expect_type(ca_all$co, 'double') - expect_type(ca_all$pm10, 'double') - expect_type(ca_all$pm25, 'double') - expect_type(ca_all$aqs, 'character') + expect_s3_class(ca_all, "data.frame") + expect_s3_class(ca_all$date, "POSIXct") + expect_type(ca_all$tc, "double") + expect_type(ca_all$rh, "double") + expect_type(ca_all$ws, "double") + expect_type(ca_all$wd, "double") + expect_type(ca_all$p, "double") + expect_type(ca_all$o3, "double") + expect_type(ca_all$no, "double") + expect_type(ca_all$no2, "double") + expect_type(ca_all$nox, "double") + expect_type(ca_all$co, "double") + expect_type(ca_all$pm10, "double") + expect_type(ca_all$pm25, "double") + expect_type(ca_all$aqs, "character") }) diff --git a/tests/testthat/test-monitor_ar_retrieve_param.R b/tests/testthat/test-monitor_ar_retrieve_param.R index 80faff2..e1b10e1 100644 --- a/tests/testthat/test-monitor_ar_retrieve_param.R +++ b/tests/testthat/test-monitor_ar_retrieve_param.R @@ -1,20 +1,25 @@ test_that("monitor_ar_retrieve works!", { - csv_path <- file.path(tempdir(), "cetesb-data") dir.create(csv_path) - ca_o3 <- monitor_ar_retrieve_param(start_date = "01/02/2015", - end_date = "01/03/2015", - aqs_code = "CA", - parameters = "O3", - to_csv = TRUE, - csv_path = csv_path) + ca_o3 <- monitor_ar_retrieve_param( + start_date = "01/02/2015", + end_date = "01/03/2015", + aqs_code = "CA", + parameters = "O3", + to_csv = TRUE, + csv_path = csv_path + ) # Testing writing output - expect_equal(TRUE, - file.exists( - paste0(csv_path, - "/ESTACAO CENTRO_O3_01-02-2015_01-03-2015.csv") - )) + expect_equal( + TRUE, + file.exists( + paste0( + csv_path, + "/ESTACAO CENTRO_O3_01-02-2015_01-03-2015.csv" + ) + ) + ) # Testing data.frame output expect_equal(ncol(ca_o3), 3) @@ -22,11 +27,12 @@ test_that("monitor_ar_retrieve works!", { # Testing data.frame values o3_mean <- mean(ca_o3$o3, na.rm = TRUE) - expect_equal(o3_mean > 22, o3_mean < 23) + expect_gt(o3_mean, 22) + expect_lt(o3_mean, 23) # Testing data.frame classes - expect_s3_class(ca_o3, 'data.frame') - expect_s3_class(ca_o3$date, 'POSIXct') - expect_type(ca_o3$aqs, 'character') - expect_type(ca_o3$o3, 'double') + expect_s3_class(ca_o3, "data.frame") + expect_s3_class(ca_o3$date, "POSIXct") + expect_type(ca_o3$aqs, "character") + expect_type(ca_o3$o3, "double") }) diff --git a/tests/testthat/test-monitor_ar_retrieve_pol.R b/tests/testthat/test-monitor_ar_retrieve_pol.R index 27f2c94..f97e9d3 100644 --- a/tests/testthat/test-monitor_ar_retrieve_pol.R +++ b/tests/testthat/test-monitor_ar_retrieve_pol.R @@ -1,28 +1,30 @@ test_that("monitor_ar_retrieve_pol works!", { - start_date <- "01/01/2020" - end_date <- "07/01/2020" - ca_pol <- monitor_ar_retrieve_pol(start_date, end_date, "CA") + end_date <- "07/01/2020" + ca_pol <- monitor_ar_retrieve_pol(start_date, end_date, "CA") # Testing data.frame dims expect_equal(ncol(ca_pol), 9) expect_equal(TRUE, nrow(ca_pol) >= 144) # Testing data.frame values - pol_means<- colMeans(ca_pol[, 2:8], na.rm = TRUE) - expect_equal(pol_means["o3"] > 33, pol_means["o3"] < 35) - expect_equal(pol_means["co"] > 0.5, pol_means["co"] < 0.6) - expect_equal(pol_means["pm10"] > 21, pol_means["pm10"] < 23) + pol_means <- colMeans(ca_pol[, 2:8], na.rm = TRUE) + expect_gt(pol_means["o3"], 33) + expect_lt(pol_means["o3"], 35) + expect_gt(pol_means["co"], 0.5) + expect_lt(pol_means["co"], 0.6) + expect_gt(pol_means["pm10"], 21) + expect_lt(pol_means["pm10"], 23) # Testing data.frame classes - expect_s3_class(ca_pol, 'data.frame') - expect_s3_class(ca_pol$date, 'POSIXct') - expect_type(ca_pol$o3, 'double') - expect_type(ca_pol$no, 'double') - expect_type(ca_pol$no2, 'double') - expect_type(ca_pol$nox, 'double') - expect_type(ca_pol$co, 'double') - expect_type(ca_pol$pm10, 'double') - expect_type(ca_pol$pm25, 'double') - expect_type(ca_pol$aqs, 'character') + expect_s3_class(ca_pol, "data.frame") + expect_s3_class(ca_pol$date, "POSIXct") + expect_type(ca_pol$o3, "double") + expect_type(ca_pol$no, "double") + expect_type(ca_pol$no2, "double") + expect_type(ca_pol$nox, "double") + expect_type(ca_pol$co, "double") + expect_type(ca_pol$pm10, "double") + expect_type(ca_pol$pm25, "double") + expect_type(ca_pol$aqs, "character") }) From c342adbb4b8ecaa425f09a259627bb98ba7a6c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Gavidia-Calder=C3=B3n?= Date: Tue, 10 Mar 2026 12:59:18 -0300 Subject: [PATCH 4/7] Closes #11 --- DESCRIPTION | 3 ++- tests/testthat/test-cetesb_retrieve_param.R | 3 +-- tests/testthat/test-monitor_ar_retrieve_param.R | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 64e1db9..a175df2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -51,7 +51,8 @@ Suggests: openair, ggplot2, purrr, - magrittr + magrittr, + withr Depends: R (>= 3.5.0) Config/testthat/edition: 3 diff --git a/tests/testthat/test-cetesb_retrieve_param.R b/tests/testthat/test-cetesb_retrieve_param.R index 3261242..da42441 100644 --- a/tests/testthat/test-cetesb_retrieve_param.R +++ b/tests/testthat/test-cetesb_retrieve_param.R @@ -1,8 +1,7 @@ test_that("cetesb_retrieve_param works!", { load("sysdata.rda") - csv_path <- file.path(tempdir(), "cetesb-data2") - dir.create(csv_path) + csv_path <- withr::local_tempdir() pin_param <- cetesb_retrieve_param(u, p, c("o3", "NOX", "VV"), 99, "01/01/2020", "07/01/2020", diff --git a/tests/testthat/test-monitor_ar_retrieve_param.R b/tests/testthat/test-monitor_ar_retrieve_param.R index e1b10e1..9eebef1 100644 --- a/tests/testthat/test-monitor_ar_retrieve_param.R +++ b/tests/testthat/test-monitor_ar_retrieve_param.R @@ -1,6 +1,5 @@ test_that("monitor_ar_retrieve works!", { - csv_path <- file.path(tempdir(), "cetesb-data") - dir.create(csv_path) + csv_path <- withr::local_tempdir ca_o3 <- monitor_ar_retrieve_param( start_date = "01/02/2015", From 6286590f169da850395e5e79efa49f20c251a0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Gavidia-Calder=C3=B3n?= Date: Tue, 10 Mar 2026 13:08:20 -0300 Subject: [PATCH 5/7] fix: #11 --- tests/testthat/test-cetesb_retrieve_param.R | 6 +++--- tests/testthat/test-monitor_ar_retrieve_param.R | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-cetesb_retrieve_param.R b/tests/testthat/test-cetesb_retrieve_param.R index da42441..d8239af 100644 --- a/tests/testthat/test-cetesb_retrieve_param.R +++ b/tests/testthat/test-cetesb_retrieve_param.R @@ -1,18 +1,18 @@ test_that("cetesb_retrieve_param works!", { load("sysdata.rda") - csv_path <- withr::local_tempdir() + csv_folder <- withr::local_tempdir() pin_param <- cetesb_retrieve_param(u, p, c("o3", "NOX", "VV"), 99, "01/01/2020", "07/01/2020", - to_csv = TRUE, csv_path = csv_path + to_csv = TRUE, csv_path = csv_folder ) # Testing writing output expect_equal( TRUE, file.exists( paste0( - csv_path, + csv_folder, "/Pinheiros_O3_NOX_VV_01-01-2020_07-01-2020.csv" ) ) diff --git a/tests/testthat/test-monitor_ar_retrieve_param.R b/tests/testthat/test-monitor_ar_retrieve_param.R index 9eebef1..0624cda 100644 --- a/tests/testthat/test-monitor_ar_retrieve_param.R +++ b/tests/testthat/test-monitor_ar_retrieve_param.R @@ -1,5 +1,5 @@ test_that("monitor_ar_retrieve works!", { - csv_path <- withr::local_tempdir + csv_folder <- withr::local_tempdir() ca_o3 <- monitor_ar_retrieve_param( start_date = "01/02/2015", @@ -7,14 +7,14 @@ test_that("monitor_ar_retrieve works!", { aqs_code = "CA", parameters = "O3", to_csv = TRUE, - csv_path = csv_path + csv_path = csv_folder ) # Testing writing output expect_equal( TRUE, file.exists( paste0( - csv_path, + csv_folder, "/ESTACAO CENTRO_O3_01-02-2015_01-03-2015.csv" ) ) From cd487f97278f6bd20ecf09d21d27c38d65fd4813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Gavidia-Calder=C3=B3n?= Date: Tue, 10 Mar 2026 18:07:32 -0300 Subject: [PATCH 6/7] fix: #12 --- R/cetesb_retrieve.R | 7 +- R/cetesb_retrieve_met.R | 12 +-- R/cetesb_retrieve_met_pol.R | 14 +--- R/cetesb_retrieve_param.R | 19 +++-- R/cetesb_retrieve_pol.R | 17 ++-- R/monitor_ar_retrieve_met.R | 15 +--- R/monitor_ar_retrieve_met_pol.R | 14 +--- R/monitor_ar_retrieve_param.R | 24 +++--- R/monitor_ar_retrieve_pol.R | 15 +--- R/query_summary.R | 84 +++++++++++++++++++ R/write_csv.R | 4 + man/cetesb_retrieve_met.Rd | 3 - man/cetesb_retrieve_met_pol.Rd | 3 - man/cetesb_retrieve_param.Rd | 3 - man/cetesb_retrieve_pol.Rd | 3 - man/monitor_ar_retrieve_met.Rd | 3 - man/monitor_ar_retrieve_met_pol.Rd | 3 - man/monitor_ar_retrieve_param.Rd | 3 - man/monitor_ar_retrieve_pol.Rd | 3 - tests/testthat/test-cetesb_retrieve_met_pol.R | 2 + 20 files changed, 133 insertions(+), 118 deletions(-) create mode 100644 R/query_summary.R diff --git a/R/cetesb_retrieve.R b/R/cetesb_retrieve.R index 2b01d20..c599887 100644 --- a/R/cetesb_retrieve.R +++ b/R/cetesb_retrieve.R @@ -115,10 +115,7 @@ cetesb_retrieve <- function(username, password, if (ncol(dat) != 19){ dat <- data.frame(date = all.dates$date , pol = NA, aqs = aqs_name, # nocov stringsAsFactors = FALSE) # nocov - message(paste0( # nocov - 'No data available for ', # nocov - pol_name, # nocov - ". Filling with NA.")) # nocov + padding_out_message_for(pol_name) # nocov } if (ncol(dat) == 19) { @@ -139,7 +136,7 @@ cetesb_retrieve <- function(username, password, aqs = aqs_name, stringsAsFactors = FALSE) } else { - message(paste0('Download OK ', pol_abr)) + download_ok_cetesb_msg(pol_abr) dat <- data.frame(date = all.dates$date , pol = dat$value , aqs = aqs_name, stringsAsFactors = FALSE) } # nocov end diff --git a/R/cetesb_retrieve_met.R b/R/cetesb_retrieve_met.R index c99deab..bd86681 100644 --- a/R/cetesb_retrieve_met.R +++ b/R/cetesb_retrieve_met.R @@ -12,7 +12,6 @@ #' @param aqs_code Code of AQS #' @param start_date Date to start downloading in dd/mm/yyyy #' @param end_date Date to end downloading in dd/mm/yyyy -#' @param verbose Print query summary #' @param to_csv Creates a csv file. FALSE by default #' @param csv_path Path to save the csv file. #' @@ -35,8 +34,8 @@ #' } cetesb_retrieve_met <- function(username, password, aqs_code, start_date, - end_date, verbose = TRUE, - to_csv = FALSE, csv_path = ""){ + end_date, to_csv = FALSE, + csv_path = ""){ # Check if aqs_code is valid aqs <- cetesb @@ -45,12 +44,7 @@ cetesb_retrieve_met <- function(username, password, aqs_code <- as.numeric(check_code[2]) # Adding query summary - if (verbose){ - message("Your query is:") - message("Parameter: TC, RH, WS, WD, Pressure") - message("Air quality station: ", aqs_name) - message("Period: From ", start_date, " to ", end_date) - } + query_summary(start_date, end_date, aqs_name, "met") tc <- cetesb_retrieve(username, password, 25, aqs_code, start_date, diff --git a/R/cetesb_retrieve_met_pol.R b/R/cetesb_retrieve_met_pol.R index a354df4..b3dc96b 100644 --- a/R/cetesb_retrieve_met_pol.R +++ b/R/cetesb_retrieve_met_pol.R @@ -13,7 +13,6 @@ #' @param aqs_code Code of AQS #' @param start_date Date to start downloading in dd/mm/yyyy #' @param end_date Date to end downloading in dd/mm/yyyy -#' @param verbose Print query summary #' @param to_csv Creates a csv file. FALSE by default #' @param csv_path Path to save the csv file. #' @@ -38,8 +37,8 @@ #' } cetesb_retrieve_met_pol <- function(username, password, aqs_code, start_date, - end_date, verbose = TRUE, - to_csv = FALSE, csv_path = ""){ + end_date, to_csv = FALSE, + csv_path = ""){ # Check if aqs_code is valid aqs <- cetesb @@ -48,13 +47,8 @@ cetesb_retrieve_met_pol <- function(username, password, aqs_code <- as.numeric(check_code[2]) # Adding query summary - if (verbose){ - message("Your query is: ") - message(paste("Parameter: TC, RH, WS, WD, Pressure,", - "O3, NO, NO2, NOX, PM2.5, PM10, CO")) - message("Air quality station: ", aqs_name) - message("Period: From ", start_date, " to ", end_date) - } + query_summary(start_date, end_date, aqs_name, "met_pol") + tc <- cetesb_retrieve(username, password, 25, aqs_code, start_date, diff --git a/R/cetesb_retrieve_param.R b/R/cetesb_retrieve_param.R index 6f56889..de50488 100644 --- a/R/cetesb_retrieve_param.R +++ b/R/cetesb_retrieve_param.R @@ -14,7 +14,6 @@ #' @param aqs_code Code of AQS #' @param start_date Date to start downloading in dd/mm/yyyy #' @param end_date Date to end downloading in dd/mm/yyyy -#' @param verbose Print query summary #' @param to_csv Creates a csv file. FALSE by default #' @param csv_path Path to save the csv file #' @@ -39,8 +38,8 @@ #' } cetesb_retrieve_param <- function(username, password, parameters, aqs_code, start_date, end_date, - verbose = TRUE, to_csv = FALSE, - csv_path = ""){ + to_csv = FALSE, + csv_path = ""){ # Check if aqs_code is valid aqs <- cetesb @@ -68,12 +67,14 @@ cetesb_retrieve_param <- function(username, password, parameters, # Adding query summary - if (verbose){ - message("Your query is:") - message("Parameter: ", paste(codes_df$name, collapse = ", ")) - message("Air quality station: ", aqs_name) - message("Period: From ", start_date, " to ", end_date) - } + query_summary(start_date, end_date, aqs_name, "param", + codes_df$name) + # if (verbose){ + # message("Your query is:") + # message("Parameter: ", paste(codes_df$name, collapse = ", ")) + # message("Air quality station: ", aqs_name) + # message("Period: From ", start_date, " to ", end_date) + # } # Downloading data aqs_data <- lapply(codes_df$code, cetesb_retrieve, diff --git a/R/cetesb_retrieve_pol.R b/R/cetesb_retrieve_pol.R index d47b287..a83c8be 100644 --- a/R/cetesb_retrieve_pol.R +++ b/R/cetesb_retrieve_pol.R @@ -12,7 +12,6 @@ #' @param aqs_code Code of AQS #' @param start_date Date to start downloading in dd/mm/yyyy #' @param end_date Date to end downloading in dd/mm/yyyy -#' @param verbose Print query summary #' @param to_csv Creates a csv file. FALSE by default #' @param csv_path Path to save the csv file #' @@ -36,8 +35,8 @@ #' } cetesb_retrieve_pol <- function(username, password, aqs_code, start_date, - end_date, verbose = TRUE, - to_csv = FALSE, csv_path = ""){ + end_date, to_csv = FALSE, + csv_path = ""){ # Check if aqs_code is valid aqs <- cetesb @@ -46,12 +45,7 @@ cetesb_retrieve_pol <- function(username, password, aqs_code <- as.numeric(check_code[2]) # Adding query summary - if (verbose){ - message("Your query is:") - message("Parameter: O3, NO, NO2, NOX, MP2.5, MP10, CO") - message("Air quality station: ", aqs_name) - message("Period: From ", start_date, " to ", end_date) - } + query_summary(start_date, end_date, aqs_name, "pol") o3 <- cetesb_retrieve(username, password, 63, aqs_code, start_date, @@ -96,9 +90,8 @@ cetesb_retrieve_pol <- function(username, password, cols_unchange <- -c(1, ncol(all_pol)) all_pol[, cols_unchange] <- sapply(all_pol[, cols_unchange], as.numeric) - message(paste( - "Download complete for", unique(all_pol$aqs) - )) + # Download ok msg + download_ok_cetesb_msg('', unique(all_pol$aqs)) if (to_csv){ write_csv(all_pol, aqs_name, start_date, end_date, "POL", csv_path) # nocov diff --git a/R/monitor_ar_retrieve_met.R b/R/monitor_ar_retrieve_met.R index 38ac70a..1036da5 100644 --- a/R/monitor_ar_retrieve_met.R +++ b/R/monitor_ar_retrieve_met.R @@ -7,7 +7,6 @@ #' @param start_date Date to start downloading in dd/mm/yyyy. #' @param end_date Date to end downloading in dd/mm/yyyy. #' @param aqs_code Code of AQS. See `monitor_ar_aqs`. -#' @param verbose Print query summary. #' @param to_local Date information in local time. TRUE by default. #' @param to_csv Create a csv file. FALSE by default. #' @param csv_path Path to save the csv file. @@ -25,8 +24,8 @@ #' ca_met <- monitor_ar_retrieve_met(start_date, end_date, "CA") #' } monitor_ar_retrieve_met <- function(start_date, end_date, aqs_code, - verbose = TRUE, to_local = TRUE, - to_csv = FALSE, csv_path = ""){ + to_local = TRUE, to_csv = FALSE, + csv_path = ""){ # Check is aqs_code is valid if (!(aqs_code %in% aqs_monitor_ar$code)){ stop("Wrong aqs_code, please check monitor_ar_aqs", call. = FALSE) # nocov @@ -37,16 +36,8 @@ monitor_ar_retrieve_met <- function(start_date, end_date, aqs_code, # Adding query summary aqs_name <- aqs_monitor_ar$name[aqs_monitor_ar$code == aqs_code] - if (verbose){ - message("Your query is:") - message("Parameter: ", paste(params, collapse = ", ")) - message("Air quality station: ", aqs_name) - message("Period: From ", start_date, " to ", end_date) - } - all_met <- monitor_ar_retrieve_param(start_date, end_date, aqs_code, - params, to_local = to_local, - verbose = FALSE) + params, to_local = to_local) names(all_met) <- c("date", "tc", "rh", "ws", "wd", "p", "aqs") diff --git a/R/monitor_ar_retrieve_met_pol.R b/R/monitor_ar_retrieve_met_pol.R index e1b9785..3421adc 100644 --- a/R/monitor_ar_retrieve_met_pol.R +++ b/R/monitor_ar_retrieve_met_pol.R @@ -8,7 +8,6 @@ #' @param start_date Date to start downloading dd/mm/yyyy #' @param end_date Date to end downloading dd/mm/yyyy #' @param aqs_code Code of AQS -#' @param verbose Print query summary #' @param to_local Date information in local time. TRUE by default. #' @param to_csv Creates a csv file. FALSE by default. #' @param csv_path Path to save the csv file. @@ -27,8 +26,8 @@ #' ca_all <- monitor_ar_retrieve_met_pol(start_date, end_date, "CA") #' } monitor_ar_retrieve_met_pol <- function(start_date, end_date, aqs_code, - verbose = TRUE, to_local = TRUE, - to_csv = FALSE, csv_path = ""){ + to_local = TRUE, to_csv = FALSE, + csv_path = ""){ # Check is aqs_code is valid if (!(aqs_code %in% aqs_monitor_ar$code)){ stop("Wrong aqs_code, please check monitor_ar_aqs", call. = FALSE) # nocov @@ -40,16 +39,9 @@ monitor_ar_retrieve_met_pol <- function(start_date, end_date, aqs_code, # Adding query summary aqs_name <- aqs_monitor_ar$name[aqs_monitor_ar$code == aqs_code] - if (verbose){ - message("Your query is: ") - message("Parameter: ", paste(params, collapse = ", ")) - message("Air quality station: ", aqs_name) - message("Period: From ", start_date, " to ", end_date) - } all_data <- monitor_ar_retrieve_param(start_date, end_date, aqs_code, - params, to_local = to_local, - verbose = FALSE) + params, to_local = to_local) names(all_data) <- c("date", tolower(params), "aqs") names(all_data)[2:6] <- c("tc", "rh", "ws", "wd", "p") diff --git a/R/monitor_ar_retrieve_param.R b/R/monitor_ar_retrieve_param.R index 835ae33..7d40a21 100644 --- a/R/monitor_ar_retrieve_param.R +++ b/R/monitor_ar_retrieve_param.R @@ -9,7 +9,6 @@ #' @param parameters Parameters to download. #' It can be a vector with many parameters. #' @param to_local Date information in local time. TRUE by default. -#' @param verbose Print query summary. #' @param to_csv Creates a csv file. FALSE by default #' @param csv_path Path to save the csv file. #' @@ -28,7 +27,7 @@ #' #' } monitor_ar_retrieve_param <- function(start_date, end_date, aqs_code, - parameters, to_local=TRUE, verbose = TRUE, + parameters, to_local=TRUE, to_csv = FALSE, csv_path = ""){ # Check if params are measured @@ -45,12 +44,8 @@ monitor_ar_retrieve_param <- function(start_date, end_date, aqs_code, aqs_name <- aqs_monitor_ar$name[aqs_monitor_ar$code == aqs_code] # Adding query summary - if (verbose){ - message("Your query is:") - message("Parameter: ", paste(parameters, collapse = ", ")) - message("Air quality station: ", aqs_name) - message("Period: From ", start_date, " to ", end_date) - } + query_summary(start_date, end_date, aqs_name, "param", parameters) + start_date_format <- as.POSIXct(strptime(start_date, format="%d/%m/%Y"), tz = "UTC") @@ -89,12 +84,13 @@ monitor_ar_retrieve_param <- function(start_date, end_date, aqs_code, f = 'json' )) # Checking request - if (res$status_code == 200){ - message("Succesful request") - message(paste("Downloading ", paste(parameters, collapse = " "))) - } else { - stop("Unsuccesful request. Something goes wrong", call. = FALSE) # nocov - } + download_ok_monitor_msg(res, parameters) + # if (res$status_code == 200){ + # message("Succesful request") + # message(paste("Downloading ", paste(parameters, collapse = " "))) + # } else { + # stop("Unsuccesful request. Something goes wrong", call. = FALSE) # nocov + # } # Reading json raw_data <- jsonlite::fromJSON(rawToChar(res$content)) diff --git a/R/monitor_ar_retrieve_pol.R b/R/monitor_ar_retrieve_pol.R index ea54443..2fe2154 100644 --- a/R/monitor_ar_retrieve_pol.R +++ b/R/monitor_ar_retrieve_pol.R @@ -7,7 +7,6 @@ #' @param start_date Date to start downloading in dd/mm/yyyy. #' @param end_date Date to end downloading in dd/mm/yyyy. #' @param aqs_code Code of AQS. -#' @param verbose Print query summary. #' @param to_local Date information in local time. TRUE by default. #' @param to_csv Creates a csv file. FALSE by default. #' @param csv_path Path to save the csv file. @@ -25,8 +24,8 @@ #' ca_pol <- monitor_ar_retrieve_pol(start_date, end_date, "CA") #' } monitor_ar_retrieve_pol <- function(start_date, end_date, aqs_code, - verbose = TRUE, to_local = TRUE, - to_csv = FALSE, csv_path = ""){ + to_local = TRUE, to_csv = FALSE, + csv_path = ""){ # Check is aqs_code is valid if (!(aqs_code %in% aqs_monitor_ar$code)){ stop("Wrong aqs_code, please check monitor_ar_aqs", call. = FALSE) # nocov @@ -37,16 +36,8 @@ monitor_ar_retrieve_pol <- function(start_date, end_date, aqs_code, # Adding query summary aqs_name <- aqs_monitor_ar$name[aqs_monitor_ar$code == aqs_code] - if (verbose){ - message("Your query is:") - message("Parameter: ", paste(params, collapse = ", ")) - message("Air quality station: ", aqs_name) - message("Period: From ", start_date, " to ", end_date) - } - all_pol <- monitor_ar_retrieve_param(start_date, end_date, aqs_code, - params, to_local = to_local, - verbose = FALSE) + params, to_local = to_local) names(all_pol) <- c("date", tolower(params), "aqs") names(all_pol)[8] <- "pm25" diff --git a/R/query_summary.R b/R/query_summary.R new file mode 100644 index 0000000..b68b528 --- /dev/null +++ b/R/query_summary.R @@ -0,0 +1,84 @@ +#' Display query summary +#' +#' @param start_date Start date of query +#' @param end_date End date of query +#' @param aqs_name Name of the station +#' @param retrive_type Type of retrieve function +#' @param param_vector Use when using *_param functions +#' +#' @noRd +#' @keywords internal + +query_summary <- function(start_date, end_date, aqs_name, + retrive_type, param_vector = NULL){ + if (getOption("qualR.quiet", FALSE)) { + return() + } + + switch (retrive_type, + pol = {parameters <- "O3, NO, NO2, NOX, MP2.5, MP10, CO"}, + met = {parameters <- "TC, RH, WS, WD, Pressure"}, + met_pol = {parameters <- "TC, RH, WS, WD, Pressure,O3, NO, NO2, NOX, PM2.5, PM10, CO"}, + param = {parameters <- paste(param_vector, collapse = ", ")} + ) + + message("Your query is:") + message(paste0("Parameter: ", parameters)) + message("Air quality station: ", aqs_name) + message("Period: From ", start_date, " to ", end_date) +} + +#' Download Ok message for CETESB +#' +#' @param pol_br Name of the download parameter +#' +#' @noRd +#' @keywords internal +download_ok_cetesb_msg <-function(pol_abr, aqs_name = NULL){ + if (getOption("qualR.quiet", FALSE)) { + return() + } + + if (!is.null(aqs_name)){ + message(paste("Download complete for", aqs_name)) + } else { + message(paste0('Download OK ', pol_abr)) + } +} + +#' Padding out message +#' +#' @param param_name Parameter name that has missing data +#' +#' @noRd +#' @keywords internal +padding_out_message_for <- function(param_name){ + if (getOption("qualR.quiet", FALSE)) { + return() + } + message(paste0( # nocov + 'No data available for ', # nocov + param_name, # nocov + ". Filling with NA.")) +} + +#' Download Ok message for MOnitor AR +#' +#' @param res request +#' @param parameters Name of the download parameter +#' +#' @noRd +#' @keywords internal +download_ok_monitor_msg <-function(res, parameters){ + if (getOption("qualR.quiet", FALSE)) { + return() + } + if (res$status_code == 200){ + message("Succesful request") + message(paste("Downloading ", paste(parameters, collapse = " "))) + } else { + stop("Unsuccesful request. Something goes wrong", call. = FALSE) # nocov + } +} + + diff --git a/R/write_csv.R b/R/write_csv.R index 185365d..19e3933 100644 --- a/R/write_csv.R +++ b/R/write_csv.R @@ -23,5 +23,9 @@ write_csv <- function(aqs_data_df, aqs_name, start_date, end_date, } utils::write.table(aqs_data_df, file_path, sep = ",", row.names = FALSE) + + if (getOption("qualR.quiet", FALSE)) { + return() + } message(paste(file_path, "was created")) } diff --git a/man/cetesb_retrieve_met.Rd b/man/cetesb_retrieve_met.Rd index f0b965b..db82243 100644 --- a/man/cetesb_retrieve_met.Rd +++ b/man/cetesb_retrieve_met.Rd @@ -10,7 +10,6 @@ cetesb_retrieve_met( aqs_code, start_date, end_date, - verbose = TRUE, to_csv = FALSE, csv_path = "" ) @@ -26,8 +25,6 @@ cetesb_retrieve_met( \item{end_date}{Date to end downloading in dd/mm/yyyy} -\item{verbose}{Print query summary} - \item{to_csv}{Creates a csv file. FALSE by default} \item{csv_path}{Path to save the csv file.} diff --git a/man/cetesb_retrieve_met_pol.Rd b/man/cetesb_retrieve_met_pol.Rd index 4dd4c33..7f807de 100644 --- a/man/cetesb_retrieve_met_pol.Rd +++ b/man/cetesb_retrieve_met_pol.Rd @@ -10,7 +10,6 @@ cetesb_retrieve_met_pol( aqs_code, start_date, end_date, - verbose = TRUE, to_csv = FALSE, csv_path = "" ) @@ -26,8 +25,6 @@ cetesb_retrieve_met_pol( \item{end_date}{Date to end downloading in dd/mm/yyyy} -\item{verbose}{Print query summary} - \item{to_csv}{Creates a csv file. FALSE by default} \item{csv_path}{Path to save the csv file.} diff --git a/man/cetesb_retrieve_param.Rd b/man/cetesb_retrieve_param.Rd index 7d0ac6d..91401dd 100644 --- a/man/cetesb_retrieve_param.Rd +++ b/man/cetesb_retrieve_param.Rd @@ -11,7 +11,6 @@ cetesb_retrieve_param( aqs_code, start_date, end_date, - verbose = TRUE, to_csv = FALSE, csv_path = "" ) @@ -30,8 +29,6 @@ to download} \item{end_date}{Date to end downloading in dd/mm/yyyy} -\item{verbose}{Print query summary} - \item{to_csv}{Creates a csv file. FALSE by default} \item{csv_path}{Path to save the csv file} diff --git a/man/cetesb_retrieve_pol.Rd b/man/cetesb_retrieve_pol.Rd index 9e378d3..7123713 100644 --- a/man/cetesb_retrieve_pol.Rd +++ b/man/cetesb_retrieve_pol.Rd @@ -10,7 +10,6 @@ cetesb_retrieve_pol( aqs_code, start_date, end_date, - verbose = TRUE, to_csv = FALSE, csv_path = "" ) @@ -26,8 +25,6 @@ cetesb_retrieve_pol( \item{end_date}{Date to end downloading in dd/mm/yyyy} -\item{verbose}{Print query summary} - \item{to_csv}{Creates a csv file. FALSE by default} \item{csv_path}{Path to save the csv file} diff --git a/man/monitor_ar_retrieve_met.Rd b/man/monitor_ar_retrieve_met.Rd index e7fff26..148cc08 100644 --- a/man/monitor_ar_retrieve_met.Rd +++ b/man/monitor_ar_retrieve_met.Rd @@ -8,7 +8,6 @@ monitor_ar_retrieve_met( start_date, end_date, aqs_code, - verbose = TRUE, to_local = TRUE, to_csv = FALSE, csv_path = "" @@ -21,8 +20,6 @@ monitor_ar_retrieve_met( \item{aqs_code}{Code of AQS. See \code{monitor_ar_aqs}.} -\item{verbose}{Print query summary.} - \item{to_local}{Date information in local time. TRUE by default.} \item{to_csv}{Create a csv file. FALSE by default.} diff --git a/man/monitor_ar_retrieve_met_pol.Rd b/man/monitor_ar_retrieve_met_pol.Rd index dd5d28d..a281bc0 100644 --- a/man/monitor_ar_retrieve_met_pol.Rd +++ b/man/monitor_ar_retrieve_met_pol.Rd @@ -8,7 +8,6 @@ monitor_ar_retrieve_met_pol( start_date, end_date, aqs_code, - verbose = TRUE, to_local = TRUE, to_csv = FALSE, csv_path = "" @@ -21,8 +20,6 @@ monitor_ar_retrieve_met_pol( \item{aqs_code}{Code of AQS} -\item{verbose}{Print query summary} - \item{to_local}{Date information in local time. TRUE by default.} \item{to_csv}{Creates a csv file. FALSE by default.} diff --git a/man/monitor_ar_retrieve_param.Rd b/man/monitor_ar_retrieve_param.Rd index 36c0703..7d652a3 100644 --- a/man/monitor_ar_retrieve_param.Rd +++ b/man/monitor_ar_retrieve_param.Rd @@ -10,7 +10,6 @@ monitor_ar_retrieve_param( aqs_code, parameters, to_local = TRUE, - verbose = TRUE, to_csv = FALSE, csv_path = "" ) @@ -27,8 +26,6 @@ It can be a vector with many parameters.} \item{to_local}{Date information in local time. TRUE by default.} -\item{verbose}{Print query summary.} - \item{to_csv}{Creates a csv file. FALSE by default} \item{csv_path}{Path to save the csv file.} diff --git a/man/monitor_ar_retrieve_pol.Rd b/man/monitor_ar_retrieve_pol.Rd index 5b463ff..4603a00 100644 --- a/man/monitor_ar_retrieve_pol.Rd +++ b/man/monitor_ar_retrieve_pol.Rd @@ -8,7 +8,6 @@ monitor_ar_retrieve_pol( start_date, end_date, aqs_code, - verbose = TRUE, to_local = TRUE, to_csv = FALSE, csv_path = "" @@ -21,8 +20,6 @@ monitor_ar_retrieve_pol( \item{aqs_code}{Code of AQS.} -\item{verbose}{Print query summary.} - \item{to_local}{Date information in local time. TRUE by default.} \item{to_csv}{Creates a csv file. FALSE by default.} diff --git a/tests/testthat/test-cetesb_retrieve_met_pol.R b/tests/testthat/test-cetesb_retrieve_met_pol.R index 06d2124..c2ac7a2 100644 --- a/tests/testthat/test-cetesb_retrieve_met_pol.R +++ b/tests/testthat/test-cetesb_retrieve_met_pol.R @@ -1,6 +1,8 @@ test_that("cetesb_retrieve_met_pol works!", { load("sysdata.rda") + u <- Sys.getenv('QUALAR_USER') + p <- Sys.getenv('QUALAR_PASS') pinheiros <- cetesb_retrieve_met_pol(u, p, aqs_code = 99, start_date = "01/01/2020", From 9d1dc95f367150605109b3aa15991b7c9c59633f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Gavidia-Calder=C3=B3n?= Date: Sun, 24 May 2026 02:59:54 -0300 Subject: [PATCH 7/7] fix #17 --- data-raw/cetesb_aqs.R | 2 +- data/cetesb_aqs.rda | Bin 2709 -> 2673 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/data-raw/cetesb_aqs.R b/data-raw/cetesb_aqs.R index ab6880a..10d687c 100644 --- a/data-raw/cetesb_aqs.R +++ b/data-raw/cetesb_aqs.R @@ -28,7 +28,7 @@ missing_aqs <- data.frame( lat = c(-23.50897, -23.41321, -22.72425, -22.78021, -22.43906, -23.8052), lon = c(-46.70122, -46.75605, -41.33955, - -41.113904, -41.58144, -39.40007), + -41.113904, -47.58144, -45.40007), loc = c("São Paulo", "São Paulo", "Interior", "Interior", "Interior", "Litoral") ) diff --git a/data/cetesb_aqs.rda b/data/cetesb_aqs.rda index bbfc9a02d4abfab3a557a2560a11c741e0276415..0a5eab9e3e95d33cf1fa73227fc40efcca73c70b 100644 GIT binary patch delta 2664 zcmV-u3YYbj74Z}iLRx4!F+o`-Q(3J5mTv$A_>mDNe-LWydb0MKh0;yls*|8pgvmUa z5$bsm#M1&adM4C)6KOJSBSx8%QMERZJw}X7jA#=>O&*g+sh~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