Skip to content

Commit

Permalink
Added pkgdown documentation. Added one testthat test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajit Londhe committed Aug 23, 2019
1 parent 16eb5ff commit 0b18519
Show file tree
Hide file tree
Showing 31 changed files with 2,215 additions and 127 deletions.
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
language: r
sudo: false
cache: packages

branches:
except:
- /^*-v[0-9]/

r_packages:
- covr
- drat

before_script:
- export PKG_NAME=$(Rscript -e 'cat(paste0(devtools::as.package(".")$package))')
- export PKG_TARBALL=$(Rscript -e 'pkg <- devtools::as.package("."); cat(paste0(pkg$package,"_",pkg$version,".tar.gz"))')

# Build and check package
script:
- R CMD build .
- _R_CHECK_CRAN_INCOMING_=FALSE R CMD check "${PKG_TARBALL}" --as-cran
- cat ${PKG_NAME}.Rcheck/00install.out # Print out install / compile log

after_success:
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && perl compare_versions --tag && bash deploy.sh && curl --data "build=true" -X POST https://registry.hub.docker.com/u/ohdsi/broadsea-methodslibrary/trigger/f0b51cec-4027-4781-9383-4b38b42dd4f5/
- Rscript -e 'library(covr);codecov()'

notifications:
recipients:
- alondhe2@its.jnj.com
- mblacke@its.jnj.com
- fdefalco@its.jnj.com
email:
on_success: change
on_failure: change
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: DataQualityDashboard
Type: Package
Title: Execute Data Quality Checks on CDM Database
Title: Execute and View Data Quality Checks on OMOP CDM Database
Version: 0.0.1
Date: 2019-08-05
Date: 2019-08-22
Authors@R: c(
person("Clair", "Blacketer", , "mblacke@its.jnj.com", role = c("aut", "cre")),
person("Ajit", "Londhe", role = c("aut")),
Expand All @@ -12,7 +12,7 @@ Authors@R: c(
person("Pavel", "Grafkin", role = c("aut"))
)
Maintainer: Clair Blacketer <mblacke@its.jnj.com>
Description: An R package for assessing data quality in standardized OMOP common data model data sources.
Description: An R package for assessing data quality in standardized OMOP Common Data Model data sources.
License: Apache License 2.0
VignetteBuilder: knitr
URL: https://github.com/OHDSI/DataQualityDashboard
Expand All @@ -33,4 +33,4 @@ Suggests:
rmarkdown,
shiny
RoxygenNote: 6.1.1
Encoding: UTF-8
Encoding: UTF-8
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(dqDashPOC)
export(dqDashPOCOutput)
export(executeDqChecks)
export(renderDqDashPOC)
export(viewDqDashboard)
export(writeJsonResultsToTable)
import(htmlwidgets)
45 changes: 0 additions & 45 deletions R/dqDashPOC.R

This file was deleted.

19 changes: 18 additions & 1 deletion R/execution.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# @file execution.R
#
# Copyright 2019 Observational Health Data Sciences and Informatics
#
# This file is part of DataQualityDashboard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

.recordResult <- function(result = NULL, check,
checkDescription, sql,
Expand Down Expand Up @@ -446,7 +463,7 @@ executeDqChecks <- function(connectionDetails,
}


#' Execute DQ checks
#' Write JSON Results to SQL Table
#'
#' @param connectionDetails A connectionDetails object for connecting to the CDM database
#' @param resultsDatabaseSchema The fully qualified database name of the results schema
Expand Down
20 changes: 19 additions & 1 deletion R/view.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
# @file view.R
#
# Copyright 2019 Observational Health Data Sciences and Informatics
#
# This file is part of DataQualityDashboard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


#' View DQ Dashboard
#'
#' @param jsonPath The path to the JSON file produced by executeDqDashboard
#' @param jsonPath The path to the JSON file produced by \code{\link{executeDqChecks}}
#'
#' @export
viewDqDashboard <- function(jsonPath) {
Expand Down
58 changes: 30 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
DataQualityDashboard
=================
====================

DataQualityDashboard is an initiative in the OHDSI community to improve data quality standards in observational data science.
The DataQualityDashboard is a tool to help improve data quality standards in observational data science.

Introduction
============
An R package for characterizing the data quality of a person-level data source that has been converted into the OMOP CDM 5.3.1 format.

Features
========
- Utilizes configurable data checks
- Analyzes data in the common data model format for all data checks
- Utilizes configurable data check thresholds
- Analyzes data in the OMOP Common Data Model format for all data checks
- Produces a set of data check results with supplemental investigation assets.


Technology
==========
DataQualityDashboard is an R package that wraps a Java library for integration of data quality checks in the OHDSI WebAPI as well as stand-alone R processing.
DataQualityDashboard is an R package

System Requirements
===================
Requires R (version 3.2.2 or higher). Requires Java.
Requires R (version 3.2.2 or higher). Requires [DatabaseConnector](https://github.com/OHDSI/DatabaseConnector) and [SqlRender](https://github.com/OHDSI/SqlRender).

Getting Started
===============
```r




# fill out the connection details -----------------------------------------------------------------------
connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = "", user = "",
password = "", server = "",
port = "", extraSettings = "")
connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = "",
user = "",
password = "",
server = "",
port = "",
extraSettings = "")

cdmDatabaseSchema <- "yourCdmSchema" # the fully qualified database schema name of the CDM
resultsDatabaseSchema <- "yourResultsSchema" # the fully qualified database schema name of the results schema (that you can write to)
Expand All @@ -50,8 +50,8 @@ outputFolder <- "output"
# logging type -------------------------------------------------------------------------------------
verboseMode <- FALSE # set to TRUE if you want to see activity written to the console

# write results to table? -----------------------------------------------------------------------
writeToTable <- TRUE # set to FALSE if you want to skip writing to results table
# write results to table? ------------------------------------------------------------------------------
writeToTable <- TRUE # set to FALSE if you want to skip writing to a SQL table in the results schema

# if writing to table and using Redshift, bulk loading can be initialized -------------------------------

Expand All @@ -68,20 +68,20 @@ checkLevels <- c("TABLE", "FIELD", "CONCEPT")

# which DQ checks to run? ------------------------------------

checkNames <- c() #Names can be found in inst/csv/OMOP_CDM_v5.3.1_Check_Desciptions.csv
checkNames <- c() # Names can be found in inst/csv/OMOP_CDM_v5.3.1_Check_Desciptions.csv

# run the job --------------------------------------------------------------------------------------
DataQualityDashboard::executeDqChecks(connectionDetails = connectionDetails,
cdmDatabaseSchema = cdmDatabaseSchema,
resultsDatabaseSchema = resultsDatabaseSchema,
cdmSourceName = cdmSourceName,
numThreads = numThreads,
sqlOnly = sqlOnly,
outputFolder = outputFolder,
verboseMode = verboseMode,
writeToTable = writeToTable,
checkLevels = checkLevels,
checkNames = checkNames)
cdmDatabaseSchema = cdmDatabaseSchema,
resultsDatabaseSchema = resultsDatabaseSchema,
cdmSourceName = cdmSourceName,
numThreads = numThreads,
sqlOnly = sqlOnly,
outputFolder = outputFolder,
verboseMode = verboseMode,
writeToTable = writeToTable,
checkLevels = checkLevels,
checkNames = checkNames)

# inspect logs ----------------------------------------------------------------------------
ParallelLogger::launchLogViewer(logFileName = file.path(outputFolder, cdmSourceName,
Expand All @@ -92,11 +92,12 @@ jsonFilePath <- ""
DataQualityDashboard::writeJsonResultsToTable(connectionDetails = connectionDetails,
resultsDatabaseSchema = resultsDatabaseSchema,
jsonFilePath = jsonFilePath)

# view dashboard --------------------------------------------------------------------------
viewDqDashboard(jsonPath = "full_path_to_json_file.json")

```

User Documentation
==================

Support
=======
Expand All @@ -108,7 +109,8 @@ DataQualityDashboard is licensed under Apache License 2.0

### Development status

In early development phase. Not ready for use.
In early development phase. Not ready for use.

# Acknowledgements

This project is supported in part through the National Science Foundation grant IIS 1251151.
21 changes: 21 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
template:
params:
bootswatch: cosmo

home:
links:
- text: Ask a question
href: http://forums.ohdsi.org

reference:
- title: "Execution"
desc: >
Function for running data quality checks
contents:
- executeDqChecks
- writeJsonResultsToTable
- title: "View Dashboard"
desc: >
Function for viewing the data quality dashboard
contents:
- viewDqDashboard
68 changes: 68 additions & 0 deletions compare_versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/perl

open(R_VERSION, "grep 'Version' DESCRIPTION |");
$version = <R_VERSION>;
close(R_VERSION);

$version =~ /(\d+)\.(\d+)\.(\d+)/;
$r_major = $1;
$r_minor = $2;
$r_mod = $3;

print "New R version: $r_major-$r_minor-$r_mod\n";

open(GIT_VERSION, "git describe --tags |");
$git = <GIT_VERSION>;
close(GIT_VERSION);

$git =~ /v(\d+)\.(\d+)\.(\d+)/;
$git_major = $1;
$git_minor = $2;
$git_mod = $3;

print "Current git version: $git_major-$git_minor-$git_mod\n";

if ($r_major > $git_major || $r_minor > $git_minor || $r_mod > $git_mod) {
$monotonic = 0;
} else {
$monotonic = -1;
}

if ($monotonic != 0) {
print "Non-monotonically increasing versions numbers\n";
}

if ($monotonic == 0 & $ARGV[0] eq "--tag") {

open(GIT_TAG, "git tag v$r_major.$r_minor.$r_mod |");

$fail = 0;
while ($line = <GIT_TAG>) {
if ($line =~ /fatal/) {
$fail = 1;
}
print "tag: $line";
} # TODO Check for errors
close(GIT_TAG);
print "tag: END\n\n";

if ($fail eq 1) {
exit(-1);
}

$cmd = "git config user.name \"alondhe\"; " .
"git config user.email \"alondhe2@its.jnj.com\"; " .
"git tag v$r_major.$r_minor.$r_mod ; " .
"git push -q https://\$GH_TOKEN\@github.com/OHDSI/\$PKG_NAME.git --tags";

print "cmd: $cmd\n";

open(GIT_PUSH, "$cmd |");
while ($line = <GIT_PUSH>) {
print "push: $line";
} # TODO Check for errors
close(GIT_PUSH);
print "push: END\n\n";
}

exit($monotonic);
Loading

0 comments on commit 0b18519

Please sign in to comment.