FEMEM

Flag records where the effort field is missing.

-- © Copyright 2026 The Kahawai Collective
-- SPDX-License-Identifier: MIT
INSERT INTO grooming_rules
VALUES ('FEMEM', 'edw', 'effort', 'Flag', 'Flag events where the primary effort measure is missing');

CREATE OR REPLACE FUNCTION FEMEM() RETURNS VOID AS $$

INSERT INTO groomed.checks (code, "table", "column", id)
SELECT 'FEMEM', 'effort', 'effort_num', id
FROM   groomed.effort
WHERE  primary_method IN ('MW', 'BT', 'BPT') AND effort_num IS NULL;

INSERT INTO groomed.checks (code, "table", "column", id)
SELECT 'FEMEM', 'effort', 'total_hook_num', id
FROM   groomed.effort
WHERE  primary_method IN ('SLL', 'BLL') AND total_hook_num IS NULL;

INSERT INTO groomed.checks (code, "table", "column", id)
SELECT 'FEMEM', 'effort', 'total_net_length', id
FROM   groomed.effort
WHERE  primary_method IN ('SN', 'PS') AND total_net_length IS NULL;

UPDATE groomed.effort
SET    checks = checks || '{FEMEM}'
FROM   groomed.checks u
WHERE  u.code = 'FEMEM'
AND    groomed.effort.id = u.id;

$$ LANGUAGE SQL;

SELECT FEMEM();
Effects of grooming
Figure 1: The number of records affected by the FEMEM rule, by year and source.
Figure 2: The proportion of records affected by the FEMEM rule, by form type, for all form types where some records are groomed by the FEMEM rule.