import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from functools import lru_cache
from datetime import datetime

EVENT_MAP = {'vault': 'VT', 'bars': 'UB', 'beam': 'BB', 'floor': 'FX', 'all_around': 'AA'}
EVENTS = ['VT', 'UB', 'BB', 'FX']
ROSTER_COLS = ['Gymnast ID', 'Name', 'Team']
SCHEDULE_COLS = ['Team ID', 'Team', 'Team Meet ID', 'Meet Date', 'Home/Away', 'Opponents', 'Meet Name', 'Meet ID']
RESULTS_COLS = ['Score'] + EVENTS
IND_RESULTS_COLS = ['Gymnast ID', 'Name'] + EVENTS + ['AA']


def validate_input(teams):
    if isinstance(teams, str):
        teams = [teams]
    elif not isinstance(teams, list):
        raise TypeError('teams must be a string or a list')

    return teams


@lru_cache(maxsize=1000000)
def get_data_from_api(endpoint, suffix):
    session = requests.Session()
    retry = Retry(connect=3, backoff_factor=0.5)
    adapter = HTTPAdapter(max_retries=retry)
    session.mount('http://', adapter)
    session.mount('https://', adapter)

    url = 'https://www.roadtonationals.com/api/women/' + endpoint
    if suffix:
        url += '/' + suffix

    return session.get(url)


def fix_opponents(ops):
    if not isinstance(ops, str):
        return ops

    ops = (ops.replace(', ', '/').replace(',','/').replace(' and ', '/').replace(' @ ', '/').replace(' w/ ', '/').replace(' with ', '/'))

    if 'william & mary' in ops.lower():
        # Todo: title case is going to mess with other opponents here, full mapping might fix that
        ops = ops.title().replace('William & Mary', 'William&Mary').replace(' & ', '/').replace('William&Mary', 'William & Mary')
    else:
        ops = ops.replace(' & ', '/')

    if ops[:3] == 'at ':
        ops = ops[3:]
    if '(' in ops and ops[-1] == ')':
        ops = ops.split('(')[0].strip()

    ops = '/'.join([OP_MAP.get(op.strip(), OP_MAP.get(op.lower(), op)) for op in ops.split('/')])
    return ops


def normalize_date(dt, dt_format='%a, %b-%d-%Y'):
    return datetime.strptime(dt, dt_format)


def merge_dicts(dict1, dict2, merge_field):
    for i in range(len(dict1)):
        # they're likely in the same order
        try:
            if dict1[i][merge_field] == dict2[i][merge_field]:
                dict1[i].update(dict2[i])
                continue
        except IndexError:
            pass

        # if not in the same order, search through the list to find the one with the same date
        for j in range(len(dict2)):
            if dict1[i][merge_field] == dict2[j][merge_field]:
                dict1[i].update(dict2[j])
                break


def get_extra_cols(include_hometowns, include_class, include_events):
    extra_cols = []
    if include_hometowns:
        extra_cols.append('Hometown')
    if include_class:
        extra_cols.append('School Year')
    if include_events:
        extra_cols.append('Events')

    return extra_cols


OP_MAP = {
    "AIR FORCE ACADEMY": "Air Force",
    "AFA": "Air Force",
    "air force academy": "Air Force",
    "Air Force Academy": "Air Force",
    "AIR FORCE": "Air Force",
    "afa": "Air Force",
    "Air Force": "Air Force",
    "Afa": "Air Force",
    "air force": "Air Force",
    "alabama": "Alabama",
    "Alabama": "Alabama",
    "ALABAMA": "Alabama",
    "uaa": "Alaska",
    "Uaa": "Alaska",
    "ALASKA": "Alaska",
    "Alaska": "Alaska",
    "UAA": "Alaska",
    "alaska": "Alaska",
    "arizona": "Arizona",
    "ARIZONA": "Arizona",
    "Arizona": "Arizona",
    "asu": "Arizona State",
    "Asu": "Arizona State",
    "arizona state": "Arizona State",
    "Arizona State": "Arizona State",
    "ASU": "Arizona State",
    "ARIZONA STATE": "Arizona State",
    "ARKANSAS": "Arkansas",
    "Arkansas": "Arkansas",
    "arkansas": "Arkansas",
    "AUBURN": "Auburn",
    "Auburn": "Auburn",
    "auburn": "Auburn",
    "BRIGHAM YOUNG": "BYU",
    "Brigham Young": "BYU",
    "BYU": "BYU",
    "brigham young": "BYU",
    "byu": "BYU",
    "Byu": "BYU",
    "BALL STATE": "Ball State",
    "ball state": "Ball State",
    "BALL STATE UNIVERSITY": "Ball State",
    "ball state university": "Ball State",
    "Ball State": "Ball State",
    "Ball State University": "Ball State",
    "boise": "Boise State",
    "boise state": "Boise State",
    "BOISE": "Boise State",
    "BOISE STATE": "Boise State",
    "Boise": "Boise State",
    "Boise State": "Boise State",
    "Bgsu": "Bowling Green",
    "bgsu": "Bowling Green",
    "Bowling Green": "Bowling Green",
    "BGSU": "Bowling Green",
    "bowling green": "Bowling Green",
    "BOWLING GREEN": "Bowling Green",
    "bowling green state": "Bowling Green",
    "Bowling Green State": "Bowling Green",
    "BOWLING GREEN STATE": "Bowling Green",
    "BRIDGEPORT": "Bridgeport",
    "bridgeport": "Bridgeport",
    "Bridgeport": "Bridgeport",
    "Brockport": "Brockport",
    "brockport": "Brockport",
    "BROCKPORT": "Brockport",
    "BROWN": "Brown",
    "Brown": "Brown",
    "brown": "Brown",
    "cal state fullerton": "Cal State Fullerton",
    "CS Fullerton": "Cal State Fullerton",
    "CSUF": "Cal State Fullerton",
    "Cal State-Fullerton": "Cal State Fullerton",
    "CAL STATE-FULLERTON": "Cal State Fullerton",
    "Csuf": "Cal State Fullerton",
    "Fullerton": "Cal State Fullerton",
    "csuf": "Cal State Fullerton",
    "fullerton": "Cal State Fullerton",
    "cs fullerton": "Cal State Fullerton",
    "cal state-fullerton": "Cal State Fullerton",
    "Cs Fullerton": "Cal State Fullerton",
    "Cal State Fullerton": "Cal State Fullerton",
    "FULLERTON": "Cal State Fullerton",
    "CS FULLERTON": "Cal State Fullerton",
    "CAL STATE FULLERTON": "Cal State Fullerton",
    "Cal Berkley": "California",
    "CALIFORNIA": "California",
    "California": "California",
    "cal": "California",
    "UC Berkely": "California",
    "california": "California",
    "UC BERKELY": "California",
    "cal berkley": "California",
    "Cal": "California",
    "CAL": "California",
    "uc berkely": "California",
    "Uc Berkely": "California",
    "CAL BERKLEY": "California",
    "Centenary College": "Centenary",
    "CENTENARY COLLEGE": "Centenary",
    "centenary": "Centenary",
    "centenary college": "Centenary",
    "CENTENARY": "Centenary",
    "Centenary": "Centenary",
    "CMU": "Central Michigan",
    "cmu": "Central Michigan",
    "Central Michigan": "Central Michigan",
    "Cmu": "Central Michigan",
    "central michigan": "Central Michigan",
    "CENTRAL MICHIGAN": "Central Michigan",
    "Cornell": "Cornell",
    "cornell": "Cornell",
    "CORNELL": "Cornell",
    "CORTLAND": "Cortland",
    "cortland": "Cortland",
    "cortland state": "Cortland",
    "CORTLAND STATE": "Cortland",
    "Cortland State": "Cortland",
    "Cortland": "Cortland",
    "denver": "Denver",
    "Denver": "Denver",
    "DENVER": "Denver",
    "E. MICHIGAN UNIV": "Eastern Michigan",
    "e. michigan univ": "Eastern Michigan",
    "Eastern Michigan": "Eastern Michigan",
    "emu": "Eastern Michigan",
    "EMU": "Eastern Michigan",
    "EASTERN MICHIGAN": "Eastern Michigan",
    "eastern michigan": "Eastern Michigan",
    "Emu": "Eastern Michigan",
    "E. Michigan Univ": "Eastern Michigan",
    "FISK": "Fisk",
    "Fisk": "Fisk",
    "fisk": "Fisk",
    "FLORIDA": "Florida",
    "florida": "Florida",
    "Florida": "Florida",
    "George Washington": "George Washington",
    "GEORGE WASHINGTON UNIVERSITY": "George Washington",
    "Gwu": "George Washington",
    "george washington university": "George Washington",
    "george washington": "George Washington",
    "gwu": "George Washington",
    "George Washington University": "George Washington",
    "GEORGE WASHINGTON": "George Washington",
    "GWU": "George Washington",
    "Georgia": "Georgia",
    "GEORGIA": "Georgia",
    "georgia": "Georgia",
    "GREENVILLE": "Greenville",
    "Greenville": "Greenville",
    "greenville": "Greenville",
    "Gustavus Adolphus": "Gustavus Adolphus",
    "gustavus adolphus": "Gustavus Adolphus",
    "GUSTAVUS ADOLPHUS": "Gustavus Adolphus",
    "Hamline": "Hamline",
    "HAMLINE": "Hamline",
    "hamline": "Hamline",
    "ILLINOIS": "Illinois",
    "illinois": "Illinois",
    "university of illinois": "Illinois",
    "UNIVERSITY OF ILLINOIS": "Illinois",
    "Univ Of Ill": "Illinois",
    "University of Illinois": "Illinois",
    "Illinois": "Illinois",
    "University Of Illinois": "Illinois",
    "UNIV OF ILL": "Illinois",
    "univ of ill": "Illinois",
    "illinois state": "Illinois State",
    "ILLINOIS STATE": "Illinois State",
    "Illinois State": "Illinois State",
    "Indiana": "Indiana",
    "indiana": "Indiana",
    "INDIANA": "Indiana",
    "University Of Iowa": "Iowa",
    "iowa": "Iowa",
    "University of Iowa": "Iowa",
    "Iowa": "Iowa",
    "university of iowa": "Iowa",
    "UNIVERSITY OF IOWA": "Iowa",
    "IOWA": "Iowa",
    "iowa state": "Iowa State",
    "IOWA STATE": "Iowa State",
    "Iowa State": "Iowa State",
    "Ithaca College": "Ithaca College",
    "ITHACA COLLEGE": "Ithaca College",
    "ithaca college": "Ithaca College",
    "James Madison Univ": "James Madison",
    "james madison university": "James Madison",
    "james madison univ": "James Madison",
    "JAMES MADISON UNIV": "James Madison",
    "james madison u": "James Madison",
    "JMU": "James Madison",
    "James Madison": "James Madison",
    "jmu": "James Madison",
    "JAMES MADISON": "James Madison",
    "JAMES MADISON U": "James Madison",
    "Jmu": "James Madison",
    "james madison": "James Madison",
    "James Madison University": "James Madison",
    "JAMES MADISON UNIVERSITY": "James Madison",
    "James Madison U": "James Madison",
    "Kent State": "Kent State",
    "Kent": "Kent State",
    "kent": "Kent State",
    "KENT STATE": "Kent State",
    "KENT": "Kent State",
    "kent state": "Kent State",
    "Uk": "Kentucky",
    "kentucky": "Kentucky",
    "uk": "Kentucky",
    "UK": "Kentucky",
    "Kentucky": "Kentucky",
    "KENTUCKY": "Kentucky",
    "Liu": "LIU",
    "LIU": "LIU",
    "liu": "LIU",
    "lsu": "LSU",
    "LSU": "LSU",
    "Lsu": "LSU",
    "LINDENWOOD": "Lindenwood",
    "Lindenwood": "Lindenwood",
    "lindenwood": "Lindenwood",
    "Maryland": "Maryland",
    "MARYLAND": "Maryland",
    "maryland": "Maryland",
    "U Massachusetts": "Massachusetts",
    "Massachusetts": "Massachusetts",
    "massachusetts": "Massachusetts",
    "U MASSACHUSETTS": "Massachusetts",
    "umass": "Massachusetts",
    "Umass": "Massachusetts",
    "u massachusetts": "Massachusetts",
    "UMASS": "Massachusetts",
    "MASSACHUSETTS": "Massachusetts",
    "UMass": "Massachusetts",
    "MICHIGAN": "Michigan",
    "Michigan": "Michigan",
    "michigan": "Michigan",
    "MICHIGAN STATE": "Michigan State",
    "mich st": "Michigan State",
    "Michigan State": "Michigan State",
    "MICH ST": "Michigan State",
    "Mich St": "Michigan State",
    "msu": "Michigan State",
    "michigan state": "Michigan State",
    "MSU": "Michigan State",
    "Msu": "Michigan State",
    "Minnesota": "Minnesota",
    "MINNESOTA": "Minnesota",
    "minnesota": "Minnesota",
    "MISSOURI": "Missouri",
    "Missouri": "Missouri",
    "missouri": "Missouri",
    "nc state": "N.C. State",
    "NC STATE": "N.C. State",
    "North Carolina State": "N.C. State",
    "NC State University": "N.C. State",
    "north carolina state": "N.C. State",
    "NORTH CAROLINA STATE": "N.C. State",
    "Nc State University": "N.C. State",
    "nc state university": "N.C. State",
    "n.c. state": "N.C. State",
    "N.C. STATE": "N.C. State",
    "Nc State": "N.C. State",
    "NC STATE UNIVERSITY": "N.C. State",
    "NC State": "N.C. State",
    "N.C. State": "N.C. State",
    "Nebraska": "Nebraska",
    "nebraska": "Nebraska",
    "NEBRASKA": "Nebraska",
    "NEW HAMPSHIRE": "New Hampshire",
    "unh": "New Hampshire",
    "UNH": "New Hampshire",
    "new hampshire": "New Hampshire",
    "Unh": "New Hampshire",
    "New Hampshire": "New Hampshire",
    "new mexico": "New Mexico",
    "New Mexico": "New Mexico",
    "NEW MEXICO": "New Mexico",
    "north carolina": "North Carolina",
    "University of North Carolina": "North Carolina",
    "UNIVERSITY OF NORTH CAROLINA": "North Carolina",
    "Unc": "North Carolina",
    "North Carolina": "North Carolina",
    "UNC": "North Carolina",
    "University Of North Carolina": "North Carolina",
    "university of north carolina": "North Carolina",
    "NORTH CAROLINA": "North Carolina",
    "unc": "North Carolina",
    "N Illinois Univ": "Northern Illinois",
    "NORTHERN ILLINOIS UNIVERSITY": "Northern Illinois",
    "N ILLINOIS UNIV": "Northern Illinois",
    "northern illinois": "Northern Illinois",
    "NIU": "Northern Illinois",
    "NORTHERN ILLINOIS": "Northern Illinois",
    "Niu": "Northern Illinois",
    "northern illinois university": "Northern Illinois",
    "Northern Illinois University": "Northern Illinois",
    "Northern Illinois": "Northern Illinois",
    "niu": "Northern Illinois",
    "n illinois univ": "Northern Illinois",
    "ohio state": "Ohio State",
    "Ohio State": "Ohio State",
    "OHIO STATE": "Ohio State",
    "oklahoma": "Oklahoma",
    "Oklahoma": "Oklahoma",
    "OKLAHOMA": "Oklahoma",
    "OREGON STATE": "Oregon State",
    "oregon state": "Oregon State",
    "OSU": "Oregon State",
    "Osu": "Oregon State",
    "osu": "Oregon State",
    "Oregon State": "Oregon State",
    "upenn": "Penn",
    "Penn": "Penn",
    "PENN": "Penn",
    "Pennsylvania": "Penn",
    "penn": "Penn",
    "pennsylvania": "Penn",
    "PENNSYLVANIA": "Penn",
    "UPenn": "Penn",
    "UPENN": "Penn",
    "Upenn": "Penn",
    "psu": "Penn State",
    "Psu": "Penn State",
    "penn state": "Penn State",
    "Penn St": "Penn State",
    "PENN ST": "Penn State",
    "penn st": "Penn State",
    "PENN STATE": "Penn State",
    "Penn State": "Penn State",
    "PSU": "Penn State",
    "PITT": "Pittsburgh",
    "University Of Pittsburgh": "Pittsburgh",
    "University of Pittsburgh": "Pittsburgh",
    "UNIVERSITY OF PITTSBURGH": "Pittsburgh",
    "pittsburgh": "Pittsburgh",
    "Pittsburgh": "Pittsburgh",
    "Pitt": "Pittsburgh",
    "university of pittsburgh": "Pittsburgh",
    "PITTSBURGH": "Pittsburgh",
    "pitt": "Pittsburgh",
    "radford": "Radford",
    "Radford": "Radford",
    "RADFORD": "Radford",
    "Rhode Island College": "Rhode Island College",
    "Ric": "Rhode Island College",
    "rhode island college": "Rhode Island College",
    "ric": "Rhode Island College",
    "RHODE ISLAND COLLEGE": "Rhode Island College",
    "RIC": "Rhode Island College",
    "RUTGERS UNIVERSITY": "Rutgers",
    "RUTGERS": "Rutgers",
    "Rutgers University": "Rutgers",
    "rutgers": "Rutgers",
    "rutgers university": "Rutgers",
    "Rutgers": "Rutgers",
    "SEMO": "SEMO",
    "S.E. Missouri": "SEMO",
    "S.E. MISSOURI": "SEMO",
    "Semo": "SEMO",
    "Se Missouri St.": "SEMO",
    "Southeast Missouri": "SEMO",
    "southeast missouri": "SEMO",
    "Se Missouri St": "SEMO",
    "SE Missouri St.": "SEMO",
    "southeast missouri state": "SEMO",
    "se missouri st": "SEMO",
    "SE MISSOURI ST.": "SEMO",
    "SOUTHEAST MISSOURI": "SEMO",
    "se missouri st.": "SEMO",
    "SEMO State": "SEMO",
    "s.e. missouri": "SEMO",
    "SEMO STATE": "SEMO",
    "semo state": "SEMO",
    "SOUTHEAST MISSOURI STATE": "SEMO",
    "Southeast Missouri State": "SEMO",
    "SE MISSOURI ST": "SEMO",
    "SE Missouri ST": "SEMO",
    "semo": "SEMO",
    "Semo State": "SEMO",
    "SAC STATE": "Sacramento State",
    "Sacramento State": "Sacramento State",
    "sac state": "Sacramento State",
    "Sac St": "Sacramento State",
    "Sac State": "Sacramento State",
    "SACRAMENTO STATE": "Sacramento State",
    "sac st": "Sacramento State",
    "SAC ST": "Sacramento State",
    "csus": "Sacramento State",
    "CSUS": "Sacramento State",
    "sacramento state": "Sacramento State",
    "Csus": "Sacramento State",
    "san jose": "San Jose State",
    "SAN JOSE STATE": "San Jose State",
    "San Jose State": "San Jose State",
    "San Jose": "San Jose State",
    "SAN JOSE": "San Jose State",
    "san jose state": "San Jose State",
    "seattle pacific": "Seattle Pacific",
    "spu": "Seattle Pacific",
    "Spu": "Seattle Pacific",
    "Seattle Pacific": "Seattle Pacific",
    "SPU": "Seattle Pacific",
    "SEATTLE PACIFIC": "Seattle Pacific",
    "simpson": "Simpson",
    "SIMPSON": "Simpson",
    "Simpson": "Simpson",
    "SCSU": "Southern Connecticut",
    "Southern CT": "Southern Connecticut",
    "SOUTHERN CONN UNIVERSITY": "Southern Connecticut",
    "southern conn university": "Southern Connecticut",
    "scsu": "Southern Connecticut",
    "Scsu": "Southern Connecticut",
    "SOUTHERN CT": "Southern Connecticut",
    "Southern Conn University": "Southern Connecticut",
    "Southern Ct": "Southern Connecticut",
    "southern ct": "Southern Connecticut",
    "SOUTHERN CONNECTICUT": "Southern Connecticut",
    "Southern Conn.": "Southern Connecticut",
    "Southern Connecticut": "Southern Connecticut",
    "southern conn.": "Southern Connecticut",
    "southern connecticut": "Southern Connecticut",
    "SOUTHERN CONN.": "Southern Connecticut",
    "southern illinois university": "Southern Illinois University",
    "Siu": "Southern Illinois University",
    "siu": "Southern Illinois University",
    "SIU": "Southern Illinois University",
    "Southern Illinois University": "Southern Illinois University",
    "SOUTHERN ILLINOIS UNIVERSITY": "Southern Illinois University",
    "Southern Utah": "Southern Utah",
    "S UTAH": "Southern Utah",
    "s utah": "Southern Utah",
    "so utah": "Southern Utah",
    "SO UTAH": "Southern Utah",
    "Suu": "Southern Utah",
    "SOUTHERN UTAH": "Southern Utah",
    "southern utah": "Southern Utah",
    "SOUTHERN UTAH UNIV.": "Southern Utah",
    "SUU": "Southern Utah",
    "suu": "Southern Utah",
    "So Utah": "Southern Utah",
    "Southern Utah Univ.": "Southern Utah",
    "S Utah": "Southern Utah",
    "southern utah univ.": "Southern Utah",
    "springfield": "Springfield",
    "SPRINGFIELD": "Springfield",
    "Springfield": "Springfield",
    "springfield college": "Springfield",
    "Springfield College": "Springfield",
    "SPRINGFIELD COLLEGE": "Springfield",
    "stanford": "Stanford",
    "STANFORD": "Stanford",
    "Stanford": "Stanford",
    "temple": "Temple",
    "TEMPLE": "Temple",
    "Temple": "Temple",
    "Tx Woman'S Univ.": "Texas Woman's",
    "TX WOMAN'S": "Texas Woman's",
    "TX Woman's Univ.": "Texas Woman's",
    "TWU": "Texas Woman's",
    "texas woman's univ": "Texas Woman's",
    "TX. WOMAN'S UNIV.": "Texas Woman's",
    "Texas Woman'S": "Texas Woman's",
    "TEXAS WOMAN'S UNIV": "Texas Woman's",
    "tx woman's": "Texas Woman's",
    "Texas Woman'S Univ": "Texas Woman's",
    "TEXAS WOMAN'S": "Texas Woman's",
    "Texas Women's": "Texas Woman's",
    "tx woman's univ.": "Texas Woman's",
    "texas woman's": "Texas Woman's",
    "Texas Women'S": "Texas Woman's",
    "TX WOMAN'S UNIV.": "Texas Woman's",
    "TX. Woman's Univ.": "Texas Woman's",
    "Texas Woman's": "Texas Woman's",
    "Tx Woman'S": "Texas Woman's",
    "texas women's": "Texas Woman's",
    "Tx. Woman'S Univ.": "Texas Woman's",
    "TX Woman's": "Texas Woman's",
    "twu": "Texas Woman's",
    "Twu": "Texas Woman's",
    "tx. woman's univ.": "Texas Woman's",
    "TEXAS WOMEN'S": "Texas Woman's",
    "Towson University": "Towson",
    "TOWSON STATE": "Towson",
    "Towson": "Towson",
    "TOWSON UNIVERSITY": "Towson",
    "towson university": "Towson",
    "Towson State": "Towson",
    "TOWSON": "Towson",
    "towson state": "Towson",
    "towson": "Towson",
    "Davis": "UC Davis",
    "UC Davis": "UC Davis",
    "UC DAVIS": "UC Davis",
    "uc davis": "UC Davis",
    "davis": "UC Davis",
    "DAVIS": "UC Davis",
    "Uc Davis": "UC Davis",
    "ucsb": "UC-Santa Barbara",
    "Uc-Santa Barbara": "UC-Santa Barbara",
    "uc-santa barbara": "UC-Santa Barbara",
    "UC SANTA BARBARA": "UC-Santa Barbara",
    "UC-SANTA BARBARA": "UC-Santa Barbara",
    "Ucsb": "UC-Santa Barbara",
    "UC Santa Barbara": "UC-Santa Barbara",
    "UC-Santa Barbara": "UC-Santa Barbara",
    "uc santa barbara": "UC-Santa Barbara",
    "Uc Santa Barbara": "UC-Santa Barbara",
    "UCSB": "UC-Santa Barbara",
    "ucla": "UCLA",
    "UCLA": "UCLA",
    "la": "UCLA",
    "La": "UCLA",
    "LA": "UCLA",
    "Ucla": "UCLA",
    "illinois-chicago": "UIC",
    "Illinios-Chicago": "UIC",
    "uic": "UIC",
    "Illinois-Chicago": "UIC",
    "Uic": "UIC",
    "illinios-chicago": "UIC",
    "UIC": "UIC",
    "ILLINOIS-CHICAGO": "UIC",
    "ILLINIOS-CHICAGO": "UIC",
    "univ. of rhode island": "URI",
    "UNIVERSITY OF RHODE ISLAND": "URI",
    "URI": "URI",
    "uri": "URI",
    "Univof Rhode Island": "URI",
    "UNIVOF RHODE ISLAND": "URI",
    "univof rhode island": "URI",
    "University of Rhode Island": "URI",
    "UNIV. OF RHODE ISLAND": "URI",
    "University Of Rhode Island": "URI",
    "university of rhode island": "URI",
    "Uri": "URI",
    "Univ. Of Rhode Island": "URI",
    "Univ. of Rhode Island": "URI",
    "UW-EAU CLAIRE": "UW-Eau Claire",
    "Uw-Eau Claire": "UW-Eau Claire",
    "uw-eau claire": "UW-Eau Claire",
    "UW-Eau Claire": "UW-Eau Claire",
    "uw-la crosse": "UW-La Crosse",
    "wisconsin-lacrosse": "UW-La Crosse",
    "UW-LA CROSSE": "UW-La Crosse",
    "Uw-La Crosse": "UW-La Crosse",
    "UW-La Crosse": "UW-La Crosse",
    "WISCONSIN-LACROSSE": "UW-La Crosse",
    "Wisconsin-Lacrosse": "UW-La Crosse",
    "Uw-Oshkosh": "UW-Oshkosh",
    "uw-oshkosh": "UW-Oshkosh",
    "UW-Oshkosh": "UW-Oshkosh",
    "OSHKOSH": "UW-Oshkosh",
    "UW-OSHKOSH": "UW-Oshkosh",
    "oshkosh": "UW-Oshkosh",
    "Oshkosh": "UW-Oshkosh",
    "Uw-Stout": "UW-Stout",
    "UW-STOUT": "UW-Stout",
    "UW-Stout": "UW-Stout",
    "uw-stout": "UW-Stout",
    "UW-WHITEWATER": "UW-Whitewater",
    "Uw-Whitewater": "UW-Whitewater",
    "UW-Whitewater": "UW-Whitewater",
    "uw-whitewater": "UW-Whitewater",
    "URSINUS COLLEGE": "Ursinus",
    "ursinus college": "Ursinus",
    "URSINUS": "Ursinus",
    "Ursinus": "Ursinus",
    "ursinus": "Ursinus",
    "Ursinus College": "Ursinus",
    "utah": "Utah",
    "UTAH": "Utah",
    "Utah": "Utah",
    "utah state": "Utah State",
    "UTAH STATE": "Utah State",
    "Utah State": "Utah State",
    "University Of Vermont": "Vermont",
    "vermont": "Vermont",
    "Vermont": "Vermont",
    "university of vermont": "Vermont",
    "VERMONT": "Vermont",
    "UNIVERSITY OF VERMONT": "Vermont",
    "University of Vermont": "Vermont",
    "Washington": "Washington",
    "washington": "Washington",
    "WASHINGTON": "Washington",
    "WEST CHESTER": "West Chester",
    "west chester": "West Chester",
    "West Chester": "West Chester",
    "West Virginia Univ.": "West Virginia",
    "West Virginia": "West Virginia",
    "WEST VIRGINIA": "West Virginia",
    "WVU": "West Virginia",
    "west virginia": "West Virginia",
    "WEST VIRGINIA UNIV.": "West Virginia",
    "west virginia univ.": "West Virginia",
    "wvu": "West Virginia",
    "Wvu": "West Virginia",
    "Western Mich": "Western Michigan",
    "Western Michigan": "Western Michigan",
    "western michigan": "Western Michigan",
    "western mich": "Western Michigan",
    "WESTERN MICHIGAN": "Western Michigan",
    "WESTERN MICH": "Western Michigan",
    "WILLIAM & MARY": "William & Mary",
    "William & Mary": "William & Mary",
    "COLLEGE OF WILLIAM & MARY": "William & Mary",
    "College Of William & Mary": "William & Mary",
    "william & mary": "William & Mary",
    "college of william & mary": "William & Mary",
    "WILSON": "Wilson",
    "Wilson": "Wilson",
    "wilson": "Wilson",
    "WILSON COLLEGE": "Wilson",
    "Wilson College": "Wilson",
    "wilson college": "Wilson",
    "WINONA STATE": "Winona State",
    "Winona State": "Winona State",
    "winona state": "Winona State",
    "Yale": "Yale",
    "yale": "Yale",
    "YALE": "Yale"
}