drh_participant_cgm_dates

Column Type
tenant_id VARCHAR
study_id TEXT
participant_id TEXT
cgm_start_date
cgm_end_date

SQL DDL

CREATE VIEW drh_participant_cgm_dates As
SELECT 
    (
        select
            party_id
        from
            party
        limit
            1
    ) as tenant_id,
    (
        select
            study_id
        from
            uniform_resource_study
        limit
            1
    ) as study_id,
    participant_id,
    MIN(Date_Time) AS cgm_start_date,
    MAX(Date_Time) AS cgm_end_date
FROM 
    combined_cgm_tracing
GROUP BY 
    participant_id