TripalCultivate / TripalCultivate-Phenotypes

Provides generic support for large scale phenotypic data and traits with importers, content pages and visualizations.
GNU General Public License v3.0
1 stars 0 forks source link

G4.76 - Divide Trait Import Value plugin instance into 3 separate instances #76

Closed carolyncaron closed 5 months ago

carolyncaron commented 6 months ago

Branch

g4.76-divideTraitImportValue

Groups

Group 2 - Data Importing, Group 4 - API | Services | Plugins

Describe

After spending time thinking about/discussing how to organize plugin instances for validating the phenotype share importer, we realized that the plugin instance to validate columns in the trait importer could be split up into 3 separate instances:

  1. Empty values
  2. That the combination of Trait Name + Method Short Name + Unit is not duplicated within the datafile or the database
  3. The column "Type" contains either the value "Qualitative" or "Quantitative"

See issue #53 for the original design of the current validators

Design

The current validator class TraitImportValues (TraitImportValues.php) will be divided into the following 3 classes:

  1. EmptyCell
  2. DuplicateTraits
  3. TraitTypeColumn

These 3 classes will all be under the scope of "FILE ROW" and the "TRAIT IMPORT VALUES" scope will be removed.

Empty Cell: Currently checks for individual empty cells and if the file is missing data rows (ie. only has a header). We will want to limit this plugin instance to check individual cells, and relocate the functionality check for data rows to another pre-existing plugin or new one altogether. Additionally, we will want a way to specify which cells are allowed to be empty, as this will be the case for other importers that will use this plugin instance.

Duplicate Traits: Currently only checks for duplicate traits in the file. Since this is provided the scope of a row in the file, it will need to keep track of traits that were already processed before it in addition to checking if the trait + method + unit combo already exists at the database level.

TraitTypeColumn: Our plan is to make this validator highly generic in the hopes it can be re-used for the phenotype importers. Renamed to something like "ValidValueFromList"? In addition to being provided with a single row from the input file, the $context array will contain: