-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRun_DQA.R
More file actions
70 lines (59 loc) · 2.02 KB
/
Run_DQA.R
File metadata and controls
70 lines (59 loc) · 2.02 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
library(futile.logger)
source('Infrastructure/LibraryImports.R')
source('Infrastructure/ReportImports.R', chdir = T)
source('Infrastructure/GlobalConstants.R')
source('Infrastructure/LoggingFunctions.R')
source('Resources/site_info.R')
source("./Main/Level1/v2/Execute_Level1_PEDSnet_DQA.R", chdir=T)
source("./Main/Level2/Execute_Level2_PEDSnet_DQA.R", chdir = T)
Sys.setenv(TZ="GMT")
Sys.setenv(ORA_SDTZ="GMT")
#Fixes rJava out of memory exception
options(java.parameters = "-Xmx1024m")
options(warn=-1)
flog.appender(appender.file("dqa.log"), name='debug.io')
flog.info('Log started!')
runDQA<-function(level)
{
if (level == 1) {
runAndLog(
FUN = executeLevel1DQA,
success_log = 'Level 1 DQA succesfully finished!',
error_log='Level 1 DQA failed to finish')
} else if (level == 2) {
runAndLog(
FUN=executeLevel2DQA,
success_log = 'Level 2 DQA succesfully finished!',
error_log='Level 2 DQA failed to finish')
} else {
message('Level must be either 1 or 2')
}
}
generateSingleReport <- function(level, report) {
test_report = NULL
if(level == 1) {
test_report <- g_level1_reports[[report]]
} else if (level == 2) {
test_report <- g_level2_reports[[report]]
}
if (is.null(test_report)) {
if(level != 1 && level != 2) {
flog.error("Level must be 1 or 2")
} else if (level == 1) {
flog.error("%s is not a valid level 1 report", report)
flog.info("Available reports are as follows: ")
flog.info(ls(g_level1_reports))
} else {
flog.error("%s is not a valid level 2 report", report)
flog.info("Available reports are as follows: ")
flog.info(ls(g_level2_reports))
}
}
else {
runAndLog(
FUN = test_report,
success_log = paste(report, ' report succesfully generated.', sep=""),
error_log = paste('Failed to generate ', report, ' report, see dqa.log for more details.', sep="")
)
}
}