import csv


def filter_correlations(filepath, pairs):
    """Filter endpoint pairs based on their case-control correlation"""
    res = []
    max_case_ratio = 0.9
    pairs = set(pairs)
    with open(filepath) as ff:
        reader = csv.DictReader(ff)
        for row in reader:
            corr_pair = (row['endpoint_a'], row['endpoint_b'])
            if corr_pair in pairs and float(row['case_ratio']) < max_case_ratio:
                res.append(corr_pair)
    return res