# Architecture overview ## System context - **Parents / Encadrants** accedent a l interface web depuis desktop, tablette ou affichage TV. - **API Backend** gere l authentification, la persistence et la logique metier. - **Service d ingestion** transforme les fichiers bruts en evenements normalises. - **Stockage** (base SQL + objet) conserve les plannings et medias associes. - **Bus d evenements** (placeholder) propagate les alertes et notifications. ```mermaid flowchart LR User[Utilisateur] -->|HTTP| Frontend Frontend -->|REST| Backend Backend -->|Upload| Storage[(Stockage fichiers)] Backend -->|Job| Ingestion Ingestion -->|Resultat JSON| Backend Backend -->|WebSocket / REST| Frontend Backend -->|Events| Notifier[(Alerting)] ``` ## Modules ### Frontend - `screens/` vues principales (Planning, Enfants, Parametres). - `components/` elements UI generiques (plan board, timeline, modals). - `services/` clients API (children, schedules, alerts, uploads). - `styles/` theming global, mode plein ecran, palette dynamique. - `state/` (a creer) pour Zustand ou Redux Toolkit. ### Backend - `routes/` definitions Express pour enfants, plannings, fichiers, alertes. - `controllers/` validation request/response via Zod. - `services/` logique (assignation planning, detection alertes). - `models/` mapping ORM (Prisma / Sequelize placeholder). - `config/` gestion env, secrets, toggles features. - `jobs/` (a ajouter) pour traitements asynchrones d ingestion. ### Ingestion - `adapters/ocr.py` connecteurs Tesseract / Vision API. - `parsers/` exploitent pdfplumber, openpyxl, pillow. - `schemas/` definissent le format de sortie unifie. - `tasks/` pipeline orchestrateur (FastAPI background tasks ou Celery). ### Shared - `types/` exports TypeScript (DTO communs: Child, Schedule, Activity, Alert). - `ui/` composants design system (Bouton, Barre laterale, timeline). ## Donnees ### Entite Child ``` Child { id: string fullName: string birthDate?: string colorHex?: string notes?: string } ``` ### Entite Schedule ``` Schedule { id: string childId: string periodStart: string periodEnd: string sourceFileUrl: string activities: Activity[] } ``` ### Entite Activity ``` Activity { id: string title: string category: "school" | "sport" | "medical" | "event" | "other" description?: string location?: string startDateTime: string endDateTime: string reminders: Reminder[] metadata?: Record } ``` ### Entite Reminder ``` Reminder { id: string activityId: string offsetMinutes: number channel: "push" | "email" | "sms" | "device" } ``` ## Operations cle 1. **Upload planning** (POST `/children/{id}/schedules`) 2. **Lister calendrier** (GET `/calendar?from=&to=`) 3. **Mettre a jour activite** (PATCH `/activities/{id}`) 4. **Activer mode plein ecran** (frontend uniquement) 5. **Notifications programmes** (backend -> notifier) ## Securite - API key familiale + Auth future (magic link / SSO). - Sanitisation des fichiers uploades. - Limitation taille fichier (10MB par defaut). - Logs et audit (pistes a definir). ## Extensibilite - Connecteurs agenda (Google Calendar, Outlook). - Synchronisation ecoles via SFTP/Email. - Application mobile (React Native) reutilisant API + shared UI.