Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Luisanchez0/modulo_Horario/llms.txt

Use this file to discover all available pages before exploring further.

Schedule generation is the core workflow in Módulo Horario. Given a set of teachers, subjects, classrooms, and an academic period, the system automatically assigns each subject to a time slot, day, classroom, and teacher — producing a complete weekly schedule while respecting shift and availability constraints.
Triggering schedule generation requires the ADMIN role. Teachers with the DOCENTE role can view existing schedules but cannot create or generate them.

Prerequisites

Before generating a schedule, make sure all four catalogs are populated:

At least one period

A schedule is always generated for a specific academic period. Create the period first on the Periodos page.

Teachers with availability

Each teacher should have availability blocks configured. Without them, the generator falls back to the full workday window.

Subjects in the catalog

Subjects must exist in the materias-service before they can be assigned to time slots.

Classrooms in the catalog

Classrooms must exist in the aulas-service. Each classroom’s capacity is visible in the schedule output.

Constraints respected by the generator

The generation algorithm enforces these rules for every candidate slot:
A teacher cannot be assigned to two different subjects at the same time on the same day. The algorithm checks all existing and newly created schedule entries before committing each assignment.
Each teacher has a shift: MATUTINO (07:00–14:00), VESPERTINO (15:00–22:00), or AMBOS. A teacher assigned to MATUTINO will never be scheduled in an afternoon slot, and vice versa. The validator rejects any manual entry that violates this rule too.
Teachers can define specific days and time windows when they are available. The generator only places assignments within those windows. If no availability is configured, the teacher is treated as available for the entire requested workday.
Two different subjects cannot share the same classroom at the same time. The algorithm checks for time overlaps across all slots before assigning a classroom.

Generating a schedule from the UI

1

Open the Horarios page

Navigate to the Horarios section from the main menu. You must be logged in as ADMIN.
2

Expand the Generar Horarios Automaticos panel

Click the collapsible panel labeled Generar Horarios Automaticos to reveal the generation form.
3

Select a period

Choose the academic period from the Periodo dropdown. Only existing periods appear here.
4

Configure the workday

Set the session duration (minimum 30 minutes), the workday start and end times, and the days to include. The default days are Monday through Friday.
5

Optionally filter teachers, subjects, and classrooms

Use the multi-select lists to limit generation to specific teachers, subjects, or classrooms. If you leave them empty, the system uses all available records from each catalog service.
6

Click Generar automaticamente

The system submits the request and returns the results. Created schedule entries appear immediately in the schedule viewer below.

Generating via API

Send a POST request to /horarios/generar with an Authorization header containing an ADMIN token.
curl -X POST http://localhost:8004/horarios/generar \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>" \
  -d '{
    "periodo_id": 1,
    "duracion_minutos": 120,
    "hora_inicio_jornada": "08:00",
    "hora_fin_jornada": "14:00",
    "dias": ["LUNES", "MARTES", "MIERCOLES"],
    "docente_ids": [1, 2],
    "materia_ids": [1, 2, 3],
    "aula_ids": [1, 2]
  }'
Omitting docente_ids, materia_ids, or aula_ids causes the service to fetch all available records from the respective catalog microservices automatically. See the API reference for the full request schema.

Understanding the response

The generation endpoint returns three fields:
FieldDescription
creadosArray of schedule entries that were successfully created, each including teacher name, subject name, classroom name, day, and time.
materias_sin_asignarArray of subject IDs that could not be assigned. This happens when no valid slot exists due to availability or conflict constraints.
mensajesHuman-readable summary messages explaining how many schedules were created and why any subjects were skipped.
{
  "periodo_id": 1,
  "creados": [
    {
      "id": 1,
      "docente_id": 1,
      "materia_id": 1,
      "aula_id": 1,
      "periodo_id": 1,
      "dia": "LUNES",
      "hora_inicio": "08:00",
      "hora_fin": "10:00",
      "docente_nombre": "Juan Perez",
      "materia_nombre": "Base de Datos",
      "aula_nombre": "Aula A1",
      "aula_capacidad": 35
    }
  ],
  "materias_sin_asignar": [3],
  "mensajes": [
    "Se generaron 2 horarios para el periodo 1",
    "No se pudieron asignar 1 materias por falta de cupo o disponibilidad"
  ]
}

Manual schedule creation

You can also create individual schedule entries without using the generator. On the Horarios page, expand the Crear Horario panel and fill in the teacher, subject, classroom, period, day, start time, and end time. The same conflict and shift validation rules apply when saving manually.

Editing and deleting schedules

ADMIN users can edit or delete any existing schedule entry. In the schedule table, each row includes Editar and Eliminar buttons. Clicking Editar opens a modal where you can change all fields; clicking Eliminar asks for confirmation before removing the entry.
Deleting a schedule entry is permanent. If you need to clear all entries for a period, delete them before attempting to delete the period itself.

Build docs developers (and LLMs) love