# Changelog ## [2025-12-01] - Student Data Import Implementation Initial Release - **Added** new `students` table schema with fields: `id`, `order_number`, `cial_code`, `nif_nie_passport`, `registration_number`, `file_number`, `first_name`, `last_name`, `full_name`, `birth_date`, `gender`, `study_group`, `created_at`, `updated_at`. - **Added** indexes on `cial_code`, `nif_nie_passport`, `(last_name, first_name)`, `birth_date`, `gender`, `study_group`. - **Added** `assigned_to_student` foreign key column to `tablets` and `non_loanable_devices` tables. - **Added** `student_id` foreign key to `loans` table. - **Implemented** CSV import script (`scripts/import_students.py`) for ISO-8859-1 (Latin-1) encoded CSV files with automatic UTF-8 handling, name field splitting, date conversion (DD/MM/YYYY → YYYY-MM-DD), discard "Estudio" field, duplicate checking, progress reporting, and dry-run support. - **Created** database migration script (`scripts/migrate_database.py`) with backup, schema creation, index creation, foreign key addition, and consistency verification. - **Updated** Flask application (`app.py`): - Added new routes: `/students`, `/add_student`, `/student/`, `/edit_student/`, `/delete_student/`, `/import_students`. - Modified loan routes to optionally associate tablet loans with students. - Added student model definitions and relationships. - Added indexes and validation for new student fields. - **Added** Jinja2 front‑end templates: - `templates/students.html` – list/search/student details with filters and pagination. - `templates/add_student.html` – form for adding new students. - `templates/edit_student.html` – form for editing existing students. - `templates/student_detail.html` – view student details including loan and device history. - `templates/import_students.html` – CSV import interface with instructions. - Updated `base.html` to include Students navigation link. - Updated `loan_tablet.html` with student selection dropdown. - **Updated** `requirements.txt` to include Flask, Flask-Babel, python-dotenv, pytest, pytest-cov, waitress. - **Created** documentation file `docs/DATABASE_SCHEMA_SPECIFICATION.md` with detailed schema definition, import rules, and migration path.