generated from ohdsi-studies/EmptyStudyRepository
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial BipolarMissclassificationValidation commit
added code to create cohorts, apply simple score model, evaluate it, calculate summary survival info, find relationship between predicted score and outcome over 10 years
- Loading branch information
Showing
37 changed files
with
10,297 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: Default | ||
SaveWorkspace: Default | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: ISO8859-1 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
|
||
AutoAppendNewline: Yes | ||
StripTrailingWhitespace: Yes | ||
|
||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Package: BipolarMisclassificationValidation | ||
Type: Package | ||
Title: External Validation of Model Predicting Bipolar Misdiagnosed as MDD | ||
Version: 0.0.1 | ||
Date: 2020-01-01 | ||
Author: Jenna Reps | ||
Maintainer: Jenna Reps <youremail@address> | ||
Description: This study applies and evaluates a simple score model to OMOP CDM data that predicts which newly diagnosed MDD patients will be diagnosed with bipolar within the next 3 years | ||
License: Apache License 2.0 | ||
Depends: | ||
R (>= 3.3.0), | ||
DatabaseConnector (>= 1.11.4), | ||
survival | ||
Imports: | ||
FeatureExtraction (>= 2.0.0), | ||
SqlRender, | ||
Cyclops (>= 1.2.2), | ||
PatientLevelPrediction (>= 3.0.10), | ||
ggplot2, | ||
gridExtra, | ||
ff, | ||
ffbase (>= 0.12.1), | ||
ParallelLogger, | ||
OhdsiSharing | ||
Suggests: | ||
testthat | ||
NeedsCompilation: no | ||
RoxygenNote: 6.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"skeletonType": "PatientLevelPredictionValidationStudy", | ||
"skeletonVersion": "v0.0.1", | ||
"requiredHydraVersion": "v0.0.3", | ||
"actions":[{ | ||
"type": "fileNameFindAndReplace", | ||
"input": "packageName", | ||
"find": "bipolarValidation" | ||
},{ | ||
"type": "stringFindAndReplace", | ||
"input": "packageName", | ||
"find": "bipolarValidation" | ||
},{ | ||
"type": "jsonArrayToCsv", | ||
"input": "cohortDefinitions", | ||
"mapping": [{"source": "id", "target": "cohortId"}, | ||
{"source": "id", "target": "atlasId"}, | ||
{"source": "name", "target": "name", "modifiers": ["convertToFileName"]}], | ||
"output": "inst/settings/CohortsToCreate.csv" | ||
},{ | ||
"type": "jsonArrayToJson", | ||
"input": "cohortDefinitions", | ||
"fileName": "name", | ||
"payload": "expression", | ||
"output": "inst/cohorts" | ||
},{ | ||
"type": "jsonArrayToSql", | ||
"input": "cohortDefinitions", | ||
"fileName": "name", | ||
"payload": "expression", | ||
"output": "inst/sql/sql_server" | ||
}, | ||
{ | ||
"type": "jsonToJson", | ||
"input": "", | ||
"output": "inst/settings/plpAnalysisList.json" | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(checkInstall) | ||
export(createCohorts) | ||
export(execute) | ||
export(getTable1) | ||
export(packageResults) | ||
export(transportPlpModels) | ||
import(DatabaseConnector) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Copyright 2018 Observational Health Data Sciences and Informatics | ||
# | ||
# This file is part of PredictionNetworkStudySkeleton | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
#' Package the results for sharing with OHDSI researchers | ||
#' | ||
#' @details | ||
#' This function packages the results. | ||
#' | ||
#' @param outputFolder Name of local folder to place results; make sure to use forward slashes | ||
#' (/) | ||
#' @param minCellCount The minimum number of subjects contributing to a count before it can be included in the results. | ||
#' | ||
#' @export | ||
packageResults <- function(outputFolder, | ||
minCellCount = 5) { | ||
if(missing(outputFolder)){ | ||
stop('Missing outputFolder...') | ||
} | ||
|
||
# transport the results | ||
|
||
#create export subfolder in workFolder | ||
exportFolder <- file.path(outputFolder, "resultsToShare") | ||
|
||
if (!file.exists(exportFolder)){ | ||
dir.create(exportFolder, recursive = T) | ||
} | ||
|
||
# loads analysis results | ||
if(file.exists(file.path(outputFolder, 'validationResults.rds'))){ | ||
plpResult <- readRDS(file.path(outputFolder, 'validationResults.rds')) | ||
|
||
if(minCellCount==0){ | ||
minCellCount <- NULL | ||
} | ||
result <- PatientLevelPrediction::transportPlp(plpResult, save = F, | ||
n=minCellCount, | ||
includeEvaluationStatistics=T, | ||
includeThresholdSummary=T, | ||
includeDemographicSummary=T, | ||
includeCalibrationSummary =T, | ||
includePredictionDistribution=T, | ||
includeCovariateSummary=T) | ||
saveRDS(result, file.path(exportFolder, 'validationResults.rds')) | ||
|
||
} | ||
|
||
|
||
|
||
### Add all to zip file ### | ||
zipName <- paste0(outputFolder, '.zip') | ||
OhdsiSharing::compressFolder(exportFolder, zipName) | ||
# delete temp folder | ||
unlink(exportFolder, recursive = T) | ||
|
||
writeLines(paste("\nStudy results are compressed and ready for sharing at:", zipName)) | ||
return(zipName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# @file SkeletonValidationPackage.R | ||
# | ||
# Copyright 2018 Observational Health Data Sciences and Informatics | ||
# | ||
# This file is part of SkeletonValidationPackage | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
#' SkeletonValidationPackage | ||
#' | ||
#' @docType package | ||
#' @name SkeletonValidationPackage | ||
#' @import DatabaseConnector | ||
NULL |
Oops, something went wrong.