                         SELECT count(*) FROM trisano.dw_contact_events_view c
                         WHERE dmev.id = c.id AND contact_type = 'Infant'
                     ) AS contact_infants,
-                    CASE
-                        WHEN disposition_date IS NULL THEN 1
-                        -- This is also probably not what we want
-                        ELSE 0
-                    END AS currently_active
+                    (
+                        SELECT count(*) FROM trisano.dw_contact_events_view c
+                        WHERE dmev.id = c.id AND contact_type = 'Infant'
+                        AND c.disposition IS NULL
+                    ) AS currently_active
                 FROM
                     trisano.dw_morbidity_events_view dmev
                 WHERE

-- along with TriSano. If not, see http://www.gnu.org/licenses/agpl-3.0.txt.

BEGIN;

DROP SCHEMA IF EXISTS phepb_reports CASCADE;


                FROM 
                    trisano.dw_morbidity_events_view
                WHERE
                    disease_name = 'Hepatitis B Pregnancy Event' AND
                    actual_delivery_date IS NULL
                    ;

CREATE TABLE report2 AS
