Skip to content

Commit

Permalink
Fix export when there are multiple exposure-outcomes per SCCS data file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Admin_mschuemi authored and Admin_mschuemi committed Jun 10, 2024
1 parent 4410157 commit 7ee89db
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 29 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: SelfControlledCaseSeries
Type: Package
Title: Self-Controlled Case Series
Version: 5.2.1
Date: 2024-06-06
Version: 5.2.2
Date: 2024-06-10
Authors@R: c(
person("Martijn", "Schuemie", , "[email protected]", role = c("aut", "cre")),
person("Patrick", "Ryan", role = c("aut")),
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
SelfControlledCaseSeries 5.2.2
==============================

Bugfixes

1. Fix export when there are multiple exposure-outcomes per SCCS data file.

SelfControlledCaseSeries 5.2.1
==============================

Expand Down
32 changes: 16 additions & 16 deletions R/Export.R
Original file line number Diff line number Diff line change
Expand Up @@ -762,23 +762,23 @@ exportGroup <- function(group, sccsDiagnosticThresholds, outputFolder, databaseI
.data$preExposureDiagnostic != "FAIL", 1, 0)) %>%
select(-"eraId")
sccsDiagnosticsSummary[[length(sccsDiagnosticsSummary) + 1]] <- table
return(list(
sccsAgeSpanning = sccsAgeSpanning,
sccsAttrition = sccsAttrition,
sccsCalendarTimeSpanning = sccsCalendarTimeSpanning,
sccsCensorModel = sccsCensorModel,
sccsCovariate = sccsCovariate,
sccsCovariateResult = sccsCovariateResult,
sccsEra = sccsEra,
sccsEventDepObservation = sccsEventDepObservation,
sccsLikelihoodProfile = sccsLikelihoodProfile,
sccsSpline = sccsSpline,
sccsTimeToEvent = sccsTimeToEvent,
sccsTimeTrend = sccsTimeTrend,
sccsTimePeriod = sccsTimePeriod,
sccsDiagnosticsSummary = sccsDiagnosticsSummary
))
}
return(list(
sccsAgeSpanning = sccsAgeSpanning,
sccsAttrition = sccsAttrition,
sccsCalendarTimeSpanning = sccsCalendarTimeSpanning,
sccsCensorModel = sccsCensorModel,
sccsCovariate = sccsCovariate,
sccsCovariateResult = sccsCovariateResult,
sccsEra = sccsEra,
sccsEventDepObservation = sccsEventDepObservation,
sccsLikelihoodProfile = sccsLikelihoodProfile,
sccsSpline = sccsSpline,
sccsTimeToEvent = sccsTimeToEvent,
sccsTimeTrend = sccsTimeTrend,
sccsTimePeriod = sccsTimePeriod,
sccsDiagnosticsSummary = sccsDiagnosticsSummary
))
}

computeSpans <- function(studyPopulation, variable = "age") {
Expand Down
5 changes: 3 additions & 2 deletions extras/MultiAnalysesVignetteDataFetch.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ connectionDetails <- DatabaseConnector::createConnectionDetails(
user = keyring::key_get("redShiftUserName"),
password = keyring::key_get("redShiftPassword")
)
cdmDatabaseSchema <- "cdm_truven_mdcd_v2565"
cdmDatabaseSchema <- "cdm_truven_mdcd_v2888"
cohortDatabaseSchema <- "scratch_mschuemi"
cohortTable <- "sccs_vignette"
options(sqlRenderTempEmulationSchema = NULL)
Expand Down Expand Up @@ -273,7 +273,8 @@ exportToCsv(
outputFolder = outputFolder,
exportFolder = file.path(outputFolder, "export"),
databaseId = "MDCD",
minCellCount = 5
minCellCount = 5,
maxCores = 1
)

# Upload results to SQLite -----------------------------------------------------
Expand Down
11 changes: 6 additions & 5 deletions extras/UploadResultsToSqlite.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Currently requires installing OhdsiSharing from https://github.com/anthonysena/OhdsiSharing/tree/issue-6-upload-results
library(OhdsiSharing)
library(DatabaseConnector)
library(SelfControlledCaseSeries)

outputFolder <- "d:/temp/sccsVignette2"

Expand All @@ -19,16 +20,16 @@ file.copy(
to = file.path(outputFolder, "export")
)

createResultsDataModelTables(
createResultsDataModel(
connectionDetails = connectionDetails,
schema = "main",
resultsFolder = file.path(outputFolder, "export")
databaseSchema = "main"
)

uploadResults(
SelfControlledCaseSeries::uploadResults(
connectionDetails = connectionDetails,
schema = "main",
resultsFolder = file.path(outputFolder, "export")
zipFileName = file.path(outputFolder, "export", "Results_MDCD.zip"),
purgeSiteDataBeforeUploading = FALSE
)

# Add cg_cohort_definition table:
Expand Down
6 changes: 2 additions & 4 deletions vignettes/SingleStudies.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -688,10 +688,8 @@ if (folderExists) {
We see that, after removing the COVID blip, the observed-to-expected ratio seems stable. We can perform a formal test for stability:

```{r eval=FALSE}
stability <- computeTimeStability(studyPopulation = studyPop,
sccsModel = model)
stability %>%
filter(!stable)
computeTimeStability(studyPopulation = studyPop,
sccsModel = model)
```
```{r echo=FALSE,message=FALSE}
if (folderExists) {
Expand Down

0 comments on commit 7ee89db

Please sign in to comment.