Skip to content

Commit

Permalink
Merge pull request #416 from OHDSI/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jreps authored Oct 12, 2023
2 parents 86930ed + ecf0fa2 commit 7a55c31
Show file tree
Hide file tree
Showing 11 changed files with 1,235 additions and 21 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/R_CMD_check_Hades.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ jobs:
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: "r-reticulate"

- uses: r-lib/actions/setup-r-dependencies@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Package: PatientLevelPrediction
Type: Package
Title: Developing patient level prediction using data in the OMOP Common Data
Model
Version: 6.3.5
Date: 2023-08-15
Version: 6.3.6
Date: 2023-10-09
Authors@R: c(
person("Jenna", "Reps", email = "[email protected]", role = c("aut", "cre")),
person("Martijn", "Schuemie", role = c("aut")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
PatientLevelPrediction 6.3.6
======================
- fix bug with ohdsi shiny modules version check (issue 415)

PatientLevelPrediction 6.3.5
======================
- Fix sklearnToJson to be compatible with scikit-learn>=1.3
Expand Down
5 changes: 3 additions & 2 deletions R/HelperFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ listAppend <- function(a, b){
#'
#' @param envname A string for the name of the virtual environment (default is 'PLP')
#' @param envtype An option for specifying the environment as'conda' or 'python'. If NULL then the default is 'conda' for windows users and 'python' for non-windows users
#' @param condaPythonVersion String, Python version to use when creating a conda environment
#'
#' @export
configurePython <- function(envname='PLP', envtype=NULL){
configurePython <- function(envname='PLP', envtype=NULL, condaPythonVersion="3.11"){

if(is.null(envtype)){
if(getOs()=='windows'){
Expand All @@ -113,7 +114,7 @@ configurePython <- function(envname='PLP', envtype=NULL){
warning(paste0('Conda environment ', envname,' exists. You can use reticulate::conda_remove() to remove if you want to fresh config'))
} else {
ParallelLogger::logInfo(paste0('Creating virtual conda environment called ', envname))
location <- reticulate::conda_create(envname=envname, packages = "python", conda = "auto")
location <- reticulate::conda_create(envname=envname, packages = paste0("python==", condaPythonVersion), conda = "auto")
}
packages <- c('numpy','scipy','scikit-learn', 'pandas','pydotplus','joblib')
ParallelLogger::logInfo(paste0('Adding python dependancies to ', envname))
Expand Down
2 changes: 1 addition & 1 deletion R/ViewShinyPlp.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ viewPlps <- function(databaseSettings){
)
} else{
ohdsiModulesVersion <- strsplit(x = as.character(utils::packageVersion('OhdsiShinyModules')), split = '\\.')[[1]]
if(ohdsiModulesVersion[1]>=1 & ohdsiModulesVersion[2]>= 2){
if(paste0(ohdsiModulesVersion[1], ".", ohdsiModulesVersion[2])>= 1.2){
config <- ParallelLogger::loadSettingsFromJson(
fileName = system.file(
'shinyConfigUpdate.json',
Expand Down
20 changes: 10 additions & 10 deletions R/uploadToDatabase.R
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ addCohort <- function(
targetDialect = targetDialect,
tableName = 'cohort_definition',
columnNames = c('cohort_name'),
values = c(paste0("'",cohortDefinition$cohortName,"'")),
values = c(paste0("'",gsub('\'', '', cohortDefinition$cohortName),"'")),
tempEmulationSchema = tempEmulationSchema
)

Expand All @@ -1157,12 +1157,12 @@ addCohort <- function(

if(addNew){
cohortDefinitionId <- result$cohortDefinitionId[result$json %in% json]
ParallelLogger::logInfo(paste0('Cohort ',cohortDefinition$cohortName,' exists in cohort_definition with cohort id', result$cohortDefinitionId[result$json %in% json]))
ParallelLogger::logInfo(paste0('Cohort ',gsub('\'', '', cohortDefinition$cohortName),' exists in cohort_definition with cohort id', result$cohortDefinitionId[result$json %in% json]))
} else{
ParallelLogger::logInfo(paste0('Adding cohort ',cohortDefinition$cohortName))
ParallelLogger::logInfo(paste0('Adding cohort ',gsub('\'', '', cohortDefinition$cohortName)))

data <- data.frame(
cohortName = cohortDefinition$cohortName,
cohortName = gsub('\'', '', cohortDefinition$cohortName),
cohortDefinitionId = cohortDefinition$cohortId,
json = json
)
Expand All @@ -1187,7 +1187,7 @@ addCohort <- function(
targetDialect = targetDialect,
tableName = 'cohort_definition',
columnNames = c('cohort_name', 'cohort_definition_id'),
values = c(paste0("'",cohortDefinition$cohortName,"'"), cohortDefinition$cohortId),
values = c(paste0("'",gsub('\'', '', cohortDefinition$cohortName),"'"), cohortDefinition$cohortId),
tempEmulationSchema = tempEmulationSchema
)

Expand All @@ -1202,18 +1202,18 @@ addCohort <- function(
targetDialect = targetDialect,
tableName = 'cohorts',
columnNames = c('cohort_definition_id','cohort_name'),
values = c(cohortDefinitionId, paste0("'",cohortDefinition$cohortName,"'")),
values = c(cohortDefinitionId, paste0("'",gsub('\'', '', cohortDefinition$cohortName),"'")),
tempEmulationSchema = tempEmulationSchema
)

if(nrow(result)>0){
ParallelLogger::logInfo(paste0('Cohort ',cohortDefinition$cohortName,' exists in cohorts with cohort id', result$cohortId))
ParallelLogger::logInfo(paste0('Cohort ',gsub('\'', '', cohortDefinition$cohortName),' exists in cohorts with cohort id', result$cohortId))
} else{
ParallelLogger::logInfo(paste0('Adding cohort ',cohortDefinition$cohortName))
ParallelLogger::logInfo(paste0('Adding cohort ',gsub('\'', '', cohortDefinition$cohortName)))

data <- data.frame(
cohortDefinitionId = cohortDefinitionId,
cohortName = cohortDefinition$cohortName
cohortName = gsub('\'', '', cohortDefinition$cohortName)
)
DatabaseConnector::insertTable(
connection = conn,
Expand All @@ -1235,7 +1235,7 @@ addCohort <- function(
targetDialect = targetDialect,
tableName = 'cohorts',
columnNames = c('cohort_definition_id','cohort_name'),
values = c(cohortDefinitionId, paste0("'",cohortDefinition$cohortName,"'")),
values = c(cohortDefinitionId, paste0("'",gsub('\'', '', cohortDefinition$cohortName),"'")),
tempEmulationSchema = tempEmulationSchema
)
}
Expand Down
8 changes: 8 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ navbar:
- reference
- articles
- tutorial
- benchmarks
- predictors
- bestpractice
- news
right: [hades, github]
Expand All @@ -39,6 +41,12 @@ navbar:
bestpractice:
text: Best Practices
href: articles/BestPractices.html
benchmarks:
text: Benchmarks
href: articles/BenchmarkTasks.html
predictors:
text: Predictors
href: articles/ConstrainedPredictors.html
news:
text: Changelog
href: news/index.html
Expand Down
4 changes: 3 additions & 1 deletion man/configurePython.Rd

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

Loading

0 comments on commit 7a55c31

Please sign in to comment.