Giter VIP home page Giter VIP logo

mymicds-v2's Introduction

MyMICDS-v2

MyMICDS.net for all of your MyMICDS.needs

Setup

Dependencies

To start development on MyMICDS-v2, first run npm install in the main project directory. This will install all the runtime dependencies (including TypeScript) as well as TypeDoc, TSLint, and all the other development dependencies.

Configuration

A local config file is required on every machine you develop on. This stores sensitive information such as database credentials and API keys. Copy src/libs/config.example.ts into a new file called config.ts with the proper information filled out as described in the example. This file is included in .gitignore, so you don't have to worry about accidentally committing the credentials.

Usage

To start the server for development, run npm start. In a production environment, run npm run prod.

Tasks Server

To start the tasks server, run npm run tasks.

For Development

If you would like the server to restart on file changes, install nodemon and simply run nodemon in the project root.

Documentation

Run npm run docs to build documentation. TypeDoc will generate documentation based on comments and type structures and dump it into the /docs/ folder. This creates static HTML files, so you'll have to open them manually in your browser.

Testing

Run npm test to do a compilation check on all source files and run the API tests. Similar to src/libs/config.ts, the tests require a test/config.ts that needs to be filled out.

Note: When adding new routes to the API, contributors should always add a corresponding test, unless there are factors (performance, authentication, etc) that would make it unreasonable to run the test quickly on a CI server.

Other Repositories

The Angular front-end for MyMICDS.

The official TypeScript client for connecting to MyMICDS. Automatically handles API requests using RxJS.

A Wear OS watch face featuring MyMICDS integration.

Contact

Wanna become a developer on the MyMICDS.net team? Shoot us an email at [email protected]! We accept anyone and everyone, so don't be shy!

For any other questions, comments, concerns, or suggestions, you can also contact [email protected].

mymicds-v2's People

Contributors

aldonovan avatar dependabot[bot] avatar grantbaum avatar iprodigy avatar michaelgira23 avatar nickbclifford avatar rpsforza avatar sbaumohl avatar stlgolfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mymicds-v2's Issues

MyMICDS Themes

Increase the personalization of MyMICDS by allowing people to set different themes. This would change the CSS of the whole website. Possibly allow users to upload their own CSS sheets to make their own custom theme, similar to how Reddit allows people to customize the CSS of a subreddit?

To prevent XSS, we would need to use a filter. Building off the Reddit example, this is the source for Reddit's CSS filter.

MyMICDS Notes

Automatically create OneNote Notebooks that are shared with all the students in each class. This will require multiple steps:

  1. Mechanism for organizing people by Portal class. The goal of this is to group people who will be in the exact same room, at the exact same time, with the exact same teacher.
  2. Use the OneNote API to automatically create a Notebook. This is automatically placed in OneDrive.
  3. Use the OneDrive API to share the Notebooks with each students in the class.

Create Quizlet Classes and Automatically add Students into their Respective Group

For my grade, we have an 'MICDS Class of 2019' Quizlet class which allows us to share Quizlet sets we've made with each other. Asking some freshman, they said their grade does not have an MICDS Class of 2020 Quizlet, so maybe we could use the Quizlet API to automagically create classes and organize students into their respective grade's group? This could streamline the process of doing it manually and help people collaborate.

Convert to ES6 syntax

As of right now, a majority of the back-end is written entirely in ES5 syntax. While there's nothing inherently bad about this, there are some things that can be expressed much more concisely in ES6, namely arrow functions (e => e.something vs function(e) { return e.something; }) and for..of loops (for(let e of arr) vs for(var i = 0; i < arr.length; i++) { var e = arr[i]; }). Lucky for us, Node has natively supported ES6 for a while now, so there's no reason not to switch.

Cache Day Rotation Portal Feed as well

Right now, we query the day rotation feed every page visit. We should cache this like the other Portal/Canvas feeds so minimize latency and requests to portal.

Start using Mongo aggregations

As seen in ff605a4, using aggregations instead of many consecutive database queries is much better for performance. There are some functions related to classes and planner events (according to @michaelgira23) that could benefit from this.

Sick Day Support

A student could indicate on the website that they will be missing certain classes that day. After each class, a few random users from the missing student's class will be prompted with a little form to give a summary of what happened in class. This would require us to group people by the same class similar to MyMICDS Notes. It would play well with MyMICDS Notes so the sick person could also access notes that day.

Fix "Block X +" prefix when not really wanted

So, the schedule works by retrieving the user's portal calendar, then adding our own classes to add stuff like lunch and free periods. If the user has a free period in the block which determines your lunch period, then we have to do something special.

Since neither lunch nor free periods show up on the portal feed, there's no way to exactly determine if the user has first or second lunch. In this case, we should display "Block X + Lunch" so we at least acknowledge the presence of that block.

The schedule works by getting the user's grade, then looking up the generic block schedule for the user's grade. It then fetches the portal feed (which contains only core classes + advisory stuff) and overlays it on-top of the generic block schedule. The generic block schedule spans both first and second lunch, so the user's portal class should ideally overlap the first half if they have second lunch, and the second half if they have first lunch. We detect if this big lunch period in the generic schedule has been overlapped. If not, then we append "Block X +" to the lunch period because that implies the user has a free period, which is not included in the portal feed.

Apparently, somewhere it's detecting the lunch period not being overlapped even when it is, and recursively appending that "Block X +" during certain days. I think the unnecessary block prefixing is caused by users who legitimately have the prefix, but doesn't get erased so it shows up for everyone and doesn't get erased (until we restart the back-end server).

Optimize schedule algorithm for teachers

It looks like some teachers are actually using the site regularly after the Assembly presentation of October 27th. We should show them some love and add collab meetings and stuff to the default schedule.

Custom Module System

In the homepage, allow the user to configure grid and the modules the way they want to. Create a drag and drop interface to customize the modules, create an interface to easily add modules into the system, and add more modules to the system.

For storing modules in the database, it would also be nice if each module could also store user-specific settings or data. (Metric or imperial for weather, what format to display date, etc.)

Add notification before free period ends/lunch ends/any class ends, or before another class starts

This is really an extension of #58 that we've been talking about for a while. Want to take a nap during free period? Or just want eat your lunch in piece without look at the clock every 5-10 minutes? Configure MyMICDS to give you a notification at a specified time. This could be configured either before a class ends or before a class starts. This should be able to be set for everyone lunch, every free period, every class, or every individual class.

Where #58 is more specific is by detecting if the user is outside campus and using an API to determine how long it would take to drive back to school and compensating for that time too.

This would probably require #42 to be completed too.

Add notification warning when lunch ends

Before lunch ends, give a notification to the user. For seniors or those able to leave campus to get lunch, use something like the Waze API to determine how long it will take to drive back to school. This should be configured by the user.

Get Sports data error

When running latest angular frontend on dev branch and backend server on master branch, sports js raises this error whenever a request for scores has been made:

Unable to select database
^

SyntaxError: Unexpected token U in JSON at position 0
    at Object.parse (native)
    at Request._callback (D:\Github\MyMICDS-v2\src\libs\sports.js:40:15)
    at Request.self.callback (D:\Github\MyMICDS-v2\node_modules\request\request.js:186:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request.<anonymous> (D:\Github\MyMICDS-v2\node_modules\request\request.js:1081:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage.<anonymous> (D:\Github\MyMICDS-v2\node_modules\request\request.js:1001:12)
    at IncomingMessage.g (events.js:291:16)

Fix lunch period of default block schedule when Portal feed unavailable

When the portal feed is unavailable, we fall back to using the generic block schedule, and substitute any custom classes the user has inserted in their Settings page. Because classes also have a "type" field, we are able to determine if a user has first lunch or second; however, the current algorithm does not reflect this and instead shows one bug lunch that takes up both lunch slots, and completely ignores the the class that goes before/after.

We should have the algorithm use the specified block type to determine if the user as first or second lunch. If no classes are specified and the type is unknown, default to saying "Block X + Lunch"

Enhance Registration Page

The registration page could be a bit more engaging and streamline the entire setup from registration to integrating Portal/Canvas feeds and adding aliases. Right now, the URL inputs are a bit hidden in the settings page, so it could be cool if we could walk the user through setting everything up.

I think it would be great to have something like Slack does. (Here's an example. I'm talking about the steps from confirming email to inviting users) Basically, have a full-page slideshow type thing. Have form inputs in the middle of the page with text to walk you though inserting data. Obviously, the user should be able to skip any of these additional steps besides basic account registration if they don't currently have time. We could give a little alert on the home page with a link to said walk-through page if the user hasn't already inserted their URLs or aliases yet.

MyMICDS Blog/News

Besides a place to post our own announcements about the site, we could create a platform that allows students to more openly share news with the community. This is mainly referring to something like a digital (and more frequent) version of the school newspaper.

Weather retrieval

Weather retrieval fails occasionally and i haven't looked into why

Parse the Daily Bulletin for an Assortment of Features!

The Daily Bulletin is an email that the entire Upper School receives every day before school. The bulletin is a PDF contains the day's schedule, news from around the school, the lunch, birthdays, and more. On MyMICDS, we query my email and automatically download the Daily Bulletin to put on MyMICDS. While this is useful for people who don't organize their email or don't want to log into their email, it is possible for us to leverage this even more.

It is possible to parse and extract information from the PDF which opens up so many possibilities. Here are a few:

Possibilities

Special Days

You know why there are so many people who where blazers after formal dress day? Because that's their punishment for forgetting. On the header/title of the bulletin, it will usually say whether or not it's formal dress. We can then have an email notification system remind people when it's formal dress the next day. The bulletin also has other holidays besides formal dress.

Parse Announcements

We can get the announcements from the bulletin and add an announcement module in our upcoming modules system. By extracting the text ourselves, we can style the text and integrate it smoothly into our interface and add our own announcements.

Field Trips / Early Dismissal

We could also separate the field trips and early dismissals from the regular announcements. Bonus points if we can highlight which ones are relevant to the user.

Parse Birthdays

Wish our fellow students (and teachers) a happy birthday. Preferably also change their background to this gif I made a long time ago in v1 for Alexander's birthday. However, this works as well.

Lunch

Lunch isn't too terribly important because we already get data from the school lunch website, but it wouldn't hurt to have a point of redundancy to fall back to in case the lunch website is down or something.

Schedule

This is probably the most ambitious out of all of the possibilities, but if we're successful, it could be one of the most useful. If we're able to parse the schedule in the Daily Bulletin, then we can have more redundancy and rely less on the Portal. Currently, if the Portal goes down, then MyMICDS is screwed when it comes to displaying the schedule, which is one of the main features of the site. Also, the bulletin sometimes has a more detailed schedule (usually special assemblies or activities are just labelled "Advisory").

What makes the schedule so complex is when different grades/classes have different things. For example, on Day 1, Science/Art/Math have first lunch and class second and vice versa for other classes. Special schedules are hard in general, and we'd have to parse keywords to determine which demographic each entry belongs to in the schedule.

Clubs

We can find out which clubs are meeting in which room with which teacher. We could compile a list of all the clubs and have users select any they are in. We can add notifications if they're club is meeting, and even insert it into their schedule automatically.

Challenges

While all of these things sound awesome, it ain't easy.

As far as I know, the Daily Bulletin is made manually, by humans. It visually looks similar, but when attempting this task last year in v1, I noticed several nuances (1 line break separating the announcements instead of 2, etc.) Text is messy, so it's going to be hard to parse it. We'd have to expect anything could change, and compensate for it. It will be important to look at all the previous archived bulletins (since my freshman year!) and make sure every single one of them parses correctly.

Solutions

I've attempted to parse the Daily Bulletin back in MyMICDS-v1 (php/parse_bulletin.php) but didn't have much success. I used a PDF -> Text converter, which meant I could only work with a string. However, the Daily Bulletin uses different styles like bold/underlined, center alignment, etc. that can't be represented in a simple string. Headers and titles were very hard to distinguish without stylings. That's why I'd recommend using a library like pdf2json which gives a lot more data to work with.

Change callback-based API to Promises

Switching over to Promises would come with many advantages, mainly being able to use the async/await special syntax for making synchronous-looking code that actually acts asynchronously.

Get real-time stuff working including spinny thingy

We originally used socket.io for real-time things, but after migrating over to Nginx, socket.io was throwing some 502 or CORS error or something like that, which was causing some of the other API requests to also fail.

It might be useful if we used deepstream.io, which seems to have a few more methods than simply sending events with custom data such as: data-sync, request-response, or publish-subscribe.

The real-time thing would be useful if the user changes data in another tab, browser, or machine. Also spinny thingy. Can't forget about the spinny thingy on the homepage that should spin for everyone if one person spins it.

Add Notifications if Formal Dress Day

We can try parsing the Portal Calendar and give a notification of some sort to the user if it's a formal dress day the following day. We could send an email notification (which the user can obviously turn off) or we could give a push notification if we finally get the mobile app existing.

Cache Portal / Canvas Feeds for Users

When loading the schedule, one of the slowest things that bottlenecks the time of the API call is making a request to the portal/canvas every time the user wants to view their schedule or their planner. We could greatly speed up this process by caching the feeds in our database.

Add Notifications if a Teacher Adds an Assignment to Canvas Last-Minute

Don't you just hate it when teachers post assignments on Canvas last-minute so you and your classmates miss them? If we start caching Portal/Canvas feeds, we can check if any assignments were changed upon each query. Notify the user somehow (email, push notification, etc.) if an assignment is added that is due the next day (or Monday if it is currently the weekend).

This might be helpful if we get it working, but we don't want to DDoS Canvas. Make sure to find a balance between speed and performance.

Admin Panel

We should make an admin panel for administrating things that administrators need to administrate. These things include:

  1. Easily viewing and moderating user's background images
  2. Managing MyMICDS Notes OneNote and OneDrive API tokens
  3. Taking over the world
  4. Other things we will think of later

Limit one custom MyMICDS class for each block

When inserting your classes in the settings page, you're able to create an unlimited amount of classes, and select their block, type, color, name, etc. However, users should never need to configure more than one class for each block. Only exception would be things like after-school clubs/sports, advisory etc., which the user should still be able to add an unlimited amount of.

By limiting this, we could pre-populate the form with a class for each block, so it might be overall easier to configure them. From a back-end perspective, this would clear up confusion about which class type to use when determining first lunch/second lunch if multiple classes are configured for the same block but with different types. The user shouldn't ever have to do configure multiple classes per block anyways.

Unit/integration testing

I am aware that we do have a test directory, but I think it would be in our best interest to start using Mocha or another framework for unit testing. Hopefully, this would stop us pushing broken stuff into production because we don't have the testing infrastructure.

Fix middle school schedule

On today's late start, I notice for the seventh-grade schedule it says flex ends at 11:30, which isn't right, that's on normal days, and then for Physical Education it says that it ends at 11:10 and that Flex starts at 10:45. Also, it says recess starts at 12:05, and flex "ends" at 11:30. Hopefully, this made sense. Thanks.

I thought there was another schedule problem too, though I forgot. Maybe I see if it's in our email.

Add Notification System

Add a notification system so we can alert our users. This should be completed first before we can finish #35 and #36. This could also help us send out mass emails like newsletters to our users. Naming of the notifications system should be generalized in case we complete MyMICDS Mobile and also want to give push notifications instead of email. The user should be able to turn on/off notifications in the settings page. It would also be useful to generate a hash so users can "unsubscribe" by visiting https://mymicds.net/unsubscribe/{USER}/{HASH} without entering their password, so this link can be put in the email.

Automagically alias Portal and Canvas classes instead of user configuring aliases

As of now, in order to link classes in the Portal calendar to the Canvas calendar, the user must insert their classes into the MyMICDS system, then use the 'Alias' button to check in all of the associated classes. This process is a bit tedious, and it would be great if we could automate this somehow.

One method that might be useful is use existing people's Portal and Canvas calendars and analyze which people share the same Canvas classes who have the same Portal class. (Ex. everyone who has the portal class Integrated Mathematics 2 Accelerated - 2 (G2) also has T1-Integrated Math 2 Accelerated:SPORT, T2-Integrated Math 2 Accelerated:SPORT and T3-Integrated Math 2 Accelerated:SPORT, so we can safely assume those are all related.) However, this might not work perfectly if there is a class that mandatory for everyone (Ex. All the freshman have to take English Crossing Thresholds) however, this could still eliminate possibilities to make the algorithm more accurate.

Once we link certain portal classes and canvas classes together, we could use the process of elimination to get even better results. In order to make this Sudoku-like process of elimination algorithm faster, we should determine if P=NP.

Background CORS Issue

When selecting an image or generating a Trianglify background, it will keep uploading for a while. This happens both on production and on localhost.

While uploading on production, you get a CORS issue.

This is the error message on Firefox:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.mymicds.net/background/upload. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
However the pre-flight OPTIONS request indeed contains Access-Control-Allow-Origin: * in the header and the actual POST request itself is made.

This is the error message on Chrome:

POST https://api.mymicds.net/background/upload 504 (Gateway Time-out)
settings:1 XMLHttpRequest cannot load https://api.mymicds.net/background/upload. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://mymicds.net' is therefore not allowed access. The response had HTTP status code 504.

While uploading on localhost, you just don't get a response.

Ability to hide all grade activity items

Currently, there are sometimes after-school events like sports or plays or other meetings that show up on the schedule. This messes with the percentage of the day and stuff.

Create MyMICDS Browser Extension

Now, you might be thinking, "What the heck does MyMICDS.net need a browser extension for? It's already a website!!11!1one!1!!"

Well sir or ma'am, one of the weirdest parts of setting up a MyMICDS account is inserting your Portal and Canvas URLs. Said browser extension would prompt the user for their portal/canvas credentials and automatically scrap the DOM for the necessary URLs and send them to the back-end. This would also allow us to send all 8 different feeds to the back-end for any data analytics we might want to do.

The user would be able to quickly install the extension to speed up the registration process, but still have the option to insert the URLs manually. The MyMICDS browser extension could also have other features, like have a popup to show progress of day and calculate Canvas grades even if the teacher disabled them (students can already look at points and do the math themselves, this would just automate the process).

One very important planning step is deciding how the user will be authenticated for Portal and Canvas. Credentials should never be sent to the back-end. This process should remain only on the front-end. It would be best to either redirect the user to the portal/canvas login, or have an iframe or something. Having some MyMICDS popup ask for credentials that is not the official login form is playing in dangerous territory. We should avoid this at all costs, but if not, talk to one of the school tech guys to get the okay from them. Again, credentials should never be sent to the back-end, and the browser extension should handle them as little as possible.

Get real-time stuff working via socket.io or alternative

Initially, we created our real-time infrastructure for the spinny thing. However, scaling the back-end to multiple instances meant that there were four socket.io servers, so the spinny thing wouldn't always spin for truly everyone. When migrating from Apache to Nginx socket.io gave 502 errors at seemingly random times.

It would be create if we can get real-time stuff working again to alert all clients when data is manipulated (Ex. cross out an event in the planner on one computer should automatically update on all others) and also it's really essential to the core foundations of MyMICDS that we bring back spinny thingy.

MyMICDS Clubs

Create a feature that allows people to create these "club" groups. They would be able to add other MyMICDS accounts to this group. Clubs could opt into have their club listed publicly on a page so other people could join. There would be a club page with a list of members and a chat room. Clubs could create meeting times, which could be automatically inserted into the user's schedule, or added to the user's planner.

Fix schedule error "blocks is not defined"

This error occasionally happens. Haven't looked into what circumstances this happens, but it do.

4|mymicds  | ReferenceError: blocks is not defined
4|mymicds  |     at asyncLib.parallel (/home/node/MyMICDS/MyMICDS-v2/src/libs/schedule.js:289:6)
4|mymicds  |     at /home/node/MyMICDS/MyMICDS-v2/node_modules/async/dist/async.js:3853:9
4|mymicds  |     at /home/node/MyMICDS/MyMICDS-v2/node_modules/async/dist/async.js:484:16
4|mymicds  |     at iterateeCallback (/home/node/MyMICDS/MyMICDS-v2/node_modules/async/dist/async.js:1013:24)
4|mymicds  |     at /home/node/MyMICDS/MyMICDS-v2/node_modules/async/dist/async.js:988:16
4|mymicds  |     at /home/node/MyMICDS/MyMICDS-v2/node_modules/async/dist/async.js:3850:13
4|mymicds  |     at apply (/home/node/MyMICDS/MyMICDS-v2/node_modules/async/dist/async.js:41:25)
4|mymicds  |     at /home/node/MyMICDS/MyMICDS-v2/node_modules/async/dist/async.js:76:12
4|mymicds  |     at portal.getDayRotation (/home/node/MyMICDS/MyMICDS-v2/src/libs/schedule.js:268:8)
4|mymicds  |     at Request.request [as _callback] (/home/node/MyMICDS/MyMICDS-v2/src/libs/portal.js:313:6)

Fix Portal URL

The calendar from "Entire Calendar: My Calendars" returns an empty calendar. This seems to be a problem with the Portal, not MyMICDS as it returns a valid iCal format, just no events inside.

I've already tried decoding the URL and even importing the web cal into Google Calendars, but no avail. It does however work with the user's individual "Schedule" calendar. While this does give the user's schedule, it does not include other things such as sports or special events that might be helpful, but this is a good fallback until we get something working.

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.