-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b879adc
commit 91b84a0
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
lib/service/diabetes-research-hub/cookbook/different-patient-column-names.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- TODO: Use ChatGPT to fully understand what participant data represents and incorporate insights from GitHub discussions. | ||
-- If the column in the CSV file `participant` is `patient_id` and instead of `gender` the CSV file has `sex` as the column name. | ||
-- Drop and recreate the participant_data view | ||
DROP VIEW IF EXISTS drh_participant_data; | ||
CREATE VIEW drh_participant_data AS | ||
SELECT | ||
patient_id AS participant_id, study_id, site_id, diagnosis_icd, med_rxnorm, | ||
treatment_modality, sex AS gender, race_ethnicity, age, bmi, baseline_hba1c, | ||
diabetes_type, study_arm | ||
FROM uniform_resource_participant; |
13 changes: 13 additions & 0 deletions
13
lib/service/diabetes-research-hub/cookbook/sample-id-generation.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- Drop the view if it exists | ||
DROP VIEW IF EXISTS drh_participant_data; | ||
|
||
-- Create a view with a prefixed and UUID-appended participant_id, and unchanged foreign key values | ||
CREATE VIEW drh_participant_data AS | ||
SELECT | ||
-- Prefix with 'PART_' and append a UUID-like hex blob | ||
'PART_' || lower(hex(randomblob(2)) || hex(randomblob(2))) AS participant_id, | ||
-- Foreign keys (study_id and site_id) must remain unchanged | ||
study_id, site_id, diagnosis_icd, med_rxnorm, | ||
treatment_modality, gender, race_ethnicity, age, bmi, baseline_hba1c, | ||
diabetes_type, study_arm | ||
FROM uniform_resource_participant; |