Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screenDiam validation #115

Open
illume opened this issue Oct 25, 2022 · 2 comments
Open

screenDiam validation #115

illume opened this issue Oct 25, 2022 · 2 comments

Comments

@illume
Copy link
Collaborator

illume commented Oct 25, 2022

See "instructions for writing a validation function". Below are notes from the spec, the original validation function (in the PHP language), and the SQL table structure.

screenDiam Check for diameter range (d <0 and d> maxpossible raises an error). "SELECT TempID FROM ".$fileName." WHERE DBH<>0 AND (DBH>".$maxDBH." OR DBH<".$minDBH.") AND Errors<>'NONE' Minimum DBH for a stem is often 1.0, but this depends on whether site uses mm or cm. Local Checks to see if a tree’s diameter at breastheight (DBH) is within a predefined range.  Note that some sites record data in millimeters and others in centimeters, so minimum DBH is often 1.0 but not always.

Some was done on this already: see #107 (comment)

@illume illume changed the title draft validation: screenDiam screenDiam validation Dec 9, 2022
@siddheshraze
Copy link
Collaborator

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 ValidateScreenMeasuredDiameterMinMax(IN minDBH decimal(10, 2), IN maxDBH decimal(10, 2))
BEGIN
    INSERT INTO forestgeo_bci.cmverrors (CoreMeasurementID, ValidationErrorID)
    SELECT
        CoreMeasurementID,
        2 AS ValidationErrorID
    FROM
        forestgeo_bci.coremeasurements
    WHERE
        MeasuredDBH < minDBH OR MeasuredDBH > maxDBH;
END;

@justinpac
Copy link
Collaborator

This is still pending because it needs to be integrated with the species limits table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants