Skip to content

Commit

Permalink
Release v0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonysena authored Mar 10, 2023
2 parents eb229fd + 99dfe73 commit f20a6a5
Show file tree
Hide file tree
Showing 77 changed files with 6,683 additions and 726 deletions.
62 changes: 31 additions & 31 deletions .github/workflows/R_CMD_check_Hades.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get install -y libssh-dev
Rscript -e 'install.packages("remotes")'
while read -r cmd
do
eval sudo $cmd
Expand Down Expand Up @@ -140,33 +139,34 @@ jobs:
draft: false
prerelease: false

- uses: r-lib/actions/setup-r@v2
if: ${{ env.new_version != '' }}

- name: Install drat
if: ${{ env.new_version != '' }}
run: |
install.packages('drat')
shell: Rscript {0}

- name: Remove any tarballs that already exists
if: ${{ env.new_version != '' }}
run: |
rm -f *.tar.gz
- name: Download package tarball
if: ${{ env.new_version != '' }}
uses: actions/download-artifact@v2
with:
name: package_tarball

- name: Push to drat
if: ${{ env.new_version != '' }}
run: |
bash deploy.sh
- name: Push to BroadSea
if: ${{ env.new_version != '' }}
run: |
curl --data "build=true" -X POST https://registry.hub.docker.com/u/ohdsi/broadsea-methodslibrary/trigger/f0b51cec-4027-4781-9383-4b38b42dd4f5/
# AGS: Commenting out until Strategus is in HADES
# - uses: r-lib/actions/setup-r@v2
# if: ${{ env.new_version != '' }}
#
# - name: Install drat
# if: ${{ env.new_version != '' }}
# run: |
# install.packages('drat')
# shell: Rscript {0}
#
# - name: Remove any tarballs that already exists
# if: ${{ env.new_version != '' }}
# run: |
# rm -f *.tar.gz
#
# - name: Download package tarball
# if: ${{ env.new_version != '' }}
# uses: actions/download-artifact@v2
# with:
# name: package_tarball
#
# - name: Push to drat
# if: ${{ env.new_version != '' }}
# run: |
# bash deploy.sh
#
# - name: Push to BroadSea
# if: ${{ env.new_version != '' }}
# run: |
# curl --data "build=true" -X POST https://registry.hub.docker.com/u/ohdsi/broadsea-methodslibrary/trigger/f0b51cec-4027-4781-9383-4b38b42dd4f5/
#
55 changes: 30 additions & 25 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,43 +1,48 @@
Package: Strategus
Type: Package
Title: Coordinating and Executing Analytics Using HADES Modules
Version: 0.0.2
Date: 2022-03-25
Version: 0.0.3
Date: 2023-03-10
Authors@R: c(
person("Martijn", "Schuemie", , "[email protected]", role = c("aut", "cre"))
)
Maintainer: Martijn Schuemie <[email protected]>
person("Martijn", "Schuemie", email = "[email protected]", role = c("aut", "cre")),
person("Anthony", "Sena", email = "[email protected]", role = c("aut")),
person("Observational Health Data Science and Informatics", role = c("cph"))
)
Maintainer: Anthony Sena <[email protected]>
Description: An R package for coordinating and executing analytics using HADES modules.
License: Apache License 2.0
URL: https://ohdsi.github.io/Strategus, https://github.com/OHDSI/Strategus
BugReports: https://github.com/OHDSI/Strategus/issues
Depends:
R (>= 4.0.0),
CohortGenerator (>= 0.5.0),
DatabaseConnector (>= 5.0.4)
CohortGenerator (>= 0.7.0),
DatabaseConnector (>= 5.1.0)
Imports:
targets,
renv (>= 0.15.5),
ParallelLogger,
dplyr,
checkmate,
keyring,
rlang,
utils,
R.utils,
digest,
SqlRender,
readr
targets,
renv (>= 0.15.5),
ParallelLogger (>= 3.1.0),
dplyr,
checkmate,
keyring,
rlang,
utils,
R.utils,
digest,
methods,
tibble,
SqlRender (>= 1.11.0)
Suggests:
testthat,
fs,
knitr,
rmarkdown
testthat (>= 3.0.0),
fs,
knitr,
rmarkdown,
Eunomia
Remotes:
ohdsi/CohortGenerator,
ohdsi/DatabaseConnector
ohdsi/Eunomia
VignetteBuilder: knitr
NeedsCompilation: no
RoxygenNote: 7.2.0
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
Encoding: UTF-8
Config/testthat/edition: 3
6 changes: 5 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

export(addModuleSpecifications)
export(addSharedResources)
export(createCdmExecutionSettings)
export(createEmptyAnalysisSpecificiations)
export(createExecutionSettings)
export(createResultsExecutionSettings)
export(ensureAllModulesInstantiated)
export(execute)
export(getModuleList)
export(retrieveConnectionDetails)
export(storeConnectionDetails)
export(unlockKeyring)
import(CohortGenerator)
import(DatabaseConnector)
import(dplyr)
importFrom(methods,is)
importFrom(rlang,.data)
22 changes: 21 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
Strategus 0.0.3
===============

- Breaking change: removed function `createExecutionSettings()` and replaced with 2 new functions: `createCdmExecutionSettings()` and `createResultsExecutionSettings()`. (#19)
- Added Vignettes (#23)
- Provide better support for `keyring` to handle named/locked keyrings (#24)
- Add function to list Strategus modules (#30)
- Fixes from testing (#36)
- Enforce module structure for proper use with renv (#37)
- Support CDM 5.4 source table format (#41)
- Add unit tests (#47)


Strategus 0.0.2
===============

- Updates renv to 0.15.5
- Call renv::use() for each module


Strategus 0.0.1
===============

Initial version
Initial version
77 changes: 54 additions & 23 deletions R/DatabaseMetaData.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 Observational Health Data Sciences and Informatics
# Copyright 2023 Observational Health Data Sciences and Informatics
#
# This file is part of Strategus
#
Expand All @@ -21,48 +21,79 @@
# carefully consider serialization and deserialization to JSON, which currently
# uses custom functionality in ParallelLogger to maintain object attributes.

createDatabaseMetaData <- function(executionSettings) {
createDatabaseMetaData <- function(executionSettings, keyringName = NULL) {
databaseMetaDataFolder <- file.path(executionSettings$resultsFolder, "DatabaseMetaData")
if (!dir.exists(databaseMetaDataFolder)) {
dir.create(databaseMetaDataFolder, recursive = TRUE)
}

connectionDetails <- retrieveConnectionDetails(executionSettings$connectionDetailsReference)
connectionDetails <- retrieveConnectionDetails(
connectionDetailsReference = executionSettings$connectionDetailsReference,
keyringName = keyringName
)
connection <- DatabaseConnector::connect(connectionDetails)
on.exit(DatabaseConnector::disconnect(connection))

resultsDataModel <- CohortGenerator::readCsv(
file = system.file("databaseMetaDataRdms.csv", package = "Strategus"),
warnOnCaseMismatch = FALSE
)

sql <- "SELECT TOP 1 * FROM @cdm_database_schema.cdm_source;"
cdmSource <- renderTranslateQuerySql(connection = connection,
sql = sql,
snakeCaseToCamelCase = TRUE,
cdm_database_schema = executionSettings$cdmDatabaseSchema)
cdmSource <- renderTranslateQuerySql(
connection = connection,
sql = sql,
snakeCaseToCamelCase = TRUE,
cdm_database_schema = executionSettings$cdmDatabaseSchema
)

# Restrict the cdmSource columns to those that are
# expected in the resultsDataModel
cdmSource <- cdmSource[, which(names(cdmSource) %in% SqlRender::snakeCaseToCamelCase(resultsDataModel$columnName))]

# In the case that the CDM is pre v5.4, it will lack the new
# cdm_version_concept_id column. In this case, we'll default it to
# concept_id == 1147638 which is CDM v5.3.1
# Ref: https://ohdsi.github.io/CommonDataModel/cdm54Changes.html
if (!"cdmVersionConceptId" %in% names(cdmSource)) {
cdmSource$cdmVersionConceptId <- 1147638
}

sql <- "SELECT TOP 1 vocabulary_version FROM @cdm_database_schema.vocabulary WHERE vocabulary_id = 'None';"
vocabVersion <- renderTranslateQuerySql(connection = connection,
sql = sql,
snakeCaseToCamelCase = TRUE,
cdm_database_schema = executionSettings$cdmDatabaseSchema)
vocabVersion <- renderTranslateQuerySql(
connection = connection,
sql = sql,
snakeCaseToCamelCase = TRUE,
cdm_database_schema = executionSettings$cdmDatabaseSchema
)

sql <- "SELECT MAX(observation_period_end_date) as max_obs_period_end_date
FROM @cdm_database_schema.observation_period;"
observationPeriodMax <- renderTranslateQuerySql(connection = connection,
sql = sql,
snakeCaseToCamelCase = TRUE,
cdm_database_schema = executionSettings$cdmDatabaseSchema)
observationPeriodMax <- renderTranslateQuerySql(
connection = connection,
sql = sql,
snakeCaseToCamelCase = TRUE,
cdm_database_schema = executionSettings$cdmDatabaseSchema
)

databaseId <- digest::digest2int(paste(cdmSource$cdmSourceName, cdmSource$cdmReleaseDate))
database <- cdmSource %>%
mutate(vocabularyVersion = vocabVersion$vocabularyVersion,
databaseId = !!databaseId) %>%
mutate(
vocabularyVersion = vocabVersion$vocabularyVersion,
databaseId = !!databaseId
) %>%
bind_cols(observationPeriodMax)

# Export the csv files:
CohortGenerator::writeCsv(x = database,
file = file.path(databaseMetaDataFolder, "database_meta_data.csv"))
CohortGenerator::writeCsv(
x = database,
file = file.path(databaseMetaDataFolder, "database_meta_data.csv")
)

resultsDataModel <- readr::read_csv(file = system.file("databaseMetaDataRdms.csv", package = "Strategus"),
show_col_types = FALSE)
CohortGenerator::writeCsv(x = resultsDataModel,
file = file.path(databaseMetaDataFolder, "resultsDataModelSpecification.csv"))
CohortGenerator::writeCsv(
x = resultsDataModel,
file = file.path(databaseMetaDataFolder, "resultsDataModelSpecification.csv"),
warnOnFileNameCaseMismatch = FALSE
)
return(databaseId)
}
Loading

0 comments on commit f20a6a5

Please sign in to comment.