<commit_before>package org.pdxfinder.dataexport;

import org.pdxfinder.TSV;
import org.pdxfinder.graph.dao.*;
import org.pdxfinder.services.DataImportService;
import org.pdxfinder.services.UtilityService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.stream.Collectors;

/*
 * Created by csaba on 02/10/2019.
 */
@Service
public class UniversalDataExtractionServices {

    private static final Logger log = LoggerFactory.getLogger(UniversalDataExtractionServices.class);

    private UtilityService utilityService;
    private DataImportService dataImportService;

    public static final String MODEL_ID = "modelId";
    public static final String PROVIDER_TYPE = "providerType";
    public static final String MODEL_ACCESSIBILITY = "modelAccessibility";
    public static final String ACCESS_MODALITIES = "accessModalities";
    public static final String CONTACT_EMAIL = "contactEmail";
    public static final String CONTACT_NAME = "contactName";
    public static final String CONTACT_LINK = "contactLink";
    public static final String MODEL_LINK = "modelLink";
    public static final String PROVIDER_NAME = "providerName";
    public static final String PROVIDER_ABBREV = "providerAbbrev";
    public static final String PROJECT_NAME = "projectName";
    private static final String NOT_SPECIFIED = "Not Specified";
    private static final String PATIENT_ORIGIN = "patient";
    private static final String MODEL_ORIGIN = "xenograft";

    static final String EMPTY = "";
    
    @Autowired
    public UniversalDataExtractionServices(DataImportService dataImportService, UtilityService utilityService) {
        this.dataImportService = dataImportService;
        this.utilityService = utilityService;
    }

    public MetadataSheets extractMetadata(Group group, MetadataSheets sheets, boolean isHarmonized){
        sheets.set(TSV.metadataSheetNames.checklist.name(), extractChecklist());
        sheets.set(TSV.metadataSheetNames.patient.name(), extractPatientSheet(group));
        sheets.set(TSV.metadataSheetNames.sample.name(), extractSampleSheet(group, isHarmonized));
        sheets.set(TSV.metadataSheetNames.model.name(), extractModelDetails(group));
        sheets.set(TSV.metadataSheetNames.model_validation.name(), extractModelValidations(group));
        sheets.set(TSV.metadataSheetNames.sharing.name(), extractSharingAndContact(group));
        sheets.set(TSV.metadataSheetNames.loader.name(), extractLoaderRelatedData(group));
        return sheets;
    }

    public List<List<String>> extractChecklist(){
        List<List<String>> checklist = new ArrayList<>();<commit_msg>made final variable static as per code smell review<commit_after>package org.pdxfinder.dataexport;

import org.pdxfinder.TSV;
import org.pdxfinder.graph.dao.*;
import org.pdxfinder.services.DataImportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.stream.Collectors;

/*
 * Created by csaba on 02/10/2019.
 */
@Service
public class UniversalDataExtractionServices {

    private static final Logger log = LoggerFactory.getLogger(UniversalDataExtractionServices.class);

    private DataImportService dataImportService;

    public static final String MODEL_ID = "modelId";
    public static final String PROVIDER_TYPE = "providerType";
    public static final String MODEL_ACCESSIBILITY = "modelAccessibility";
    public static final String ACCESS_MODALITIES = "accessModalities";
    public static final String CONTACT_EMAIL = "contactEmail";
    public static final String CONTACT_NAME = "contactName";
    public static final String CONTACT_LINK = "contactLink";
    public static final String MODEL_LINK = "modelLink";
    public static final String PROVIDER_NAME = "providerName";
    public static final String PROVIDER_ABBREV = "providerAbbrev";
    public static final String PROJECT_NAME = "projectName";
    private static final String NOT_SPECIFIED = "Not Specified";
    private static final String PATIENT_ORIGIN = "patient";
    private static final String MODEL_ORIGIN = "xenograft";

    static final String EMPTY = "";
    
    @Autowired
    public UniversalDataExtractionServices(DataImportService dataImportService) {
        this.dataImportService = dataImportService;
    }

    public MetadataSheets extractMetadata(Group group, MetadataSheets sheets, boolean isHarmonized){
        sheets.set(TSV.metadataSheetNames.checklist.name(), extractChecklist());
        sheets.set(TSV.metadataSheetNames.patient.name(), extractPatientSheet(group));
        sheets.set(TSV.metadataSheetNames.sample.name(), extractSampleSheet(group, isHarmonized));
        sheets.set(TSV.metadataSheetNames.model.name(), extractModelDetails(group));
        sheets.set(TSV.metadataSheetNames.model_validation.name(), extractModelValidations(group));
        sheets.set(TSV.metadataSheetNames.sharing.name(), extractSharingAndContact(group));
        sheets.set(TSV.metadataSheetNames.loader.name(), extractLoaderRelatedData(group));
        return sheets;
    }

    public List<List<String>> extractChecklist(){
        List<List<String>> checklist = new ArrayList<>();
{'fraction_non_alphanumeric': 0.08941132913735654, 'fraction_numerical': 0.0037023324694557573, 'mean_word_length': 4.879216539717084, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '2408605', 'n_tokens_mistral': 1496, 'n_tokens_neox': 1458, 'n_words': 346}