feat(US-P04): Parent IA Sessions — Learning Session Dashboard - #270
feat(US-P04): Parent IA Sessions — Learning Session Dashboard#270ikramelaimaa wants to merge 11 commits into
Conversation
bcdd0e9 to
67b8404
Compare
|
Your PR description is very detailed and well-structured One thing is missing though: there's no documentation file in Could you add these before this is ready for review? |
Review — feat(US-P04): Parent IA Sessions — Learning Session DashboardThanks for the detailed PR description and the effort put into tests. The overall structure is clean and the API contract is well designed. However, several issues prevent this PR from being ready to merge. 1. 🔴 Blocking — Hardcoded fake child ID in frontend// ui/src/lib/components/parent/SessionsIA.svelte
const CHILD_ID = 'demo-child-001';This ID is used in every API call: const data = await getIASessions(token, CHILD_ID);
selectedSession = await getIASessionDetail(token, session.id, CHILD_ID);
const res = await getIASessionTranscript(token, selectedSession.id, CHILD_ID);This means every parent account will query sessions for the same fictional child 2. 🔴 Blocking — Backend returns hardcoded demo dataThe service layer generates fictional data instead of querying the real database: # learning/sessions/ia_service.py
def _get_demo_sessions(self, child_id, subject=None): # line 42
...
sessions = self._get_demo_sessions(child_id, subject=subject) # line 100This is confirmed by the PR description itself:
The entire data pipeline is fictional — the frontend sends a fake ID, the backend returns invented sessions. A feature that only works with demo data is not ready to merge into 3. 🟡 Non-blocking — French property names in TypeScript types and backend modelsThe matiere: string // → should be: subject
duree_minutes: number // → should be: duration_minutes
metriques: Metriques // → should be: metrics
autonomie: number // → should be: autonomy
statut: string // → should be: statusThe rest of the codebase uses English field names consistently ( 4. 🟡 Non-blocking — Frontend charter violationsSeveral UI inconsistencies were found against the project's frontend charter: a) Emoji icons instead of a consistent icon libraryKPI cards and subject icons use hardcoded emojis ( Suggestion: replace emojis with SVG icons consistent with the rest of the interface. b)
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new “Parent Portal” UI section for viewing a child’s AI learning sessions and introduces corresponding backend /api/v1/ia-sessions/* endpoints (currently backed by demo data) to support list/detail/transcript retrieval.
Changes:
- Added parent-facing Svelte routes/components for an IA Sessions dashboard (KPIs, filtering/search, detail modal with transcript).
- Introduced a new backend IA Sessions router/service with demo responses and registered it in the FastAPI app.
- Added new backend/unit/integration test files and a Playwright E2E test scaffold.
Reviewed changes
Copilot reviewed 13 out of 16 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/routes/parent/sessions/+page.svelte | Adds the /parent/sessions page that renders the IA sessions dashboard component. |
| ui/src/routes/parent/+layout.svelte | Introduces the parent portal layout (sidebar/nav/top bar). |
| ui/src/lib/components/parent/SessionsIA.svelte | Implements the sessions dashboard UI (KPIs, filters, grid, detail modal, transcript). |
| ui/src/lib/apis/ia-sessions/index.ts | Adds frontend API client wrappers for IA sessions list/detail/transcript endpoints. |
| tests/e2e/test_sessions_ia_e2e.py | Adds a Playwright E2E test scaffold for the parent sessions flow. |
| pytest.ini | Adds pytest configuration (asyncio mode). |
| learning/sessions/ia_service.py | Adds an IA sessions service with demo data and (placeholder) access control. |
| learning/sessions/domain.py | Adds domain dataclasses/enums for IA sessions and quality/alert logic. |
| gateway/http/routers/ia_sessions.py | Adds FastAPI router for /api/v1/ia-sessions/* endpoints and response models. |
| gateway/http/dependencies.py | Adds a DI provider for IASessionsService. |
| gateway/http/app.py | Registers the new IA sessions router with the FastAPI app. |
| backend/tests/unit/test_sessions_ia_unit.py | Adds unit tests (currently using locally redefined domain models). |
| backend/tests/unit/init.py | Initializes backend unit test package. |
| backend/tests/integration/test_sessions_ia_integ.py | Adds integration-style tests (currently mock-based async tests). |
| backend/tests/integration/init.py | Initializes backend integration test package. |
| backend/tests/init.py | Initializes backend test package. |
| goto(`/parent/${id}`); | ||
| } | ||
|
|
||
| onMount(async () => { |
| <script lang="ts"> | ||
| import { onMount } from 'svelte'; | ||
| import { goto } from '$app/navigation'; | ||
| import { get, writable, derived } from 'svelte/store'; |
| import { get, writable, derived } from 'svelte/store'; | ||
| import { user, theme } from '$lib/stores'; | ||
| import { page } from '$app/stores'; | ||
| import { getContext } from 'svelte'; |
| let currentIsDarkMode = false; | ||
| isDarkMode.subscribe((value) => { | ||
| currentIsDarkMode = value; | ||
| document.documentElement.classList.toggle('dark', value); | ||
| }); |
| {:else} | ||
| <!-- Grille 4 colonnes --> | ||
| <div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4"> | ||
| {#each visibleSessions as session} |
| @@ -0,0 +1,145 @@ | |||
| """Router Sessions IA — /api/v1/ia-sessions/* (US-P04).""" | |||
|
|
|||
| from typing import Any, Dict, List, Optional | |||
| from typing import Any, Dict, List, Optional | ||
|
|
||
| from fastapi import APIRouter, Depends, HTTPException, Query, status | ||
| from pydantic import BaseModel, Field |
| import pytest | ||
| from playwright.sync_api import Page, expect | ||
|
|
| import pytest | ||
| import uuid | ||
| from unittest.mock import AsyncMock, patch | ||
|
|
| # ═══════════════════════════════════════════════════════════════════ | ||
| # MODÈLES MÉTIER (à remplacer par tes vrais imports quand ils existent) | ||
| # from learning.sessions.domain import IASession, MetriquesSession, ... | ||
| # ═══════════════════════════════════════════════════════════════════ |
… child_id, fix unused imports, gate E2E tests
…ve currentIsDarkMode
…0 with official palette
… register parent routers in app
|
Hi @baaki-hicham @Oumaima-elkhoummassi 👋 All review comments have been fully addressed ✅ 🔴 Blocking issues — FIXED1. Hardcoded
2. Backend connected to real DB
🟡 Non-blocking issues — FIXED3. TypeScript field names → English
4a. Emoji icons → SVG components
4b. blue-500 replaced
4c. i18n for all KPI labels
Copilot comments — ALL FIXED
📚 Documentation — ADDED
Ready for re-review! 🙏 |
feat(US-P04): Parent IA Sessions — Learning Session Dashboard
📋 Summary
This PR implements the complete User Story US-P04: allowing a parent to view their child's AI learning sessions, with automatic summaries, quality metrics, and difficulty alerts.
🎯 User Story
Acceptance Criteria:
🖼️ Screenshots
Main View — IA Sessions Dashboard
KPI Cards:
✅ PR Checklist
Code
Security
UI/UX
Manual Validation
localhost:5173/parent/sessions🔜 Out of Scope (future stories)
generateSummary()👤 Suggested Reviewers