Skip to content

pi-dev-java2026/Esprit-PIDEV-3A29-2526-Dinari

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Dinari

A fintech education platform built with Symfony 6.4 and a Python ML microservice. Users can browse courses, take quizzes, get personalized recommendations, and chat with an AI assistant — all without creating an account.


Tech Stack

Layer Technology
Backend Symfony 6.4 (PHP 8.1+)
ORM Doctrine ORM 3.x
Templating Twig 3.x
Database MySQL 8
Admin UI EasyAdmin 4 + custom admin
Frontend Bootstrap 5, Stimulus 3, Turbo 7
Charts Chart.js via symfony/ux-chartjs
AI Chatbot Python FastAPI + scikit-learn TF-IDF

Features

  • Courses & Chapters — browse fintech courses organized into ordered chapters with video, images, and key takeaways
  • Quiz System — multiple-choice quizzes with practice and timed exam modes
  • Recommendations — personalized course suggestions based on quiz performance and weak topics
  • Notifications — automatic in-app alerts after quiz completion (score feedback + recommendations ready)
  • AI Chatbot — domain-specific assistant trained on the platform's own course content
  • Statistics — personal learning dashboard with score history and progress charts
  • Comments & Reactions — emoji reactions on course chapter comments
  • i18n — French / English / Arabic with RTL support
  • Admin Dashboard — full content management for courses, chapters, quizzes, and comments

Prerequisites

  • PHP 8.1+
  • Composer
  • MySQL 8
  • Node.js (for asset building, optional — importmap is used)
  • Python 3.10+ (for the chatbot microservice)
  • Symfony CLI (recommended)

Installation

1. Clone and install PHP dependencies

git clone <repo-url>
cd Dinari
composer install

2. Configure environment

cp .env .env.local

Edit .env.local and set your values:

APP_SECRET=your_secret_here
DATABASE_URL="mysql://root:password@localhost:3306/pidev?serverVersion=8.0.32&charset=utf8mb4"
CHATBOT_SERVICE_URL=http://localhost:8001

3. Create the database and run migrations

php bin/console doctrine:database:create
php bin/console doctrine:migrations:migrate

4. (Optional) Load fixtures

mysql -u root pidev < fixtures.sql

5. Install frontend assets

php bin/console importmap:install
php bin/console assets:install

6. Start the Symfony server

symfony server:start
# or
php -S localhost:8000 -t public/

Chatbot Microservice Setup

The AI chatbot runs as a separate Python process. It must be running for the chat widget to work. If it is down, the widget shows a graceful error message.

1. Install Python dependencies

cd chatbot_service
pip install -r requirements.txt

2. Configure the database connection

cp .env.example .env

Edit chatbot_service/.env:

DB_HOST=localhost
DB_PORT=3306
DB_NAME=pidev
DB_USER=root
DB_PASSWORD=

3. Build the training dataset from the database

python build_dataset.py

This connects to MySQL, extracts all course/chapter/quiz content, and writes dataset.json.

4. Train the model

python train.py

This fits a TF-IDF model on the dataset and saves model.pkl.

5. Start the FastAPI server

uvicorn app:app --host 0.0.0.0 --port 8001

The chatbot is now available at http://localhost:8001. Symfony's CHATBOT_SERVICE_URL env var must point to this address.

Retrain after adding new courses

After adding or editing courses in the admin, retrain the model:

# Option A — manually
python build_dataset.py && python train.py

# Option B — via API (while the server is running)
curl -X POST http://localhost:8001/retrain

Project Structure

Dinari/
├── src/
│   ├── Controller/
│   │   ├── Admin/          # Admin-side controllers + EasyAdmin CRUDs
│   │   └── Client/         # User-facing controllers
│   ├── Entity/             # Doctrine entities (Cours, Chapitre, Quiz, QuizResultat,
│   │                       #   Notification, Commentaire, Reaction, ChapitreTache, ChapitreQuestion)
│   ├── Event/              # QuizCompletedEvent, RecommendationsGeneratedEvent
│   ├── EventSubscriber/    # NotificationEventSubscriber
│   ├── Repository/         # Doctrine repositories
│   └── Service/            # AssistantService, RecommendationService, NotificationService
├── templates/
│   ├── base.html.twig      # Main layout (navbar, footer, chatbot widget, i18n)
│   ├── chatbot/            # _widget.html.twig
│   ├── client/             # All user-facing pages
│   └── admin/              # Admin dashboard pages
├── migrations/             # Doctrine database migrations
├── config/
│   ├── services.yaml       # DI config (chatbot URL injection)
│   └── packages/           # Bundle configuration
├── public/                 # Web root (CSS, JS, fonts, images)
└── assets/                 # Stimulus controllers, app.js

chatbot_service/
├── app.py                  # FastAPI server (/chat, /health, /retrain)
├── train.py                # Trains TF-IDF model → model.pkl
├── build_dataset.py        # Extracts DB content → dataset.json
├── dataset.json            # Training data (Q&A pairs)
├── model.pkl               # Trained model (generated, not committed)
└── requirements.txt        # Python dependencies

Key Routes

URL Description
/ Homepage
/cours Course listing
/quiz Quiz listing
/recommandations Personalized recommendations
/notifications In-app notifications
/statistiques Personal learning stats
/chatbot/message Chatbot API (POST, JSON)
/admin Custom admin dashboard
/easyadmin EasyAdmin CRUD interface

Environment Variables

Variable Description Default
APP_ENV Symfony environment (dev/prod) dev
APP_SECRET Symfony secret key
DATABASE_URL MySQL connection string
CHATBOT_SERVICE_URL URL of the Python chatbot microservice http://localhost:8001
MAILER_DSN Mailer transport DSN null://null
MESSENGER_TRANSPORT_DSN Messenger transport doctrine://default

Documentation

  • ARCHITECTURE.md — full project structure, entities, API routes, and design decisions
  • MODULES_DEEP_DIVE.md — deep walkthrough of Chatbot, Notifications, Recommendations, and i18n

Notes

  • There is no user authentication. All personalization is scoped to the browser session.
  • The chatbot is entirely self-contained — no external AI API is used.
  • The admin at /admin is the main content management interface. /easyadmin is a secondary CRUD interface.
  • Arabic language support includes full RTL layout switching.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors