Skip to content

Commit

Permalink
fixing views after moving test_subject_boolean to baseline_data table
Browse files Browse the repository at this point in the history
  • Loading branch information
sid4py committed Jan 10, 2025
1 parent 0968e37 commit caa03e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion neurobooth_terra/views/sql/rc_demographic_clean.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SELECT
dem.redcap_event_name,
(regexp_match(REPLACE(dem.redcap_event_name, 'enrollment', 'v1'), 'v(\d+)_arm_\d+'))[1]::int AS redcap_sequence_num,
(regexp_match(REPLACE(dem.redcap_event_name, 'enrollment', 'v1'), 'v\d+_arm_(\d+)'))[1]::int AS redcap_study_arm,
pinfo.test_subject_boolean,
bdata.test_subject_boolean,
CASE
WHEN dem.demographic_complete = 2 THEN TRUE
ELSE FALSE
Expand Down Expand Up @@ -152,6 +152,8 @@ SELECT
FROM rc_demographic dem
RIGHT OUTER JOIN rc_participant_and_consent_information pinfo
ON dem.subject_id = pinfo.subject_id -- Should by a many-to-one join
RIGHT OUTER JOIN rc_baseline_data bdata
ON dem.subject_id = bdata.subject_id
LEFT OUTER JOIN subject subj
ON pinfo.subject_id = subj.subject_id
ORDER BY
Expand Down
2 changes: 1 addition & 1 deletion neurobooth_terra/views/sql/v_longitudinal_summary.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ WITH latest_diagnosis AS (
MAX(visit.neurobooth_visit_dates) AS last_visit,
MAX(visit.neurobooth_visit_dates) - MIN(visit.neurobooth_visit_dates) AS total_days
FROM rc_visit_dates visit
JOIN rc_participant_and_consent_information subj_info
JOIN rc_baseline_data subj_info
ON visit.subject_id = subj_info.subject_id
WHERE subj_info.test_subject_boolean = FALSE
GROUP BY
Expand Down

0 comments on commit caa03e7

Please sign in to comment.