-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.R
More file actions
30 lines (21 loc) · 899 Bytes
/
main.R
File metadata and controls
30 lines (21 loc) · 899 Bytes
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
library(tercen)
library(dplyr, warn.conflicts = FALSE)
library(tim)
#http://127.0.0.1:5402/test-team/w/8ef9012b2d2f050214e16189ba0406b4/ds/3a384786-103c-4f71-a4fc-81da01db627a
#options("tercen.workflowId" = "8ef9012b2d2f050214e16189ba0406b4")
#options("tercen.stepId" = "3a384786-103c-4f71-a4fc-81da01db627a")
ctx = tercenCtx()
colNames <- ctx$cnames
# grepl( needle, haystack, fixed = TRUE)
# Checking for documentId columns
docIdCols <- unname(unlist(colNames[unlist(lapply(colNames, function(x){
return(grepl("documentId", x, fixed = TRUE))
} ))]))
if (length(docIdCols) == 0 ) stop("At least 1 documentId column expected.")
for( docIdCol in docIdCols ){
docId <- ctx$cselect(unique(unlist(docIdCol)))
print(paste0("[documentId] ", docId[[1]]))
tempFolder <- file.path('/tmp', docId[[1]],docId[[1]] )
unlink(dirname(tempFolder), recursive = TRUE)
}
ctx$save(ctx$select())