Skip to content

Commit

Permalink
bug fix for first O and shiny update
Browse files Browse the repository at this point in the history
bug fix for first O
updating shiny
  • Loading branch information
jreps committed Oct 6, 2023
1 parent 5e5c401 commit 739a772
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 13 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: Characterization
Type: Package
Title: Characterizations of Cohorts
Version: 0.1.1.9000
Date: 2023-03-13
Version: 0.1.2
Date: 2023-09-03
Authors@R: c(
person("Jenna", "Reps", , "[email protected]", role = c("aut", "cre")),
person("Patrick", "Ryan", , "[email protected]", role = c("aut"))
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Characterization 0.1.2
======================
Fixing bug where first outcome was still all outcomes
Updating shiny app to work with old and new ShinyAppBuilder

Characterization 0.1.1
======================

Expand Down
61 changes: 51 additions & 10 deletions R/ViewShiny.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,62 @@ viewChars <- function(
connection <- ResultModelManager::ConnectionHandler$new(connectionDetails)
databaseSettings$connectionDetailsSettings <- NULL

# set database settings into system variables
Sys.setenv("resultDatabaseDetails_characterization" = as.character(ParallelLogger::convertSettingsToJson(databaseSettings)))

config <- ParallelLogger::loadSettingsFromJson(
fileName = system.file(
'shinyConfig.json',
package = "Characterization"
if(utils::packageVersion('ShinyAppBuilder') < '1.2.0'){
#use old method
# set database settings into system variables
Sys.setenv("resultDatabaseDetails_characterization" = as.character(ParallelLogger::convertSettingsToJson(databaseSettings)))

config <- ParallelLogger::loadSettingsFromJson(
fileName = system.file(
'shinyConfig.json',
package = "Characterization"
)
)
)

if(!testApp){
ShinyAppBuilder::viewShiny(config = config, connection = connection)
if(!testApp){
ShinyAppBuilder::viewShiny(
config = config,
connection = connection
)
} else{
ShinyAppBuilder::createShinyApp(config = config, connection = connection)
}

} else{
ShinyAppBuilder::createShinyApp(config = config, connection = connection)
# use new method

config <- ParallelLogger::loadSettingsFromJson(
fileName = system.file(
'shinyConfigUpdate.json',
package = "Characterization"
)
)
databaseSettings$cTablePrefix = databaseSettings$tablePrefix
databaseSettings$cgTablePrefix = databaseSettings$cohortTablePrefix
databaseSettings$databaseTable = 'DATABASE_META_DATA'
databaseSettings$databaseTablePrefix = ''
databaseSettings$iTablePrefix = databaseSettings$incidenceTablePrefix
databaseSettings$cgTable <- "cohort_definition"

if(!testApp){
ShinyAppBuilder::viewShiny(
config = config,
connection = connection,
resultDatabaseSettings = databaseSettings
)
} else{
ShinyAppBuilder::createShinyApp(
config = config,
connection = connection,
resultDatabaseSettings = databaseSettings
)

}

}


}


Expand Down
26 changes: 26 additions & 0 deletions inst/shinyConfigUpdate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"shinyModules": [
{
"id": "about",
"tabName": "About",
"tabText": "About",
"shinyModulePackage": "OhdsiShinyModules",
"uiFunction": "aboutViewer",
"serverFunction": "aboutServer",
"infoBoxFile": "aboutHelperFile()",
"icon": "info",
"order": 1
},
{
"id": "characterization",
"tabName": "Characterization",
"tabText": "Characterization",
"shinyModulePackage": "OhdsiShinyModules",
"uiFunction": "characterizationViewer",
"serverFunction": "characterizationServer",
"infoBoxFile": "characterizationHelperFile()",
"icon": "chart-line",
"order": 2
}
]
}
2 changes: 1 addition & 1 deletion inst/sql/sql_server/createTargetOutcomeCombinations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where cohort_definition_id in
drop table if exists #outcomes_agg_first;
select * into #outcomes_agg_first
from (select *,
row_number() over(partition by subject_id, cohort_definition_id, cohort_start_date order by cohort_start_date asc) as rn
row_number() over(partition by subject_id, cohort_definition_id order by cohort_start_date asc) as rn
from #outcomes_agg
) as o
where o.rn = 1
Expand Down

0 comments on commit 739a772

Please sign in to comment.