/
main_ColOpenData.R
51 lines (39 loc) · 1.55 KB
/
main_ColOpenData.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
##
## This script is the main script for the EpiCo package.
## It is used to run the EpiCo algorithm on a given dataset.
## This is the R translation of the python code in EpiCo_python
##
library(reticulate) # for Python interoperability
# Load Python shell
use_python("/Users/samueltorres/opt/anaconda3/bin/python") # path to Python environment
# Point to controller
source_python("controller.py")
downloadSivigilaData <- function(years_to_download, events_to_download) {
download_Data <- download_sivigila_data(years_to_download, events_to_download)
return(download_Data)
}
preprocessData <- function(years_to_preprocess, events_to_preprocess, save) {
if (save) {
if (length(years_to_preprocess) == 1) {
years_save <- years_to_preprocess[[1]]
} else {
years_save <- paste(years_to_preprocess[[1]],
years_to_preprocess[[length(years_to_preprocess)]],
sep = "-")
}
}
preprocess_data <- preprocess_sivigila_data(years_to_preprocess,
events_to_preprocess,
years_save,
save)
return(preprocess_data)
}
preprocessDataDemographics <- function(save) {
preprocess_data_demographics <- preprocess_cesus_demographic(save)
return(preprocess_data_demographics)
}
preprocessDataHouseholds <- function(save) {
preprocess_data_households <- preprocess_cesus_household(save)
return(preprocess_data_households)
}
preprocessDataHouseholds(save = TRUE)