Code Monkey home page Code Monkey logo

minervaclient's Introduction

Minervac

The Minerva Client

minervac is a CLI client for Minerva's course registration facilities. Currently, the program can display your current course schedule, final exam schedule, or transcript, and register for courses by CRN or course code. Course schedules can be formatted with custom reports, conflicts are detected, and HTML timetables, as well as importable calendar files, can be produced. Previously registered courses are recorded and minervac will only attempt registration for the remaining courses on each run. The program is implemented in Python and currently is very hacky. Pull requests welcome. If you have ideas for features or have found a bug, please open an issue.

Registering for a course
More screenshots

Updates


  • You can now view your final exam schedule (mnvc sched -E)

  • You can now query your transcript (mnvc transcript)

  • A visual timetable feature has been implemented. (-V).
  • Calendar export is now available (vCalendar format only). (-C)

  • The command-line interface won't be modified anymore, only extended. Configuration format is still in flux.
  • Displaying course schedule information with custom reports.

See also

Goals

The goals of this project are to create a simple and high-quality interface for the most-used features of Minerva. The user interface will be designed in accordance with UNIX priciples, thus, minervac will be easily programmable. Additionally, minervac will clearly explain how it is connecting to Minerva and provide a starting point for other projects that attempt to use the Minerva "API". This project is free and open-source.

Installation

  1. minervac uses the requests, beautifulsoup4, and html5lib modules for Python.
    • The easiest way to install them is probably with pip: sudo pip install requests beautifulsoup4 html5lib
  2. Copy credentials.py to credentials_local.py and fill in your credentials.
  3. Edit config.py to setup various settings

Usage

It's way simpler than actually using Minerva!

  • Registration: mnvc reg
    • To register for a set of courses: mnvc reg -t FALL2016 COMP-251-001 MATH-240-001
    • To register by CRN (faster): minervac reg -t 2016-FALL 814 30302 30
    • To save previously-registered courses and only register for what remains: mnvc reg -j compstuff -t 2016-FALL COMP-273-002 COMP-396-001
    • NOTE: An option to search without logging in is provided. However, only waitlist information can be determined in this way, and its quality may be poor.
  • Scheduling: mnvc sched
    • To display your schedule: mnvc sched -t WINTER2017
    • To display more details (-l), or less (-s): mnvc sched -lt SUMMER-2017 or minervac sched -st 2016WINTER-SUP
    • To use a custom report (edit config.py): mnvc sched -t WINTER2017 -r magicreport
    • To export your timetable to a HTML file: minervac sched -t 2016SUMMER -V > ~/summer-schedule.html
      • Edit config.py to change the way courses are formatted and sched_timetable.css to adjust the styling.
      • Hint: Click on a building name to get directions. Hover over courses to see an explanation of the color code.
    • To export your course schedule to an iCalendar file: mnvc sched -Ct 2017-WINTER > mcgill-winter-2017.ics
      • You can also export your final exam schedule, like this: mnvc sched -ECt FALL2016 > mcgill-fall-2016-finals.ics.
      • The resulting file can be imported into your favorite calendar application (Google Calendar, and the Mac OS X Calendar work.)
      • This format may also be called ICS or vCalendar.
    • To display your final exam schedule: mnvc sched -t FALL2016 -E
  • Transcripts: mnvc transcript
    • To display your transcript: mnvc transcript
    • The term argument is optional, and more than one term can be specified: minervac transcript -t FALL2016,2017-SUMMER
    • Reports (-r) and the long (-l) and short (-s) shortcuts can be used. (See Scheduling above.)
    • To display only your program information (-S) and GPA (-C): mnvc transcript -SC
    • To display some miscellaneous transcript information as well (-P): mnvc transcript -P
  • For a full description of available options: mnvc -h
  • A few useful extra scripts are included in the extras/ folder:
    • Note: These tools are more experimental than mnvc itself and might not work so well.
    • grablrs.py: Downloads LRS lecture recordings.
    • transcript-monitor.sh: Allows you to monitor your unofficial transcript for new grades.

Scheduling registration

  • Put it in your crontab. This way, the minervac will automatically be run at the time interval you choose, and you will receive an email indicating the status of your course registration job.
    • If you don't have cron, you may need to write a long-running loop or use your OS' job scheduling facility. Oh, and by the way, your OS sucks.
  • An example crontab line: 00 * * * * minervac -dj compstuff -t 2016FALL 814 20620 33 .
  • Some ideas:
    • Set the MAILTO option to your email address, or pipe the output to mail.
    • You can receive this information as a SMS text message. Look up the email-to-SMS gateway for your cellular carrier. For example, [email protected]

Further development

  • Displaying degree evaluation reports.
  • Won't implement: While it would be trivial to support dropping courses, I am worried that this may mess up people's schedules as Minerva does not perform truly atomic transactions. Furthermore, it may mess up my own schedule and so I don't want to test it. If you're braver than I am, please send me a pull request.
  • Support output formatters and more control over what this program prints.
  • Allow querying for courses from the CLI, and use a SQL database to allow for fancy queries.
  • Integrate my course selection satisfiability solver to recommend what you can register for.

WARNING

  1. You are solely responsible for deciding if minervac is compliant with McGill's policies, and if you want to assume this risk.

  2. minervac might mess up your course schedule in a very bad sort of way.

  3. The final exam data might be unpleasantly wrong, as it is generated from a messed uppretty high-quality PDF. Progress at McGill!

  4. minervac might suddenly stop working if Minerva is changed.

  5. Minerva is a horrible, horrible system and trying to extend this program may lead to a horrible headache.

  6. This program was badly written, in a rush, and might have some serious design flaws.

  7. May give CS hipsters a headache.

Applicability outside McGill

Minerva is a Banner installation (Release 8.7, to be precise), so you may be able to adapt the program to work for your university or college. Try to edit minerva_common.py with the correct URL to your student information system. A quick way to check if you've got Banner is to Google for "bwckgens" and your institution's name.

Screenshots

minervaclient's People

Contributors

jiahao-c avatar npaun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

auryan898 yona-w

minervaclient's Issues

Add a query feature for public course datasets

Problem:

  • You'd like to be able to look up COMP 362 without having to look at the course schedule, bwckgens, and all kinds of online stuff.
  • SQL syntax might actually be less painful than McGill's query interface.
  • You'd like a quick dump of all COMP courses offered this year (or next year too).
  • Somebody posted a course averages dataset online, and you'd like to make use of it.

Solution

  • Minervaclient could load bwckgens.csv into a SQLite database, and implement a few simple requests (by course, by department), and then let you use SQL to query the rest.
  • We could integrate the course averages dataset, and figure out how to manually scrape through the calendar to find pre-reqs, etc.

Add Simplyvoting integration

Problem:

  • You like to vote in SSMU elections and referendums but can't be arsed to log in and do it.

Solution:

  • Maybe you could use Minervac to submit your votes. Scriptable voting?

Generate a better course timetable

  • This would be implemented from the current data.
  • The format would probably be HTML, with tables and a non-headache-inducing stylesheet.

Export exam schedules to ICS

Problem:

  • Viewing your final exam schedule with the Minerva Client is so much better than the old way, but now you want more.
  • You'd like to import your exam schedule into a calendaring program, so you can plan things in advance, and get good grades for once.

Solution:

  • The Minerva client should allow you to export your course schedule to ICS.
  • This would work by combining -C and -E (mnvc sched -CEt FALL2016 > exams.ics).

Implementation

  • The ICS generating code is actually really minimal, so it is better to just write a new module sched_exam_ics that generates one-time, 3-h events for each exam.
  • (Multi-day exams just get another event shoved in on the second day.)

Monitor transcripts for changes

Processing Transcripts

  • I like to know when new grades are available.
  • Sometimes profs change the grades retroactively, and this is also useful to know.
  • Unfortunately, this is a totally new parser to write.
  • But, no more fucking POST requests.

Monitoring for changes

  • Write the transcript to a file, diff it against the previous one.
  • If it's the same, throw it out.
  • If it's different, tell the user.

Display course conflicts in visual schedule mode

Problem:

  • While registering, you often end up with course conflicts.
  • You like to use mnvc's visual schedule to see your course calendar, but it just silently ignores conflicts.

Solution

  • Modify the visual schedule code to correctly show conflicts.
    • This is hard and annoying.

Workaround

  • Import your schedule into a calendar program using the ICS export feature and analyze your conflicts there. You can also model potential solutions there too.
  • Use a command-line, text mode report. Conflicts are indicated there.
  • Log into Minerva and use its clunky conflict detection thing. It does work, I think.

Search for empty classrooms

Problem:

  • You need a space to study, and all of McGill's study space sucks.
  • You'd like to just grab some random classroom, but you don't know which will be empty.

Solution:

  • The Minerva client could have a static dataset of scheduled courses (generated from the dynamic schedule), and allow you to query it for which classrooms are empty now.
  • The set of all classrooms shall be defined as the set of classrooms which have at least 1 course in them, and the set of empty classrooms shall be the set of classrooms which don't have a class in them at a certain time.

Potential Issues:

  • Classes can move around, rooms can be booked, etc.
  • The door might be locked.
  • McGill probably tries to keep utilization as high as possible. Not sure how many empty rooms could be found.

Allow relevant output formats for the various reports

Output Formats

Display Formats
Schedule, Exams Text, JSON, CSV ....HTML w/ JS...... SQL
Visual Schedule HTML, PDF via HTML, PNG via HTML
Calendar ICS, JSON
Messages, Registration Status Text, JSON
Course Search Results JSON

Problem:

  • You'd like to turn your visual schedule into a nice PDF, or into a nice image.
  • You'd like to parse the output of the Minerva client so that it can be controlled by an algorithm of your own invention -- some kind of AI? if you can't get into one course try for another?
  • You'd like to import Minervac reports into some kind of spreadsheet software, or do some kind of data analysis with the output.

Solution:

  • Minervac should implement the -f option, and allow you to select from the valid formats for each kind of display/report.
  • The JSON format will just select the columns specified by the report, and ignore sort and format. SQL should do the same thing.
  • The CSV format will select the columns, sort as directed and format the columns, replacing tabs and spaces with commas.

Implementation

  • CSV, JSON, SQL, etc: As described above.
  • PDF: Use weasyprint? PNG pdf2png?
  • HTML Table: Dump to HTML table, inject some JS and CSS that can allow for filtering and reordering.
  • Error messages/Status messages: Change the raw text dump into some kind of struct, which can be output formatted.
  • Course search: Just expose pub_search and auth_search.

Add LRS integration

Problem:

  • You'd like to be notified when new LRS course recordings are available. Possibly mirror them too.
  • You'd like to be able to download LRS recordings for a certain day, using a less painful UI.
  • Some LRS courses are public (in one of lrs.mcgill.ca, cool.mcgill.ca, bcooltv.mcgill.ca), some are listed only in myCourses

Solution:

  • Minervac could find the right LRS course ID from your myCourses, or use a mapping of public IDs.
  • It could then show a report from the feed, generate the right download link and send email messages.

Implementation

  • Once the correct mapping is found, a RSS feed is generated.
  • RSS can be properly parsed, and a small report could be made.
  • URLs could be computed by searching the RSS according to simple criteria. 'Last Friday', etc.

Add myCourses integration

Problem:

  • Now that all of Minerva's information is at your fingertips, you'd like to know what assignments you have and when they're due. Maybe even upload them straight from the CLI.
  • You'd also like to see your grades, so that you no longer have to experience the agony of getting an email that says "A1 updated", and then spend ages clicking through to see the grade.
  • Assignment feedback is sprawled-out over multiple places -- maybe you could merge them.
  • Sometimes people change your grades, and you'd like to know when that happens.
  • There's some kind of myCourses calendar that seems some use. Maybe assignment due + myCourses calendar could be combined.

Solution:

  • The Minerva Client could add a myCourses subcommand that logs you in via Shibboleth (without the rest of the bible story happening), parses the unholy markup of myCourses, and lets you use the reports functionality.
  • If integrated with the diff-set feature, you can get live updates.
  • Submit forms in myCourses to hand in your assignments.

Implementation

  • A whole new world: requests, requests, beautifulsoup, dicts, parse, dicts, output.
  • Might have to deal with JS, unfortunately.
  • More details to come.

Add support for final exam schedules

Problem:

  • Finding the exam schedule requires googling and clicking around, and once you find it, you probably won't bookmark it.
  • Final exam schedules are stored in a clunky PDF, but you might not save it.
  • To find your exams, you need to use CTRL+F. Once you've found your exams, you generally won't write down the info, forcing you to do this all over again.

Solution:

  • The Minerva Client can show you your final exams so that you can quickly look at them.

Implementation

  • Get the user's current courses from the transcript.
    • Also record the user's last name for finding the exam room.
  • The exam dataset is not machine-readable, so generate a JSON via a semi-automatic process and use it for the Minerva Client.
  • Correlate the two to produce an exam report.
  • Correlate building codes with a source of human-readable building names.

Exams Dataset

  • Tabula can accurately split the data into rows.
  • It often munges fields together strangely, so normalize the number of tabs, convert fields that got spaced together with tabs, and also detect fields that have gotten concatenated together for some reason.
  • Manual correction is needed when exams span multiple days, the exam entry spans multiple rows, the prof's name is too long, or something got weirldly mangled.
  • Parse up this data using a script, and sanitize all the fields.
  • Export to JSON.
  • Do this all over again next semester.

Add library integration

Problem:

  • Everything is so convenient now, but the library's full catalog is a disaster.
  • You've gotten fined for a late course reserve item, but the reminder notification was late too.
  • Although there are no overdue fines, maybe it's best to keep renewing stuff?

Solution:

  • Add a module that can parse the library catalog, and send alerts about items coming due, generate an account report, auto-renew items, and maybe integrated with some kind of notification API.

Implementation

  • Process the unholy library markup.

Minerva opt-out integration

Problem:

  • You are a committed free-rider, and are also lazy. Opting out of stuff takes too many clicks.
  • You'd like a list of everything you can opt-out of, and then you could just mark each one.
  • Then, you'd like to automatically opt-out of everything you selected.

Solution:

  • The Minerva client can read off opt-outable fees, and fill out each and every goddamn form to do it.

Create an integrated course schedule/exam/transcript mode

Problem:

  • Minervac can display a lot of different information in a lot of different formats. But one very common use case is to take a quick look at currently relevant information.
  • During the start of the semester you want to know where things are, near the end you want to know about your exam, and after the exam you want to know how well you did.
  • It might also make sense for you to look at last semester (transcript) and next semester (course schedule).
  • You might want to show an entire academic year too, or just use the current term.

Solution:

  • Minervac should guess your term by default, by figuring out where you are in relation to the Summer,Winter,Fall terms.
  • It should allow relative references ('next winter','winter','next', etc.)
  • When asked to generate an integrated report, the Minerva client should show the last one of (course schedule, exam schedule, transcript grades)
  • Multiple terms separated by commas should just re-call the report generator, as well as single references that expand to multiple terms.
  • An integrated reports format should be designed that can properly align data from each report to a certain extent.

Implementation.

  • To be determined.

Log out of Minerva when finished

Currently, minervac doesn't log out. Logging out might stop Minerva from complaining about break-in attempts when you try to use the web interface.

Make jobs feature check whether the user is actually enrolled in the course

Issue:

Currently, mnvc provides a jobs feature, to allow for batch registration. Only courses remaining to be registered will be attempted on each iteration.

mnvc considers all 'registrable courses' to have been registered if no 'registration errors' occurred.

If a registration error, at the quick add/drop stage, only affects some courses, the entire batch will be considered a failure.

Using the require registrable courses option (-R), will prevent Minervac from attempting to register in courses when the process clearly won't succeed.

Even if this option is passed, Minerva could supply contradictory information leading to a quick add/drop error, causing the whole batch to fail.

Solution:

Minervac should check which courses have actually been registered for.

It could do this efficiently, by parsing the results of the quick add/drop request. This would however require parsing more Minerva GOOPML.

Another option would be to request a schedule and verify that the courses contained in it are what we expected. This would be more inefficient, but could reuse existing parsers. Perhaps it could be argued that this option is "safer" as it checks that everything seems normal about the user's registration in the course.

Improvements to minervaclient?

I wanted to suggest some improvements, such as:

  • A search subcommand to just find course information without needing a login
  • Publish minervaclient to Pypi for pip installation
  • Remove the necessity for a credentials_local.py
  • Convert your mix of tabs and spaces to just spaces

But as I went looking for these issues I kind of did them in my fork, assuming that you had set this project aside. This is the part where I say sorry that I took the name minervaclient from pip and uploaded my fork to it!

I was afraid to make a pull request too, because I made sooo many drastic changes to the code I didn't think you'd accept it. I still plan on making my own set of improvements, do you care for any kind of attribution? Should I stop? Love your work btw! It's the nicest 3rd party library I've seen so far that acesses Minerva services, and it actually works compared to the others!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.