unepwcmc/SAPI — pull request #167 by agnessa (2014-01-09 17:09:55+00:00)
Title: Accept spp and app n (#61992448)

This PR changes the way we handle misformatted data; previously, the validators would use simple sanisiting functions like SQUISH_NULL when comparing with accepted values. The problem with that was that the same checks needed to be repeated in many places, and the queries grew.

Now we perform an explicit sanitising step (i.e. data is automatically amended in the sandbox table) when uploading the file and also after any update.

The kind of amendments which are considered are mostly SQUISH_NULLing everything, as well as performing a more specialised sanitisation on the species name (stripping the spp and converting the case to first capital letter - all the rest small case).

Additionally, appendix N is now considered as valid input; nevertheless, it will raise a secondary error for the species - appendix - year check, and it is not trivial to fix that. The same applies to hybrids.