Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Description: A set of tools for analyzing data associated with the Mosquito Aler
License: GPL (>= 3)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Suggests:
covr,
testthat (>= 3.0.0)
Expand All @@ -31,4 +31,5 @@ Imports:
utils,
stats,
curl,
tools
tools,
RcppSimdJson
17 changes: 9 additions & 8 deletions R/get_malert_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ get_malert_data = function(source = "zenodo", doi = "10.5281/zenodo.597466"){
} else{
stop("Error: This function currently only supports downloads from Github or Zenodo")
}
reports = bind_rows(lapply(2014:lubridate::year(lubridate::today()), function(this_year){
print(this_year)
flush.console()
this_file = paste0("home/webuser/webapps/tigaserver/static/all_reports", this_year, ".json")
jsonlite::fromJSON(unz(temp, file = this_file), flatten = TRUE) %>% as_tibble()
}))
unlink(this_temp_file)
return(reports)
unzip(temp, exdir = dirname(temp))
reports_file_list = list.files(dirname(temp), recursive = TRUE, pattern = "all_reports[0-9]{4}.json", full.names = TRUE)
reports = bind_rows(lapply(reports_file_list, function(this_file){
print(regmatches(basename(this_file), regexpr("[0-9]{4}", basename(this_file))))
flush.console()
RcppSimdJson::fload(this_file, flatten = TRUE, max_simplify_lvl = "data_frame") %>% as_tibble()
}))
unlink(file.path(dirname(temp), "/home"), recursive = TRUE)
return(reports)
}
Loading