Created
March 30, 2012 07:11
-
-
Save joelverhagen/2248376 to your computer and use it in GitHub Desktop.
List of Various University of Cincinnati Codes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"BoK Codes": { | |
"Diversity & Culture": "DC", | |
"English Composition": "EC", | |
"Fine Arts": "FA", | |
"Historical Perspectives": "HP", | |
"Humanities": "HU", | |
"Literature": "LT", | |
"Natural Sciences": "NS", | |
"Quantitative Reasoning": "QR", | |
"Social & Ethical Issues": "SE", | |
"Social Sciences": "SS" | |
}, | |
"College Codes": { | |
"Blue Ash College": "28", | |
"Carl H. Lindner College Of Business": "22", | |
"Clermont College": "34", | |
"College Of Allied Health Sciences": "35", | |
"College Of Design, Architecture, Art And Planning": "23", | |
"College Of Education, Criminal Justice, And Human Services": "18", | |
"College Of Engineering & Applied Science": "20", | |
"College Of Medicine": "26", | |
"College Of Nursing": "29", | |
"College Of Pharmacy": "25", | |
"College-Conservatory Of Music": "16", | |
"Division Of Professional Practice": "36", | |
"Mcmicken College Of Arts And Sciences": "15" | |
}, | |
"Course Format Codes": { | |
"CD-ROM/DVD": "CD", | |
"Correspondence": "CO", | |
"Individual": "IN", | |
"Learning at Large": "LL", | |
"Satellite Conference": "SC", | |
"Television Broadcast": "TV", | |
"Video Conference": "VC", | |
"Videotape": "VT", | |
"World Wide Web Classes": "WB" | |
}, | |
"Discipline Codes": { | |
"Accounting": "ACCT", | |
"Accounting Technology": "ACTN", | |
"Addictions": "ADDC", | |
"Advanced Medical Imaging Technology": "AMIT", | |
"Advanced Nursing - Adult Health": "ANAH", | |
"Advanced Nursing - Community Health": "ANCH", | |
"Advanced Nursing - Nursing Administration": "ANNA", | |
"Advanced Nursing - Parent Child": "ANPC", | |
"Advanced Nursing - Psychiatric": "ANPS", | |
"Aerospace Engineering & Engineering Mechanics": "AEEM", | |
"Africana Studies": "AFST", | |
"Air Force ROTC": "AF", | |
"Allied Health": "ALH", | |
"American Sign Language": "ASL", | |
"Anthropology": "ANTH", | |
"Applied Interdisciplinary Studies": "AIS", | |
"Arabic Languages and Culture": "ARAB", | |
"Architectural Engineering": "AE", | |
"Architectural Technology": "ARTN", | |
"Architecture": "ARCH", | |
"Architecture and Interior Design": "SAID", | |
"Art Education": "ARTE", | |
"Art History": "ARTH", | |
"Arts Administration": "AADM", | |
"Asian Languages": "ASIA", | |
"Asian Studies": "AIST", | |
"Athletic Training": "ATH", | |
"Aviation Technology": "AVTN", | |
"Bassoon": "BSN", | |
"Biological Sciences": "BIOL", | |
"Biomedical Engineering": "BME", | |
"Biostatistics and Epidemiology": "BE", | |
"Blood Transfusion Medicine": "BTM", | |
"Building Trades Technology": "BLTN", | |
"Business Administration": "BA", | |
"Business Law": "BLAW", | |
"Cabinet and Furniture Making": "CBMK", | |
"Cell and Molecular Biology": "CB", | |
"Cellular Therapies": "CT", | |
"Chemical Engineering": "CHE", | |
"Chemical Technology": "CHTN", | |
"Chemical and Materials Engineering": "CME", | |
"Chemistry": "CHEM", | |
"Chinese Languages and Cultures": "CHIN", | |
"Civil Engineering": "CVE", | |
"Civil and Construction Engineering Technology": "CVTN", | |
"Clarinet": "CLAR", | |
"Classical Civilization": "CLAS", | |
"Classical Guitar": "GTAR", | |
"Clinical Laboratory Science": "CLSC", | |
"Clinical Research": "CLRS", | |
"Coaching": "COAC", | |
"Communication": "COMM", | |
"Communication Design": "CMDS", | |
"Communication Sciences and Disorders": "CSD", | |
"Computer Engineering Technology": "CET", | |
"Computer Information Systems": "CIS", | |
"Computer Information Systems: Multimedia": "CISM", | |
"Computer Science": "CS", | |
"Computer Systems Support": "CSST", | |
"Conducting": "COND", | |
"Construction Management": "CM", | |
"Cooperative Education": "COOP", | |
"Counseling": "CNSL", | |
"Criminal Justice": "CJ", | |
"Criminal Justice Technology": "CJTN", | |
"Culinary Arts": "CUL", | |
"Curriculum and Instruction": "CI", | |
"Dance": "DNCE", | |
"Dental Hygiene": "DHYG", | |
"Design": "DSGN", | |
"Design, Architecture, Art and Planning": "DAAP", | |
"Developmental Biology": "DB", | |
"Digital Design": "DGTL", | |
"Directing": "DRTG", | |
"Double Bass": "DBBS", | |
"Dramatic Performance": "DRPF", | |
"Early Childhood Education": "ECE", | |
"Economic Education": "ECED", | |
"Economics": "ECON", | |
"Educational Foundations": "EDFN", | |
"Educational Leadership": "EDLD", | |
"Educational Studies": "EDST", | |
"Electrical and Computer Engineering": "EECE", | |
"Electronic Media": "EMED", | |
"Electronic Media Technology": "EMDT", | |
"Electronic Technology": "ELTN", | |
"Emergency Medical Services": "EMS", | |
"Engineering": "ENGR", | |
"Engineering Education": "ENED", | |
"Engineering Fundamentals": "ENFD", | |
"Engineering Graduate Fundamentals": "EGFD", | |
"Engineering Graphics Technology": "EGTN", | |
"English": "ENGL", | |
"English - British Literature": "ENGB", | |
"English - Comparative Literature": "ENGC", | |
"English Horn": "ENHN", | |
"English as a Second Language": "ESL", | |
"Ensemble": "ENSM", | |
"Entrepreneurship/Family Business": "ENTR", | |
"Environmental Engineering": "ENVE", | |
"Environmental Health": "ENV", | |
"Environmental Studies": "EVST", | |
"Environmental and Industrial Hygiene": "EIH", | |
"Euphonium": "EUPH", | |
"European Studies": "EUST", | |
"Fashion Design": "FASH", | |
"Fashion Design Product Development": "FDPD", | |
"Finance": "FIN", | |
"Fine Arts - Art": "FAA", | |
"Fine Arts - Music": "FAM", | |
"Fine Arts - Studio": "FAST", | |
"Fire Science": "FST", | |
"Flute": "FLUT", | |
"Foundation Studies": "FDST", | |
"French": "FREN", | |
"French Horn": "HORN", | |
"Genetic Counseling": "GC", | |
"Geography": "GEOG", | |
"Geology": "GEOL", | |
"German": "GRMN", | |
"Graduate Medicine Interdepartmental": "GNTD", | |
"Graphic Design": "GRPH", | |
"Greek": "GRK", | |
"HVAC and Stationary Engineering": "HVAC", | |
"Harp": "HARP", | |
"Harpsichord": "HSC", | |
"Health Care Management": "HCMT", | |
"Health Education": "HPE", | |
"Health Sciences": "HLSC", | |
"Health, Fitness and Leisure Studies": "HFL", | |
"History": "HIST", | |
"Honors": "HNRS", | |
"Honors Plus": "HNPL", | |
"Horticulture": "HORT", | |
"Hospitality Management": "HM", | |
"Human Social Services Technology": "HSST", | |
"Immunobiology": "IMM", | |
"Industrial Design": "INDL", | |
"Industrial Design: Transportation": "IDTR", | |
"Information Systems": "IS", | |
"Information Technology": "IT", | |
"Interdisciplinary": "INTR", | |
"Interdisciplinary Health Education": "HLTH", | |
"Interior Design": "INTD", | |
"International Business": "INTB", | |
"Internship": "INT", | |
"Irish Languages": "IRSH", | |
"Italian": "ITAL", | |
"Japanese Languages and Cultures": "JAPN", | |
"Jazz Double Bass": "JZDB", | |
"Jazz Guitar": "JZGT", | |
"Jazz Percussion": "JZPR", | |
"Jazz Piano": "JZPA", | |
"Jazz Saxophone": "JZSX", | |
"Jazz Studies": "JZST", | |
"Jazz Trombone": "JZTB", | |
"Jazz Trumpet": "JZTP", | |
"Jazz Voice": "JZVO", | |
"Journalism": "JOUR", | |
"Judaic Studies": "JUDC", | |
"Latin": "LATN", | |
"Latin American Studies": "LAS", | |
"Literacy": "LTCY", | |
"Management": "MGMT", | |
"Manufacturing Engineering Technology": "MFTN", | |
"Manufacturing Engineering Trades Technology": "MFTT", | |
"Marketing": "MKTG", | |
"Materials Engineering": "MTEN", | |
"Materials Science": "MTSC", | |
"Mathematics": "MATH", | |
"Mechanical Engineering": "MECH", | |
"Mechanical Engineering Technologies": "MET", | |
"Medical Assisting": "MA", | |
"Medical Physics": "MP", | |
"Metallurgical Engineering": "METL", | |
"Middle Childhood Education": "MDL", | |
"Middle Eastern Studies": "MES", | |
"Military Science": "MS", | |
"Molecular & Cellular Physiology": "MCP", | |
"Molecular Gen, Biochem, Microbiol & Immunology": "MG", | |
"Molecular, Cellular and Biochemical Pharmacology": "MCBP", | |
"Multidisciplinary": "MLTI", | |
"Music Education": "MUED", | |
"Music History and Literature": "HILT", | |
"Music Theory and Composition": "MTHC", | |
"Musical Theater": "MUST", | |
"Neuroscience": "NS", | |
"Nuclear Engineering": "NUC", | |
"Nursing": "NURS", | |
"Nursing Technology": "NSTN", | |
"Nutrition Sciences": "NUTR", | |
"Oboe": "OBOE", | |
"Occupational Medicine": "OCCM", | |
"Occupational Safety and Ergonomics": "OSE", | |
"Office Administration Technology": "OATN", | |
"Opera": "OPRA", | |
"Operations Management": "OM", | |
"Organ": "ORGN", | |
"Organizational Leadership/Human Resources": "OLHR", | |
"Paralegal Studies": "PARA", | |
"Paramedic Education": "PRED", | |
"Pathobiology and Molecular Medicine": "PMM", | |
"Percussion": "PERC", | |
"Pharmaceutical Drug Development": "PHDD", | |
"Pharmacy-Administrative Science": "PADM", | |
"Pharmacy-Biological Science": "PBIO", | |
"Pharmacy-Interdisciplinary": "PHID", | |
"Pharmacy-Pharmaceutics": "PCEU", | |
"Pharmacy-Pharmacy Practice": "PHRX", | |
"Pharmacy-Professional Experience": "PHPE", | |
"Pharmacy-Therapeutics": "PHTH", | |
"Philosophy": "PHIL", | |
"Photography": "PHTG", | |
"Physical Therapist Assistant": "PTA", | |
"Physical Therapy": "PT", | |
"Physician Scientist Training Program": "PSTP", | |
"Physics": "PHYS", | |
"Piano": "PIAN", | |
"Planning": "PLAN", | |
"Political Science": "POL", | |
"Portuguese": "PORT", | |
"Professional Development": "PD", | |
"Professional Seminar": "PRFS", | |
"Psychology": "PSYC", | |
"Public Health": "PH", | |
"Quantitative Analysis": "QA", | |
"Radiation Science": "RDSC", | |
"Radiation Therapy Technology": "RDTH", | |
"Radiologic Technology": "RDTN", | |
"Reading": "READ", | |
"Real Estate": "RE", | |
"Respiratory Therapy": "RT", | |
"Russian": "RUSS", | |
"Saxophone": "SAX", | |
"School of World Languages and Cultures": "SWLC", | |
"Secondary Education": "SEC", | |
"Social Science": "SOSC", | |
"Social Work": "SW", | |
"Sociology": "SOC", | |
"Spanish": "SPAN", | |
"Special Education": "SPED", | |
"Sports Management": "SMGT", | |
"Statistics": "STAT", | |
"Substance Abuse Counseling": "SACN", | |
"Surgical Technician": "ST", | |
"Swahili": "SWAH", | |
"Theater Production": "THPR", | |
"Toxicology": "TOX", | |
"Trombone": "TRB", | |
"Trumpet": "TRP", | |
"Tuba": "TUBA", | |
"Urban Administration and Urban Studies": "URBN", | |
"Urban Educational Leadership": "UEL", | |
"Veterinary Technology": "VETN", | |
"Viola": "VLA", | |
"Violin": "VLN", | |
"Violoncello": "VC", | |
"Voice": "VOIC", | |
"Welding Technology": "WLTN", | |
"Women's Studies": "WMST", | |
"Women's, Gender and Sexuality Studies": "WGS" | |
}, | |
"Term Codes": { | |
"Spring 2011-2012": "12S", | |
"Summer 2011-2012": "12U" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Written for Python 3 interpreters | |
# Requires lxml (http://lxml.de/) for HTML parsing and requests (http://python-requests.org) for HTTP requests | |
import requests | |
import lxml.html | |
import re | |
import json | |
def getCodes(): | |
def getHtml(htmlText): | |
return lxml.html.fromstring(htmlText) | |
def getPairs(options): | |
return map(lambda option: (option.text.strip(), option.get("value")), options) | |
def prependCodes(pairs): | |
return map(lambda pair: (pair[1] + " - " + pair[0], pair[1]), pairs) | |
codePrefixRegex = re.compile(r"^[A-Za-z0-9]+ - ") | |
def removePrefix(value): | |
return codePrefixRegex.sub("", value) | |
def removePrefixes(pairs): | |
return map(lambda pair: (removePrefix(pair[0]), pair[1]), pairs) | |
codes = {} | |
# request for all of the unparsed code information | |
response = requests.get("https://webapps.uc.edu/onestop/learningopp/search.asp", headers = { | |
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.142 Safari/535.19" | |
}) | |
html = getHtml(response.text) | |
# for Term codes, College codes, and Discipline codes | |
script = html.xpath("//script")[0].text | |
scriptMatches = re.findall(r"function\s+write(Terms|College|Discipline)\(\)\s+\{\s+document\.write\((.+?)\);?\s+\}", script) | |
for title, text in scriptMatches: | |
# evaluate the JavaScript text and turn it into a HTML object | |
subHtml = getHtml(eval(text)); | |
# associate option values with option text | |
pairs = getPairs(subHtml.xpath("//option")) | |
if title == "Terms": | |
codes["Term Codes"] = list(pairs) | |
elif title == "College": | |
codes["College Codes"] = list(removePrefixes(map(lambda pair: (pair[0].title(), pair[1]), pairs))) | |
elif title == "Discipline": | |
codes["Discipline Codes"] = list(removePrefixes(pairs)) | |
if len(codes) != 3: | |
raise ScrapeException("3 code types were expected. Only " + str(len(codes)) + " were found. The codes that were found are " + formalJoin(codes.keys()) + ".", html.xpath("//script")[0].text) | |
# for BoK codes | |
options = html.xpath("//select[@name = 'bok']/option") | |
pairs = list(getPairs(options)) | |
codes["BoK Codes"] = list(removePrefixes(filter(lambda pair: pair[0] != "-Select All-", pairs))) | |
if len(pairs) - 1 != len(codes["BoK Codes"]): | |
raise ScrapeException('No "-Select All-" option was found in the BoK codes select box.', html.xpath("//select[@name = 'bok']")[0]) | |
# for Course Format codes | |
options = html.xpath("//select[@name = 'deliverymode']/option") | |
pairs = list(getPairs(options)) | |
codes["Course Format Codes"] = list(filter(lambda pair: pair[0] != "All Class Formats", pairs)) | |
if len(pairs) - 1 != len(codes["Course Format Codes"]): | |
raise ScrapeException('No "All Class Formats" option was found in the course format codes select box.', html.xpath("//select[@name = 'bok']")[0]) | |
# make sure that we can safely turn each into a dictionary | |
for codeType in codes: | |
keys = list(map(lambda pair: pair[0], codes[codeType])) | |
if len(set(keys)) != len(keys): | |
raise ScrapeException("There duplicate code entries in the code dictionary for the " + codeType + ".", html) | |
codes[codeType] = dict(codes[codeType]) | |
return codes | |
print(json.dumps(getCodes(), indent = 4, sort_keys = True)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment