FEMDV

Update historical diving method codes to DV

From 1 October 2019 all diving effort uses the DV #### Diving Combined (snorkel, scuba and surface supplied) - method code. {.unnumbered}

This check finds historical records reported using the DI, UBA, or UBS method codes and recodes them to the DV method code.

-- © Copyright 2026 The Kahawai Collective
-- SPDX-License-Identifier: MIT
INSERT INTO grooming_rules
VALUES ('FEMDV', 'edw', 'effort', 'Fix', 'Update historical diving method codes to DV');

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

INSERT INTO groomed.checks (code, "table", "column", id, details, orig, new)
SELECT 'FEMDV', 'effort', 'primary_method', id, trip::TEXT, primary_method, 'DV'
FROM   groomed.effort e
WHERE primary_method IN ('DI','UBA','UBS');

UPDATE groomed.effort SET checks = checks || '{FEMDV}', primary_method = 'DV'
FROM   groomed.checks u
WHERE  u.code = 'FEMDV'
AND    groomed.effort.id = u.id;

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