FAQ | This is a LIVE service | Changelog

Commit 7307335d authored by Dr Rich Wareham's avatar Dr Rich Wareham
Browse files

add static CamSIS college table [REVIEW]

parent 9024410e
......@@ -21,7 +21,7 @@ import sys
import docopt
from . import source
from . import source, camsis
from .settings import load_settings
from .upload import google_storage_upload
......@@ -98,9 +98,11 @@ def collect_institutions(connection):
continue
chris_data[row["inst"]] = chris_data.get(row["inst"], []) + [row["unitref"]]
# Pre-seed CAMSIS data from static table.
camsis_data = {inst: [dept] for dept, _, inst in camsis.STATIC_COLLEGES}
# Fetch CAMSIS data into dictionary keyed by Lookup instid.
LOG.info("Fetching CAMSIS institutions...")
camsis_data = {}
for row in source.fetch(connection, "SELECT dept, inst FROM camsis_data.dept_inst"):
if row["inst"] is None:
continue
......
# Static mapping providing:
#
# (CamSIS college code, CamSIS description, Lookup instid)
#
# Generated manually from: https://www.camsis.cam.ac.uk/files/student-codes/a01.html
STATIC_COLLEGES = [
("CAI", "Gonville and Caius College", "CAIUS"),
("CC", "Corpus Christi College", "CORPUS"),
("CHR", "Christ's College", "CHRISTS"),
("CHU", "Churchill College", "CHURCH"),
("CL", "Clare College", "CLARE"),
("CLH", "Clare Hall", "CLAREH"),
("CTH", "St Catharine's College", "CATH"),
("DAR", "Darwin College", "DARWIN"),
("DOW", "Downing College", "DOWN"),
("ED", "St Edmund's College", "EDMUND"),
("EM", "Emmanuel College", "EMM"),
("F", "Fitzwilliam College", "FITZ"),
("G", "Girton College", "GIRTON"),
("HH", "Hughes Hall", "HUGHES"),
("HO", "Homerton College", "HOM"),
("JE", "Jesus College", "JESUS"),
("JN", "St John's College", "JOHNS"),
("K", "King's College", "KINGS"),
("LC", "Lucy Cavendish College", "LCC"),
("M", "Magdalene College", "MAGD"),
("N", "Newnham College", "NEWN"),
("NH", "Murray Edwards College", "NEWH"),
("PEM", "Pembroke College", "PEMB"),
("PET", "Peterhouse", "PET"),
("Q", "Queens' College", "QUEENS"),
("R", "Robinson College", "ROBIN"),
("SE", "Selwyn College", "SEL"),
("SID", "Sidney Sussex College", "SID"),
("T", "Trinity College", "TRIN"),
("TH", "Trinity Hall", "TRINH"),
("W", "Wolfson College", "WOLFC"),
]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment