FEPMM
Method missing
This check follows the suggestion of Starr (2007) to flag entire trips which have an event with a missing method.
-- © Copyright 2026 The Kahawai Collective
-- SPDX-License-Identifier: MIT
INSERT INTO grooming_rules
VALUES ('FEPMM', 'edw', 'effort', 'Flag', 'Flag trips if any events have a missing method');
CREATE OR REPLACE FUNCTION FEPMM()
RETURNS VOID AS $$
INSERT INTO groomed.checks (code, "table", "column", id)
SELECT 'FEPMM', 'effort', 'primary_method', id
FROM groomed.effort
WHERE trip IN (
SELECT DISTINCT trip
FROM groomed.effort
WHERE primary_method IS NULL AND trip IS NOT NULL
);
UPDATE groomed.effort SET checks = checks || '{FEPMM}'
FROM groomed.checks u
WHERE u.code = 'FEPMM'
AND groomed.effort.id = u.id;
$$ LANGUAGE SQL;
SELECT FEPMM();Effects of grooming