Skip to content
Merged

Dev #101

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
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ search-sandboxed:
R:
devscripts/r-interpreter.sh

check:
Rscript devscripts/check-cran.R

check-remote:
Rscript devscripts/check-cran-remote.R

R-test:
$(call check_epi_home)
$(call set_kr_pass)
Expand Down
4 changes: 2 additions & 2 deletions episomer/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: episomer
Title: Early Detection of Public Health Threats from Social Media Data
Version: 3.0.30
Version: 3.0.32
Authors@R: c(
person(given = "Laura",
family = "Espinosa",
Expand Down Expand Up @@ -59,7 +59,7 @@ Authors@R: c(
role = "ctb",
email = "y.mansiaux@epiconcept.fr")
)
Description: It allows you to automatically monitor trends of social media messages by time, place and topic aiming at detecting public health threats early through the detection of signals (i.e., an unusual increase in the number of messages per time, topic and location). It was designed to focus on infectious diseases, and it can be extended to all hazards or other fields of study by modifying the topics and keywords. More information on the original package 'epitweetr' is available in the peer-review publication <doi:10.2807/1560-7917.ES.2022.27.39.2200177>.
Description: It allows you to automatically monitor trends of social media messages by time, place and topic aiming at detecting public health threats early through the detection of signals (i.e., an unusual increase in the number of messages per time, topic and location). It was designed to focus on infectious diseases, and it can be extended to all hazards or other fields of study by modifying the topics and keywords. More information on the original package 'epitweetr' is available in the peer-review publication Espinosa et al. (2022) <doi:10.2807/1560-7917.ES.2022.27.39.2200177>.
License: EUPL
URL: https://github.com/EU-ECDC/episomer
BugReports: https://github.com/EU-ECDC/episomer/issues
Expand Down
1 change: 1 addition & 0 deletions episomer/R/add_new_media.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ create_api_and_plan_files_for_new_social_media <- function(
#' this function has to be called within episomer subfolder containing thr R subfolder after executing devtools::load_all()
#' @param social_media Name of the new social media
#' @param social_media_ref Name of the reference social media
#' @return TRUE, called for side effects (creation of new social media files).
#' @export
add_new_social_media <- function(
social_media,
Expand Down
2 changes: 1 addition & 1 deletion episomer/R/aggregate.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ cached <- new.env()
#' }
#' The returned dataset can be cached for further calls if requested. Only one dataset per series is cached.
#' @examples
#' if(FALSE){
#' \dontrun{
#' message('Please choose the episomer data directory')
#' setup_config(file.choose())
#' # Getting all country posts between 2020-jan-10 and 2020-jan-31 for all topics
Expand Down
13 changes: 5 additions & 8 deletions episomer/R/alert.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' A prerequisite for this function is that the \code{\link{search_loop}} must already have stored posts in the search folder and that the geotagging and aggregation tasks have been completed.
#' Normally, this function is not called directly by the user, but from the \code{\link{detect_loop}} function.
#' @examples
#' if(FALSE){
#' \dontrun{
#' library(episomer)
#' # setting up the data folder
#' message('Please choose the episomer data directory')
Expand Down Expand Up @@ -100,7 +100,7 @@ generate_alerts <- function(tasks = get_tasks()) {
#' the upper limit and whether a signal is detected or not.
#' @details for algorithm details see package vignette.
#' @examples
#' if(FALSE){
#' \dontrun{
#' library(episomer)
#' #Running the modifies version of the ears algorithm for a particular data series
#' ts <- c(150, 130, 122, 160, 155, 128, 144, 125, 300, 319, 289, 277, 500)
Expand Down Expand Up @@ -306,7 +306,7 @@ get_reporting_date_counts <- function(
#' the upper limit and whether a signal is detected or not.
#' @details for algorithm details see package vignette.
#' @examples
#' if(FALSE){
#' \dontrun{
#' library(episomer)
#' #Running the alerts for France in topic covid-19
#' df <-calculate_region_alerts(sms="bluesky",
Expand Down Expand Up @@ -459,7 +459,7 @@ calculate_region_alerts <- function(
#' @return A dataframe containing the monitored time point for the given regions and topic,
#' the upper limit and whether a signal is detected or not.
#' @examples
#' if(FALSE){
#' \dontrun{
#' library(episomer)
#' #Running the alerts for World in topic covid-19
#' df <-calculate_regions_alerts(
Expand Down Expand Up @@ -816,7 +816,7 @@ do_next_alerts <- function(tasks = get_tasks()) {
#' @return a data frame containing the calculated alerts for the period. If no alerts are found then NULL is returned
#' @details For more details see the package vignette.
#' @examples
#' if(FALSE){
#' \dontrun{
#' library(episomer)
#' # setting up the data folder
#' message('Please choose the episomer data directory')
Expand Down Expand Up @@ -941,7 +941,6 @@ get_alerts <- function(
})
if (!is.null(df)) {
if (limit > 0 && limit < nrow(df)) {
set.seed(26062012)
df <- df[sample(nrow(df), limit), ]
}
# Adding top posts if required
Expand Down Expand Up @@ -1667,7 +1666,6 @@ get_alert_balanced_df <- function(
dplyr::count()
# we choose 25 percent of rows to be used as test set. These rows will not be augmented
split <- jsonlite::rbind_pages(lapply(1:nrow(allcat_df), function(i) {
set.seed(20131205)
x = 1:allcat_df$n[[i]]
alert_training_df %>%
dplyr::filter(.data$given_category == allcat_df$given_category[[i]]) %>%
Expand Down Expand Up @@ -1816,7 +1814,6 @@ get_alert_balanced_df <- function(
augmented_in_cat <- augmented_alerts %>%
dplyr::filter(.data$given_category == cat_df$given_category[[i]])
frac <- smallest_cat / nrow(augmented_in_cat)
set.seed(20131205)
x = 1:nrow(augmented_in_cat)
augmented_in_cat %>%
dplyr::mutate(
Expand Down
10 changes: 6 additions & 4 deletions episomer/R/check.R
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ check_tar_gz <- function() {
#' @return Data frame containing the statuses of all realized checks
#' @details This function executes a series of sanity checks, concerning, Java, bitness, task status, dependencies and social media authentication.
#' @examples
#' if(FALSE){
#' \dontrun{
#' #importing episomer
#' library(episomer)
#' message('Please choose the episomer data directory')
Expand Down Expand Up @@ -628,7 +628,7 @@ checks <- new.env()
#' @return A list of health check errors found
#' @details This function sends an email to the defined administrator if episomer is not collecting posts, aggregating posts or not calculating alerts
#' @examples
#' if(FALSE){
#' \dontrun{
#' #importing episomer
#' library(episomer)
#' message('Please choose the episomer data directory')
Expand Down Expand Up @@ -817,13 +817,15 @@ update_session_info <- function() {
#' - 'posts': Posts collected by episomer
#' - 'logs': Log files produced automatically on windows task scheduler tasks.
#' @examples
#' if(FALSE){
#' \dontrun{
#' #importing episomer
#' library(episomer)
#' message('Please choose the episomer data directory')
#' setup_config(file.choose())
#' message('Please choose a destination directory')
#' dest <- file.choose()
#' #creating a compressed snapshot for settings and logs
#' create_snapshot(getwd(), c("settings","dependencies"), compress = TRUE)
#' create_snapshot(dest, c("settings","dependencies"), compress = TRUE)
#' }
#' @rdname create_snapshot
#' @export
Expand Down
8 changes: 4 additions & 4 deletions episomer/R/config.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ get_empty_config <- function(data_dir) {
#' @param data_dir Path to the directory containing the application settings (it must exist).
#' If not provided it takes the value of the latest call to setup_config in the current session, or the value of the EPI_HOME environment variable or episomer subdirectory in the working directory,
#' default: if (exists("data_dir", where = conf)) conf$data_dir else if (Sys.getenv("EPI_HOME") !=
#' "") Sys.getenv("EPI_HOME") else file.path(getwd(), "episomer")
#' "") Sys.getenv("EPI_HOME") else file.path(tempdir(), "episomer")
#' @param ignore_keyring Whether to skip loading settings from the keyring (social media and SMTP credentials), default: FALSE
#' @param ignore_properties Whether to skip loading settings managed by the Shiny app in properties.json file, Default: FALSE
#' @param ignore_topics Whether to skip loading settings defined in the topics.xlsx file and download plans from topics.json file, default: FALSE
Expand All @@ -193,7 +193,7 @@ get_empty_config <- function(data_dir) {
#' \item{\code{\link{sm_api_set_auth_bluesky}}}
#' }
#' @examples
#' if(FALSE){
#' \dontrun{
#' library(episomer)
#' #loading system settings
#' message('Please choose the episomer data directory')
Expand All @@ -214,7 +214,7 @@ setup_config <- function(
data_dir = if (exists("data_dir", where = conf)) conf$data_dir else if (
Sys.getenv("EPI_HOME") != ""
)
Sys.getenv("EPI_HOME") else file.path(getwd(), "episomer"),
Sys.getenv("EPI_HOME") else file.path(tempdir(), "episomer"),
ignore_keyring = FALSE,
ignore_properties = FALSE,
ignore_topics = FALSE,
Expand Down Expand Up @@ -480,7 +480,7 @@ copy_plans_from <- function(temp) {
#' @details Permanently saves configuration changes to the data folder (excluding social media credentials, but not SMTP credentials)
#' to save social media credentials please use \code{\link{sm_api_set_auth_bluesky}}
#' @examples
#' if(FALSE){
#' \dontrun{
#' library(episomer)
#' #load configuration
#' message('Please choose the episomer data directory')
Expand Down
8 changes: 4 additions & 4 deletions episomer/R/dataviz.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#'
#' This function requires that \code{\link{search_loop}} and \code{\link{detect_loop}} have already run successfully in order to show results.
#' @examples
#' if(FALSE){
#' \dontrun{
#' message('Please choose the episomer data directory')
#' setup_config(file.choose())
#' #Getting trendline for dengue for South America for the last 30 days
Expand Down Expand Up @@ -443,7 +443,7 @@ plot_trendline <- function(
#'
#' This functions requires that \code{\link{search_loop}} and \code{\link{detect_loop}} have already been run successfully to show results.
#' @examples
#' if(FALSE){
#' \dontrun{
#' #Getting bubble chart for dengue for South America for last 30 days
#' message('Please choose the episomer data directory')
#' setup_config(file.choose())
Expand Down Expand Up @@ -875,7 +875,7 @@ create_map <- function(
#'
#' This function requires that \code{\link{search_loop}} and \code{\link{detect_loop}} have already been run successfully to show results.
#' @examples
#' if(FALSE){
#' \dontrun{
#' message('Please choose the episomer data directory')
#' setup_config(file.choose())
#' #Getting topword chart for dengue for France, Chile, Australia for last 30 days
Expand Down Expand Up @@ -933,7 +933,7 @@ create_topwords <- function(
#'
#' This functions requires that \code{\link{search_loop}} and \code{\link{detect_loop}} have already been run successfully to show results.
#' @examples
#' if(FALSE){
#' \dontrun{
#' message('Please choose the episomer data directory')
#' setup_config(file.choose())
#' #Getting topword chart for dengue for France, Chile, Australia for last 30 days
Expand Down
4 changes: 2 additions & 2 deletions episomer/R/fs.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ get_scala_recalc_hash_url <- function() {
#' The database is implemented using Apache Lucene indexes allowing episomer to access its data as a search engine but also as a tabular database.
#' \code{\link{health_check}} called each 60 seconds on a background process to send alerts to the administrator if some episomer components fail.
#' @examples
#' if(FALSE){
#' \dontrun{
#' #Running the detect loop
#' library(episomer)
#' message('Please choose the episomer data directory')
Expand Down Expand Up @@ -162,7 +162,7 @@ fs_loop <- function(data_dir = NA) {
#' AND, OR and -(for excluding terms) are supported on q parameter.
#' Order by week is always applied before relevance so even if you provide by_relevance = TRUE all of the matching posts of the first week will be returned first
#' @examples
#' if(FALSE){
#' \dontrun{
#' #Running the detect loop
#' library(episomer)
#' message('Please choose the episomer data directory')
Expand Down
6 changes: 3 additions & 3 deletions episomer/R/geo-tagging.R
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ get_country_index_map <- function() {
#'
#' Normally this function is not called directly by the user but from the \code{\link{detect_loop}} function.
#' @examples
#' if(FALSE){
#' \dontrun{
#' library(episomer)
#' # setting up the data folder
#' message('Please choose the episomer data directory')
Expand Down Expand Up @@ -460,7 +460,7 @@ update_geonames <- function(tasks = get_tasks()) {
#'
#' Normally this function is not called directly by the user but from the \code{\link{detect_loop}} function.
#' @examples
#' if(FALSE){
#' \dontrun{
#' library(episomer)
#' # setting up the data folder
#' message('Please choose the episomer data directory')
Expand Down Expand Up @@ -632,7 +632,7 @@ update_languages <- function(tasks = get_tasks(), reuse_downloads = FALSE) {
#'
#' This function is called from the Shiny app on geolocation evaluation tab but can also be used for manually evaluating the episomer geolocation algorithm.
#' @examples
#' if(FALSE) {
#' \dontrun{
#' library(episomer)
#' # setting up the data folder
#' message('Please choose the episomer data directory')
Expand Down
4 changes: 2 additions & 2 deletions episomer/R/plans.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# a plan will perform several requests to the underlysing API and each time a request is performed the number of requests will be increased.
# The field scheduled_for indicates the time when the next request is expected to be executed.
# @examples
# if(FALSE){
# \dontrun{
# #creating the default plan
# parse_plan_attributes()
# }
Expand Down Expand Up @@ -110,7 +110,7 @@ merge_plans <- function(p1, p2) {
# Any finished plans after the first will be discharged. Note that a maximum of 100 plans are kept)
# @returns the updated list of plans
# @examples
# if(FALSE){
# \dontrun{
# #Getting default plan
# update_plans(plans = list(), schedule_span = 120)
# #Updating topics for first topic
Expand Down
Loading
Loading