-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.R
More file actions
126 lines (84 loc) · 2.88 KB
/
server.R
File metadata and controls
126 lines (84 loc) · 2.88 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#### SERVER ------
server <- function(input, output, session) {
get.tbl<-reactive({
validate(need(input$Keywords!="",
"No keywords entered"))
working.Keywords<- unlist(strsplit(input$Keywords,";"))
if(!is.null(input$exclude)){
working.exclude<- unlist(strsplit(input$exclude,";"))
} else {
working.exclude<-NULL
}
if(!is.null(input$non_standard.codes)){
working.non_standard.codes<- input$non_standard.codes
} else {
working.non_standard.codes<-NULL
}
getCandidateCodes(
keywords=c(working.Keywords),
conceptClassId = NULL,
standardConcept = "Standard",
domains = "Condition", #input$domains,
searchSynonyms = input$search.synonyms,
searchNonStandard = FALSE,
fuzzyMatch = input$fuzzy.match,
maxDistanceCost = input$fuzzy.match.max.distance,
exclude = working.exclude,
includeDescendants = input$include.descendants,
includeAncestor = input$include.ancestor,
verbose = TRUE,
db=db,
vocabularyDatabaseSchema = vocabSchema
)
})
output$tbl<- renderDataTable({
table<-get.tbl()
validate(need(ncol(table)>1,
"No results for selected inputs"))
datatable(table,rownames= FALSE, extensions = 'Buttons',
options = list( buttons = list(list(extend = "excel",
text = "Download table as excel",
filename = "CandidateCodelist.csv"))
))
} )
output$downloadCodelist <- downloadHandler(
filename = function() {
paste0("CandidateCodes", ".csv")
},
content = function(file) {
write.csv( get.tbl() , file, row.names =FALSE)
}
)
# ntext <- eventReactive(input$goButton, {
# input$non_standard.codes
# })
get.tbl.non_standard<-eventReactive(input$button, {
table<-get.tbl()
validate(need(nrow(table)>0,
"No candidate codes"))
validate(need(input$non_standard.codes!="",
"No vocabulary selected"))
showMappings(table ,
nonStandardVocabularies=input$non_standard.codes,
db=db,
vocabularyDatabaseSchema = vocabSchema)
})
output$tbl.non_standard<- renderDataTable({
table<-get.tbl.non_standard()
validate(need(ncol(table)>1,
"No results for selected inputs"))
datatable(table,rownames= FALSE, extensions = 'Buttons',
options = list( buttons = list(list(extend = "excel",
text = "Download table as excel",
filename = "CandidateCodelistMappings.csv"))
))
} )
output$downloadCodelistMappings <- downloadHandler(
filename = function() {
paste0("CandidateCodelistMappings", ".csv")
},
content = function(file) {
write.csv( get.tbl.non_standard() , file, row.names =FALSE)
}
)
}