-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathREADME.Rmd
84 lines (65 loc) · 2.86 KB
/
README.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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# PETDiagnostics
<!-- badges: start -->
<!-- badges: end -->
The goal of PETDiagnostics is to assess feasibility of data sources to perform observational studies on pregnancy related topics using the pregnancy extension tables in OHDSI.
## Installation
You can install the development version of PETDiagnostics like so:
```{r, eval=FALSE}
install.packages("remotes")
remotes::install_github("oxford-pharmacoepi/PETDiagnostics")
```
## Example
### Create a reference to data in the OMOP CDM format
The PETDiagnostics package is designed to work with data in the OMOP CDM format, so our first step is to create a reference to the data using the CDMConnector package. Here we´ll generate an example reference with simulated data (to see how you would create a reference to your database please consult the CDMConnector package documentation).
```{r example}
library(PETDiagnostics)
library(CDMConnector)
library(dplyr)
# We first need to create a mock database with a cdm reference
# this function creates a mothertable and a babytable
cdm<-mockPregnancy(mothertable = NULL,
babytable = NULL,
pregnancy_size = 100,
fetus_size = 110,
seed = 1)
# this is what the table(s) look like
# use the mothertable and/or the babytable depending on your data
head(cdm$mothertable)
head(cdm$babytable)
```
## Execute the diagnostic checks of your table(s)
### if both tables are available, all checks are possible
### if only the mothertable is available, the "fetusid" and "weightDist" check is not possible, put babytable = NULL
### if only the babytable is available, only the "overview", "missing", "weightDist", and "bitSet" check is possible, put mothertable = NULL
```{r}
resultList <- executeChecks (
mothertable = cdm$mothertable,
babytable = cdm$babytable,
checks = c("overview","annualOverview","missing", "unknown","gestationalAge","datesAgeDist","outcomeMode",
"fetusesLiveborn","fetusid","weightDist","bitSet"),
minCellCount = 5,
minGestAge_Days = 21,
verbose = FALSE)
```
## Exporting results
### resultList is the named list with results
### databaseId is the database identifier
### outputFolder is the folder to write to
```{r}
writeResultToDisk (resultList = resultList, databaseId = "mock", outputFolder = tempdir())
```
```{r, echo=FALSE}
DBI::dbDisconnect(attr(cdm, "dbcon"), shutdown = TRUE)
```