-
Notifications
You must be signed in to change notification settings - Fork 0
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
G4.76 STEP 1 --Divides trait import value plugin instance into 3 separate instances #77
Conversation
…or no data rows in the new validators
… been implemented
…, and categorized validator tests into a new directory
…code was complaining
…he file row scope
…ss and created its own Kernel test file
…d completed 2 tests
…tests accordingly
…lity for checking in the database.
…r validator tests
…e traits validator test for the database level
…ng on PR 81 to be merged
Manual Test: I performed manual test outlined above and the method/logic works as described. Suggestions/Improvements are as follow:
Information surrounding the file being uploaded such as the file id, genus, project and the column headers are readily available through the validator base loadAssets() method. TripalCultivate-Phenotypes/trpcultivate_phenotypes/src/TripalCultivatePhenotypesValidatorBase.php Line 55 in 217e1ca
In this case, the column headers are available in this property TripalCultivate-Phenotypes/trpcultivate_phenotypes/src/TripalCultivatePhenotypesValidatorBase.php Line 31 in 217e1ca
$this->column_headers[0] // is the Trait Name There is also no reference what line number the error occurred, but I am assuming this will all be addressed in another PR.
Type: One of "Qualitative" or "Quantitative". Source code:
I have example here: TripalCultivate-Phenotypes/trpcultivate_phenotypes/src/Plugin/Validators/Genus.php Line 100 in 217e1ca
EmptyCell.php
ValueInList.php
checkIndices()
|
Thank you Reynold 😊 I have addressed your suggestions specific to the source code in commit ebede3a. Specifically:
|
…valid values should be occuring.
Here are my comments to @reynoldtan's suggestions based on his manual test:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code-wise this looks great 😍
All the suggestions are comment focused.
trpcultivate_phenotypes/src/Plugin/Validators/DuplicateTraits.php
Outdated
Show resolved
Hide resolved
trpcultivate_phenotypes/src/Plugin/Validators/DuplicateTraits.php
Outdated
Show resolved
Hide resolved
trpcultivate_phenotypes/src/Plugin/Validators/DuplicateTraits.php
Outdated
Show resolved
Hide resolved
trpcultivate_phenotypes/tests/src/Kernel/TripalImporter/TraitImporterFormValidateTest.php
Outdated
Show resolved
Hide resolved
trpcultivate_phenotypes/tests/src/Kernel/TripalImporter/TraitImporterRunTest.php
Outdated
Show resolved
Hide resolved
trpcultivate_phenotypes/tests/src/Kernel/TripalImporter/TraitImporterRunTest.php
Outdated
Show resolved
Hide resolved
trpcultivate_phenotypes/tests/src/Kernel/Validators/PluginValidatorTest.php
Outdated
Show resolved
Hide resolved
trpcultivate_phenotypes/tests/src/Kernel/Validators/ValidatorFileRowScopeTest.php
Outdated
Show resolved
Hide resolved
Redeclares protected variables as arrays where it was removed Co-authored-by: Lacey-Anne Sanderson <las166@mail.usask.ca>
All of Lacey's suggestions within commented parts of the code Co-authored-by: Lacey-Anne Sanderson <las166@mail.usask.ca>
Added skip test message Co-authored-by: Lacey-Anne Sanderson <las166@mail.usask.ca>
Thanks for your suggestions Lacey! I committed all of them in 3 batches 😄 |
…h the input file and database
Thanks for catching this, Reynold! In this case, if a trait combo has been inserted into the database, ideally the validator should still recognize when a trait combo has been validated before (ie. it is a duplicated row in the input file) and tell the user about that too. I've updated the DuplicateTrait validator to account for this and added a test for this situation in commit 503879e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code updates look good!
Issue #76
Motivation
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:
See issue #53 for the original design of the current validators
What does this PR do?
This PR creates 3 new validators:
pass
if the values at the specified indices are not empty, and statusfail
if any are.pass
if the values at the specified indices contain any one of the specified valid values. Otherwise, a status offail
is returned.pass
if no duplicates found,fail
if the combination of trait + method + unit is found.Additionally, 2 new methods were added to the Validator Base class:
IMPORTANT NOTE: This PR does NOT remove the class TraitImportValues nor does it change the Trait Importer to call these new validators instead of the TraitImportValues class. This will be addressed in a separate PR. The purpose was to flesh out these validators first, and test them independently before moving on to having them utilized by an importer. Some tests were marked as skipped which will also be addressed in the next PR.
Testing
Automated Testing
Kernel/Validators
ValidatorBaseTest
,ValidatorTraitImporterTest
andValidatorFileRowScopeTest
ValidatorBaseTest->testValidatorBaseCheckIndices
ValidatorFileRowScopeTest->testValidatorValueInList
ValidatorFileRowScopeTest->testValidatorEmptyCell
ValidatorTraitImporterTest->testValidatorDuplicateTraitsFile
ValidatorTraitImporterTest->testValidatorDuplicateTraitsDatabase
Manual Testing
Tripal
>Content
>Add Tripal Content
and selectOrganism
from the listTripal
>Extensions
>Tripal Cultivate Phenotypes Configuration
Devel
>Execute PHP
. You may need to add it as an option by going toConfigure
and checkingPHP Execute
in the list first.The following are templates for testing each validator individually. Play around with different values in $file_row, or $context['indices']. You can also try to trigger an exception by the checkIndices() method!
EmptyCell
ValueInList
DuplicateTraits: file level
DuplicateTraits: database level