schedule-gen
v1.0.1
Published
A timetable generator that assigns subjects, teachers, rooms, and groups without conflicts
Readme
🗕️ Schedule-Gen (npm Package)
A Schedule Generator that automates class scheduling using Python. This npm package acts as a wrapper around a Python script to generate optimized timetables.
🚀 Features
- 🔹 Automated Scheduling – Generates conflict-free timetables.
- 🔹 Easy-to-Use – Just install the package and call the function.
- 🔹 Customizable Inputs – Define subjects, faculty, classrooms, and time slots.
- 🔹 Node.js & Python Integration – Runs a Python script under the hood.
🛠 Tech Stack
- Python – Core scheduling logic
- Node.js – Wrapper for npm package
- child_process – Runs Python script from JavaScript
🛆 Installation
npm install schedule-gen📚 Usage
1️⃣ Import the Module
const { generateTimetable } = require("schedule-gen");2️⃣ Define Your Input Data
Provide JSON input with details of subjects, teachers, classrooms, groups, and time slots.
const inputData = {
teachers: ["Alice", "Bob"],
subjects: ["Math", "Science", "History"],
rooms: ["Room 101", "Room 102"],
groups: ["Group A", "Group B"],
timeSlots: ["9 AM", "10 AM", "11 AM"]
};3️⃣ Generate the Timetable
generateTimetable(inputData, (response) => {
console.log(JSON.stringify(response, null, 2));
});🔍 Example Output
If successful, you will receive a JSON response with the scheduled timetable:
{
"success": true,
"data": {
"timetable": [
{
"subject": "Math",
"teacher": "Alice",
"room": "Room 101",
"group": "Group A",
"time_slot": "9 AM"
},
{
"subject": "Science",
"teacher": "Bob",
"room": "Room 102",
"group": "Group B",
"time_slot": "10 AM"
}
]
}
}❌ Handling Errors
If an error occurs, the response will indicate failure:
{
"success": false,
"error": "Invalid input: JSON data must be an object."
}💜 License
This project is licensed under the MIT License.
