Skip to content

Commit

Permalink
Added return values to all functions
Browse files Browse the repository at this point in the history
  • Loading branch information
clairblacketer committed Feb 6, 2024
1 parent d152472 commit 67e30a1
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 0.2.0
Date: 2024-02-02 21:50:16 UTC
SHA: b9e2be6188f57934df0a7a805ff43bee5a61e74e
Date: 2024-02-06 20:13:33 UTC
SHA: d152472484fb2bedd2596e2279a24afbd0084f0b
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Title: OMOP CDM DDL and Documentation Generator
Version: 0.2.0
Author: Clair Blacketer [aut, cre]
Maintainer: Clair Blacketer <mblacke@its.jnj.com>
Description: Generates the scripts required to create an OMOP CDM database and associated documentation for supported database platforms. 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
Expand Down
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
4 changes: 4 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,6 +51,7 @@ 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") {
Expand All @@ -75,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 @@ -99,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
2 changes: 2 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# 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

Expand Down
8 changes: 6 additions & 2 deletions man/buildRelease.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/buildReleaseZip.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions man/createDdl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions man/downloadCurrentDdl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/executeDdl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/listSupportedDialects.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/listSupportedVersions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/parseWiki.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions man/writeDdl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 67e30a1

Please sign in to comment.