Get last generated cohort checksums
Source:R/CohortConstruction.R
getLastGeneratedCohortChecksums.RdThis gets a log of the last checksum for each cohort id stored in the cohort_checksum table.
This should be used to audit cohort generation as (if generated with cohort_generator) cohorts should always have an end time in this table. The last end time will be the cohort that is in the cohort table (assuming no other manual modifications are made to the cohort table itself).
This can be used downstream of CohortGenerator to evaluate if cohorts are consistent with passed definitions.
Usage
getLastGeneratedCohortChecksums(
connectionDetails = NULL,
connection = NULL,
cohortId = NULL,
cohortDatabaseSchema,
cohortTableNames = getCohortTableNames(),
.checkTables = TRUE
)Arguments
- connectionDetails
An object of type
connectionDetailsas created using thecreateConnectionDetailsfunction in the DatabaseConnector package. Can be left NULL ifconnectionis provided.- connection
An object of type
connectionas created using theconnectfunction in the DatabaseConnector package. Can be left NULL ifconnectionDetailsis provided, in which case a new connection will be opened at the start of the function, and closed when the function finishes.- cohortId
cohortId to check. If NULL, all cohorts will be returned.
- cohortDatabaseSchema
Schema name where your cohort tables reside. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'.
- cohortTableNames
The names of the cohort tables. See
getCohortTableNamesfor more details.- .checkTables
used internally