ncats / CTSA-Metrics

17 stars 16 forks source link

Datetime Issue in Query for Demo Age/DOB Measure #6

Closed cukarthik closed 6 years ago

cukarthik commented 6 years ago

Since birth_datetime is an optional field in the current OMOP version, I would suggest modifying the this line to have an 'OR' statement that includes the commented lines of code.

So the query would look like this:

        SELECT 'Demo Age/DOB' AS Domain,
        CAST(COUNT(DISTINCT D.person_id) as Float) AS 'Patients with Standards'
        FROM Person D
        -- We may want to alter this to be only Year of birth present at this time Year, Month and Day are required in order to count
        Where D.birth_datetime  is NOT NULL OR (D.Year_of_Birth  is NOT NULL
            and  D.month_of_Birth is NOT NULL
            and  D.Day_of_Birth  is NOT NULL)
KenGersing commented 6 years ago

The script was modified to only check for the year of birth.