Skip to content

Commit cdf8db2

Browse files
committed
backup
1 parent 93dfe31 commit cdf8db2

File tree

10 files changed

+96
-28188
lines changed

10 files changed

+96
-28188
lines changed

R/utils.R

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,35 @@ download_db <- function(url,
4545
cli::cli_alert_info("Downloading data from {.url {url}}.")
4646
}
4747

48+
dat_file <- tempfile(fileext = file_ext)
49+
50+
if (isTRUE(check_need_libcurl_condathis())) {
51+
condathis_downgrade_libcurl()
52+
53+
url_to_use <-
54+
paste0(url,
55+
"?",
56+
paste(names(url_query_param),
57+
url_query_param,
58+
sep = "=",
59+
collapse = "&"))
60+
61+
req <- condathis::run("curl", "-o", dat_file, url_to_use,
62+
env_name = "openssl-linux-env",
63+
verbose = FALSE)
64+
65+
66+
}
67+
68+
69+
4870
req <- httr2::request(url) |>
4971
httr2::req_url_query(
5072
!!!url_query_param,
5173
multi = "explore"
5274
) |>
5375
httr2::req_perform()
5476

55-
dat_file <- tempfile(fileext = file_ext)
56-
5777
req |>
5878
httr2::resp_body_raw() |>
5979
writeBin(dat_file)
@@ -71,27 +91,58 @@ download_db <- function(url,
7191
out_cl
7292
}
7393

94+
# curl_res <- condathis::run("curl",
95+
# paste0(base_url, query_string, collapse = ""),
96+
# env_name = "openssl-linux-env", verbose = FALSE
97+
# )
98+
99+
# # Need to downgrade libcurl?
100+
# if (isTRUE(check_need_libcurl_condathis())) {
101+
# condathis_downgrade_libcurl()
102+
# extr_iris_to_use <- extr_iris_openssl_
103+
# } else {
104+
# extr_iris_to_use <- extr_iris_
105+
# }
106+
# curl -o prova.html 'https://cfpub.epa.gov/ncea/pprtv/atoz.cfm?excel=yes'
107+
# curl 'https://cfpub.epa.gov/ncea/pprtv/atoz.cfm?excel=yes'
108+
# list(excel = "yes"),
109+
110+
# curl_command <- paste("curl -o",
111+
# file_name,
112+
# paste0(
113+
# url,
114+
# "?",
115+
# paste(names(url_query_param),
116+
# url_query_param,
117+
# sep = "=",
118+
# collapse = "&")))
74119

75120
#' Search and Match Data
76121
#'
77-
#' This function searches for matches in a dataframe based on a given list of ids
78-
#' and search type, then combines the results into a single dataframe, making sure
79-
#' that NA rows are added for any missing ids. The column `query` is a the end of
80-
#' the dataframe.
122+
#' This function searches for matches in a dataframe based on a given list of
123+
#' ids and search type, then combines the results into a single dataframe,
124+
#' making sure that NA rows are added for any missing ids. The column
125+
#' `query` is a the end of the dataframe.
81126
#'
82127
#' @param dat The dataframe to be searched.
83128
#' @param ids A vector of ids to search for.
84129
#' @param search_type The type of search: "casrn" or "name".
85-
#' @param col_names Column names to be used when creating a new dataframe in case of no matches.
86-
#' @param chemical_col The name of the column in dat where chemical names are stored.
130+
#' @param col_names Column names to be used when creating a new dataframe in
131+
#' case of no matches.
132+
#' @param chemical_col The name of the column in dat where chemical names
133+
#' are stored.
87134
#' @return A dataframe with search results.
88135
#' @keywords internal
89136
#'
90137
#' @details This function is used in `extr_pprtv` and `extr_monograph`.
91138
#'
92139
#' @seealso
93140
#' \code{\link{extr_pprtv}}, \code{\link{extr_monograph}}
94-
search_and_match <- function(dat, ids, search_type, col_names, chemical_col = "chemical") {
141+
search_and_match <- function(dat,
142+
ids,
143+
search_type,
144+
col_names,
145+
chemical_col = "chemical") {
95146
results <- lapply(ids, function(id) {
96147
if (search_type == "casrn") {
97148
match <- dat[dat$casrn == id, ]

docs/deps/bootstrap-5.3.1/bootstrap.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/pkgdown.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
pandoc: '3.5'
1+
pandoc: 3.1.3
22
pkgdown: 2.1.1
33
pkgdown_sha: ~
44
articles: {}
5-
last_built: 2025-02-21T19:55Z
5+
last_built: 2025-02-21T20:19Z
66
urls:
77
reference: https://c1au6i0.github.io/extractox/reference
88
article: https://c1au6i0.github.io/extractox/articles

docs/reference/extr_comptox.html

Lines changed: 20 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/extr_iris.html

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)