Module: Protonym::SoftValidationExtensions::Klass

Included in:
Protonym
Defined in:
app/models/protonym/soft_validation_extensions.rb

Constant Summary collapse

VALIDATIONS =
{
  sv_validate_name: {
      set: :validate_name,
      name: 'Validate name',
      description: 'Validate name format'
  },

  sv_missing_etymology: {
    set: :missing_fields,
    name: 'Missing etymology',
    description: 'Etymology is not defined',
    resolution:  [:new_taxon_name_task]
  },

  sv_validate_parent_rank: {
    set: :validate_parent_rank,
    name: 'Inappropriate parent rank',
    description: 'Validates parent rank, for example suggesting "Incertae sedis" relationship for the species which has family as a parent taxon',
    resolution:  [:new_taxon_name_task]
  },

  sv_potential_family_homonyms: {
    set: :potential_homonyms,
    name: 'Potential family-group name homonyms',
    description: 'Detect potential homonyms or duplicates in the family-group names'
  },

  sv_potential_genus_homonyms: {
    set: :potential_homonyms,
    name: 'Potential genus-group name homonyms',
    description: 'Detect potential homonyms or duplicates in the genus-group names'
  },

  sv_potential_species_homonyms: {
    set: :potential_homonyms,
    name: 'Potential species-group name homonyms',
    description: 'Detect potential homonyms or duplicates in the species-group names'
  },

  sv_potential_usage_duplicates: {
    set: :potential_usage_duplicates,
    name: 'Potential usage duplicates',
    description: 'Detect duplicate name usage (misspelling, family group name form).'
  },

  sv_missing_original_genus: {
    set: :missing_relationships,
    name: 'Missing original genus',
    description: 'Get notification if the original genus is not set for the genus or species-group name',
    resolution:  [:new_taxon_name_task]
  },

  sv_missing_type_species: {
    set: :missing_relationships,
    name: 'Missing type species',
    description: 'Get notification if the type species is not set for the genus-group name',
    resolution:  [:new_taxon_name_task]
  },

  sv_missing_type_genus: {
    set: :missing_relationships,
    name: 'Missing type genus',
    description: 'Get notification if the type genus is not set for the family-group name',
    resolution:  [:new_taxon_name_task]
  },

  sv_missing_substitute_name: {
    set: :missing_relationships,
    name: 'Missing substitute name',
    description: 'Get notification if the taxon is a homonym, but a synonym relationship is not provided'
  },

  sv_missing_part_of_speech: {
    set: :missing_classifications,
    name: 'Missing part of speech',
    description: 'Part of speech is not set for the species-group name',
    resolution:  [:new_taxon_name_task]
  },

  sv_missing_gender: {
    set: :missing_classifications,
    name: 'Missing grammatical gender',
    description: 'Grammatical gender is not set for the genus-group name',
    resolution:  [:new_taxon_name_task]
  },

  sv_species_gender_agreement: {
    set: :species_gender_agreement,
    name: 'Species gender agreement',
    description: 'Species-group names is set as declinable, but the form of name is not provided, or the ending of the name is incorrect'
  },

  sv_species_gender_agreement_not_required: {
    set: :species_gender_agreement,
    name: 'Species gender agreement not required',
    description: 'Species-group name is not declanable, alternative forms are not required'
  },

  sv_type_placement: {
    set: :type_placement,
    name: 'Type placement',
    description: 'The type is classified outside the taxon. For example, the type species of the genus is not included in this genus'
  },

  sv_type_placement1: {
    set: :type_placement,
    fix: :sv_fix_type_placement1,
    name: 'Type outside of nominal taxon',
    description: 'Notify if the taxon is a type, but not classified in the taxon, for which it is a type. For example, the type species of the genus is not included in this genus'
  },

  sv_primary_types: {
    set: :primary_types,
    name: 'Primary type is not selected',
    description: 'Primary type is not selected for a species-group taxon',
    resolution: [:edit_type_material_task]
  },

  sv_primary_types_repository: {
    set: :primary_types,
    name: 'Primary type repository is not selected',
    description: 'Species-group name has a primary type selected, but is does not have type repository',
    resolution: [:edit_type_material_task]
  },

  sv_validate_coordinated_names_source: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_source,
    name: 'Matching original source of coordinated names',
    description: 'Two coordinated names (for example a genus and nominotypical subgenus) should have the same original source. When the source is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_page: {
      set: :validate_coordinated_names,
      fix: :sv_fix_coordinated_names_page,
      name: 'Matching source papes of coordinate names',
      description: 'Two coordinate names (for example a genus and nominotypical subgenus) should have the same original citation pages. When the pages are not set for one of the names, they could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_author: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_author,
    name: 'Matching author of coordinated names',
    description: 'Two coordinated names (for example a genus and nominotypical subgenus) should have the same verbatim_author. When the author is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_year: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_year,
    name: 'Matching year of coordinated names',
    description: 'Two coordinated names (for example a genus and nominotypical subgenus) should have the same verbatim. When the year is not set for one of the names, it could be automatically set using the Fix',
    resolution: [:new_taxon_name_task],
  },

  sv_validate_coordinated_names_gender: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_gender,
    name: 'Matching gender of coordinated names',
    description: 'Two coordinated genus-group names (for example a genus and nominotypical subgenus) should have the same grammatical gender. When the gender is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_part_of_speech: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_part_of_speech,
    name: 'Matching part of speech of coordinated names',
    description: 'Two coordinated species-group names (for example a species and nominotypical subspecies) should have the same part of speech. When the part of speech is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_original_genus: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_original_genus,
    name: 'Matching original genus of coordinated names',
    description: 'Two coordinated names (for example a species and nominotypical subspecies) should have the same original genus. When the original genus is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_original_subgenus: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_original_subgenus,
    name: 'Matching original subgenus of coordinated names',
    description: 'Two coordinated names (for example a species and nominotypical subspecies) should have the same original subgenus. When the original subgenus is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_original_species: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_original_species,
    name: 'Matching original species of coordinated names',
    description: 'Two coordinated names (for example a species and nominotypical subspecies) should have the same original species. When the original species is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_original_subspecies: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_original_subspecies,
    name: 'Matching original subspecies of coordinated names',
    description: 'Two coordinated names (for example a species and nominotypical subspecies) should have the same original subspecies. When the original subspecies is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_original_variety: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_original_variety,
    name: 'Matching original variety of coordinated names',
    description: 'Two coordinated names (for example a species and nominotypical subspecies) should have the same original variety. When the original variety is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_original_form: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_original_form,
    name: 'Matching original form of coordinated names',
    description: 'Two coordinated names (for example a species and nominotypical subspecies) should have the same original form. When the original form is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_type_species: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_type_species,
    name: 'Matching type species of coordinated names',
    description: 'Two coordinated genus-group names (for example a genus and nominotypical subgenus) should have the same type species. When the type species is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_type_species_type: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_type_species_type,
    name: 'Matching type species designation of coordinated names',
    description: 'Two coordinated genus-group names (for example a genus and nominotypical subgenus) should have the same type species designation. When the type species designation does not match with the coordinated name, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_type_genus: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_type_genus,
    name: 'Matching type genus of coordinated names',
    description: 'Two coordinated family-group names (for example a family and nominotypical subfamily) should have the same type genus. When the type genus is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_type_specimen: {
    set: :validate_coordinated_names,
    fix: :sv_fix_coordinated_names_type_specimen,
    name: 'Matching type specimen of coordinated names',
    description: 'Two coordinated species-group names (for example a species and nominotypical subspecies) should have the same type specimens. When the type specimen is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_etymology: {
      set: :validate_coordinated_names,
      fix: :sv_fix_coordinated_names_etymology,
      name: 'Matching etymology of coordinated names',
      description: 'Two coordinated names (for example a species and nominotypical subspecies) should have the same etymology. When the etymology is not set for one of the names, it could be automatically set using the Fix'
  },

  sv_validate_coordinated_names_roles: {
      set: :validate_coordinated_roles,
      fix: :sv_fix_coordinated_names_roles,
      name: 'Matching author roles of coordinated names',
      description: 'Two coordinated names (for example a species and nominotypical subspecies) should have the author roles. When the roles are not set for one of the names, they could be automatically set using the Fix'
  },

  sv_single_sub_taxon: {
    set: :single_sub_taxon,
    fix: :sv_fix_add_nominotypical_sub,
    name: 'Single sub-taxon',
    description: 'When the name is a sub-taxon (for example a subgenus in genus) the parent taxon should have a nominotypical sub-taxon. When the nominotypical sub-taxon is missing, it could be automatically created using the Fix',
    flagged: true
  },

  sv_parent_priority: {
    set: :parent_priority,
    name: 'Higher rank priority',
    description: 'In the same rank-group (for example, genus-group), the parent should be the oldest taxon'
  },

  sv_homotypic_synonyms: {
    set: :homotypic_synonyms,
    name: 'Missing homotypic synonym relationship',
    description: 'Two taxa should be homotypic synonyms if they share the same type'
  },

  sv_family_is_invalid: {
    set: :family_is_invalid,
    name: 'Invalid family',
    description: 'Family is invalid due to the homonymy or suppression of its type genus'
  },

  sv_family_is_invalid_no_substitute: {
    set: :family_is_invalid,
    name: 'No substitute for invalid family',
    description: 'Family is marked as invalid, but no synonym relationship is created'
  },

  sv_source_not_older_then_description: {
    set: :dates,
    name: 'Source year does not match Taxon verbatim_year',
    description: 'Source year does not match Taxon verbatim_year'
  },

  sv_original_combination_relationships: {
    set: :original_combination_relationships,
    name: 'Self original combination relationship',
    description: 'Taxon itself should be present as as the lowest original combination relationship',
    resolution: [:new_taxon_name_task]
  },

  sv_extant_children: {
    set: :extant_children,
    name: 'Extinct taxon has extant children taxa',
    description: 'Extinct taxon has extant children taxa'
  },

  sv_protonym_to_combination: {
    set: :protonym_to_combination,
    fix: :becomes_combination,
    name: 'Protonym with unavailable/invalid relationship which could potentially be converted into a combination',
    description: 'Detection of protonyms, which could be not synonym, but subsequent combinations of another protonym. The Fix could convert the protonym into combination. The Fix require manual trigger',
    flagged: true
  },

  sv_presence_of_combination: {
    set: :presence_of_combination,
    fix: :sv_fix_presence_of_combination,
    name: 'Missing subsequent combination.',
    description: 'Missing subsequent combination. Current classification of the taxon is different from original combination. The Fix require manual trigger',
    flagged: true
  },

  sv_missing_roles: {
    set: :missing_roles,
    name: 'Missing taxon author roles',
    description: 'Taxon author roles are not set',
    resolution:  [:new_taxon_name_task]
  },

  sv_person_vs_year_of_publication: {
    set: :person_vs_year_of_publication,
    name: 'The taxon author deceased',
    description: "The taxon year of description does not match with the author's years of life",
    resolution:  [:new_taxon_name_task]
  },

  sv_duplicate_nomen_nudum: {
    set: :duplicate_nomen_nudum,
    name: 'Duplicate nomen nudum',
    description: "Nomen nudum could be a duplicate or described later with an available name",
    resolution:  [:new_taxon_name_task]
  },

  sv_year_is_not_required: {
    set: :year_is_not_required,
    fix: :sv_fix_year_is_not_required,
    name: 'Verbatim year is not required',
    description: 'Verbatim year is not required if the original source is set and the source has year of publication. The Fix will delete the verbatim_year'
  },

  sv_author_is_not_required: {
    set: :author_is_not_required,
    fix: :sv_fix_author_is_not_required,
    name: 'Verbatim author is not required',
    description: 'Verbatim author is not required if the author roles are set. The Fix will delete the verbatim_author'
  },

  sv_misspelling_roles_are_not_required: {
    set: :roles_are_not_required,
    fix: :sv_fix_misspelling_roles_are_not_required,
    name: 'Author roles are not required for misspelling',
    description: 'Author roles are not required for misspelling. The author of the misspelling is inherited from the correctly spelled protonym. The Fix will delete the roles'
  },

  sv_misspelling_author_is_not_required: {
    set: :roles_are_not_required,
    fix: :sv_fix_misspelling_author_is_not_required,
    name: 'Verbatim author is not required for misspelling',
    description: 'Verbatim author is not required for misspelling. The author of the misspelling is inherited from the correctly spelled protonym. The Fix will delete the author'
  },

  sv_misspelling_year_is_not_required: {
    set: :roles_are_not_required,
    fix: :sv_fix_misspelling_year_is_not_required,
    name: 'Verbatim year is not required for misspelling',
    description: 'Verbatim year is not required for misspelling. The year of the misspelling is inherited from the correctly spelled protonym. The Fix will delete the year'
  },

  sv_missing_otu: {
    set: :missing_otu,
    fix: :sv_fix_missing_otu,
    name: 'Missing OTU',
    description: 'Missing OTU prevents proper migration to Catalog of Life'
  }
}.freeze