/
ConceptSetDefinitionsInOhdsiPhenotypeLibrary.Rmd
94 lines (80 loc) · 2.05 KB
/
ConceptSetDefinitionsInOhdsiPhenotypeLibrary.Rmd
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
---
title: "Concept Set Definitions in OHDSI Phenotype Library"
author: "Gowtham A. Rao"
date: "`r Sys.Date()`"
output:
html_document:
number_sections: yes
toc: no
vignette: >
%\VignetteIndexEntry{Concept Set Definitions in OHDSI Phenotype Library}
%\VignetteEncoding{UTF-8}
%\VignetteEngine{knitr::rmarkdown}
always_allow_html: true
---
```{r, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
cache = FALSE,
comment = "#>",
error = FALSE,
tidy = FALSE
)
library(reactable)
```
```{r tidy=FALSE,eval=TRUE, echo = FALSE}
report <- PhenotypeLibrary::getPlConceptDefinitionSet()
```
```{r tidy=FALSE,eval=TRUE, echo = FALSE}
camelCaseToTitleCase <- function(string) {
errorMessages <- checkmate::makeAssertCollection()
checkmate::assertCharacter(string, add = errorMessages)
checkmate::reportAssertions(collection = errorMessages)
string <- gsub("([A-Z])", " \\1", string)
string <- gsub("([a-z])([0-9])", "\\1 \\2", string)
substr(string, 1, 1) <- toupper(substr(string, 1, 1))
return(string)
}
report <- report |>
dplyr::select(
-conceptSetSql,
-conceptSetExpression
)
colnames(report) <- camelCaseToTitleCase(colnames(report))
columnDefinitions <- list()
colnamesInReport <- colnames(report)
for (i in (1:length(colnamesInReport))) {
columnDefinitions[[colnamesInReport[[i]]]] <-
reactable::colDef(
name = colnamesInReport[[i]],
minWidth = nchar(colnamesInReport[[i]]) * 10,
sortable = TRUE,
resizable = TRUE,
show = TRUE,
html = TRUE,
na = "",
align = "left"
)
}
```
```{r tidy=FALSE,eval=TRUE, echo = FALSE}
reactable::reactable(
data = report,
columns = columnDefinitions,
sortable = TRUE,
filterable = TRUE,
resizable = TRUE,
searchable = TRUE,
pagination = TRUE,
showPagination = TRUE,
showPageInfo = TRUE,
striped = TRUE,
compact = FALSE,
wrap = FALSE,
showSortIcon = TRUE,
showSortable = TRUE,
fullWidth = TRUE,
showPageSizeOptions = TRUE,
pageSizeOptions = c(10, 20, 50, 100, 1000, 1000000),
defaultPageSize = 100
)
```