rico-et22 / elektronik-timetable

A modern school timetable frontend for VULCAN Optivum system • Used by 1,000+ students at ZSE Rzeszów, Poland • Open-source project
https://plan-lekcji.zse.rzeszow.pl
GNU Affero General Public License v3.0
17 stars 6 forks source link

Implementing Oputibamu API #40

Open Oreeeee opened 2 months ago

Oreeeee commented 2 months ago

I've made a library that parses the timetable, and exposes it as a JSON API. It returns the timetable as one JSON response, which aside from the obvious thing like the lesson, differentiates between groups (allowing to easily add a group chooser to the timetable), gives the replacement data straight up in the lesson field, and gives the info about the temporary PRz classrooms (the building and the room number). From the planned features there is adding a short lessons bool to the response, and mapping the shortened names of subjects to their full ones (for example, "pr.urz.techn" will be mapped to "pracownia urządzeń techniki komputerowej" like it is in the register clients). For now, the API would have to be hosted somewhere else (or interfaced directly using Go), but it might get moved to being hosted on the school server once it gets principal's approval (and to get approved, we need to have a client actually using the API). Hosting the API would also allow other people to make timetable frontends easily.

https://github.com/Oreeeee/oputibamu https://github.com/Oreeeee/oputibamu-api

I will provide the API documentation (it's really simple), if you are interested in implementing this, I might also help with adding this.

rico-et22 commented 2 months ago

Hello, A more friendly way to access the timetable that wouldn't need this app to parse the tables by itself is appreciated, but without any docs for this API, I can't tell if it's a good solution for this project, especially as it "returns the timetable as one JSON response" - returning the whole timetable for all classes, rooms etc. at once will have a significant impact on performance and require architectural changes (right now every class etc. is a separate cached route with incremental static regeneration). I think such changes will be too much time-consuming for me, if I did them by myself only, as I left Elektronik a year ago, have a job & pursue a degree, and now I don't have time to be responsible 24/7 for a breaking change for 1,000+ students there . Most of the features you're mentioning are already implemented. If you manage to get some react devs to fork this repo and propose a good refactor using your Oputibamu API in line with Next.js/ISR principles, then feel free to open a PR with a change to your API, but before, please test it :)

Oreeeee commented 2 months ago

I might have worded the "returns the timetable as one JSON response" a bit wrong, as I meant that it returns the table for one class per route, with all the nescessary stuff already in there. The response for the timetable looks like this: 11.json. The API is subject to change, and the day property is broken right now.

Oreeeee commented 1 month ago

Should the API return just raw timetable, array of rows of the timetable, or columns for every day? I don't know how how the current scraper does this.

rico-et22 commented 1 month ago

It's like this: image