Summary
Summary.Rmd
library(PETDiagnostics)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(CDMConnector)
#> Warning: package 'CDMConnector' was built under R version 4.3.3
library(dbplyr)
#>
#> Attaching package: 'dbplyr'
#> The following object is masked from 'package:CDMConnector':
#>
#> in_schema
#> The following objects are masked from 'package:dplyr':
#>
#> ident, sql
library(DT)
or use your own cdm connection, in which case the table needs to be added to the cdm (on how to do this, see the run_this.R script)
cdm <- PETDiagnostics::mockPregnancy(mothertable = NULL,
babytable = NULL,
pregnancy_size = 100,
fetus_size = 110,
seed = 1)
How many women and pregnancies are there?
PETOverviewMother <- PETDiagnostics::getOverview(cdm$mothertable)
DT::datatable(PETOverviewMother)
How many pregnancies and fetuses are there?
PETOverviewBaby <- PETDiagnostics::getOverview(cdm$babytable)
DT::datatable(PETOverviewBaby)
How many pregnancies are there per year?
AnnualPETOverviewMother <- PETDiagnostics::getAnnualOverview(cdm$mothertable)
DT::datatable(AnnualPETOverviewMother)
How many missing values are there in the mothertable?
The first 8 variables (until pregnancy_single) should not have any missings because they are required variables, i.e. any unknown value is mapped to zero, any observations with missing values are not considered
missingSummaryMother <- PETDiagnostics::getMissings(cdm$mothertable)
DT::datatable(missingSummaryMother)
How many missing values are there in the babytable?
The first 2 variables (until fetus_id) should not have any missings because they are required variables, i.e. any unknown value is mapped to zero, any observations with missing values are not considered
missingSummaryBaby <- PETDiagnostics::getMissings(cdm$babytable)
DT::datatable(missingSummaryBaby)
How many unknown values are there in the mothertable?
unknownSummaryMother <- PETDiagnostics::getUnknown(cdm$mothertable)
DT::datatable(unknownSummaryMother)
How do dates and gestational age add up in the mothertable?
“different gestational age” means that the difference between pregnancy end date and start date is larger than 7 days
“match gestational age” means that it the difference between pregnancy end date and start date is equal or smaller than 7 days
“missing information” counts the missings in either gestational age, pregnancy end or start date (there shold not be any missings because it is a required variable)
“end before start” counts the occasions in which the pregnancy end date happened on or before the start date plus the minimum of pre-defined gestational age
“end after start” counts the occasions in which the pregnancy end date happened after the start date plus the minimum of pre-defined gestational age
gestationalAgeMatch <- PETDiagnostics::summariseGestationalAge(cdm$mothertable,minGestAge_Days = 21) %>% dplyr::collect()
DT::datatable(gestationalAgeMatch)
What is the minimum and maximum of pregnancy start and end dates as well as the distribution of gestational age ?
valueDatesAgeDist <- PETDiagnostics::getValueDatesAgeDist(cdm$mothertable)
DT::datatable(valueDatesAgeDist)
How do outcome and mode of delivery add up in the mothertable?
“missing/unknown information” counts the missing/unknown information in either pregnancy outcome or mode of delivery (there should not be any missings)
outcomeModeMatch <- PETDiagnostics::checkOutcomeMode(cdm$mothertable)
DT::datatable(outcomeModeMatch)
How do number of fetuses and liveborns add up in the mothertable?
“missing relative number” counts the missing information in either pregnancy number of fetuses and liveborns
“multiple wrong” means that the variable pregnancy single does not add up with the pregnancy number fetus variable
“multiple right” means that the variable pregnancy single adds up with the pregnancy number fetus variable
“missing multiple” counts the missing information in either pregnancy single or pregnancy number fetus
fetusesLivebornNumber <- PETDiagnostics::checkFetusesLiveborn(cdm$mothertable)
DT::datatable(fetusesLivebornNumber)
How do number of fetuses and liveborns add up in the mothertable and babytable?
“single_not_align_with_noOfFetusId” means the variable pregnancy single does not align with the number of fetuses in the babytable
“single_align_with_noOfFetusId” means the variable pregnancy single is YES and the number of fetuses in the babytable is 1
“missing_single” counts the missing/unknown information in pregnancy single or pregnancy number fetus
“noOfFetus_not_align_with_noOfFetusId” means the variable pregnancy number fetus does not align with the number of fetuses in the babytable
“noOfFetus_align_with_noOfFetusId” means the variable pregnancy number fetus align with the number of fetuses in the babytable
“missing_noOfFetus” counts the missing information in pregnancy number fetus
fetusIdMatch <- PETDiagnostics::checkFetusId(cdm$mothertable,cdm$babytable)
DT::datatable(fetusIdMatch)
What is the distribution of birth weight in the baby table?
valueWeightDist <- PETDiagnostics::getValueWeightDist(cdm$babytable)
DT::datatable(valueWeightDist)