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.48 column headers validator #51

Closed reynoldtan closed 11 months ago

reynoldtan commented 1 year ago

Issue #48 Column Headers Validator

Motivation

This PR adds another validation scope or level. The Column Headers Validator validates column headers in the file to matches the headers defined by the Importer.

This PR is dependent on (https://github.com/TripalCultivate/TripalCultivate-Phenotypes/pull/50) Data File Validator

What does this PR do?

Please describe each things this PR does. For example, a PR may 1) solve a specific bug, 2) create an auomated test to ensure it doesn't return.

  1. Updates the scopes array in the validateForm() method of the Importer to include the key/scope 'HEADERS'.
  2. Adds a plugin into the plugin directory that corresponds to the HEADER validator scope.

Testing

Automated Testing

Please describe each automated test this PR creates and provide a list of the assertions it makes using casual language. Do not just say things like "asserts the array is not empty" but rather say "Ensures that the return value of method X with these parameters is not an empty array".

This PR has automated test included to test the following:

  1. Kernel Test: Tests headers for:
    • Headers row (line no.1 in the data file) is missing.
    • Mismatch column headers: Extra header and Missing header
    • Skip validation, set validator as todo/upcoming.

Manual Testing

Describe in detail how someone should manually test this functionality. Make sure to include whether they need to build a docker from scratch, create any records, etc.

  1. Install/Enable Tripal Cultivate Phenotypes Module.
  2. Create test data Create a project Create a genus Pair the project - genus in project prop using the genus term in the configuration as the type, alternatively with the module properly configured use the service below.
\Drupal::service('trpcultivate_phenotypes.genus_project')
  ->setGenusToProject(PROJECT ID, 'GENUS', TRUE);
  1. Execute Tripal Job created by the install.

  2. Configure module.

  3. Load Tripal Cultivate PhenoShare Importer page. mysite/admin/tripal/loaders/trpcultivate-phenotypes-share

  4. Download a template file provided in the importer and use it as test file.

  5. Alter header row (line no.1 of the template file) to test validation.