script to take an Informer report of degree code totals & map them into our human-friendly major terms
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
#!/usr/bin/env python | |
# usage: | |
# sum-majors.py "LI - Library students per term.csv" > "YEAR majors total.csv" | |
import csv | |
import fileinput | |
import sys | |
majors = csv.DictReader(fileinput.input(mode='rb')) | |
# mapping of degree codes to majors will change over time | |
# as will the "totals" dict below listing our majors | |
map = { | |
'ANIMA.BFA': 'Animation', | |
'ARCHT.BARC': 'Architecture', | |
'CERAM.BFA': 'Ceramics', | |
'COMAR.BFA': 'Community Arts', | |
'COMIC.MFA': 'MFA Comics', | |
'CURPR.MA': 'MA Curatorial', | |
# commented out programs are non-degree, not counted here | |
# 'DD2ST': '', | |
'DESGN.MFA': 'MFA Design', | |
'DESST.MBA': 'MBA Design', | |
# 'DVCCP': '', | |
# 'DVCFA': '', | |
# 'DVCWR': '', | |
'FASHN.BFA': 'Fashion', | |
'FILMG.MFA': 'MFA Fine Arts', | |
'FILMS.BFA': 'Film/Media', | |
'FINAR.MFA': 'MFA Fine Arts', | |
'FRNTR.BFA': 'Wood/Furniture', | |
'GLASS.BFA': 'Glass', | |
'GRAPH.BFA': 'Graphic Design', | |
'GRAPH.MFA': 'MFA Design', | |
'ILLUS.BFA': 'Illustration', | |
'INACT.MFA': 'MFA Design', | |
'INDIV.BFA': 'Individualized', | |
'INDUS.BFA': 'Industrial Design', | |
'INDUS.MFA': 'MFA Design', | |
'INTER.BFA': 'Interior Design', | |
'IXDSN.BFA': 'Interaction Design', | |
'MAAD1.MAAD': 'MA Architecture', | |
'MARCH.MARC': 'MA Architecture', | |
'MARC2.MARC': 'MA Architecture', | |
'MARC3.MARC': 'MA Architecture', | |
'METAL.BFA': 'Jewelry/Metal Arts', | |
# 'NODEG.UG': '', | |
'PHOTO.BFA': 'Photography', | |
'PNTDR.BFA': 'Painting/Drawing', | |
'PRINT.BFA': 'Printmaking', | |
'SCULP.BFA': 'Sculpture', | |
'SFMBA.MBA': 'MBA Strategic Finance', | |
'TEXTL.BFA': 'Textiles', | |
'UNDEC.BFA': 'Undeclared', | |
'VISCR.MA': 'MA Visual Criticism', | |
'VISST.BA': 'Visual Studies', | |
'WRITE.MFA': 'MFA Writing', | |
'WRLIT.BA': 'Writing & Literature', | |
} | |
totals = { | |
# Design + Architecture divisions | |
'Architecture': 0, | |
'Fashion': 0, | |
'Graphic Design': 0, | |
'Illustration': 0, | |
'Industrial Design': 0, | |
'Interior Design': 0, | |
'Interaction Design': 0, | |
'Wood/Furniture': 0, | |
'MA Architecture': 0, | |
'MFA Design': 0, | |
'MBA Design': 0, | |
'MBA Strategic Finance': 0, | |
# Fine Arts division | |
'Animation': 0, | |
'Ceramics': 0, | |
'Community Arts': 0, | |
'Film/Media': 0, | |
'Glass': 0, | |
'Individualized': 0, | |
'Jewelry/Metal Arts': 0, | |
'Photography': 0, | |
'Painting/Drawing': 0, | |
'Printmaking': 0, | |
'Sculpture': 0, | |
'Textiles': 0, | |
'MFA Fine Arts': 0, | |
# Humanities & Sciences Division, also encompasses miscellany | |
'Undeclared': 0, | |
'Visual Studies': 0, | |
'Writing & Literature': 0, | |
'MFA Comics': 0, | |
'MA Curatorial': 0, | |
'MA Visual Criticism': 0, | |
'MFA Writing': 0, | |
} | |
for major in majors: | |
program = map.get(major['Active Programs']) | |
if program in totals: | |
totals[program] += int(major['Count']) | |
outcsv = csv.DictWriter(sys.stdout, ['Program', 'Students']) | |
outcsv.writeheader() | |
for total in sorted(totals): | |
outcsv.writerow({'Program': total, 'Students': totals[total]}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment