Skip to content

Commit

Permalink
Merge branch 'main' into doc-tooling-support
Browse files Browse the repository at this point in the history
  • Loading branch information
clairblacketer committed Mar 28, 2024
2 parents 6e03fab + fd20424 commit d38086c
Show file tree
Hide file tree
Showing 257 changed files with 40,731 additions and 35,820 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
^LICENSE\.md$
.github/*
extras/*
docs/*
rmd/*
^CRAN-SUBMISSION$
^cran-comments\.md$
13 changes: 7 additions & 6 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 Expand Up @@ -47,15 +49,14 @@ jobs:
CDMDDLBASE_ORACLE_CDM_SCHEMA: ${{ secrets.CDMDDLBASE_ORACLE_CDM_SCHEMA }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-tinytex@v1
- uses: r-lib/actions/setup-tinytex@v2

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
Expand All @@ -66,7 +67,7 @@ jobs:

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v2
uses: actions/cache@v3.3.1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ ehthumbs.db
Thumbs.db
extras/codeToRun.R
output/
ddl/
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
14 changes: 7 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Package: CommonDataModel
Type: Package
Title: OMOP CDM DDL and Documentation Generator
Version: 0.1.0
Version: 0.2.0
Author: Clair Blacketer [aut, cre]
Maintainer: Clair Blacketer <mblacke@its.jnj.com>
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,
readxl,
DatabaseConnector,
DBI,
dplyr,
readr
Expand All @@ -24,5 +24,5 @@ Suggests:
RSQLite,
withr
NeedsCompilation: no
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Config/testthat/edition: 3
201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

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
11 changes: 7 additions & 4 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 @@ -69,11 +71,12 @@ buildRelease <- function(cdmVersions = listSupportedVersions(),
#' @return A character string containing the OHDSQL DDL
#' @export
#' @examples
#'\dontrun{
#' buildReleaseZip(cdmVersion='5.3', targetDialect='sql server', outputfolder='.')
#'
#'}
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
10 changes: 10 additions & 0 deletions R/createDdl.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@
#' @importFrom utils read.csv
#' @export
#' @examples
#'\dontrun{
#' ddl <- createDdl("5.4")
#' pk <- createPrimaryKeys("5.4")
#' fk <- createForeignKeys("5.4")
#'}
createDdl <- function(cdmVersion){
# prevent check NOTE from occurring due to non-standard evaluation of variables
cdmTableName <- cdmFieldName <- isRequired <- cdmDatatype <- NULL

# argument checks
stopifnot(is.character(cdmVersion), length(cdmVersion) == 1, cdmVersion %in% listSupportedVersions())
Expand Down Expand Up @@ -93,8 +97,11 @@ 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
isPrimaryKey <- cdmFieldName <- NULL

# argument checks
stopifnot(is.character(cdmVersion), length(cdmVersion) == 1, cdmVersion %in% listSupportedVersions())
Expand All @@ -117,8 +124,11 @@ 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
isForeignKey <- NULL

# argument checks
stopifnot(is.character(cdmVersion), length(cdmVersion) == 1, cdmVersion %in% listSupportedVersions())
Expand Down

0 comments on commit d38086c

Please sign in to comment.