Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix for result uploading #59

Merged
merged 2 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: Characterization
Type: Package
Title: Characterizations of Cohorts
Version: 2.0.0
Date: 2024-08-07
Version: 2.0.1
Date: 2024-08-21
Authors@R: c(
person("Jenna", "Reps", , "[email protected]", role = c("aut", "cre")),
person("Patrick", "Ryan", , "[email protected]", role = c("aut")),
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Characterization 2.0.1
======================
- edited cohort_type in results to varchar(12)
- fixed setting id being messed up by readr loading

Characterization 2.0.0
======================
- added tests for all HADES supported dbms
Expand Down
11 changes: 10 additions & 1 deletion R/RunCharacterization.R
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,14 @@ aggregateCsvs <- function(
"rechallenge_fail_case_series.csv", "dechallenge_rechallenge.csv"
)

colTypes <- c(
'ciicc','ciiiicciiccc', 'didciiccd',
'didddddddddciicc', 'dciicicc',
'icciicccc', 'iiciicciicddddd',
'????????',
'?????????????????', '????????????????????'
)

# this makes sure results are recreated
firstTracker <- data.frame(
table = tables,
Expand All @@ -430,7 +438,8 @@ aggregateCsvs <- function(
# TODO do this in batches
data <- readr::read_csv(
file = loadPath,
show_col_types = F
show_col_types = F,
col_types = colTypes[csvType == tables]
)

if (csvType == "analysis_ref.csv") {
Expand Down
20 changes: 10 additions & 10 deletions inst/settings/resultsDataModelSpecification.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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,float,Yes,Yes,No,No,The run identifier
analysis_ref,setting_id,varchar(30),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
Expand All @@ -54,25 +54,25 @@ 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,float,Yes,Yes,No,No,The run identifier
covariate_ref,setting_id,varchar(30),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
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,float,Yes,Yes,No,No,The run identifier
covariates,cohort_type,varchar(10),Yes,Yes,No,No,The cohort type
covariates,setting_id,varchar(30),Yes,Yes,No,No,The run identifier
covariates,cohort_type,varchar(12),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
covariates,min_characterization_mean,float,No,Yes,No,No,Minimum fraction for feature extraction
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,No,No,No,No,The average value
covariates_continuous,database_id,varchar(100),Yes,Yes,No,No,The database 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,setting_id,varchar(30),Yes,Yes,No,No,The run identifier
covariates_continuous,cohort_type,varchar(12),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
covariates_continuous,covariate_id,bigint,Yes,Yes,No,No,The covariate identifier
Expand All @@ -86,7 +86,7 @@ covariates_continuous,p_10_value,float,No,No,No,No,The 10th percentile
covariates_continuous,p_25_value,float,No,No,No,No,The 25th percentile
covariates_continuous,p_75_value,float,No,No,No,No,The 75th percentile
covariates_continuous,p_90_value,float,No,No,No,No,The 90th percentile
settings,setting_id,float,Yes,Yes,No,No,The run identifier
settings,setting_id,varchar(30),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
Expand All @@ -99,12 +99,12 @@ 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,float,Yes,Yes,No,No,The run identifier
cohort_details,cohort_type,varchar(10),Yes,Yes,No,No,The cohort type
cohort_details,setting_id,varchar(30),Yes,Yes,No,No,The run identifier
cohort_details,cohort_type,varchar(12),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
cohort_counts,database_id,varchar(100),Yes,No,No,No,The database identifier
cohort_counts,cohort_type,varchar(10),Yes,No,No,No,The cohort type
cohort_counts,cohort_type,varchar(12),Yes,No,No,No,The cohort type
cohort_counts,target_cohort_id,int,Yes,No,No,No,The target cohort id
cohort_counts,outcome_cohort_id,int,Yes,No,No,No,The outcome cohort id
cohort_counts,risk_window_start,int,No,No,No,No,The risk window start
Expand Down
20 changes: 10 additions & 10 deletions inst/sql/sql_server/ResultTables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ CREATE TABLE @my_schema.@table_prefixdechallenge_rechallenge (

CREATE TABLE @my_schema.@table_prefixanalysis_ref (
database_id varchar(100) NOT NULL,
setting_id float NOT NULL,
setting_id varchar(30) NOT NULL,
analysis_id int NOT NULL,
analysis_name varchar(max) NOT NULL,
domain_id varchar(30),
Expand All @@ -74,7 +74,7 @@ CREATE TABLE @my_schema.@table_prefixanalysis_ref (

CREATE TABLE @my_schema.@table_prefixcovariate_ref (
database_id varchar(100) NOT NULL,
setting_id float NOT NULL,
setting_id varchar(30) NOT NULL,
covariate_id bigint NOT NULL,
covariate_name varchar(max) NOT NULL,
analysis_id int NOT NULL,
Expand All @@ -86,8 +86,8 @@ CREATE TABLE @my_schema.@table_prefixcovariate_ref (

CREATE TABLE @my_schema.@table_prefixcovariates (
database_id varchar(100) NOT NULL,
setting_id float NOT NULL,
cohort_type varchar(10),
setting_id varchar(30) NOT NULL,
cohort_type varchar(12),
target_cohort_id int,
outcome_cohort_id int,
min_characterization_mean float,
Expand All @@ -99,8 +99,8 @@ CREATE TABLE @my_schema.@table_prefixcovariates (

CREATE TABLE @my_schema.@table_prefixcovariates_continuous (
database_id varchar(100) NOT NULL,
setting_id float NOT NULL,
cohort_type varchar(10),
setting_id varchar(30) NOT NULL,
cohort_type varchar(12),
target_cohort_id int,
outcome_cohort_id int,
covariate_id bigint NOT NULL,
Expand All @@ -119,7 +119,7 @@ CREATE TABLE @my_schema.@table_prefixcovariates_continuous (

-- covariateSettings
CREATE TABLE @my_schema.@table_prefixsettings (
setting_id float NOT NULL,
setting_id varchar(30) NOT NULL,
database_id varchar(100) NOT NULL,
covariate_setting_json varchar(MAX),
case_covariate_setting_json varchar(MAX),
Expand All @@ -137,16 +137,16 @@ CREATE TABLE @my_schema.@table_prefixsettings (
-- 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),
setting_id varchar(30) NOT NULL,
cohort_type varchar(12),
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),
cohort_type varchar(12),
target_cohort_id int,
outcome_cohort_id int,
risk_window_start int,
Expand Down
Loading