Python processing pipeline
The parser/ package, loaded as a wheel in Pyodide. Related: Pyodide, Schedule generation.
Public API#
create_time_table(campus, year, time_table_json, subject_json, batch, electives_subject_codes)compare_timetables(tt1, tt2)create_and_compare_timetable([params1, params2])
flowchart TD
CT[create_time_table]
CT --> R{campus / year}
R -->|62 1| F1[time_table_creator]
R -->|62 2+| F2[time_table_creator_v2]
R -->|128 1| F3[bando_year1]
R -->|128 2+| F4[banado]
R -->|BCA 1| F5[creator_year1]
R -->|BCA 2+| F6[creator]Campus modules:
parser/modules/tt_parsers/sector_62/creator.pyparser/modules/tt_parsers/sector_128/creator.pyparser/modules/tt_parsers/BCA/creator.py
Inner loop (Sector 62 year 1)#
flowchart TD
Days[for each day] --> Slots[for each timeslot]
Slots --> Classes[for each activity string]
Classes --> Code[subject_extractor]
Classes --> Batches[batch_extractor + parse_batch_numbers]
Batches --> Elective{is_elective?}
Elective -->|core| Inc{is_batch_included?}
Elective -->|elective year 1 heuristic| Inc
Inc -->|yes| Row[append day, time, name, type, location]
Row --> Out[fold into YourTietable]Year 2+ uses is_enrolled_subject(code, electives_subject_codes) instead of the year-1 elective heuristic.
Batch parsing#
parser/utils/batch.py parse_batch_numbers:
| Input | Result |
|---|---|
| empty / MINOR | A–D, G, H |
A15A17 |
A15, A17 |
ABC |
A, B, C |
A1-A10 |
range |
ECE,CSE |
mapped to A, B |
BCA and 128 have extra extractors in their utils.py.
Activity strings#
Example: TA4(CI121)-TS10/APR
flowchart LR S["TA4(CI121)-TS10/APR"] --> Type[T] S --> Batch[A4] S --> Code[CI121] S --> Loc[TS10] S --> Fac[APR]
subject_extractor takes the parenthesis (or dash fallback). location_extractor takes the room after -. Type is the leading L/T/P.
Electives#
Year 1 is_elective treats some batch patterns as electives so they still attach when the batch matches. Year 2+ only keeps subjects whose code is in the form list.
subject_name_extractor matches Code or several slices of Full Code.
Time and day#
process_day:MON→Mondayprocess_timeslot:9-9.50or10:00-10:50 AM→09:00,10:00(24h). Practicals can span two hours.
Compare#
parser/modules/compare_tt/compare.py:
flowchart TD E[_expand_timetable_to_hourly] E --> Hours[08:00-17:00 each day] Hours --> Free[both empty to common_free_slots] Hours --> Same[same name type location to classes_together]
Multi-hour blocks split into 1-hour keys first.
JS bridge#
flowchart LR toPy[pyodide.toPy] --> Fn[create_time_table] Fn --> toJs[result.toJs]
Home JSON-clones the result so Proxies do not survive into React state.
Complexity#
Per student this is O(days × slots × classes on that campus JSON). Fine in WASM. The expensive part is the first Pyodide download, not the loop.