uw.local.teaching.db package¶
Submodules¶
uw.local.teaching.db.aids module¶
Examination aids editing objects.
Classes for editing the permitted aids for an examination. This exists because formerly there was another editor for editing the default permitted aids for an admin unit. The implementation here shared code between the two editors. If it were re-implemented from scratch all of this would live in webui/aids_edit.py.
uw.local.teaching.db.classlist module¶
Classlist database access.
Code to run a query to generate a classlist data file.
-
exception
uw.local.teaching.db.classlist.
BadColumnsError
(allowed_columns, bad_columns)[source]¶ Bases:
ValueError
uw.local.teaching.db.crowdmark module¶
Crowdmark-specific routines for printing examinations.
Routines for generating the API request to Crowdmark and handling the responses.
-
uw.local.teaching.db.crowdmark.
crowdmark_process_pdf
(cursor, exam_id)[source]¶ Pre-process the raw Crowdmark QR codes PDF for the specified examination.
- Parameters
cursor – DB cursor.
exam_id – The exam_id of the examination to process.
Obtain the raw QR codes PDF from exam_exam_crowdmark.crowdmark_qrcodes_pdf_raw, process it through the standard pre-processing, and store the result in exam_exam_crowdmark.crowdmark_qrcodes_pdf.
At present there is no pre-processing - the saved version of the PDF is identical to the raw version.
-
uw.local.teaching.db.crowdmark.
crowdmark_save_raw_pdf
(cursor, pdf_url, exam_id)[source]¶ Download and save QR codes PDF.
- Parameters
cursor – DB cursor.
pdf_url – The URL from which to download the PDF.
exam_id – The exam_id of the examination to process.
Download the QR codes PDF from the specified URL and save it, then call
crowdmark_process_pdf()
to embed fonts and saved the embedded version.The following is the original code but on our server urllib2 doesn’t work with the server so we are using curl instead:
request = urllib2.Request (pdf_url) request.add_header (“Accept-Encoding”, ‘gzip’) response = urllib2.urlopen (request) status = response.getcode () result = response.read ()
- if response.info ().get (‘Content-Encoding’) == ‘gzip’:
result = gzip.GzipFile (fileobj=StringIO (result)).read ()
uw.local.teaching.db.cursor module¶
Cursor class for Instructional Support.
Inherits from the usual cursor class with added methods for commonly-needed queries.
-
class
uw.local.teaching.db.cursor.
Cursor
(connection, cursor)[source]¶ Bases:
uw.local.dbtools.Cursor
-
admin_by_id
(**parameters)¶
-
admin_get_active_roles
(**parameters)¶
-
admin_get_permissions
(**parameters)¶
-
admin_info_by_id
(**parameters)¶
-
admins_by_term
(**parameters)¶
-
building_by_code
(**parameters)¶
-
buildings
(**parameters)¶
-
check_eval_rating
(**parameters)¶
-
create_exams_by_admin_id
(**parameters)¶
-
divisions_by_offering
(**parameters)¶
-
eva_basis
(**parameters)¶
-
eva_details
(**parameters)¶
-
eval_approved
(**parameters)¶
-
exam_aids
(**parameters)¶
-
exam_by_id
(**parameters)¶
-
exam_candidate_details_ordered
(**parameters)¶
-
exam_default_sequence_choices
(**parameters)¶
-
exam_exam_sitting_by_id
(**parameters)¶
-
exam_master_by_exam
(**parameters)¶
-
exam_master_select
= 'select * from exam_exam_master_plus natural left join exam_master_type natural left join exam_master_size'¶
-
exam_master_types_by_exam
(**parameters)¶
-
exam_masters_by_exam
(**parameters)¶
-
exam_print_deadline
(**parameters)¶
-
exam_series
(**parameters)¶
-
exam_series_by_code
(**parameters)¶
-
exam_sitting_by_id
(**parameters)¶
-
exam_sitting_room_by_id
(**parameters)¶
-
exam_special_candidate_details_ordered
(**parameters)¶
-
exams_by_admin_id
(**parameters)¶
-
exams_by_candidate
(**parameters)¶
-
exams_by_sitting
(**parameters)¶
-
exams_by_sitting_room
(**parameters)¶
-
get_course_id
(**parameters)¶
-
get_meet_times_and_dates
(**parameters)¶
-
get_section_id
(**parameters)¶
-
offering_by_id
(**parameters)¶
-
offering_exam_by_id
(**parameters)¶
-
offering_get_permissions
(**parameters)¶
-
offering_select
= 'select distinct term_id, admin_id, admin_description from auth_offering_personnel_complete natural join teaching_admin where %s order by term_id desc, admin_description'¶
-
offering_sitting_by_id
(**parameters)¶
-
offering_uploader_choices
(**parameters)¶
-
offerings_by_person
(**parameters)¶
-
offerings_by_person_recent
(**parameters)¶
-
offerings_by_person_term
(**parameters)¶
-
order_by_exam
(**parameters)¶
-
personnel_by_admin
(**parameters)¶
-
personnel_by_offering
(**parameters)¶
-
print_by_id
(**parameters)¶
-
room_by_code
(**parameters)¶
-
room_by_id
(**parameters)¶
-
room_select
= 'select *, exam_room_capacity (room_id, exam_assign_build_loading_standard (%(allow_tablet_seats)s, %(allow_single_seating)s, case when %(checkerboard)s then 0 else -1 end)) as room_capacity from room_room_plus where '¶
-
room_sitting_seats
(**parameters)¶
-
rooms_by_building
(**parameters)¶
-
rooms_by_exam_sitting
(**parameters)¶
-
rooms_by_sitting
(**parameters)¶
-
rooms_inactive_sorted
(**parameters)¶
-
rooms_select
(**parameters)¶
-
rooms_sorted
(**parameters)¶
-
sections_by_offering
(**parameters)¶
-
sitting_by_id
(**parameters)¶
-
sitting_exam_by_id
(**parameters)¶
-
sitting_room_by_id
(**parameters)¶
-
sittings_by_exam
(**parameters)¶
-
sittings_by_offering
(**parameters)¶
-
unit_get_permissions
(**parameters)¶
-
update_eval_history
(**parameters)¶
-
update_exam_auth
(**parameters)¶
-
update_taeval
(**parameters)¶
-
user_get_global_permissions
(**parameters)¶
-
uw.local.teaching.db.cyon module¶
Cyon interface implementation.
-
class
uw.local.teaching.db.cyon.
UWExamsUEFFile
(cursor, term, timestamp=None)[source]¶ Bases:
uw.scientia.uef.UEFFile
-
property
administrators
¶
-
property
all_weeks
¶
-
property
candidates
¶
-
property
cursor
¶
-
property
data
¶
-
property
exam_condition
¶ Condition for finding all examinations to be scheduled.
Unused at present because we are including all examinations and even courses with no examination.
-
property
exams
¶
-
property
exams_enddate
¶
-
property
exams_startdate
¶
-
property
locations
¶
-
property
map_admins
¶
-
property
setup
¶
-
property
term
¶
-
property
term_condition
¶ Condition for finding everything relevant to this scheduling session.
-
property
timeslot_duration
¶
-
property
uw.local.teaching.db.exam_import_rooms module¶
Process to import examination rooms.
Defines a parser for the examination room upload file produced by the RO, and a procedure to process the room updates.
-
uw.local.teaching.db.exam_import_rooms.
process_exam_rooms_upload
(cursor, term, rows)[source]¶ Process RO data lines.
- Parameters
cursor – DB connection cursor.
term – Object representing a UW term.
rows (list) – The update requests parsed from the input file.
Each row is a namedtuple consisting of (exam_id, rooms) produced by parsing the RO data file. Each row should correspond to a single examination, which will have its rooms udated accordingly.
uw.local.teaching.db.exam_import_times module¶
Process to import examination times.
Defines a parser for the examination time upload file generated by Cyon, and a procedure to process the time and duration updates.
-
uw.local.teaching.db.exam_import_times.
process_exam_times_upload
(cursor, term, rows)[source]¶ Process Cyon output lines.
- Parameters
cursor – DB connection cursor.
term – Object representing a UW term.
rows (list) – The update requests parsed from the input file.
Each row is a namedtuple consisting of (exam_id, exam_date, exam_time, duration) produced by parsing the Cyon output file. Each row should correspond to a single examination, which will have its start time and duration updated accordingly.
uw.local.teaching.db.exam_print module¶
Automatic creation of print jobs for examinations.
Routines for creating print requisitions for individual examinations and entire Registrar’s Office print periods.
-
uw.local.teaching.db.exam_print.
append_file
(files, java_dir, filename)[source]¶ Append contents of a file to the specified list of files.
Parameters:
files – list of files to which to append file contents; java_dir – directory in which to find file; filename – filename within java_dir.
This routine reads the contents of [java_dir]/[filename] and appends a tuple of (filename, contents) to the provided list. This is a utility routine for use by submit_exam_print_job.
-
uw.local.teaching.db.exam_print.
find_paper_colour
(documents)[source]¶ Format a brief description of the pages required for the given masters.
- Parameters
documents – A database row with information about a master type.
- Returns
A brief English description of the number of pages in the masters, together with duplexing and page size information if it differs between the masters.
This routine describes the paper required to print the masters in the event the specific fields on the print requisition are insufficient to describe the situation.
-
uw.local.teaching.db.exam_print.
format_duplex
(duplex)[source]¶ Format a duplex choice for use in English text.
The parameter is a boolean value, False for simplex or True for duplex. The result is either ‘simplex’ or ‘duplex’ as appropriate, or ‘unknown’ for None.
-
uw.local.teaching.db.exam_print.
format_pages
(master, include_duplex, include_size)[source]¶ Format a brief description of the pages required for the given master.
The “master” parameter is a row of exam_exam_master containing at least the fields master_pages_gross, and size_code.
The output is a brief English description of the number of pages in the master, and optionally the duplexing and paper size.
-
uw.local.teaching.db.exam_print.
format_ro_time
(t, pm=False)[source]¶ Format examination time as required for RO print requisitions.
Parameters:
t – time (datetime.time); pm – append “PM” to end of times after noon.
Formats the given time in the format traditionally used for examinations printed by the Registrar’s Office.
-
uw.local.teaching.db.exam_print.
format_ro_times
(start, duration)[source]¶ Format examination times as required for RO print requisitions.
Parameters:
start – start time of examination (datetime.datetime); duration – duration of examination (datetime.timedelta).
This formats the examination date and start and end times in the way that has traditionally been used to label boxes of examinations printed by the Registrar’s Office.
-
uw.local.teaching.db.exam_print.
format_size
(size_code)[source]¶ Format a paper size code for use in English text.
The parameter is a size code as used in the field exam_master_size.size_code.
TODO: Possibly should just use exam_master_size.size_description.
-
uw.local.teaching.db.exam_print.
message_to_course_staff
(cursor, message, term_id, admin_id, role_codes, recipient_type='To')[source]¶
-
uw.local.teaching.db.exam_print.
submit_exam_print_job
(cursor, exam)[source]¶ Submit a print job for the specified examination.
- Parameters
cursor – DB cursor.
exam – examination to print (exam_exam row).
Invokes the Java prepareExamPrintJob class to create the output files for the given examination, then creates a print job within the Print application to print the papers.
If the examination is RO-administered, a blank account number is used, the contact person is hardcoded to an RO staff member, no delivery information is provided, the box-labelling and OPD/Relief pulls are included in the instructions, and a copy of each Answers master PDF is included for the emergency duplication file folder.
TODO: Should do more checking of status (nobody unseated, etc.)
-
uw.local.teaching.db.exam_print.
submit_period_print_jobs
(cursor, period)[source]¶ Submit print jobs for all appropriate examinations in a print period.
- Parameters
cursor – DB cursor.
period – Administered examination deadline (exam_print_deadline row).
Creates print jobs for all eligible examinations in the specified print period that are ready to print. Also prints an indication on stdout of what it did for each examination, and uses Outgoing to email the Registrar’s Office a list of all examinations accepted.
uw.local.teaching.db.markbox module¶
Markbox-specific routines for printing examinations.
Routines for generating the API request to Markbox and handling the responses.
-
uw.local.teaching.db.markbox.
markbox_process_pdf
(cursor, exam_id)[source]¶ Embed fonts in the Markbox PDF for the specified examination.
- Parameters
cursor – DB cursor.
exam_id – The exam_id of the examination to process.
Obtain the raw PDF from markbox_exam.markbox_answer_page_pdf_raw, process it through the standard font embedding process, and store the result in markbox_exam.markbox_answer_page_pdf.
uw.local.teaching.db.pdf module¶
PDF processing.
This module implements additional PDF processing routines.
Module contents¶
Database interface for Instructional Support.
Modules which implement the database interface for Instructional Support.