Skip to content
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.87 Split GENUS validator into new style validators. #87

Closed
laceysanderson opened this issue Jun 26, 2024 · 4 comments
Closed

G4.87 Split GENUS validator into new style validators. #87

laceysanderson opened this issue Jun 26, 2024 · 4 comments
Assignees
Labels
Group 2 - Data Importing Any issue relating to importing of biological data into either Chado or any other database. Group 4 - API | Services | Plugins Any issue related to developing an API (i.e. services + plugins)

Comments

@laceysanderson
Copy link
Member

laceysanderson commented Jun 26, 2024

Branch

g4.87-genusValidators

Groups

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

Dependencies

Describe

This issue is meant to upgrade the existing Genus to the new style described in Issue #82. These will be in inputType metadata and will be given the form values. The original Project is not needed as it is handled by the drupal form validate by making the field required 🤔

Does not remove the original validator! Does not update trait importer to use this new validator.

Design

I think we want two validators:

  1. Genus exists and is configured with phenotypes.
  2. Project exists and is configured to this genus.

I don't think either one requires any config as they should both have everything they need in the form values. Neither should look at the file in any way ;-p

@laceysanderson laceysanderson added Group 2 - Data Importing Any issue relating to importing of biological data into either Chado or any other database. Group 4 - API | Services | Plugins Any issue related to developing an API (i.e. services + plugins) labels Jun 26, 2024
@laceysanderson laceysanderson changed the title G4.[issueNo] Split GENUS validator into new style validators. G4.87 Split GENUS validator into new style validators. Jun 26, 2024
@reynoldtan
Copy link
Contributor

reynoldtan commented Jun 26, 2024

psudo-code for the genusExists() plugin:

class GenusExists {
  public function validateMetadata($form_values) {
     // Locate/extract the genus field from the form_values. 
     // This assumes that there is field named ‘genus’.
     
     // If the importer is configured to validate for genus and
     // this validator could not find a genus field.
     1. Throw an exception to the developer: you need/forgot a genus field.

     // If found
     
     Genus is a string value ie. Cicer or Lens.
     1. Check that it exits in chado.organism using the organism.genus.
     
     Failed if not found.
     
     2. Check that the genus is configured, that is the genus 
     trait, method, unit and database are set.

     Failed if not configured.
   } 
}

@reynoldtan
Copy link
Contributor

reynoldtan commented Jun 26, 2024

For the project validator plugin:
Proposing the name projectGenusMatch() - this means that I am validating that project exits and is paired to a genus. The name projectExists() might be good/suited for validator to just check if the project exists alone for Importer that collects just project information.

This plugin assumes the existence of fields named genus and project.

class projectGenusMatch {
  public function validateMetadata($form_values) {
    // Locate the project field from $form_values.
    // Can be the project id or project name.
    
    // Locate the genus field from $form_values.
    // Genus is a string value ie. Cicer or Lens.
    
    // Not Found
    If the importer is configured to validate for project + genus 
    and this validator could not find a genus and project field.
    1. Throw an exception - could not find a project and/or genus field. 
  
    // Found both fields:
    1. Check if project exits in chado.project
     
    Failed if not found.

    2. Check the genus paired/set to the project if it matches the value
    of the genus field.

    Failed if it does not match. 
  }
}

@laceysanderson
Copy link
Member Author

For the project one, maybe we need two validators? One to check if the project exists in chado because as you say this is more generic and another to check that the pair is configured. Something like projectExists and projectGenusMatch?

@reynoldtan
Copy link
Contributor

Project exists - validates the project exists in chado.project.

class projectExists {
  public function validateMetadata($form_values) {
    // Locate the project field from $form_values.
    // Can be the project id or project name.
    
    // Not Found
    If the importer is configured to validate for project 
    and this validator could not find a project field.
    1. Throw an exception - could not find a project field. 
  
    // Found project field:
    1. Check if project exits in chado.project
     
    Failed if not found.
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Group 2 - Data Importing Any issue relating to importing of biological data into either Chado or any other database. Group 4 - API | Services | Plugins Any issue related to developing an API (i.e. services + plugins)
Projects
None yet
Development

No branches or pull requests

2 participants