FESAF
Flag non RLP events using RL statistical area codes
There are several sets of statistical area (e.g. general, rock lobster, scallop). The wrong set can used be used. In particular, fishers that often use rock lobster stat areas can erroneously use them when using methods for which the general statistical areas should be applied. This grooming rule flags all misreported RLP areas as incorrect but doesn’t attempt to fix them as there is poor overlap between general statisitical areas and crayfish areas
-- © Copyright 2026 The Kahawai Collective
-- SPDX-License-Identifier: MIT
INSERT INTO grooming_rules
VALUES ('FESAF', 'edw', 'effort', 'Flag', 'Flag non RLP events using RL statistical area codes');
CREATE OR REPLACE FUNCTION FESAF() RETURNS VOID AS $$
INSERT INTO groomed.checks(code, "table", "column", id)
SELECT 'FESAF', 'effort', 'start_stats_area_code', id
FROM groomed.effort
WHERE primary_method != 'RLP' AND start_stats_area_code IN ('901', '902', '903',
'904', '905', '906', '907', '908', '909', '910', '911', '912', '913', '914', '915',
'916', '917', '918', '919', '920', '921', '922', '923', '924', '925', '926', '927'
'928', '929', '930', '931', '932', '933', '934', '935', '936','937', '938', '939',
'940', '941', '942', '943');
UPDATE groomed.effort
SET checks = checks || '{FESAF}'
FROM groomed.checks u
WHERE u.code = 'FESAF'
AND groomed.effort.id = u.id;
$$ LANGUAGE SQL VOLATILE;
SELECT FESAF();Effects of grooming