Skip to content

Commit

Permalink
Merge pull request #163 from OHDSI/big_int_cohort_id_fix
Browse files Browse the repository at this point in the history
Big int cohort id fix
  • Loading branch information
schuemie committed Apr 9, 2024
2 parents 6d8d51d + 9675062 commit 8ef8bcb
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 41 deletions.
8 changes: 5 additions & 3 deletions R/Analyses.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ createOutcome <- function(outcomeId,
riskWindowEnd = NULL,
endAnchor = NULL) {
errorMessages <- checkmate::makeAssertCollection()
checkmate::assertInt(outcomeId, add = errorMessages)
checkmate::assertNumeric(outcomeId, add = errorMessages)
checkmate::assertTRUE(all(outcomeId %% 1 == 0), add = errorMessages)
checkmate::assertLogical(outcomeOfInterest, add = errorMessages)
checkmate::assertNumeric(trueEffectSize, len = 1, null.ok = TRUE, add = errorMessages)
checkmate::assertInt(riskWindowStart, null.ok = TRUE, add = errorMessages)
Expand Down Expand Up @@ -259,8 +260,9 @@ createTargetComparatorOutcomes <- function(targetId,
excludedCovariateConceptIds = c(),
includedCovariateConceptIds = c()) {
errorMessages <- checkmate::makeAssertCollection()
checkmate::assertInt(targetId, add = errorMessages)
checkmate::assertInt(comparatorId, add = errorMessages)
checkmate::assertNumeric(targetId, add = errorMessages)
checkmate::assertNumeric(comparatorId, add = errorMessages)
checkmate::assertTRUE(all(c(targetId, comparatorId) %% 1 == 0), add = errorMessages)
checkmate::assertList(outcomes, min.len = 1, add = errorMessages)
for (i in seq_along(outcomes)) {
checkmate::assertClass(outcomes[[i]], "outcome", add = errorMessages)
Expand Down
7 changes: 4 additions & 3 deletions R/DataLoadingSaving.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ getDbCohortMethodData <- function(connectionDetails,
checkmate::assertClass(connectionDetails, "ConnectionDetails", add = errorMessages)
checkmate::assertCharacter(cdmDatabaseSchema, len = 1, add = errorMessages)
checkmate::assertCharacter(tempEmulationSchema, len = 1, null.ok = TRUE, add = errorMessages)
checkmate::assertInt(targetId, add = errorMessages)
checkmate::assertInt(comparatorId, add = errorMessages)
checkmate::assertIntegerish(outcomeIds, add = errorMessages)
checkmate::assertNumeric(targetId, add = errorMessages)
checkmate::assertNumeric(comparatorId, add = errorMessages)
checkmate::assertNumeric(outcomeIds, add = errorMessages)
checkmate::assertTRUE(all(c(targetId, comparatorId, outcomeIds) %% 1 == 0), add = errorMessages)
checkmate::assertCharacter(studyStartDate, len = 1, add = errorMessages)
checkmate::assertCharacter(studyEndDate, len = 1, add = errorMessages)
checkmate::assertCharacter(exposureDatabaseSchema, len = 1, add = errorMessages)
Expand Down
3 changes: 2 additions & 1 deletion R/StudyPopulation.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ createStudyPopulation <- function(cohortMethodData,
errorMessages <- checkmate::makeAssertCollection()
checkmate::assertClass(cohortMethodData, "CohortMethodData", add = errorMessages)
checkmate::assertDataFrame(population, null.ok = TRUE, add = errorMessages)
checkmate::assertInt(outcomeId, null.ok = TRUE, add = errorMessages)
checkmate::assertNumeric(outcomeId, null.ok = TRUE, add = errorMessages)
if (!is.null(outcomeId)) checkmate::assertTRUE(all(outcomeId %% 1 == 0), add = errorMessages)
checkmate::assertLogical(firstExposureOnly, len = 1, add = errorMessages)
checkmate::assertLogical(restrictToCommonPeriod, len = 1, add = errorMessages)
checkmate::assertInt(washoutPeriod, lower = 0, add = errorMessages)
Expand Down
68 changes: 34 additions & 34 deletions inst/csv/resultsDataModelSpecification.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ table_name,column_name,data_type,is_required,primary_key,min_cell_count,deprecat
cm_attrition,sequence_number,int,Yes,Yes,No,No,The place in the sequence of steps defining the final analysis cohort. 1 indicates the original exposed population without any inclusion criteria.
cm_attrition,description,varchar,Yes,No,No,No,"A description of the last restriction, e.g. ""Removing persons with the outcome prior"". "
cm_attrition,subjects,int,Yes,No,Yes,No,The number of subjects in the cohort.
cm_attrition,exposure_id,int,Yes,Yes,No,No,The identifier of the exposure cohort to which the attrition applies. Can be either the target or comparator cohort ID.
cm_attrition,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_attrition,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_attrition,exposure_id,bigint,Yes,Yes,No,No,The identifier of the exposure cohort to which the attrition applies. Can be either the target or comparator cohort ID.
cm_attrition,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_attrition,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_attrition,analysis_id,int,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_attrition,outcome_id,int,Yes,Yes,No,No,Foreign key referencing the cm_analysis table.
cm_attrition,outcome_id,bigint,Yes,Yes,No,No,Foreign key referencing the cm_analysis table.
cm_attrition,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database.
cm_follow_up_dist,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_follow_up_dist,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_follow_up_dist,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_follow_up_dist,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_follow_up_dist,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_follow_up_dist,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_follow_up_dist,analysis_id,int,Yes,Yes,No,No,Foreign key referencing the cm_analysis table.
cm_follow_up_dist,target_min_days,float,No,No,No,No,The minimum number of observation days for a person.
cm_follow_up_dist,target_p_10_days,float,No,No,No,No,The 10^th^ percentile of number of observation days for a person in the target group.
Expand All @@ -35,9 +35,9 @@ cm_analysis,analysis_id,int,Yes,Yes,No,No,A unique identifier for an analysis.
cm_analysis,description,varchar,Yes,No,No,No,"A description for an analysis, e.g. 'On-treatment'."
cm_analysis,definition,varchar,Yes,No,No,No,A CohortMethod JSON object specifying the analysis.
cm_result,analysis_id,int,Yes,Yes,No,No,Foreign key referencing the cm_analysis table.
cm_result,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_result,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_result,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_result,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_result,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_result,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_result,rr,float,No,No,No,No,The estimated relative risk (e.g. the hazard ratio).
cm_result,ci_95_lb,float,No,No,No,No,The lower bound of the 95% confidence interval of the relative risk.
cm_result,ci_95_ub,float,No,No,No,No,The upper bound of the 95% confidence interval of the relative risk.
Expand All @@ -62,9 +62,9 @@ cm_result,calibrated_se_log_rr,float,No,No,No,No,The standard error of the log o
cm_result,target_estimator,varchar,Yes,No,No,No,"The target estimator, for example ""att"", ""ate"", ""atu"" or ""ato""."
cm_result,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database.
cm_interaction_result,analysis_id,int,Yes,Yes,No,No,Foreign key referencing the cm_analysis table.
cm_interaction_result,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_interaction_result,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_interaction_result,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_interaction_result,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_interaction_result,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_interaction_result,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_interaction_result,interaction_covariate_id,int,Yes,Yes,No,No,Foreign key referencing the cm_covariate table.
cm_interaction_result,rr,float,Yes,No,No,No,The estimated relative risk (e.g. the ratio of hazard ratios).
cm_interaction_result,ci_95_lb,float,Yes,No,No,No,The lower bound of the 95% confidence interval of the relative risk.
Expand Down Expand Up @@ -95,9 +95,9 @@ cm_covariate_analysis,covariate_analysis_id,int,Yes,Yes,No,No,A unique identifie
cm_covariate_analysis,covariate_analysis_name,varchar,Yes,No,No,No,"A name for a covariate analysis, e.g. 'Demographics: age group'."
cm_covariate_analysis,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table.
cm_covariate_balance,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database.
cm_covariate_balance,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_covariate_balance,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_covariate_balance,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_covariate_balance,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_covariate_balance,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_covariate_balance,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_covariate_balance,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table.
cm_covariate_balance,covariate_id,bigint,Yes,Yes,No,No,A foreign key referencing the cm_covariate table.
cm_covariate_balance,target_mean_before,float,No,No,Yes,No,The mean value of the covariate in the target cohort before propensity score adjustment.
Expand All @@ -112,9 +112,9 @@ cm_covariate_balance,target_std_diff,float,No,No,No,No,The standardized differen
cm_covariate_balance,comparator_std_diff,float,No,No,No,No,The standardized difference of the means before and after propensity score adjustment in the comparator cohort.
cm_covariate_balance,target_comparator_std_diff,float,No,No,No,No,The standardized difference of the means before and after propensity score adjustment in the union of the target and comparator cohorts.
cm_diagnostics_summary,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table.
cm_diagnostics_summary,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_diagnostics_summary,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_diagnostics_summary,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_diagnostics_summary,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_diagnostics_summary,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_diagnostics_summary,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_diagnostics_summary,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database.
cm_diagnostics_summary,max_sdm,float,No,No,No,No,The maximum absolute standardized difference of mean.
cm_diagnostics_summary,shared_max_sdm,float,No,No,No,No,The maximum absolute standardized difference of mean of the shared balance (shared across outcomes).
Expand All @@ -132,11 +132,11 @@ cm_diagnostics_summary,generalizability_diagnostic,varchar(20),Yes,No,No,No,Pass
cm_diagnostics_summary,ease_diagnostic,varchar(20),Yes,No,No,No,Pass / warning / fail classification of the EASE diagnostic.
cm_diagnostics_summary,unblind,int,Yes,No,No,No,"Is unblinding the result recommended? (1 = yes, 0 = no)"
cm_diagnostics_summary,unblind_for_evidence_synthesis,int,Yes,No,No,No,"Is unblinding the result for inclusion in evidence synthesis recommended? This ignores the MDRR diagnostic. (1 = yes, 0 = no)"
cm_target_comparator_outcome,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_target_comparator_outcome,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_target_comparator_outcome,outcome_of_interest,int,Yes,No,No,No,"Is the outcome of interest (1 = yes, 0 = no)"
cm_target_comparator_outcome,true_effect_size,float,No,No,No,No,The true effect size for the target-comparator-outcome. For negatitive controls this equals 1.
cm_target_comparator_outcome,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_target_comparator_outcome,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_target_comparator_outcome,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_target_comparator_outcome,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_kaplan_meier_dist,time_day,int,Yes,Yes,No,No,Time in days since cohort start.
cm_kaplan_meier_dist,target_survival,float,Yes,No,No,No,The estimated survival fraction in the target cohort.
cm_kaplan_meier_dist,target_survival_lb,float,Yes,No,No,No,The lower bound of the 95% confidence interval of the survival fraction in the target cohort.
Expand All @@ -146,34 +146,34 @@ cm_kaplan_meier_dist,comparator_survival_lb,float,Yes,No,No,No,The lower bound o
cm_kaplan_meier_dist,comparator_survival_ub,float,Yes,No,No,No,The upper bound of the 95% confidence interval of the survival fraction in the comparator cohort.
cm_kaplan_meier_dist,target_at_risk,int,No,No,Yes,No,The number of subjects still at risk in the target cohort.
cm_kaplan_meier_dist,comparator_at_risk,int,No,No,Yes,No,The number of subjects still at risk in the comparator cohort.
cm_kaplan_meier_dist,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_kaplan_meier_dist,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_kaplan_meier_dist,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_kaplan_meier_dist,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_kaplan_meier_dist,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_kaplan_meier_dist,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_kaplan_meier_dist,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table.
cm_kaplan_meier_dist,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database.
cm_likelihood_profile,log_rr,float,Yes,Yes,No,No,The log of the relative risk where the likelihood is sampled.
cm_likelihood_profile,log_likelihood,float,Yes,No,No,No,The normalized log likelihood.
cm_likelihood_profile,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_likelihood_profile,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_likelihood_profile,outcome_id,int,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_likelihood_profile,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_likelihood_profile,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_likelihood_profile,outcome_id,bigint,Yes,Yes,No,No,The identifier for the outcome cohort.
cm_likelihood_profile,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table.
cm_likelihood_profile,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database.
cm_preference_score_dist,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table.
cm_preference_score_dist,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_preference_score_dist,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_preference_score_dist,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_preference_score_dist,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_preference_score_dist,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database.
cm_preference_score_dist,preference_score,float,Yes,Yes,No,No,A preference score value.
cm_preference_score_dist,target_density,float,Yes,No,No,No,The distribution density for the target cohort at the given preference score.
cm_preference_score_dist,comparator_density,float,Yes,No,No,No,The distribution density for the comparator cohort at the given preference score.
cm_propensity_model,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_propensity_model,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_propensity_model,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_propensity_model,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_propensity_model,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table.
cm_propensity_model,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database.
cm_propensity_model,covariate_id,bigint,Yes,Yes,No,No,Foreign key referencing the cm_covariate table. 0 is reserved for the intercept.
cm_propensity_model,coefficient,float,Yes,No,No,No,The coefficient (beta) for the covariate in the propensity model.
cm_shared_covariate_balance,database_id,varchar,Yes,Yes,No,No,Foreign key referencing the database.
cm_shared_covariate_balance,target_id,int,Yes,Yes,No,No,The identifier for the target cohort.
cm_shared_covariate_balance,comparator_id,int,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_shared_covariate_balance,target_id,bigint,Yes,Yes,No,No,The identifier for the target cohort.
cm_shared_covariate_balance,comparator_id,bigint,Yes,Yes,No,No,The identifier for the comparator cohort.
cm_shared_covariate_balance,analysis_id,int,Yes,Yes,No,No,A foreign key referencing the cm_analysis table.
cm_shared_covariate_balance,covariate_id,bigint,Yes,Yes,No,No,A foreign key referencing the cm_covariate table.
cm_shared_covariate_balance,mean_before,float,No,No,Yes,No,The mean value of the covariate in the union of the target and comparator cohort before propensity score adjustment.
Expand Down

0 comments on commit 8ef8bcb

Please sign in to comment.