AWS Builder Center

The Timetable Nobody Has

We set out to build a scheduling tool for professors. We shipped a change log for class representatives. The gap between those two sentences is four days, 112 commits, and three pivots, each one forced by a spreadsheet.

On the fourth day of a four day hackathon, a classmate messaged to ask why his Entrepreneurial Finance class was missing from our app. It was in the timetable file the whole time. Our parser had been silently throwing it away for three days, and we had no idea, because nothing had failed.
That message is the reason this post is worth reading. Everything else we built, the AWS wiring, the policy engine, the interval arithmetic, worked more or less as planned. The interesting part was the three separate times real data told us we had modelled the world wrong, and what it cost each time to listen.
The thing we built is called Slate. It is live at  main.dosqfo1xoqa7l.amplifyapp.com , the source is  on GitHub , and it now knows the actual week of 1,801 students at IIIT Allahabad, including the ones whose week matches no section on any printed sheet.
The short version: we set out to build a scheduling tool for professors. We shipped a change log for class representatives. The gap between those two sentences is four days, 112 commits, and three pivots, each one forced by a spreadsheet.



Part one: the problem is not scheduling

There is a printed timetable on the noticeboard in our department. It is correct in the way a map is correct: accurate about the terrain, useless about the traffic. It does not know that Thursday's machine learning class was cancelled this morning.
Here is what actually happens. A professor decides on Tuesday that Thursday's class will not run. They tell the class representative, because the CR is the person whose number they have. The CR posts it in a WhatsApp group of two hundred people. Some see it. Many have the group muted since the week it was created. A few walk to an empty room on Thursday and find out the expensive way.
Our first design ignored all of that. We built Schedule a session, a screen where a professor picks the sections that must attend and gets back free slots. It worked. It demoed well. And two days in, talking to actual CRs, we accepted it would never be used, because a professor will not log into a student's app to do something they can already accomplish with one WhatsApp message.
So we deleted the professor. The CR already does this work, in every section, every week, unpaid and unthanked. We did not need anyone to adopt a new role. We needed to give the existing role a server.
Pivot one, day three. It cost us a screen, a dashboard and a database table, and it made the product real.



Part two: your section is not your timetable

The obvious data model is the one we built first. A student belongs to a section. A section has classes. Your week is your section's week.
It leaks immediately, and we patched each leak:
Reality
Our patch
Labs split a section into B1 and B2
a  subSection  field
Electives draw students from every section
mark them "whole batch", show everyone
A repeating student takes a course with the junior batch
an exceptions table with ADD and DROP rows
Three patches for three symptoms of one disease. Then the institute's mid semester examinee list landed: 16,483 rows, one per student per course, with the professor's name attached.
PROG-SEM ENROLL STUDENTNAME COURSENAME FACULTYNAME
B.Tech (IT) Sem-5 IIT2024245 [redacted] Introduction to ML DR. SHIV RAM DUBEY
Who takes what, from whom. Not inferred. Stated. And once you have that file, the section model is not merely awkward, it is wrong:
Both students are in B.Tech IT Semester 5 Section C. One takes Cheminformatics as their elective, the other Business Process Management. A section based timetable shows them the same grid, and that grid is wrong for both.
Pivot two, day four. We replaced sections with offerings.



Part three: an offering is one course, one professor, one audience

 IML  is not something you can schedule. In our fifth semester it is three different classes, taught by three different professors, to three different sections. That is why "cancel IML" is an ambiguous instruction, and why every model built on course codes eventually hurts.
A student is registered in offerings. Their week is the meetings of those offerings. A cancellation attaches to an offering, so it reaches the 109 students registered in that one, and nobody else.
Watch what disappears:
  • The repeating student is registered in an offering belonging to another batch. No special case.
  • The elective is an offering with no single section. No special case.
  • The lab split is a property of a meeting, not of a person. No special case.
  • "Which sections does this change affect?" becomes a question you answer for display, not a question you compute permissions from.
The exceptions table went in the bin. The rewrite deleted more code than it added, which is usually the sign that you have found the right shape rather than a cleverer patch.




Part four: real data has a dozen ways to say the same thing

Back to my classmate's missing class. Our reader understood exactly one notation:
IML (L) - Sec A (CC3-5404)
The same workbooks also contain all of these, each meaning "this class meets here":
MDM-3 EF (CC3-5107) a minor degree module
EBE (CC3-5255) an elective, no session type
IF Sec(A) (CC3- 5106) an HSS course with its own groups
DDM (L) -LT-3113 a room written without brackets
Advance Data Analytics (CC2-4105) spelled out instead of coded
Every one we did not handle failed silently. Not with an exception, which would have been a gift. It produced a student with a gap in their week and no indication anything was wrong. Teaching the reader those five shapes changed the numbers sharply:

Before
After
Classes read from the 7th semester elective sheet
3
60
Classes read from ECE Semester 3
11
35
Registration rows we could not match to a class
5,690
2,121
And a personal favourite. One professor appears in the timetable as  Dr. Nikhiland  and in the registration list as  DR. NIKHILANAND ARYA . Not an abbreviation, not an ellipsis. Letters missing from the middle of a name. We match on a shared stem now, because reality does not care about your string equality.
Reading one sheet perfectly teaches you less than reading four badly. The fourth sheet is where your assumptions go to die.



Part five: the bug that passed every test

This one still stings.
Every authorization test we wrote passed. Claim a section, cancel a class, get refused when you should be refused. All green. Meanwhile, on the live site, every single one of those actions failed for real users with a message saying their roll number was not in the student list.
The app authenticates to AppSync with Cognito access tokens. An access token carries no email claim. Our tests invoked the Lambda with an identity object we had constructed ourselves, and we had helpfully included an email, because of course we had. The browser never sent one. The server could not identify anybody at all.
The fix was small: look the user up in the user pool by their verified username, derive their section from the admin uploaded roll list, and never trust a section the client sends.
The lesson was not small. We use  Cedar  to decide who may change what, and the policy is a file in the repository:
// Cancel / add / move a class of an offering: a CR of a section
// that offering is taught to.
permit (
principal,
action in [Slate::Action::"Cancel", Slate::Action::"AddExtra", Slate::Action::"Move"],
resource is Slate::Offering
)
when { resource.crs.contains(principal) };
That policy was correct the whole time. It was reasoning, flawlessly, about a user who did not exist. A policy engine is only ever as good as the facts you hand it, and the facts come from identity. Every decision lands in CloudWatch, which is how we caught it:
{"cedar":"allow","action":"Cancel","email":"iit2024245@iiita.ac.in","principal":{"role":"STUDENT","section":"BTech|IT|5|C"}}
{"cedar":"deny","action":"Cancel","email":"iit2024250@iiita.ac.in","principal":{"role":"STUDENT","section":"BTech|IT|5|C"}}
An allow and a deny, with who asked and what they were. A rule in a file, not an  if  buried in a form handler, and an audit trail nobody has to remember to write.




Part six: finding an hour that works

This is the feature that could not exist without the data model, and the one a chatbot cannot fake, because it needs data no chatbot has.
To place a makeup class, Slate does not ask which sections are free. It asks which people are free: every student registered in that offering, whichever batch they come from, plus the professor, who may teach three other batches.
For one class that is 109 students. Checking 109 individual timetables sounds expensive, until you notice most of them are identical.
// Students with identical timetables are one check, not sixty.
const profiles = new Map<string, { students: string[]; busy: Busy[] }>()
for (const rollId of attendees) {
const keys = keysOf(rollId)
const sig = [...keys].sort().join(',') + `|${groupOf.get(rollId) ?? ''}`
if (!profiles.has(sig)) profiles.set(sig, { students: [], busy: busyOf(keys, groupOf.get(rollId)) })
profiles.get(sig)!.students.push(rollId)
}
Group students by the set of offerings they are registered in, and 109 timetables collapse to five. Intersect those, filter by the constraints, rank what survives, attach a room that is also free, and say why in words a human can check:
free for all 109 registered students, Dr. Shiv Ram Dubey is free, within 9 to 5:30, avoids the lunch hours
And when nothing fits, name the obstacle:
Without IT Sem 5 Sec B, 1 slot works for everyone else, for example Tue 09:00 to 11:00, when Sec B has IML.
A WhatsApp poll can tell you Thursday does not work. It cannot tell you that Thursday does not work because Section B has a lab until half four, and that this is the only hour in the week that survives.



What it runs on, and what it costs

Nothing exotic, which is the point. Cognito gates sign up to institute email addresses, and that is the entire membership model. AppSync and DynamoDB hold the data, with time to live on the change records so last week's cancellations delete themselves. Four Lambdas: one reads spreadsheets from S3, one validates and writes them only after an admin confirms a diff, one does the interval arithmetic, one guards every write with Cedar. Amplify Hosting serves it.
Month to date cost: $0.00. No NAT gateway, no idle database, no instance waiting for traffic. Between classes it costs nothing, because between classes it does nothing.
Restraint mattered as much as architecture. We did not build voting, or chat, or recurring changes, or student editable timetables. Every one was suggested, every one was plausible, and every one would have turned a tool that does one thing into a tool nobody finishes.




Three things I would tell myself on day one

Get the real file before you design the schema. Not a sample. Not three rows typed by hand. The actual workbook, with its merged cells and truncated names and five ways of writing a room number. Our best design decision came from a file we did not have until day four, and most of the work before that was spent building around an assumption we could have tested on day one.
When you add a third exception, the rule is wrong. Sub-sections were the first. Electives the second. Repeating students the third. We should have stopped at the second and asked what the data was trying to tell us, instead of teaching the code to apologise for it.
Silence is the expensive failure mode. A crash gets fixed in ten minutes. A parser that skips a line it does not recognise costs you three days and a message from a classmate asking where his class went. Every skipped row in our importer is now counted, categorised and shown to the admin, because the only thing worse than bad data is bad data that looks fine.


Slate was built in four days for  First Commit  by WeMakeDevs and AWS, on the real timetables, student lists and registration records of IIIT Allahabad. It is live at  main.dosqfo1xoqa7l.amplifyapp.com  and open source at  github.com/kavyan256/slate . If you want to poke at it, sign in as  iit2024059@iiita.ac.in  with the password  SlateDemo#2026  and look at a real student's real week.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article