<commit_before>package uk.ac.ebi.spot.goci.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import uk.ac.ebi.spot.goci.model.Study;
import uk.ac.ebi.spot.goci.repository.AncestryRepository;
import uk.ac.ebi.spot.goci.repository.AssociationRepository;
import uk.ac.ebi.spot.goci.repository.LocusRepository;
import uk.ac.ebi.spot.goci.repository.RiskAlleleRepository;
import uk.ac.ebi.spot.goci.repository.StudyRepository;

import java.util.List;

/**
 * Created by dwelter on 09/01/17.
 */

@Service
public class DataDeletionService {

    private final Logger log = LoggerFactory.getLogger(getClass());

    protected Logger getLog() {
        return log;
    }

    private StudyService studyService;
    private AncestryRepository ancestryRepository;
    private StudyRepository studyRepository;
    private AssociationRepository associationRepository;
    private LocusRepository locusRepository;
    private RiskAlleleRepository riskAlleleRepository;

    @Autowired
    public DataDeletionService(StudyService studyService,
                               StudyRepository studyRepository,
                               AncestryRepository ancestryRepository,
                               AssociationRepository associationRepository,
                               LocusRepository locusRepository,
                               RiskAlleleRepository riskAlleleRepository){
        this.studyService = studyService;
        this.studyRepository = studyRepository;
        this.ancestryRepository = ancestryRepository;
        this.associationRepository = associationRepository;
        this.locusRepository = locusRepository;
        this.riskAlleleRepository = riskAlleleRepository;
    }

    public void deleteNonPublicStudies(){

        List<Study> unpublishedStudies = studyService.deepFindUnPublishedStudies();

        getLog().info("Found " + unpublishedStudies.size() + " unpublished studies to be removed");


        unpublishedStudies.forEach(this::deleteStudy);

        getLog().info("Study deletion process successfully completed");
    }

    private void deleteStudy(Study study) {
        System.out.println("Removing study \t" + study.getAuthor() + "\t (ID:" + study.getId() + ") with \t"
                               + study.getAssociations().size() + "\t association and \t"
                               + study.getAncestries().size() + "\t ancestries");
        getLog().debug("Removing study \t" + study.getAuthor() + "\t (ID:" + study.getId() + ") with \t"
                               + study.getAssociations().size() + "\t association and \t"
                                + study.getAncestries().size() + "\t ancestries");




        studyRepository.delete(study);

    }


}<commit_msg>Code clean-up<commit_after>package uk.ac.ebi.spot.goci.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import uk.ac.ebi.spot.goci.model.Study;
import uk.ac.ebi.spot.goci.repository.AncestryRepository;
import uk.ac.ebi.spot.goci.repository.AssociationRepository;
import uk.ac.ebi.spot.goci.repository.LocusRepository;
import uk.ac.ebi.spot.goci.repository.RiskAlleleRepository;
import uk.ac.ebi.spot.goci.repository.StudyRepository;

import java.util.List;

/**
 * Created by dwelter on 09/01/17.
 */

@Service
public class DataDeletionService {

    private final Logger log = LoggerFactory.getLogger(getClass());

    protected Logger getLog() {
        return log;
    }

    private StudyService studyService;
    private StudyRepository studyRepository;

    @Autowired
    public DataDeletionService(StudyService studyService,
                               StudyRepository studyRepository,
                               AncestryRepository ancestryRepository,
                               AssociationRepository associationRepository,
                               LocusRepository locusRepository,
                               RiskAlleleRepository riskAlleleRepository){
        this.studyService = studyService;
        this.studyRepository = studyRepository;
    }

    public void deleteNonPublicStudies(){

        List<Study> unpublishedStudies = studyService.deepFindUnPublishedStudies();

        getLog().info("Found " + unpublishedStudies.size() + " unpublished studies to be removed");


        unpublishedStudies.forEach(this::deleteStudy);

        getLog().info("Study deletion process successfully completed");
    }

    private void deleteStudy(Study study) {
        System.out.println("Removing study \t" + study.getAuthor() + "\t (ID:" + study.getId() + ") with \t"
                               + study.getAssociations().size() + "\t association and \t"
                               + study.getAncestries().size() + "\t ancestries");
        getLog().debug("Removing study \t" + study.getAuthor() + "\t (ID:" + study.getId() + ") with \t"
                               + study.getAssociations().size() + "\t association and \t"
                                + study.getAncestries().size() + "\t ancestries");

        studyRepository.delete(study);

    }


}
{'fraction_non_alphanumeric': 0.10206400302972922, 'fraction_numerical': 0.0030297292179511455, 'mean_word_length': 2.6327372764786796, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2410576', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1357, 'n_words': 271}