17
17
# ' Get default covariate settings
18
18
# ' @description
19
19
# ' Default covariate settings for cohort diagnostics execution
20
+ # '
21
+ # ' @return Default covariate settings
20
22
# ' @export
21
23
getDefaultCovariateSettings <- function () {
22
24
FeatureExtraction :: createTemporalCovariateSettings(
@@ -94,27 +96,27 @@ getDefaultCovariateSettings <- function() {
94
96
# ' using \code{RFeatureExtraction::createTemporalCovariateSettings}
95
97
# ' Alternatively, a covariate setting object may be created using the above as an example.
96
98
# '
97
- # ' @template Connection
99
+ # ' @template connectionDetails
98
100
# ' @template CdmDatabaseSchema
99
101
# ' @template VocabularyDatabaseSchema
100
102
# ' @template CohortDatabaseSchema
101
103
# ' @template TempEmulationSchema
102
104
# ' @template CohortTable
103
105
# ' @template CohortSetReference
104
106
# ' @template exportFolder
105
- # ' @template cohortIds
107
+ # ' @template CohortIds
106
108
# ' @template cohortDefinitionSet
107
109
# ' @template MinCellCount
108
110
# ' @template Incremental
109
111
# ' @template cdmVersion
110
112
# ' @template databaseId
111
113
# ' @template minCharacterizationMean
112
114
# '
113
- # ' @param cohortTableNames Cohort Table names used by CohortGenerator package
115
+ # ' @param cohortTableNames Cohort Table names used by CohortGenerator package.
114
116
# ' @param conceptCountsTable Concepts count table name. The default is "#concept_counts" to create a temporal concept counts table.
115
- # ' If an external concept counts table is used, provide the name in character, e.g. "concept_counts" without a hash
116
- # ' @param databaseName The full name of the database. If NULL, defaults to value in cdm_source table
117
- # ' @param databaseDescription A short description (several sentences) of the database. If NULL, defaults to value in cdm_source table
117
+ # ' If an external concept counts table is used, provide the name in character, e.g. "concept_counts" without a hash.
118
+ # ' @param databaseName The full name of the database. If NULL, defaults to value in cdm_source table.
119
+ # ' @param databaseDescription A short description (several sentences) of the database. If NULL, defaults to value in cdm_source table.
118
120
# ' @param runInclusionStatistics Generate and export statistic on the cohort inclusion rules?
119
121
# ' @param runIncludedSourceConcepts Generate and export the source concepts included in the cohorts?
120
122
# ' @param runOrphanConcepts Generate and export potential orphan concepts?
@@ -130,9 +132,6 @@ getDefaultCovariateSettings <- function() {
130
132
# ' the createTemporalCovariateSettings function in the FeatureExtraction package, or a list
131
133
# ' of such objects.
132
134
# ' @param irWashoutPeriod Number of days washout to include in calculation of incidence rates - default is 0
133
- # ' @param incrementalFolder If \code{incremental = TRUE}, specify a folder where records are kept
134
- # ' of which cohort diagnostics has been executed.
135
- # ' @param useExternalConceptCountsTable If TRUE an external table for the cohort concept counts will be used.
136
135
# ' @param runFeatureExtractionOnSample Logical. If TRUE, the function will operate on a sample of the data.
137
136
# ' Default is FALSE, meaning the function will operate on the full data set.
138
137
# '
@@ -144,20 +143,6 @@ getDefaultCovariateSettings <- function() {
144
143
# '
145
144
# ' @param seedArgs List. Additional arguments to pass to the sampling function.
146
145
# ' This can be used to control aspects of the sampling process beyond the seed and sample size.
147
- # '
148
- # ' @param sampleIdentifierExpression Character. An expression that generates unique identifiers for each sample.
149
- # ' This expression can use the variables 'cohortId' and 'seed'.
150
- # ' Default is "cohortId * 1000 + seed", which ensures unique identifiers
151
- # ' as long as there are fewer than 1000 cohorts.
152
- # '
153
- # ' @param useAchilles Logical. Should the pre-computed Achilles analyses be used to get concept counts? TRUE or FALSE (default)
154
- # '
155
- # ' @param achillesDatabaseSchema Character. The name of the schema where the Achilles results tables are located.
156
- # ' Require if `useAchilles` is TRUE and ignored otherwise.
157
- # '
158
- # ' @param workDatabaseSchema Character. The name of a schema where the user has write access. Intermediate tables for concept counts
159
- # ' and orphan concepts will be created in this schema if supplied. If NULL (default) intermediate tables will
160
- # ' be created as temporary tables.
161
146
# ' @examples
162
147
# ' \dontrun{
163
148
# ' # Load cohorts (assumes that they have already been instantiated)
@@ -364,19 +349,9 @@ executeDiagnostics <- function(cohortDefinitionSet,
364
349
}
365
350
366
351
# Create output and incremental folders. check that we have write access.
367
- if (! file.exists(gsub(" /$" , " " , exportFolder ))) {
368
- dir.create(name , recursive = TRUE )
369
- ParallelLogger :: logInfo(" Created export folder" , exportFolder )
370
- }
371
- checkmate :: assertDirectory(exportFolder , access = " w" , add = errorMessage )
372
-
373
- if (incremental ) {
374
- if (! file.exists(gsub(" /$" , " " , exportFolder ))) {
375
- dir.create(name , recursive = TRUE )
376
- ParallelLogger :: logInfo(" Created incremental folder" , incrementalFolder )
377
- }
378
- checkmate :: assertDirectory(incrementalFolder , access = " w" , add = errorMessage )
379
- }
352
+ checkArg(exportFolder , add = errorMessage )
353
+ checkArg(incremental , add = errorMessage )
354
+ checkArg(incrementalFolder , add = errorMessage )
380
355
381
356
if (is(temporalCovariateSettings , " covariateSettings" )) {
382
357
temporalCovariateSettings <- list (temporalCovariateSettings )
@@ -676,7 +651,7 @@ executeDiagnostics <- function(cohortDefinitionSet,
676
651
minCellCount = minCellCount ,
677
652
databaseId = databaseId ,
678
653
incremental = FALSE ,
679
- cohortId = cohorts $ cohortId
654
+ cohortId = cohortDefinitionSet $ cohortId
680
655
)
681
656
}
682
657
)
@@ -926,6 +901,8 @@ executeDiagnostics <- function(cohortDefinitionSet,
926
901
)
927
902
928
903
feCohortTable <- cohortTableNames $ cohortSampleTable
904
+ # work around for cohortGenerator 0.11.1
905
+ cohortDefinitionSet $ cohortIds <- cohortDefinitionSet $ cohortId
929
906
feCohortDefinitionSet <-
930
907
CohortGenerator :: sampleCohortDefinitionSet(
931
908
connection = connection ,
@@ -941,15 +918,13 @@ executeDiagnostics <- function(cohortDefinitionSet,
941
918
incrementalFolder = incrementalFolder
942
919
)
943
920
944
- feCohortCounts <- computeCohortCounts (
921
+ feCohortCounts <- CohortGenerator :: getCohortCounts (
945
922
connection = connection ,
946
923
cohortDatabaseSchema = cohortDatabaseSchema ,
947
924
cohortTable = cohortTableNames $ cohortSampleTable ,
948
- cohorts = feCohortDefinitionSet ,
949
- exportFolder = exportFolder ,
950
- minCellCount = minCellCount ,
951
- databaseId = databaseId ,
952
- writeResult = FALSE
925
+ cohortDefinitionSet = feCohortDefinitionSet ,
926
+ cohortIds = cohortDefinitionSet $ cohortId ,
927
+ databaseId = databaseId
953
928
)
954
929
}
955
930
0 commit comments