<commit_before>package no.uio.ifi.trackfind.backend.data.providers.gdc;

import lombok.extern.slf4j.Slf4j;
import no.uio.ifi.trackfind.backend.data.providers.PaginationAwareDataProvider;
import org.springframework.stereotype.Component;

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

/**
 * Fetches data from <a href="https://docs.gdc.cancer.gov/">GDC</a>.
 *
 * @author <NAME>
 */
@Slf4j
@Component
public class GDCDataProvider extends PaginationAwareDataProvider {

    private static final String CASES = "https://api.gdc.cancer.gov/cases?" +
            "filters={%20%22op%22:%22and%22,%20%22content%22:[%20{%20%22op%22:%22=%22,%20%22content%22:{%20%22field%22:%22files.access%22,%20%22value%22:%22open%22%20}%20}%20]%20}&";
    private static final String CASES_EXPANDED = CASES + "expand=demographic,samples,samples.annotations,samples.portions,samples.portions.center,samples.portions.analytes,samples.portions.analytes.aliquots,samples.portions.analytes.aliquots.annotations,samples.portions.analytes.aliquots.center,samples.portions.analytes.annotations,samples.portions.slides,samples.portions.slides.annotations,samples.portions.annotations,annotations,exposures,files,files.index_files,files.downstream_analyses,files.downstream_analyses.output_files,files.archive,files.metadata_files,files.center,files.analysis,files.analysis.input_files,files.analysis.metadata,files.analysis.metadata.read_groups,files.analysis.metadata.read_groups.read_group_qcs,family_histories,diagnoses,diagnoses.treatments,project,project.program,tissue_source_site&";
    private static final String DOWNLOAD = "https://api.gdc.cancer.gov/data/";
    private static final String FILES = "files";

    /**
     * {@inheritDoc}
     */
    @SuppressWarnings("unchecked")
    @Override
    public Collection<Map> fetchData() throws Exception {
        Collection<Map> result = new HashSet<>();
        log.info("Fetching cases...");
        int pagesTotal = getPagesTotal(CASES, GDCPage.class);
        if (pagesTotal == 0) {
            return result;
        }<commit_msg>Remove unused IOException in GDCDataProvider.<commit_after>package no.uio.ifi.trackfind.backend.data.providers.gdc;

import lombok.extern.slf4j.Slf4j;
import no.uio.ifi.trackfind.backend.data.providers.PaginationAwareDataProvider;
import org.springframework.stereotype.Component;

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

/**
 * Fetches data from <a href="https://docs.gdc.cancer.gov/">GDC</a>.
 *
 * @author <NAME>
 */
@Slf4j
@Component
public class GDCDataProvider extends PaginationAwareDataProvider {

    private static final String CASES = "https://api.gdc.cancer.gov/cases?" +
            "filters={%20%22op%22:%22and%22,%20%22content%22:[%20{%20%22op%22:%22=%22,%20%22content%22:{%20%22field%22:%22files.access%22,%20%22value%22:%22open%22%20}%20}%20]%20}&";
    private static final String CASES_EXPANDED = CASES + "expand=demographic,samples,samples.annotations,samples.portions,samples.portions.center,samples.portions.analytes,samples.portions.analytes.aliquots,samples.portions.analytes.aliquots.annotations,samples.portions.analytes.aliquots.center,samples.portions.analytes.annotations,samples.portions.slides,samples.portions.slides.annotations,samples.portions.annotations,annotations,exposures,files,files.index_files,files.downstream_analyses,files.downstream_analyses.output_files,files.archive,files.metadata_files,files.center,files.analysis,files.analysis.input_files,files.analysis.metadata,files.analysis.metadata.read_groups,files.analysis.metadata.read_groups.read_group_qcs,family_histories,diagnoses,diagnoses.treatments,project,project.program,tissue_source_site&";
    private static final String DOWNLOAD = "https://api.gdc.cancer.gov/data/";
    private static final String FILES = "files";

    /**
     * {@inheritDoc}
     */
    @SuppressWarnings("unchecked")
    @Override
    public Collection<Map> fetchData() throws Exception {
        Collection<Map> result = new HashSet<>();
        log.info("Fetching cases...");
        int pagesTotal = getPagesTotal(CASES, GDCPage.class);
        if (pagesTotal == 0) {
            return result;
        }
{'fraction_non_alphanumeric': 0.13660161827701095, 'fraction_numerical': 0.031413612565445025, 'mean_word_length': 5.587774294670846, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 6, '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': '3960298', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1328, 'n_words': 156}