# Projet Enquete - Services Bancaires en Ligne (Cote d'Ivoire)

## Description
Application web full-stack pour un sondage academique sur l'adoption des services bancaires en ligne en Cote d'Ivoire, realise par le chercheur ASSIELOU N'Doli Guillaume de l'Universite Nangui Abrogoua.

## Stack Technologique

### Backend
- **Framework**: Django 4.2 + Django REST Framework
- **Admin**: Jazzmin (theme moderne)
- **Interactivite**: django-htmx
- **Authentification**: djangorestframework-simplejwt (JWT)
- **Base de donnees**: MySQL 8
- **Exports**: openpyxl (Excel), reportlab (PDF)

### Frontend
- **Framework**: Vue.js 3 + TypeScript
- **Build**: Vite
- **State Management**: Pinia
- **Routing**: Vue Router
- **Styling**: Tailwind CSS
- **Charts**: Chart.js + vue-chartjs
- **HTTP Client**: Axios

## Structure du Projet

```
assielou/
├── backend/                 # Django API
│   ├── config/             # Configuration Django
│   │   ├── settings.py
│   │   ├── urls.py
│   │   └── wsgi.py
│   ├── survey/             # App principale
│   │   ├── models.py       # Modele Response (65+ champs)
│   │   ├── admin.py        # Admin personnalise
│   │   └── services.py     # StatisticsService, ExportService
│   ├── api/                # API REST
│   │   ├── views.py
│   │   ├── serializers.py
│   │   └── urls.py
│   ├── templates/admin/    # Templates admin (stats, exports)
│   ├── manage.py
│   ├── requirements.txt
│   ├── passenger_wsgi.py   # Pour deploiement cPanel
│   └── .env
├── frontend/               # Vue.js SPA
│   ├── src/
│   │   ├── components/
│   │   │   ├── survey/     # SectionA-G, SurveyProgress
│   │   │   └── ui/         # LikertScale, RadioGroup, etc.
│   │   ├── views/          # HomeView, SurveyView, ThankYouView
│   │   ├── stores/         # Pinia store (survey.ts)
│   │   ├── services/       # API service (api.ts)
│   │   ├── types/          # TypeScript interfaces
│   │   └── router/
│   ├── package.json
│   ├── vite.config.ts
│   ├── tailwind.config.js
│   └── .env.development / .env.production
├── DEPLOY_O2SWITCH.md      # Guide deploiement
└── CLAUDE.md               # Ce fichier
```

## Commandes de Developpement

### Backend (Django)
```bash
cd backend
source venv/bin/activate

# Migrations
python manage.py makemigrations
python manage.py migrate

# Creer superuser
python manage.py createsuperuser

# Serveur dev
python manage.py runserver 8000

# Collecte fichiers statiques (production)
python manage.py collectstatic
```

### Frontend (Vue.js)
```bash
cd frontend

# Installation
npm install

# Serveur dev
npm run dev

# Build production
npm run build
```

## URLs de Developpement

| Service | URL |
|---------|-----|
| Frontend Vue.js | http://localhost:5173 |
| API Django | http://localhost:8000/api/ |
| Admin Django | http://localhost:8000/admin/ |
| Config Survey | http://localhost:8000/api/survey/config/ |

## Endpoints API

### Public
- `GET /api/survey/config/` - Configuration du questionnaire
- `POST /api/survey/submit/` - Soumettre reponse complete
- `POST /api/survey/partial/` - Sauvegarder reponse partielle

### Authentifie (JWT)
- `POST /api/auth/token/` - Obtenir token JWT
- `POST /api/auth/token/refresh/` - Rafraichir token
- `GET /api/responses/` - Liste des reponses
- `GET /api/statistics/` - Statistiques globales
- `GET /api/statistics/<section>/` - Stats par section

## Sections du Questionnaire

| Section | Description | Champs |
|---------|-------------|--------|
| A | Informations personnelles | education, gender, job, age |
| B | Usage des comptes | has_online_banking, has_mobile, has_bank |
| C | Frequence d'utilisation | freq_mobile, freq_bank, freq_other |
| D | Technologies | tech_smartphone, tech_computer, etc. |
| E | Services bancaires | 17 items (send_money, balance, etc.) |
| F | Facteurs adoption/freins | 11 facteurs + 18 freins |
| G | Commentaires | final_comment, contact_email |

## Echelle Likert (1-6)
1. Jamais
2. Rarement
3. Parfois
4. Souvent
5. Tres souvent
6. Ne sais pas

## Credentials Dev

### Django Admin
- **User**: admin
- **Password**: admin123

### MySQL Local
- **User**: root
- **Password**: root123
- **Database**: assielou_survey

## Production (o2switch)

- **Domaine**: enquete.zdslab.ovh
- **Database**: sc4zds_enquete
- **User DB**: sc4zds_enquete

Voir `DEPLOY_O2SWITCH.md` pour le guide complet.

## Notes Importantes

1. **CORS**: Configure pour autoriser localhost:5173 en dev
2. **JWT**: Tokens expirent apres 24h
3. **Validation**: Echelle Likert validee entre 1-6
4. **Exports**: CSV, Excel, PDF disponibles dans l'admin
5. **Statistiques**: Calculs automatiques des moyennes, distributions
