<commit_before>
package CXGN::List::Validate::Plugin::Accessions;

use Moose;

use Data::Dumper;

sub name { 
    return "accessions";
}

sub validate { 
    my $self = shift;
    my $schema = shift;
    my $list = shift;

    my $type_id = $schema->resultset("Cv::Cvterm")->search({ name=>"accession" })->first->cvterm_id();

    my $stock_property_cv_id = $schema->resultset("Cv::Cv")->search({ name=> "stock_property" })->first()->cv_id();


    my $synonym_type_rs = $schema->resultset("Cv::Cvterm")->search({name=>"stock_synonym", cv_id=> $stock_property_cv_id });

    my $synonym_rs;
    my $synonym_type_id;
    if ($synonym_type_rs->count == 0) { 
	$synonym_rs = $schema->resultset("Cv::Cvterm")->create_with( 
	    { name => 'stock_synonym',
	      cv   => 'stock_property',
	      #db and dbxref are set to default values "null" and "autocreated:stock_synonym" 
	    });
	$synonym_type_id = $synonym_rs->cvterm_id();
    }
    else { 
	$synonym_type_id = $synonym_type_rs->first->cvterm_id();
    }
	
    

    my %items = ();
    
    # check uniquename
    #
    foreach my $item (@$list) { <commit_msg>use SGN::Model::Cvterm instead of create_with<commit_after>
package CXGN::List::Validate::Plugin::Accessions;

use Moose;

use Data::Dumper;
use SGN::Model::Cvterm;


sub name { 
    return "accessions";
}

sub validate { 
    my $self = shift;
    my $schema = shift;
    my $list = shift;

    my $type_id = $schema->resultset("Cv::Cvterm")->search({ name=>"accession" })->first->cvterm_id();

    my $stock_property_cv_id = $schema->resultset("Cv::Cv")->search({ name=> "stock_property" })->first()->cv_id();


    my $synonym_type_rs = $schema->resultset("Cv::Cvterm")->search({name=>"stock_synonym", cv_id=> $stock_property_cv_id });

    my $synonym_rs;
    my $synonym_type_id;
    if ($synonym_type_rs->count == 0) { 
	$synonym_rs = SGN::Model::Cvterm->get_cvterm_row($schema, 'stock_synonym', 'stock_property');

	$synonym_type_id = $synonym_rs->cvterm_id();
    }
    else { 
	$synonym_type_id = $synonym_type_rs->first->cvterm_id();
    }
	
    

    my %items = ();
    
    # check uniquename
    #
    foreach my $item (@$list) { 
{'fraction_non_alphanumeric': 0.17731481481481481, 'fraction_numerical': 0.000925925925925926, 'mean_word_length': 3.8129175946547886, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1550346', 'n_tokens_mistral': 838, 'n_tokens_neox': 803, 'n_words': 143}