Skip to content

Commit

Permalink
Merge pull request #615 from OHDSI/cran-submission
Browse files Browse the repository at this point in the history
Cran submission
  • Loading branch information
clairblacketer authored Feb 12, 2024
2 parents 55c4d7a + 67e30a1 commit 54adbf4
Show file tree
Hide file tree
Showing 135 changed files with 26,725 additions and 67,491 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
extras/*
docs/*
rmd/*
^CRAN-SUBMISSION$
^cran-comments\.md$
2 changes: 2 additions & 0 deletions .github/workflows/R_CMD_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
branches:
- '**'
schedule:
- cron: '0 19 * * 0' # every Sunday at 7pm UTC

name: R-CMD-check

Expand Down
3 changes: 3 additions & 0 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version: 0.2.0
Date: 2024-02-06 20:13:33 UTC
SHA: d152472484fb2bedd2596e2279a24afbd0084f0b
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ Title: OMOP CDM DDL and Documentation Generator
Version: 0.2.0
Author: Clair Blacketer [aut, cre]
Maintainer: Clair Blacketer <[email protected]>
Description: This package uses an input csv file to create the OHDSql version of the DDL as well as the documentation associated. Then it leverages the SqlRender package to convert the DDL script written in OHDSql to the other supported dialects.
Description: Generates the scripts required to create an Observational Medical Outcomes Partnership (OMOP) Common Data Model (CDM) database and associated documentation for supported database platforms. Leverages the 'SqlRender' package to convert the Data Definition Language (DDL) script written in parameterized Structured Query Language (SQL) to the other supported dialects.
License: Apache License 2.0
Encoding: UTF-8
LazyData: true
VignetteBuilder: knitr
Depends:
DatabaseConnector,
SqlRender,
rJava
Imports:
SqlRender,
rmarkdown,
stringr,
DatabaseConnector,
DBI,
dplyr,
readr
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export(writeDdl)
export(writeForeignKeys)
export(writeIndex)
export(writePrimaryKeys)
import(DatabaseConnector)
import(SqlRender)
import(rJava)
importFrom(utils,download.file)
importFrom(utils,read.csv)
importFrom(utils,write.csv)
4 changes: 4 additions & 0 deletions R/CommonDataModel-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#' @import rJava
#' @import DatabaseConnector
#' @import SqlRender
NULL
1 change: 1 addition & 0 deletions R/WikiParser.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#'
#' @param mdFilesLocation Path to the root folder of the Wiki repository.
#' @param output_file Path to where the output CSV file should be written.
#' @return CSV files with the OMOP CDM specifications.
#' @importFrom utils write.csv
#' @export
parseWiki <- function(mdFilesLocation, output_file) {
Expand Down
8 changes: 5 additions & 3 deletions R/buildRelease.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@
#' Create OMOP CDM SQL files
#'
#' Writes DDL, ForeignKey, PrimaryKey and index SQL files for given cdmVersion
#' and targetDialect to the 'ddl' folder in current working directory.
#' and targetDialect to the 'ddl' folder in specifed output folder.
#'
#' @param cdmVersions The versions of the CDM you are creating, e.g. 5.3, 5.4.
#' Defaults to all supported CDM versions.
#' @param targetDialects A character vector of target dialects.
#' Defaults to all supported dialects.
#' @param outputfolder The base folder where the SQL files will be written.
#' Subfolders will be created for each cdmVersion and targetDialect.
#' @return Writes DDL, ForeignKey, PrimaryKey and index SQL files for given cdmVersion
#' and targetDialect to the 'ddl' folder in specifed output folder.
#' @export
buildRelease <- function(cdmVersions = listSupportedVersions(),
targetDialects = listSupportedDialects(),
outputfolder = file.path(getwd(), "inst", "ddl")){
outputfolder = file.path(tempdir(), "inst", "ddl")){
basefolder <- outputfolder
for (cdmVersion in cdmVersions) {
for (targetDialect in targetDialects) {
Expand Down Expand Up @@ -74,7 +76,7 @@ buildRelease <- function(cdmVersions = listSupportedVersions(),
#'}
buildReleaseZip <- function(cdmVersion,
targetDialect = listSupportedDialects(),
outputfolder = file.path(getwd(), "output")){
outputfolder = file.path(tempdir(), "output")){
# argument checks
stopifnot(is.character(cdmVersion), length(cdmVersion) == 1, cdmVersion %in% listSupportedVersions())

Expand Down
2 changes: 2 additions & 0 deletions R/createDdl.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ createDdl <- function(cdmVersion){


#' @describeIn createDdl createPrimaryKeys Returns a string containing the OHDSQL for creation of primary keys in the OMOP CDM.
#' @return A string containing the OHDSQL for creation of primary keys in the OMOP CDM.
#' @export
createPrimaryKeys <- function(cdmVersion){
# prevent check NOTE from occurring due to non-standard evaluation of variables
Expand All @@ -123,6 +124,7 @@ createPrimaryKeys <- function(cdmVersion){
}

#' @describeIn createDdl createForeignKeys Returns a string containing the OHDSQL for creation of foreign keys in the OMOP CDM.
#' @return A string containing the OHDSQL for creation of foreign keys in the OMOP CDM.
#' @export
createForeignKeys <- function(cdmVersion){
# prevent check NOTE from occurring due to non-standard evaluation of variables
Expand Down
5 changes: 3 additions & 2 deletions R/downloadCurrentDdl.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#' Get current DDL sitting on the master branch
#' Get current DDL sitting on the main branch
#'
#' @details
#' This function gets the current ddl on the CDM master branch. It will be taken from the Sql Server folder.
#' This function gets the current ddl on the CDM main branch. It will be taken from the Sql Server folder.
#' The default location is
#' \code{inst/settings/currentOmopDdl.sql}.
#'
#' @param githubPath The path for the GitHub repo containing the package (e.g. 'OHDSI/CommonDataModel').
#' @param pathToCsv The path for the snapshot inside the package.
#' @param outputFile The path where the file should be saved.
#'
#' @return The current DDL sitting on the main branch of the CommonDataModel repository.
#' @examples
#' \dontrun{
#' downloadCurrentDdl("OHDSI/CommonDataModel",
Expand Down
1 change: 1 addition & 0 deletions R/executeDdl.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#' @param executePrimaryKey Should the primary keys be added? TRUE or FALSE
#' @param executeForeignKey Should the foreign keys be added? TRUE or FALSE
#' @param ... Other arguments passed on to DatabaseConnector::executeSql. (This allows the user to set the path to errorReportFile.)
#' @return Writes the fully specified DDLs, primary keys, foreign keys, and indices to a file and then executes on a database.
#' @export
#'
#' @examples
Expand Down
3 changes: 2 additions & 1 deletion R/listSupportedVersions.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' List CDM versions supported by this package
#'
#' @return A character vector containing the support CDM versions in {major}.{minor} format.
#' @return A character vector containing the supported Common Data Model (CDM) versions in major.minor format.
#' @export
listSupportedVersions <- function() {
supportedVersions <- c("5.3", "5.4")
Expand All @@ -9,6 +9,7 @@ listSupportedVersions <- function() {

#' List RDBMS dialects supported by this package
#'
#' @return A list containing the supported Structured Query Language (SQL) dialects.
#' @export

listSupportedDialects <- function() {
Expand Down
5 changes: 5 additions & 0 deletions R/writeDDL.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#' @param outputfolder The directory or folder where the SQL file should be saved.
#' @param cdmDatabaseSchema The schema of the CDM instance where the DDL will be run. For example, this would be "ohdsi.dbo" when testing on sql server.
#' Defaults to "@cdmDatabaseSchema"
#' @return Writes SQL file with the OMOP CDM DDL for the specified CDM version and target dialect in the output folder.
#'
#' @export
writeDdl <- function(targetDialect, cdmVersion, outputfolder, cdmDatabaseSchema = "@cdmDatabaseSchema") {
Expand All @@ -50,7 +51,9 @@ writeDdl <- function(targetDialect, cdmVersion, outputfolder, cdmDatabaseSchema
}

#' @describeIn writeDdl writePrimaryKeys Write the SQL code that creates the primary keys to a file.
#' @return Writes a SQL file with the primary keys for the OMOP CDM based on the specified target dialect and CDM version.
#' @export
#'
writePrimaryKeys <- function(targetDialect, cdmVersion, outputfolder, cdmDatabaseSchema = "@cdmDatabaseSchema") {

# argument checks
Expand All @@ -74,6 +77,7 @@ writePrimaryKeys <- function(targetDialect, cdmVersion, outputfolder, cdmDatabas
}

#' @describeIn writeDdl writeForeignKeys Write the SQL code that creates the foreign keys to a file.
#' @return Writes a SQL file with the foreign keys for the OMOP CDM based on the specified target dialect and CDM version.
#' @export
writeForeignKeys <- function(targetDialect, cdmVersion, outputfolder, cdmDatabaseSchema = "@cdmDatabaseSchema") {

Expand All @@ -98,6 +102,7 @@ writeForeignKeys <- function(targetDialect, cdmVersion, outputfolder, cdmDatabas
}

#' @describeIn writeDdl writeIndex Write the rendered and translated sql that creates recommended indexes to a file.
#' @return Writes a SQL file with the indices for the OMOP CDM based on the specified target dialect and CDM version.
#' @export
writeIndex <- function(targetDialect, cdmVersion, outputfolder, cdmDatabaseSchema = "@cdmDatabaseSchema") {

Expand Down
13 changes: 13 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## R CMD check results

* This is a new release

# Update based on reviewer feedback
- turned off tests when environment variables are not set
- removed vignetteBuilder field from DESCRIPTION
- added return values in function documentation
- updated buildRelease.R default output folder to tempdir()

0 errors | 0 warnings | 0 notes


26 changes: 11 additions & 15 deletions docs/background.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title> OMOP CDM Background</title>

<script src="site_libs/header-attrs-2.16/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.25/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/cosmo.min.css" rel="stylesheet" />
Expand All @@ -29,14 +29,14 @@
h6 {font-size: 12px;}
code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
pre:not([class]) { background-color: white }</style>
<script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script>
<script src="site_libs/jqueryui-1.13.2/jquery-ui.min.js"></script>
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<link href="site_libs/highlightjs-9.12.0/default.css" rel="stylesheet" />
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
<link href="site_libs/font-awesome-5.1.0/css/all.css" rel="stylesheet" />
<link href="site_libs/font-awesome-5.1.0/css/v4-shims.css" rel="stylesheet" />
<link href="site_libs/font-awesome-6.4.2/css/all.min.css" rel="stylesheet" />
<link href="site_libs/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet" />
<link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />

<style type="text/css">
Expand Down Expand Up @@ -185,25 +185,18 @@
border-radius: 4px;
}

.tabset-dropdown > .nav-tabs > li.active:before {
content: "";
.tabset-dropdown > .nav-tabs > li.active:before, .tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "\e259";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}

.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
content: "&#xe258;";
border: none;
}

.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "";
content: "\e258";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
border: none;
}

.tabset-dropdown > .nav-tabs > li.active {
Expand Down Expand Up @@ -402,6 +395,9 @@
<li>
<a href="cdm54Changes.html">Changes from CDM v5.3</a>
</li>
<li>
<a href="cdm54erd.html">Entity Relationships</a>
</li>
</ul>
</li>
</ul>
Expand Down
26 changes: 11 additions & 15 deletions docs/cdm30.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>CDM v3</title>

<script src="site_libs/header-attrs-2.16/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.25/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/cosmo.min.css" rel="stylesheet" />
Expand All @@ -29,14 +29,14 @@
h6 {font-size: 12px;}
code {color: inherit; background-color: rgba(0, 0, 0, 0.04);}
pre:not([class]) { background-color: white }</style>
<script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script>
<script src="site_libs/jqueryui-1.13.2/jquery-ui.min.js"></script>
<link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" />
<script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script>
<script src="site_libs/navigation-1.1/tabsets.js"></script>
<link href="site_libs/highlightjs-9.12.0/default.css" rel="stylesheet" />
<script src="site_libs/highlightjs-9.12.0/highlight.js"></script>
<link href="site_libs/font-awesome-5.1.0/css/all.css" rel="stylesheet" />
<link href="site_libs/font-awesome-5.1.0/css/v4-shims.css" rel="stylesheet" />
<link href="site_libs/font-awesome-6.4.2/css/all.min.css" rel="stylesheet" />
<link href="site_libs/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet" />
<link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />

<style type="text/css">
Expand Down Expand Up @@ -185,25 +185,18 @@
border-radius: 4px;
}

.tabset-dropdown > .nav-tabs > li.active:before {
content: "";
.tabset-dropdown > .nav-tabs > li.active:before, .tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "\e259";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
}

.tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before {
content: "&#xe258;";
border: none;
}

.tabset-dropdown > .nav-tabs.nav-tabs-open:before {
content: "";
content: "\e258";
font-family: 'Glyphicons Halflings';
display: inline-block;
padding: 10px;
border-right: 1px solid #ddd;
border: none;
}

.tabset-dropdown > .nav-tabs > li.active {
Expand Down Expand Up @@ -402,6 +395,9 @@
<li>
<a href="cdm54Changes.html">Changes from CDM v5.3</a>
</li>
<li>
<a href="cdm54erd.html">Entity Relationships</a>
</li>
</ul>
</li>
</ul>
Expand Down
Loading

0 comments on commit 54adbf4

Please sign in to comment.