diff --git a/inst/settings/resultsDataModelSpecification.csv b/inst/settings/resultsDataModelSpecification.csv index b1f00e7..6d54256 100644 --- a/inst/settings/resultsDataModelSpecification.csv +++ b/inst/settings/resultsDataModelSpecification.csv @@ -45,7 +45,7 @@ dechallenge_rechallenge,pct_rechallenge_attempt,float,Yes,No,No,No,The percentag dechallenge_rechallenge,pct_rechallenge_success,float,Yes,No,No,No,The percentage of rechallenge success dechallenge_rechallenge,pct_rechallenge_fail,float,Yes,No,No,No,The percentage of rechallenge fails analysis_ref,database_id,varchar(100),Yes,Yes,No,No,The database identifier -analysis_ref,setting_id,int,Yes,Yes,No,No,The run identifier +analysis_ref,setting_id,float,Yes,Yes,No,No,The run identifier analysis_ref,analysis_id,int,Yes,Yes,No,No,The analysis identifier analysis_ref,analysis_name,varchar,Yes,No,No,No,The analysis name analysis_ref,domain_id,varchar,Yes,No,No,No,The domain id @@ -54,7 +54,7 @@ analysis_ref,end_day,int,Yes,No,No,No,The end day analysis_ref,is_binary,varchar(1),Yes,No,No,No,Is this a binary analysis analysis_ref,missing_means_zero,varchar(1),Yes,No,No,No,Missing means zero covariate_ref,database_id,varchar(100),Yes,Yes,No,No,The database identifier -covariate_ref,setting_id,int,Yes,Yes,No,No,The run identifier +covariate_ref,setting_id,float,Yes,Yes,No,No,The run identifier covariate_ref,covariate_id,bigint,Yes,Yes,No,No,The covariate identifier covariate_ref,covariate_name,varchar,Yes,No,No,No,The covariate name covariate_ref,analysis_id,int,Yes,No,No,No,The analysis identifier @@ -62,7 +62,7 @@ covariate_ref,concept_id,bigint,Yes,No,No,No,The concept identifier covariate_ref,value_as_concept_id,int,N,N,N,N,The value as concept_id for features created from observation or measurement values covariate_ref,collisions,int,N,N,N,N,The number of collisions found for the covariate_id covariates,database_id,varchar(100),Yes,Yes,No,No,The database identifier -covariates,setting_id,int,Yes,Yes,No,No,The run identifier +covariates,setting_id,float,Yes,Yes,No,No,The run identifier covariates,cohort_type,varchar(10),Yes,Yes,No,No,The cohort type covariates,target_cohort_id,int,Yes,Yes,No,No,The target cohort id covariates,outcome_cohort_id,int,Yes,Yes,No,No,The outcome cohort id @@ -71,7 +71,7 @@ covariates,covariate_id,bigint,Yes,Yes,No,No,The covaraite id covariates,sum_value,int,Yes,No,No,No,The sum value covariates,average_value,float,Yes,No,No,No,The average value covariates_continuous,database_id,varchar(100),Yes,Yes,No,No,The database identifier -covariates_continuous,setting_id,int,Yes,Yes,No,No,The run identifier +covariates_continuous,setting_id,float,Yes,Yes,No,No,The run identifier covariates_continuous,cohort_type,varchar(10),Yes,Yes,No,No,The cohort type covariates_continuous,target_cohort_id,int,Yes,Yes,No,No,The target cohort id covariates_continuous,outcome_cohort_id,int,Yes,Yes,No,No,The outcome cohort id @@ -86,7 +86,7 @@ covariates_continuous,p_10_value,float,Yes,No,No,No,The 10th percentile covariates_continuous,p_25_value,float,Yes,No,No,No,The 25th percentile covariates_continuous,p_75_value,float,Yes,No,No,No,The 75th percentile covariates_continuous,p_90_value,float,Yes,No,No,No,The 90th percentile -settings,setting_id,int,Yes,Yes,No,No,The run identifier +settings,setting_id,float,Yes,Yes,No,No,The run identifier settings,database_id,varchar(100),Yes,Yes,No,No,The database identifier settings,covariate_setting_json,varchar,Yes,No,No,No,The covariate settings JSON settings,case_covariate_setting_json,varchar,Yes,No,No,No,The during covariate settings JSON @@ -99,7 +99,7 @@ settings,end_anchor,varchar(15),No,No,No,No,The end anchor settings,case_pre_target_duration,int,No,No,No,No,How far to look back before index for case features settings,case_post_outcome_duration,int,No,No,No,No,How far to look forward after outcome for case features cohort_details,database_id,varchar(100),Yes,Yes,No,No,The database identifier -cohort_details,setting_id,int,Yes,Yes,No,No,The run identifier +cohort_details,setting_id,float,Yes,Yes,No,No,The run identifier cohort_details,cohort_type,varchar(10),Yes,Yes,No,No,The cohort type cohort_details,target_cohort_id,int,Yes,Yes,No,No,The target cohort id cohort_details,outcome_cohort_id,int,Yes,Yes,No,No,The outcome cohort id diff --git a/inst/sql/sql_server/ResultTables.sql b/inst/sql/sql_server/ResultTables.sql index c0893f8..99bb3af 100644 --- a/inst/sql/sql_server/ResultTables.sql +++ b/inst/sql/sql_server/ResultTables.sql @@ -59,37 +59,9 @@ CREATE TABLE @my_schema.@table_prefixdechallenge_rechallenge ( outcome_cohort_definition_id) ); - --- covariateSettings -CREATE TABLE @my_schema.@table_prefixsettings ( - setting_id int NOT NULL, - database_id varchar(100) NOT NULL, - covariate_setting_json varchar(MAX), - case_covariate_setting_json varchar(MAX), - min_prior_observation int, - outcome_washout_days int, - risk_window_start int, - start_anchor varchar(15), - risk_window_end int, - end_anchor varchar(15), - case_pre_target_duration int, - case_post_outcome_duration int, - PRIMARY KEY (setting_id, database_id) -); - --- added this table -CREATE TABLE @my_schema.@table_prefixcohort_details ( - setting_id int NOT NULL, - database_id varchar(100) NOT NULL, - target_cohort_id int, - outcome_cohort_id int, - cohort_type varchar(10), - PRIMARY KEY (setting_id, database_id,target_cohort_id,outcome_cohort_id,cohort_type) -); - CREATE TABLE @my_schema.@table_prefixanalysis_ref ( - setting_id int NOT NULL, database_id varchar(100) NOT NULL, + setting_id float NOT NULL, analysis_id int NOT NULL, analysis_name varchar(max) NOT NULL, domain_id varchar(30), @@ -101,8 +73,8 @@ CREATE TABLE @my_schema.@table_prefixanalysis_ref ( ); CREATE TABLE @my_schema.@table_prefixcovariate_ref ( - setting_id int NOT NULL, database_id varchar(100) NOT NULL, + setting_id float NOT NULL, covariate_id bigint NOT NULL, covariate_name varchar(max) NOT NULL, analysis_id int NOT NULL, @@ -113,24 +85,24 @@ CREATE TABLE @my_schema.@table_prefixcovariate_ref ( ); CREATE TABLE @my_schema.@table_prefixcovariates ( - setting_id int NOT NULL, database_id varchar(100) NOT NULL, + setting_id float NOT NULL, + cohort_type varchar(10), target_cohort_id int, outcome_cohort_id int, - cohort_type varchar(10), + min_characterization_mean float, covariate_id bigint NOT NULL, sum_value int NOT NULL, average_value float NOT NULL, - min_characterization_mean float, PRIMARY KEY (database_id, setting_id, target_cohort_id, outcome_cohort_id, cohort_type , covariate_id) ); CREATE TABLE @my_schema.@table_prefixcovariates_continuous ( - setting_id int NOT NULL, database_id varchar(100) NOT NULL, + setting_id float NOT NULL, + cohort_type varchar(10), target_cohort_id int, outcome_cohort_id int, - cohort_type varchar(10), covariate_id bigint NOT NULL, count_value int NOT NULL, min_value float, @@ -145,23 +117,47 @@ CREATE TABLE @my_schema.@table_prefixcovariates_continuous ( PRIMARY KEY (database_id, setting_id, target_cohort_id, outcome_cohort_id, cohort_type , covariate_id) ); -CREATE TABLE @my_schema.@table_prefixcohort_counts( +-- covariateSettings +CREATE TABLE @my_schema.@table_prefixsettings ( + setting_id float NOT NULL, database_id varchar(100) NOT NULL, - target_cohort_id int, - outcome_cohort_id int, - cohort_type varchar(10), + covariate_setting_json varchar(MAX), + case_covariate_setting_json varchar(MAX), min_prior_observation int, outcome_washout_days int, risk_window_start int, + risk_window_end int, start_anchor varchar(15), + end_anchor varchar(15), + case_pre_target_duration int, + case_post_outcome_duration int, + PRIMARY KEY (setting_id, database_id) +); + +-- added this table +CREATE TABLE @my_schema.@table_prefixcohort_details ( + database_id varchar(100) NOT NULL, + setting_id float NOT NULL, + cohort_type varchar(10), + target_cohort_id int, + outcome_cohort_id int, + PRIMARY KEY (setting_id, database_id,target_cohort_id,outcome_cohort_id,cohort_type) +); + +CREATE TABLE @my_schema.@table_prefixcohort_counts( + database_id varchar(100) NOT NULL, + cohort_type varchar(10), + target_cohort_id int, + outcome_cohort_id int, + risk_window_start int, risk_window_end int, + start_anchor varchar(15), end_anchor varchar(15), + min_prior_observation int, + outcome_washout_days int, row_count int NOT NULL, person_count int NOT NULL, min_exposure_time int, mean_exposure_time int, - max_exposure_time int--, - --PRIMARY KEY (database_id, target_cohort_id,outcome_cohort_id, - --cohort_type, min_prior_observation, outcome_washout_days, - --risk_window_start, start_anchor, risk_window_end, end_anchor) + max_exposure_time int );