unepwcmc/SAPI — pull request #90 by simaob (2013-10-18 12:54:51+00:00)
Title: Sec validation species name and term

This branch adds secondary validations for matches between species name and terms.

The acceptable pairings are added to the trade_taxon_concept_code_pairs table, and can be added at any leve of the taxonomic tree. As trade can be reported at different levels, the view to validate the input includes "self_and_descendants" based on the taxon_concept_id on the trade_taxon_concept_code_pairs table.

This branch also includes an import file with pairings between FAMILY and Terms (as exported from the Oracle SQL database).

A spec was added to test if the validation is working.

To test this you'll need to run:

in shell console:
rake db:migrate

in rails console:
Trade::InclusionValidationRule.create(
:column_names => ['species_name', 'term_code'],
:valid_values_view => 'valid_taxon_concept_term_view',
:run_order => 4,
:is_primary => false
)

in shell console:
rake import:taxon_concept_terms_pairs