2.3 KiB
2.3 KiB
Story 4.4: Génération du Rapport PDF (Audit Trail)
Status: review
Story
As a Julien (Analyst), I want to export my findings as a professional PDF report, so that I can share and archive my validated analysis.
Acceptance Criteria
- PDF Generation: Backend generates a high-quality PDF containing project title, date, and metrics.
- Visual Inclusion: The PDF includes the key metrics summary (R², etc.) and the coefficient table.
- Audit Trail: The PDF explicitly lists the data cleaning steps (e.g., "34 rows excluded from Pressure_Bar").
- Environment Context: Includes library versions (Pandas, Scikit-learn) and the random seeds used.
- Download Action: Clicking "Export PDF" in the frontend triggers the download.
Tasks / Subtasks
- Dependency Update (AC: 1)
- Add
reportlaborfpdf2to the backend usinguv.
- Add
- Report Engine (AC: 1, 2, 3, 4)
- Implement
generate_pdf_report(results, metadata, audit_trail)inbackend/app/core/engine/reports.py.
- Implement
- API & Integration (AC: 5)
- Create
POST /api/v1/reports/exportendpoint. - Add the "Download PDF" button to the application header.
- Create
Dev Notes
- Aesthetic: Designed the PDF with a clean header and color-coded p-values to match the web dashboard.
- Audit: Automated version extraction for key scientific libraries (Pandas, Sklearn, etc.) to ensure complete reproducibility documentation.
- Header: Updated main page header to dynamically show the "PDF Report" button when results are ready.
Project Structure Notes
- Created
backend/app/core/engine/reports.pyfor PDF layout. - Created
backend/app/api/v1/reports.pyfor the export route. - Integrated download logic in
frontend/src/app/page.tsx.
References
- [Source: functional-requirements.md#FR21]
- [Source: epics.md#Story 4.4]
Dev Agent Record
Agent Model Used
{{agent_model_name_version}}
Completion Notes List
- Implemented professional PDF generation using
fpdf2. - Added color-coded statistical coefficients to the PDF output.
- Included a comprehensive Audit Trail section for scientific reproducibility.
- Connected the frontend download action to the backend generation service.
File List
- /backend/app/core/engine/reports.py
- /backend/app/api/v1/reports.py
- /backend/main.py
- /frontend/src/app/page.tsx