Smithsonian / ForestGEO

🌱🌳Web app helping a global network of scientists and forest research sites manage and validate data. Collaboration between the Smithsonian Institution's Forest Global Earth Observatory (ForestGEO), Microsoft, and CodeDay.
12 stars 4 forks source link

minMaxHeightOfMeasure validation #129

Open illume opened 1 year ago

illume commented 1 year ago

See "instructions for writing a validation function". Below are notes from the spec.

minMaxHeightOfMeasure  Min & Max Height of Measurement (HOM) NEW ADDITION   Makes sure HOM is within range for a given site. Must be greater than 0. Usually HOM is at “breast height” approximately 1.3m.

Note, this is a new validation without an existing validation function.

siddheshraze commented 8 months ago

Here is an updated procedure to run this and mark its errors in the CMVErrors table! Function's been reviewed with GPT so it should work as intended, but full testing is still pending:

create
    definer = azureroot@`%` procedure ValidateHOMUpperAndLowerBounds(IN minHOM decimal(10, 2), IN maxHOM decimal(10, 2))
BEGIN
    INSERT INTO forestgeo_bci.cmverrors (CoreMeasurementID, ValidationErrorID)
    SELECT
        CoreMeasurementID,
        3 AS ValidationErrorID
    FROM
        forestgeo_bci.coremeasurements
    WHERE
        MeasuredHOM < minHOM OR MeasuredHOM > maxHOM;
END;