feat: PDF horario upload — real Tec21 calendar from MiTec#19
Merged
Conversation
release: onboarding UX + Gemini insights engine
release: Persona A integration + Tec21 calendar + hydration fix
Replaces the hand-rolled "5+1+5+1+5" Tec21 calendar with the real periods extracted from the student's official MiTec horario PDF. Periods, materias, CRNs, schedules, and Semana Tec flags now come from the source of truth instead of being computed from a single start date. Backend - lib/pdf/horario-parser.ts: sends the PDF directly to Gemini multimodal (gemini-2.5-flash) with a structured response schema. Returns alumno, matricula, periodo, and an array of materias with their `periodos` (each with inicio/fin/dias/hora_inicio/hora_fin/ubicacion/es_semana_tec). - POST /api/profile/horario: multipart upload, parses, replaces materias_inscritas with PDF-derived rows and updates profiles with periodo_nombre/periodo_inicio/periodo_fin. - lib/tec21/calendar.ts refactor: getPeriodoActivo() reads materias_inscritas.periodos to detect Semana Tec (any active period flagged) or compute the current block boundaries (intersection of active non-tec periods). Returns a human label and dias_restantes_bloque for prompt context. - lib/gemini/prompts.ts: prompt now uses periodo_activo (real data) instead of computed semana_actual; new rules around Semana Tec; stronger Canvas prioritization; few-shot updated to a Semana Tec scenario. - /api/insights/generate: filters materias to those active in the current period, marks Semana Tec materias, keeps Canvas-inferred materias. Frontend - OnboardingFlow rewritten: paso 3 ahora es "sube tu PDF de MiTec" en lugar de selección manual de materias. Auto-fills nombre/matricula del PDF. - Old SelectedMateria/TOGGLE_MATERIA logic removed — PDF is source of truth. Schema - profiles.semestre_inicio dropped; replaced by periodo_nombre/periodo_inicio/periodo_fin. - materias_inscritas: + crn text, + periodos jsonb. Migration: ALTER TABLE profiles DROP COLUMN IF EXISTS semestre_inicio; ALTER TABLE profiles ADD COLUMN IF NOT EXISTS periodo_nombre text; ALTER TABLE profiles ADD COLUMN IF NOT EXISTS periodo_inicio date; ALTER TABLE profiles ADD COLUMN IF NOT EXISTS periodo_fin date; ALTER TABLE materias_inscritas ADD COLUMN IF NOT EXISTS crn text; ALTER TABLE materias_inscritas ADD COLUMN IF NOT EXISTS periodos jsonb default '[]'::jsonb; Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Por qué
El calendario "5+1+5+1+5" calculado desde una sola fecha no funcionaba: cada estudiante tiene un horario distinto, con materias activas en periodos diferentes y Semanas Tec en fechas reales que dependen de su inscripción. Ahora leemos el PDF oficial de MiTec.
Cómo
Gemini multimodal (gemini-2.5-flash) acepta el PDF directo con structured output schema. Saca alumno, matrícula, periodo, materias con sus periodos y flag de Semana Tec.
Cambios
lib/pdf/horario-parser.ts— parse vía Gemini multimodalPOST /api/profile/horario— multipart upload, replaces materias_inscritaslib/tec21/calendar.tsrefactor:getPeriodoActivo()usa los periodos reales de la DBperiodo_activoreal ("Semana Tec" / "Bloque N") en vez de calcularloprofiles.semestre_inicioeliminado, reemplazado porperiodo_nombre/periodo_inicio/periodo_finmaterias_inscritasganacrnyperiodosjsonbSQL Migration
Test plan
🤖 Generated with Claude Code