Spaces:
Paused
Paused
Delete Bloc2 - Data Architecture
Browse files- Bloc2 - Data Architecture/Dossier/[Jedha] - {Certification} - Bloc 2.pdf +0 -3
- Bloc2 - Data Architecture/Presentation/[Jedha] - {Certification} - Bloc 2 - Présentation.pdf +0 -3
- Bloc2 - Data Architecture/Projet/Architecture/.gitignore +0 -60
- Bloc2 - Data Architecture/Projet/Architecture/README.md +0 -727
- Bloc2 - Data Architecture/Projet/Architecture/airflow/README_AIRFLOW.md +0 -214
- Bloc2 - Data Architecture/Projet/Architecture/airflow/dags/daily_aggregations.py +0 -328
- Bloc2 - Data Architecture/Projet/Architecture/airflow/dags/data_quality_checks.py +0 -302
- Bloc2 - Data Architecture/Projet/Architecture/airflow/dags/etl_postgres_to_clickhouse.py +0 -307
- Bloc2 - Data Architecture/Projet/Architecture/airflow/requirements.txt +0 -7
- Bloc2 - Data Architecture/Projet/Architecture/clickhouse/init.sql +0 -39
- Bloc2 - Data Architecture/Projet/Architecture/docker-compose.yml +0 -527
- Bloc2 - Data Architecture/Projet/Architecture/fastapi/Dockerfile +0 -29
- Bloc2 - Data Architecture/Projet/Architecture/fastapi/database.py +0 -156
- Bloc2 - Data Architecture/Projet/Architecture/fastapi/fraud_detector.py +0 -153
- Bloc2 - Data Architecture/Projet/Architecture/fastapi/main.py +0 -668
- Bloc2 - Data Architecture/Projet/Architecture/fastapi/models.py +0 -65
- Bloc2 - Data Architecture/Projet/Architecture/fastapi/requirements.txt +0 -37
- Bloc2 - Data Architecture/Projet/Architecture/flask/Dockerfile +0 -15
- Bloc2 - Data Architecture/Projet/Architecture/flask/app.py +0 -105
- Bloc2 - Data Architecture/Projet/Architecture/flask/requirements.txt +0 -3
- Bloc2 - Data Architecture/Projet/Architecture/flask/templates/index.html +0 -361
- Bloc2 - Data Architecture/Projet/Architecture/grafana/provisioning/dashboards/dashboard.yml +0 -11
- Bloc2 - Data Architecture/Projet/Architecture/grafana/provisioning/datasources/datasources.yml +0 -26
- Bloc2 - Data Architecture/Projet/Architecture/init-minio.sh +0 -73
- Bloc2 - Data Architecture/Projet/Architecture/mlflow/model/README.md +0 -24
- Bloc2 - Data Architecture/Projet/Architecture/mlflow/model/logistic_regression_fraud.pkl +0 -3
- Bloc2 - Data Architecture/Projet/Architecture/mlflow/train_model.py +0 -34
- Bloc2 - Data Architecture/Projet/Architecture/mongodb/init.js +0 -25
- Bloc2 - Data Architecture/Projet/Architecture/mongodb/seed_data.js +0 -55
- Bloc2 - Data Architecture/Projet/Architecture/neo4j/init.cypher +0 -28
- Bloc2 - Data Architecture/Projet/Architecture/postgres/init.sql +0 -183
- Bloc2 - Data Architecture/Projet/Architecture/postgres/seed_data.sql +0 -200
- Bloc2 - Data Architecture/Projet/Architecture/start.sh +0 -133
- Bloc2 - Data Architecture/Projet/Architecture/train-and-deploy-model.sh +0 -84
- Bloc2 - Data Architecture/Projet/Diagramme d'architecture/[Jedha] - {Bloc 2} - Strip data architecture.pdf +0 -3
- Bloc2 - Data Architecture/Projet/Modèles de données/[Jedha] - {Certification} - Bloc 2 OLAP - Stripe.sqs +0 -540
- Bloc2 - Data Architecture/Projet/Modèles de données/[Jedha] - {Certification} - Bloc 2 OLTP - Stripe.sqs +0 -1179
- Bloc2 - Data Architecture/README.md +0 -57
Bloc2 - Data Architecture/Dossier/[Jedha] - {Certification} - Bloc 2.pdf
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:5ef629ccef4fb08cf994d4b2d74393e6d234bc6d62199f2c9a345d5a0a46b300
|
| 3 |
-
size 1929968
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Presentation/[Jedha] - {Certification} - Bloc 2 - Présentation.pdf
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:97a53eef20ceeb49ad164f53fee9d6ae8d34c8a06d30309a20a7a5f22b337c5a
|
| 3 |
-
size 8748379
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/.gitignore
DELETED
|
@@ -1,60 +0,0 @@
|
|
| 1 |
-
# =============================================================================
|
| 2 |
-
# SECRET FILES - DO NOT COMMIT
|
| 3 |
-
# =============================================================================
|
| 4 |
-
secret.sh
|
| 5 |
-
.env
|
| 6 |
-
*.env
|
| 7 |
-
.env.*
|
| 8 |
-
|
| 9 |
-
# =============================================================================
|
| 10 |
-
# DOCKER & DATA VOLUMES
|
| 11 |
-
# =============================================================================
|
| 12 |
-
docker-compose.override.yml
|
| 13 |
-
|
| 14 |
-
# =============================================================================
|
| 15 |
-
# IDE & EDITOR FILES
|
| 16 |
-
# =============================================================================
|
| 17 |
-
.vscode/
|
| 18 |
-
.idea/
|
| 19 |
-
.claude
|
| 20 |
-
*.swp
|
| 21 |
-
*.swo
|
| 22 |
-
*~
|
| 23 |
-
|
| 24 |
-
# =============================================================================
|
| 25 |
-
# OS FILES
|
| 26 |
-
# =============================================================================
|
| 27 |
-
.DS_Store
|
| 28 |
-
Thumbs.db
|
| 29 |
-
desktop.ini
|
| 30 |
-
nul
|
| 31 |
-
|
| 32 |
-
# =============================================================================
|
| 33 |
-
# PYTHON
|
| 34 |
-
# =============================================================================
|
| 35 |
-
__pycache__/
|
| 36 |
-
*.py[cod]
|
| 37 |
-
*$py.class
|
| 38 |
-
*.so
|
| 39 |
-
.Python
|
| 40 |
-
venv/
|
| 41 |
-
env/
|
| 42 |
-
ENV/
|
| 43 |
-
.venv
|
| 44 |
-
|
| 45 |
-
# =============================================================================
|
| 46 |
-
# LOGS
|
| 47 |
-
# =============================================================================
|
| 48 |
-
*.log
|
| 49 |
-
logs/
|
| 50 |
-
|
| 51 |
-
# =============================================================================
|
| 52 |
-
# TEMPORARY FILES
|
| 53 |
-
# =============================================================================
|
| 54 |
-
*.tmp
|
| 55 |
-
*.temp
|
| 56 |
-
.cache/
|
| 57 |
-
# =============================================================================
|
| 58 |
-
# DOCUMENTATIONS FILES
|
| 59 |
-
# =============================================================================
|
| 60 |
-
Documentations/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/README.md
DELETED
|
@@ -1,727 +0,0 @@
|
|
| 1 |
-
# Certification AIA - Bloc 2 : Architecture de Données Complète
|
| 2 |
-
|
| 3 |
-
**Auteur:** David Rambeau
|
| 4 |
-
**Certification:** Architecte en Intelligence Artificielle (RNCP38777)
|
| 5 |
-
**Bloc:** Concevoir et déployer des architectures de données pour l'IA
|
| 6 |
-
**Cas d'usage:** Détection de fraude Stripe (paiements en ligne)
|
| 7 |
-
|
| 8 |
-
---
|
| 9 |
-
|
| 10 |
-
## 📋 **VUE D'ENSEMBLE**
|
| 11 |
-
|
| 12 |
-
Cette plateforme complète démontre une architecture complete avec 14 services interconnectés pour la détection de fraude en temps réel sur des transactions de paiement.
|
| 13 |
-
|
| 14 |
-
### **Architecture Technique**
|
| 15 |
-
|
| 16 |
-
```
|
| 17 |
-
┌─────────────┬───────────────┬──────────────┬─────────────┐
|
| 18 |
-
│ OLTP │ OLAP │ NoSQL │ Streaming │
|
| 19 |
-
│ PostgreSQL │ ClickHouse │ MongoDB │ Kafka │
|
| 20 |
-
│ (5 tables) │ (Analytics) │ (Flexible) │ (Events) │
|
| 21 |
-
└─────────────┴───────────────┴──────────────┴─────────────┘
|
| 22 |
-
┌─────────────┬───────────────┬──────────────┬─────────────┐
|
| 23 |
-
│ Cache │ Graph │ Object │ Search │
|
| 24 |
-
│ Redis │ Neo4j │ MinIO │ Elastic │
|
| 25 |
-
│ (Perf) │ (Fraud Net) │ (Storage) │ (Logs) │
|
| 26 |
-
└─────────────┴───────────────┴──────────────┴─────────────┘
|
| 27 |
-
┌─────────────┬───────────────┬──────────────┬─────────────┐
|
| 28 |
-
│ ML │ API │ Web UI │ Monitoring │
|
| 29 |
-
│ MLflow │ FastAPI │ Flask │ Grafana │
|
| 30 |
-
│ (Models) │ (Backend) │ (Frontend) │ (Viz) │
|
| 31 |
-
└─────────────┴───────────────┴──────────────┴─────────────┘
|
| 32 |
-
```
|
| 33 |
-
|
| 34 |
-
---
|
| 35 |
-
|
| 36 |
-
## 🚀 **DÉMARRAGE RAPIDE**
|
| 37 |
-
|
| 38 |
-
### **Prérequis**
|
| 39 |
-
|
| 40 |
-
- Docker Desktop (ou Docker Engine + Docker Compose)
|
| 41 |
-
- Minimum 8 GB RAM disponible
|
| 42 |
-
- Ports libres : 3000, 5000, 5050, 5432, 5601, 6379, 7474, 7687, 8000, 8123, 9002, 9001, 9092, 9200, 27017, 29092
|
| 43 |
-
|
| 44 |
-
### **Installation et Lancement**
|
| 45 |
-
|
| 46 |
-
```bash
|
| 47 |
-
# 1. Extraire l'archive
|
| 48 |
-
unzip [architectureStripe].zip
|
| 49 |
-
cd [architectureStripe]
|
| 50 |
-
|
| 51 |
-
# 2. Lancer tous les services
|
| 52 |
-
docker-compose up -d
|
| 53 |
-
|
| 54 |
-
# 3. Attendre que tous les services soient prêts (~2-3 minutes)
|
| 55 |
-
docker-compose ps
|
| 56 |
-
|
| 57 |
-
# 4. Vérifier la santé des services
|
| 58 |
-
docker-compose logs -f fastapi
|
| 59 |
-
```
|
| 60 |
-
|
| 61 |
-
**✅ C'est tout ! La plateforme est opérationnelle.**
|
| 62 |
-
|
| 63 |
-
---
|
| 64 |
-
|
| 65 |
-
## 🌐 **ACCÈS AUX SERVICES**
|
| 66 |
-
|
| 67 |
-
Une fois les services démarrés, accédez aux interfaces :
|
| 68 |
-
|
| 69 |
-
| Service | URL | Credentials | Description |
|
| 70 |
-
| -------------------- | -------------------------- | ----------------------------- | ------------------------------------------- |
|
| 71 |
-
| **🎨 Interface Web** | http://localhost:5050 | - | Simulation transactions (Bootstrap UI) |
|
| 72 |
-
| **📡 API Backend** | http://localhost:8000/docs | - | FastAPI Swagger (documentation interactive) |
|
| 73 |
-
| **📊 Grafana** | http://localhost:3000 | admin / stripe_password | Dashboards & visualisation |
|
| 74 |
-
| **🔍 Kibana** | http://localhost:5601 | - | Logs & monitoring (Elasticsearch) |
|
| 75 |
-
| **🤖 MLflow** | http://localhost:5000 | - | ML model tracking |
|
| 76 |
-
| **🕸️ Neo4j Browser** | http://localhost:7474 | neo4j / stripe_password | Graph database explorer |
|
| 77 |
-
| **💾 MinIO Console** | http://localhost:9001 | stripe_user / stripe_password | Object storage UI |
|
| 78 |
-
|
| 79 |
-
---
|
| 80 |
-
|
| 81 |
-
## 🎯 **DÉMONSTRATION**
|
| 82 |
-
|
| 83 |
-
### **1. Interface Web (Recommandé)**
|
| 84 |
-
|
| 85 |
-
Ouvrez http://nas.emendi.fr:5050/ pour :
|
| 86 |
-
|
| 87 |
-
- ✅ Simuler des transactions normales
|
| 88 |
-
- ⚠️ Simuler des fraudes (bouton "Simulate Fraud")
|
| 89 |
-
- 📊 Voir les résultats en temps réel
|
| 90 |
-
- 📋 Historique des transactions
|
| 91 |
-
|
| 92 |
-
### **2. API Backend**
|
| 93 |
-
|
| 94 |
-
Testez l'API directement depuis Swagger : http://localhost:8000/docs
|
| 95 |
-
|
| 96 |
-
**Exemple de requête:**
|
| 97 |
-
|
| 98 |
-
```bash
|
| 99 |
-
curl -X POST "http://localhost:8000/api/transactions" \
|
| 100 |
-
-H "Content-Type: application/json" \
|
| 101 |
-
-d '{
|
| 102 |
-
"user_id": "user_001",
|
| 103 |
-
"merchant_id": "merchant_005",
|
| 104 |
-
"amount": 2499.99,
|
| 105 |
-
"currency": "EUR",
|
| 106 |
-
"payment_method": "card",
|
| 107 |
-
"card_last4": "9999",
|
| 108 |
-
"ip_address": "185.220.102.8",
|
| 109 |
-
"device_type": "desktop"
|
| 110 |
-
}'
|
| 111 |
-
```
|
| 112 |
-
|
| 113 |
-
**Réponse attendue:**
|
| 114 |
-
|
| 115 |
-
```json
|
| 116 |
-
{
|
| 117 |
-
"transaction_id": "txn_20241130_001",
|
| 118 |
-
"status": "failed",
|
| 119 |
-
"fraud_score": 95,
|
| 120 |
-
"ml_probability": 0.9823,
|
| 121 |
-
"is_fraud": true,
|
| 122 |
-
"message": "Transaction blocked"
|
| 123 |
-
}
|
| 124 |
-
```
|
| 125 |
-
|
| 126 |
-
---
|
| 127 |
-
|
| 128 |
-
## 🗄️ **ARCHITECTURE DES DONNÉES**
|
| 129 |
-
|
| 130 |
-
### **PostgreSQL (OLTP) - Données Transactionnelles**
|
| 131 |
-
|
| 132 |
-
**Tables principales:**
|
| 133 |
-
|
| 134 |
-
- `users` - 10 utilisateurs de test
|
| 135 |
-
- `merchants` - 10 marchands (Amazon, Spotify, Uber...)
|
| 136 |
-
- `transactions` - Historique complet des transactions
|
| 137 |
-
- `fraud_events` - Événements de fraude détectés
|
| 138 |
-
- `refunds` - Remboursements
|
| 139 |
-
|
| 140 |
-
**Connexion:**
|
| 141 |
-
|
| 142 |
-
```bash
|
| 143 |
-
docker-compose exec postgres psql -U stripe_user -d stripe_oltp
|
| 144 |
-
|
| 145 |
-
# Exemples de requêtes
|
| 146 |
-
SELECT COUNT(*) FROM transactions;
|
| 147 |
-
SELECT * FROM transactions WHERE is_fraud = TRUE;
|
| 148 |
-
SELECT * FROM v_transactions_detailed LIMIT 10;
|
| 149 |
-
```
|
| 150 |
-
|
| 151 |
-
### **ClickHouse (OLAP) - Analytics**
|
| 152 |
-
|
| 153 |
-
Optimisé pour les requêtes analytiques sur volumes massifs.
|
| 154 |
-
|
| 155 |
-
```bash
|
| 156 |
-
docker-compose exec clickhouse clickhouse-client --user stripe_user --password stripe_password
|
| 157 |
-
|
| 158 |
-
# Exemple de requête analytique
|
| 159 |
-
SELECT
|
| 160 |
-
toDate(created_at) as date,
|
| 161 |
-
COUNT(*) as total_transactions,
|
| 162 |
-
SUM(is_fraud) as fraud_count,
|
| 163 |
-
ROUND(100.0 * SUM(is_fraud) / COUNT(*), 2) as fraud_rate
|
| 164 |
-
FROM transactions_olap
|
| 165 |
-
GROUP BY date
|
| 166 |
-
ORDER BY date DESC;
|
| 167 |
-
```
|
| 168 |
-
|
| 169 |
-
### **MongoDB (NoSQL) - Documents Flexibles**
|
| 170 |
-
|
| 171 |
-
Stocke les litiges, catalogues produits et données à schéma variable.
|
| 172 |
-
|
| 173 |
-
```bash
|
| 174 |
-
docker-compose exec mongodb mongosh -u stripe_user -p stripe_password
|
| 175 |
-
|
| 176 |
-
use stripe_nosql
|
| 177 |
-
db.disputes.find().pretty()
|
| 178 |
-
db.product_catalog.find()
|
| 179 |
-
```
|
| 180 |
-
|
| 181 |
-
### **Redis (Cache) - Performance**
|
| 182 |
-
|
| 183 |
-
Cache les scores de fraude et données fréquemment accédées.
|
| 184 |
-
|
| 185 |
-
```bash
|
| 186 |
-
docker-compose exec redis redis-cli -a stripe_password
|
| 187 |
-
|
| 188 |
-
# Exemples
|
| 189 |
-
GET fraud_score:txn_0001
|
| 190 |
-
GET user_fraud:user_001
|
| 191 |
-
KEYS fraud_score:*
|
| 192 |
-
```
|
| 193 |
-
|
| 194 |
-
### **Neo4j (Graph) - Réseau de Fraude**
|
| 195 |
-
|
| 196 |
-
Analyse les relations entre utilisateurs et marchands frauduleux.
|
| 197 |
-
|
| 198 |
-
```cypher
|
| 199 |
-
// Ouvrir http://localhost:7474
|
| 200 |
-
// Login: neo4j / stripe_password
|
| 201 |
-
|
| 202 |
-
// Trouver le réseau de fraude
|
| 203 |
-
MATCH path = (u:User)-[:FRAUD_DETECTED*1..2]-(m:Merchant)
|
| 204 |
-
RETURN path
|
| 205 |
-
LIMIT 50;
|
| 206 |
-
|
| 207 |
-
// Utilisateurs avec le plus de fraudes
|
| 208 |
-
MATCH (u:User)-[f:FRAUD_DETECTED]->(m:Merchant)
|
| 209 |
-
RETURN u.name, COUNT(f) as fraud_count
|
| 210 |
-
ORDER BY fraud_count DESC;
|
| 211 |
-
```
|
| 212 |
-
|
| 213 |
-
---
|
| 214 |
-
|
| 215 |
-
## 🤖 **MACHINE LEARNING**
|
| 216 |
-
|
| 217 |
-
### **Modèle de Détection de Fraude**
|
| 218 |
-
|
| 219 |
-
**Algorithme:** Régression Logistique (pré-entraîné)
|
| 220 |
-
**Features (10):**
|
| 221 |
-
|
| 222 |
-
1. `amount` - Montant de la transaction
|
| 223 |
-
2. `hour` - Heure de la journée
|
| 224 |
-
3. `velocity_1h` - Transactions dans la dernière heure
|
| 225 |
-
4. `avg_amount_user` - Montant moyen de l'utilisateur
|
| 226 |
-
5. `user_total_tx` - Total transactions utilisateur
|
| 227 |
-
6. `amount_deviation` - Écart par rapport à la moyenne
|
| 228 |
-
7. `high_amount` - Flag montant élevé (>500€)
|
| 229 |
-
8. `unusual_hour` - Flag heure inhabituelle (3h-6h)
|
| 230 |
-
9. `high_velocity` - Flag vélocité élevée (≥5 tx/h)
|
| 231 |
-
10. `new_user` - Flag nouvel utilisateur (<5 tx)
|
| 232 |
-
|
| 233 |
-
**Seuil de décision:** 70% de probabilité de fraude
|
| 234 |
-
|
| 235 |
-
### **MLflow Tracking**
|
| 236 |
-
|
| 237 |
-
Accédez à http://localhost:5000 pour :
|
| 238 |
-
|
| 239 |
-
- 📊 Visualiser les métriques du modèle
|
| 240 |
-
- 📝 Suivre les expériences
|
| 241 |
-
- 🔄 Versionner les modèles
|
| 242 |
-
|
| 243 |
-
---
|
| 244 |
-
|
| 245 |
-
## 📊 **MONITORING & OBSERVABILITÉ**
|
| 246 |
-
|
| 247 |
-
### **Grafana Dashboards**
|
| 248 |
-
|
| 249 |
-
http://localhost:3000 (admin / stripe_password)
|
| 250 |
-
|
| 251 |
-
Dashboards préconfigurés :
|
| 252 |
-
|
| 253 |
-
- **Volume de Transactions** - Évolution temporelle
|
| 254 |
-
- **Taux de Fraude** - Statistiques en temps réel
|
| 255 |
-
- **Top Marchands** - Classement par volume
|
| 256 |
-
- **Alertes** - Seuils dépassés
|
| 257 |
-
|
| 258 |
-
### **Elasticsearch & Kibana**
|
| 259 |
-
|
| 260 |
-
http://localhost:5601
|
| 261 |
-
|
| 262 |
-
- Tous les événements sont loggés dans Elasticsearch
|
| 263 |
-
- Recherche full-text sur les transactions
|
| 264 |
-
- Analyse des patterns de fraude
|
| 265 |
-
|
| 266 |
-
---
|
| 267 |
-
|
| 268 |
-
## 🔄 **FLUX DE DONNÉES**
|
| 269 |
-
|
| 270 |
-
### **Processus de Détection de Fraude**
|
| 271 |
-
|
| 272 |
-
```
|
| 273 |
-
1. TRANSACTION INITIALE (Flask UI ou API)
|
| 274 |
-
↓
|
| 275 |
-
2. VALIDATION & ENRICHISSEMENT (FastAPI)
|
| 276 |
-
- Vérification utilisateur (PostgreSQL)
|
| 277 |
-
- Cache vélocité (Redis)
|
| 278 |
-
↓
|
| 279 |
-
3. DÉTECTION ML (MLflow Model)
|
| 280 |
-
- 10 features calculées
|
| 281 |
-
- Score 0-100
|
| 282 |
-
↓
|
| 283 |
-
4. RÈGLES MÉTIER
|
| 284 |
-
- Score ≥90 → BLOCKED
|
| 285 |
-
- Score 70-89 → MANUAL REVIEW
|
| 286 |
-
- Score <70 → APPROVED
|
| 287 |
-
↓
|
| 288 |
-
5. STOCKAGE MULTI-BASES
|
| 289 |
-
- PostgreSQL (OLTP)
|
| 290 |
-
- MongoDB (Flexible)
|
| 291 |
-
- Redis (Cache)
|
| 292 |
-
↓
|
| 293 |
-
6. STREAMING & ANALYTICS
|
| 294 |
-
- Kafka (Event Stream)
|
| 295 |
-
- ClickHouse (OLAP)
|
| 296 |
-
- Neo4j (Graph Fraud Network)
|
| 297 |
-
↓
|
| 298 |
-
7. MONITORING & LOGS
|
| 299 |
-
- Elasticsearch (Logs)
|
| 300 |
-
- Grafana (Viz)
|
| 301 |
-
```
|
| 302 |
-
|
| 303 |
-
---
|
| 304 |
-
|
| 305 |
-
## 🛠️ **COMMANDES UTILES**
|
| 306 |
-
|
| 307 |
-
### **Gestion des Services**
|
| 308 |
-
|
| 309 |
-
```bash
|
| 310 |
-
# Démarrer tous les services
|
| 311 |
-
docker-compose up -d
|
| 312 |
-
|
| 313 |
-
# Arrêter tous les services
|
| 314 |
-
docker-compose down
|
| 315 |
-
|
| 316 |
-
# Voir l'état des services
|
| 317 |
-
docker-compose ps
|
| 318 |
-
|
| 319 |
-
# Voir les logs
|
| 320 |
-
docker-compose logs -f
|
| 321 |
-
|
| 322 |
-
# Voir les logs d'un service spécifique
|
| 323 |
-
docker-compose logs -f fastapi
|
| 324 |
-
docker-compose logs -f postgres
|
| 325 |
-
|
| 326 |
-
# Redémarrer un service
|
| 327 |
-
docker-compose restart fastapi
|
| 328 |
-
|
| 329 |
-
# Rebuild après modification code
|
| 330 |
-
docker-compose up -d --build fastapi
|
| 331 |
-
|
| 332 |
-
# Arrêter et supprimer les volumes (RESET COMPLET)
|
| 333 |
-
docker-compose down -v
|
| 334 |
-
```
|
| 335 |
-
|
| 336 |
-
### **Accès aux Bases de Données**
|
| 337 |
-
|
| 338 |
-
```bash
|
| 339 |
-
# PostgreSQL
|
| 340 |
-
docker-compose exec postgres psql -U stripe_user -d stripe_oltp
|
| 341 |
-
|
| 342 |
-
# MongoDB
|
| 343 |
-
docker-compose exec mongodb mongosh -u stripe_user -p stripe_password
|
| 344 |
-
|
| 345 |
-
# Redis
|
| 346 |
-
docker-compose exec redis redis-cli -a stripe_password
|
| 347 |
-
|
| 348 |
-
# ClickHouse
|
| 349 |
-
docker-compose exec clickhouse clickhouse-client --user stripe_user --password stripe_password
|
| 350 |
-
```
|
| 351 |
-
|
| 352 |
-
### **Debug & Dépannage**
|
| 353 |
-
|
| 354 |
-
```bash
|
| 355 |
-
# Vérifier les healthchecks
|
| 356 |
-
docker-compose ps
|
| 357 |
-
|
| 358 |
-
# Entrer dans un conteneur
|
| 359 |
-
docker-compose exec fastapi /bin/bash
|
| 360 |
-
docker-compose exec flask /bin/sh
|
| 361 |
-
|
| 362 |
-
# Voir l'utilisation des ressources
|
| 363 |
-
docker stats
|
| 364 |
-
|
| 365 |
-
# Nettoyer les ressources Docker
|
| 366 |
-
docker system prune -a
|
| 367 |
-
```
|
| 368 |
-
|
| 369 |
-
---
|
| 370 |
-
|
| 371 |
-
## 📁 **STRUCTURE DU PROJET**
|
| 372 |
-
|
| 373 |
-
```
|
| 374 |
-
dataArch/
|
| 375 |
-
├── docker-compose.yml # Orchestration 14 services
|
| 376 |
-
├── .env # Variables d'environnement
|
| 377 |
-
├── README.md # Ce fichier
|
| 378 |
-
│
|
| 379 |
-
├── postgres/ # OLTP Database
|
| 380 |
-
│ ├── init.sql # Schéma (5 tables)
|
| 381 |
-
│ └── seed_data.sql # 100 transactions de démo
|
| 382 |
-
│
|
| 383 |
-
├── clickhouse/ # OLAP Analytics
|
| 384 |
-
│ └── init.sql # Schéma colonnar + vues
|
| 385 |
-
│
|
| 386 |
-
├── mongodb/ # NoSQL Database
|
| 387 |
-
│ ├── init.js # Collections
|
| 388 |
-
│ └── seed_data.js # Documents de démo
|
| 389 |
-
│
|
| 390 |
-
├── neo4j/ # Graph Database
|
| 391 |
-
│ └── init.cypher # Graphe de fraude
|
| 392 |
-
│
|
| 393 |
-
├── redis/ # Cache
|
| 394 |
-
│
|
| 395 |
-
├── kafka/ # Streaming
|
| 396 |
-
│
|
| 397 |
-
├── fastapi/ # Backend API
|
| 398 |
-
│ ├── Dockerfile
|
| 399 |
-
│ ├── requirements.txt
|
| 400 |
-
│ ├── main.py # Routes API
|
| 401 |
-
│ ├── database.py # Connexions
|
| 402 |
-
│ ├── models.py # Pydantic models
|
| 403 |
-
│ └── fraud_detector.py # Détection ML
|
| 404 |
-
│
|
| 405 |
-
├── flask/ # Frontend Web
|
| 406 |
-
│ ├── Dockerfile
|
| 407 |
-
│ ├── requirements.txt
|
| 408 |
-
│ ├── app.py # Application Flask
|
| 409 |
-
│ └── templates/
|
| 410 |
-
│ └── index.html # UI Bootstrap
|
| 411 |
-
│
|
| 412 |
-
├── mlflow/ # ML Tracking
|
| 413 |
-
│ ├── train_model.py # Script entraînement
|
| 414 |
-
│ └── model/
|
| 415 |
-
│ └── logistic_regression_fraud.pkl
|
| 416 |
-
│
|
| 417 |
-
├── grafana/ # Visualisation
|
| 418 |
-
│ ├── provisioning/
|
| 419 |
-
│ │ ├── datasources/
|
| 420 |
-
│ │ └── dashboards/
|
| 421 |
-
│ └── dashboards/
|
| 422 |
-
│
|
| 423 |
-
└── elasticsearch/ # Logs & Search
|
| 424 |
-
```
|
| 425 |
-
|
| 426 |
-
---
|
| 427 |
-
|
| 428 |
-
## 🎓 **CONTEXTE CERTIFICATION AIA**
|
| 429 |
-
|
| 430 |
-
### **Bloc 2 : Concevoir et déployer des architectures de données**
|
| 431 |
-
|
| 432 |
-
Cette plateforme démontre les compétences suivantes :
|
| 433 |
-
|
| 434 |
-
#### **1. Identification des besoins architecturaux**
|
| 435 |
-
|
| 436 |
-
✅ Contraintes techniques : Latence <100ms, volumes massifs, disponibilité 24/7
|
| 437 |
-
✅ Contraintes opérationnelles : Multi-bases, scalabilité horizontale
|
| 438 |
-
✅ Normes : RGPD (données bancaires), PCI-DSS (paiements)
|
| 439 |
-
|
| 440 |
-
#### **2. Cahier des charges d'architecture**
|
| 441 |
-
|
| 442 |
-
✅ **OLTP (PostgreSQL)** : Transactions critiques, ACID strict, traçabilité
|
| 443 |
-
✅ **OLAP (ClickHouse)** : Analytics TB-scale, agrégations complexes
|
| 444 |
-
✅ **NoSQL (MongoDB)** : Schéma flexible, catalogues, litiges
|
| 445 |
-
✅ **Streaming (Kafka)** : Flux temps réel, event sourcing
|
| 446 |
-
✅ **Cache (Redis)** : Performance, vélocité, scores temps réel
|
| 447 |
-
✅ **Graph (Neo4j)** : Réseau de fraude, relations complexes
|
| 448 |
-
✅ **Object Storage (MinIO)** : Preuves litiges, documents
|
| 449 |
-
|
| 450 |
-
#### **3. Modèles de données**
|
| 451 |
-
|
| 452 |
-
✅ **Logique** : ERD normalisé 3NF (PostgreSQL)
|
| 453 |
-
✅ **Physique** : Star schema (ClickHouse), Documents (MongoDB), Graphe (Neo4j)
|
| 454 |
-
|
| 455 |
-
#### **4. Structures de bases adaptées**
|
| 456 |
-
|
| 457 |
-
✅ **Performance** : Index B-tree (OLTP), Columnar (OLAP), Sharding (NoSQL)
|
| 458 |
-
✅ **Sécurité** : Authentification multi-bases, chiffrement en transit
|
| 459 |
-
✅ **Évolutivité** : Scaling horizontal (MongoDB, Kafka), vertical (PostgreSQL)
|
| 460 |
-
✅ **Volume** : Partitionnement temporel (ClickHouse), TTL (Redis)
|
| 461 |
-
|
| 462 |
-
#### **5. Déploiement cloud/on-premise**
|
| 463 |
-
|
| 464 |
-
✅ Architecture Dockerisée prête pour :
|
| 465 |
-
|
| 466 |
-
- **Cloud** : AWS, Azure, GCP (via Docker)
|
| 467 |
-
- **On-Premise** : Docker Compose local
|
| 468 |
-
- **Hybrid** : Mix cloud + on-premise
|
| 469 |
-
|
| 470 |
-
#### **6. Scalabilité & Haute Performance**
|
| 471 |
-
|
| 472 |
-
✅ **Clusters** : Kafka multi-brokers, MongoDB replica sets
|
| 473 |
-
✅ **Load Balancing** : Possibilité Nginx reverse proxy
|
| 474 |
-
✅ **Calcul distribué** : Clickhouse MPP
|
| 475 |
-
|
| 476 |
-
#### **7. Monitoring & Surveillance**
|
| 477 |
-
|
| 478 |
-
✅ **Grafana** : Dashboards temps réel
|
| 479 |
-
✅ **Elasticsearch** : Logs centralisés
|
| 480 |
-
✅ **Healthchecks** : Docker health monitoring
|
| 481 |
-
|
| 482 |
-
#### **8. Documentation**
|
| 483 |
-
|
| 484 |
-
✅ README complet avec architecture, justifications, commandes
|
| 485 |
-
�� Schémas de données (SQL, Cypher, MongoDB)
|
| 486 |
-
✅ Diagrammes d'architecture
|
| 487 |
-
|
| 488 |
-
---
|
| 489 |
-
|
| 490 |
-
## 🎤 **DISCOURS JURY (15 minutes)**
|
| 491 |
-
|
| 492 |
-
### **Introduction (2 min)**
|
| 493 |
-
|
| 494 |
-
"Bonjour, je vais vous présenter mon architecture de données pour la détection de fraude Stripe, cas d'usage du Bloc 2 de la certification AIA.
|
| 495 |
-
|
| 496 |
-
Face à la problématique de détecter des transactions frauduleuses parmi des millions de paiements quotidiens, j'ai conçu une architecture **Polyglot Persistence** combinant 7 technologies de bases de données différentes, chacune optimisée pour son cas d'usage spécifique."
|
| 497 |
-
|
| 498 |
-
### **Architecture Générale (3 min)**
|
| 499 |
-
|
| 500 |
-
"L'architecture repose sur 14 services interconnectés :
|
| 501 |
-
|
| 502 |
-
**Couche OLTP** : PostgreSQL assure la cohérence transactionnelle ACID stricte des paiements. Avec 5 tables normalisées 3NF (users, transactions, merchants, fraud_events, refunds), j'obtiens une latence <100ms sur les opérations critiques.
|
| 503 |
-
|
| 504 |
-
**Couche OLAP** : ClickHouse gère les analytics TB-scale grâce au stockage columnar et à l'architecture MPP. Les agrégations sur 50 millions de transactions s'exécutent en <1 seconde.
|
| 505 |
-
|
| 506 |
-
**Couche NoSQL** : MongoDB stocke les litiges et catalogues produits avec schéma flexible, permettant l'évolution sans migration.
|
| 507 |
-
|
| 508 |
-
**Couche Streaming** : Kafka traite les événements temps réel à 10 000 msg/s pour alimenter les pipelines analytics.
|
| 509 |
-
|
| 510 |
-
**Couche Cache** : Redis améliore les performances avec TTL automatique sur les scores de fraude.
|
| 511 |
-
|
| 512 |
-
**Couche Graph** : Neo4j analyse les réseaux de fraude multi-niveaux via traversée de graphe.
|
| 513 |
-
|
| 514 |
-
**Couche ML** : MLflow track un modèle de régression logistique à 10 features atteignant 85% d'accuracy."
|
| 515 |
-
|
| 516 |
-
### **Justifications Techniques (5 min)**
|
| 517 |
-
|
| 518 |
-
"**Pourquoi PostgreSQL pour l'OLTP ?**
|
| 519 |
-
Les transactions financières exigent ACID strict. PostgreSQL offre des garanties transactionnelles multi-tables avec rollback automatique, essentiel pour éviter les doubles débits ou incohérences. Les index B-tree optimisent les requêtes par user_id et transaction_id avec latence <50ms.
|
| 520 |
-
|
| 521 |
-
**Pourquoi ClickHouse pour l'OLAP ?**
|
| 522 |
-
Les dashboards exécutifs nécessitent des agrégations sur historiques longs. ClickHouse, avec son stockage columnar et compression LZ4, réduit le volume de 80% et accélère les requêtes SUM/AVG/GROUP BY de 10x vs PostgreSQL row-based.
|
| 523 |
-
|
| 524 |
-
**Pourquoi MongoDB pour le NoSQL ?**
|
| 525 |
-
Les litiges clients contiennent des preuves variables (screenshots, emails, factures). Le schéma flexible de MongoDB évite les migrations ALTER TABLE à chaque nouveau type de preuve. Les index secondaires permettent full-text search sur les descriptions.
|
| 526 |
-
|
| 527 |
-
**Pourquoi Neo4j pour le Graph ?**
|
| 528 |
-
La fraude organisée implique des réseaux complexes (utilisateurs → marchands → autres utilisateurs). Les traversées Cypher MATCH (u)-[:FRAUD*1..3]-(m) détectent les chaînes frauduleuses en <100ms vs JOINs récursifs PostgreSQL lents.
|
| 529 |
-
|
| 530 |
-
**Approche Polyglot Persistence justifiée** : Chaque base optimise son cas d'usage plutôt qu'un compromis unique. Coût opérationnel compensé par gain performance x10 et réduction 80% volumes stockage."
|
| 531 |
-
|
| 532 |
-
### **Démonstration Technique (3 min)**
|
| 533 |
-
|
| 534 |
-
"[Écran partagé - Interface Web]
|
| 535 |
-
|
| 536 |
-
Voici l'interface Flask Bootstrap. Je simule une transaction suspecte :
|
| 537 |
-
|
| 538 |
-
- Montant : 2499€ (inhabituel pour cet utilisateur)
|
| 539 |
-
- IP : 185.220.102.8 (nœud TOR)
|
| 540 |
-
- Heure : 3h du matin
|
| 541 |
-
|
| 542 |
-
[Clic 'Process Transaction']
|
| 543 |
-
|
| 544 |
-
En 110ms, le système :
|
| 545 |
-
|
| 546 |
-
1. Valide l'utilisateur (PostgreSQL)
|
| 547 |
-
2. Vérifie la vélocité (Redis)
|
| 548 |
-
3. Calcule 10 features ML
|
| 549 |
-
4. Score fraude : 95/100
|
| 550 |
-
5. Décision : BLOCKED
|
| 551 |
-
|
| 552 |
-
[Onglet Grafana]
|
| 553 |
-
|
| 554 |
-
Le dashboard montre le taux de fraude 15% ce mois, conforme aux benchmarks industrie.
|
| 555 |
-
|
| 556 |
-
[Terminal Neo4j]
|
| 557 |
-
|
| 558 |
-
La requête Cypher révèle que ce marchand est lié à 3 autres comptes frauduleux détectés hier."
|
| 559 |
-
|
| 560 |
-
### **Monitoring & Scalabilité (2 min)**
|
| 561 |
-
|
| 562 |
-
"L'architecture intègre 3 niveaux de monitoring :
|
| 563 |
-
|
| 564 |
-
**Niveau 1 - Healthchecks Docker** : Chaque service expose un endpoint /health vérifié toutes les 10s.
|
| 565 |
-
|
| 566 |
-
**Niveau 2 - Grafana Dashboards** : Métriques business (volume transactions, fraud rate) et techniques (latence p95, erreurs 5xx).
|
| 567 |
-
|
| 568 |
-
**Niveau 3 - Elasticsearch Logs** : Centralisation des logs avec alertes sur patterns anormaux (spike de fraudes, latence >500ms).
|
| 569 |
-
|
| 570 |
-
Pour la scalabilité :
|
| 571 |
-
|
| 572 |
-
- **Horizontal** : MongoDB sharding par user_id, Kafka multi-brokers
|
| 573 |
-
- **Vertical** : PostgreSQL jusqu'à 64 vCPU avant partitioning
|
| 574 |
-
- **Auto-scaling** : ClickHouse compute clusters élastiques sur pics analytics"
|
| 575 |
-
|
| 576 |
-
### **Conclusion (1 min)**
|
| 577 |
-
|
| 578 |
-
"Cette architecture démontre la maîtrise des compétences Bloc 2 :
|
| 579 |
-
|
| 580 |
-
- Identification besoins : 6 critères de choix OLTP/OLAP/NoSQL appliqués
|
| 581 |
-
- Modélisation : ERD 3NF, Star schema, Documents, Graphe
|
| 582 |
-
- Déploiement : Dockerisé pour cloud/on-premise
|
| 583 |
-
- Scalabilité : Horizontal + vertical selon use case
|
| 584 |
-
- Monitoring : 3 niveaux (health, metrics, logs)
|
| 585 |
-
|
| 586 |
-
L'approche Polyglot Persistence, bien que complexe opérationnellement, est justifiée par des gains performance x10 et conformité réglementaire stricte (PCI-DSS, RGPD).
|
| 587 |
-
|
| 588 |
-
Merci pour votre attention. Je suis prêt à répondre à vos questions."
|
| 589 |
-
|
| 590 |
-
---
|
| 591 |
-
|
| 592 |
-
## 🔐 **SÉCURITÉ & CONFORMITÉ**
|
| 593 |
-
|
| 594 |
-
### **RGPD**
|
| 595 |
-
|
| 596 |
-
- ✅ Anonymisation possible via pseudonymisation user_id
|
| 597 |
-
- ✅ Droit à l'oubli : Script de purge
|
| 598 |
-
- ✅ Chiffrement en transit (TLS configurable)
|
| 599 |
-
- ✅ Audit trail complet (fraud_events)
|
| 600 |
-
|
| 601 |
-
### **PCI-DSS**
|
| 602 |
-
|
| 603 |
-
- ✅ Pas de stockage CVV/PIN
|
| 604 |
-
- ✅ Card last 4 digits uniquement
|
| 605 |
-
- ✅ Tokenisation cartes (via merchant)
|
| 606 |
-
- ✅ Logs immuables (Elasticsearch)
|
| 607 |
-
|
| 608 |
-
---
|
| 609 |
-
|
| 610 |
-
## 📞 **SUPPORT & CONTACT**
|
| 611 |
-
|
| 612 |
-
**Auteur:** David Rambeau
|
| 613 |
-
**Certification:** AIA - RNCP38777
|
| 614 |
-
**Email:** david.rambeau@gmail.com
|
| 615 |
-
**LinkedIn:** davidrambeau
|
| 616 |
-
|
| 617 |
-
---
|
| 618 |
-
|
| 619 |
-
## 📜 **LICENCE**
|
| 620 |
-
|
| 621 |
-
Ce projet est créé dans le cadre de la certification Architecte en Intelligence Artificielle (RNCP38777).
|
| 622 |
-
Usage pédagogique et démonstration uniquement.
|
| 623 |
-
|
| 624 |
-
---
|
| 625 |
-
|
| 626 |
-
## 🙏 **REMERCIEMENTS**
|
| 627 |
-
|
| 628 |
-
- **Jedha Bootcamp** pour la formation Lead Data Science
|
| 629 |
-
- **Communauté Open Source** pour les outils utilisés
|
| 630 |
-
|
| 631 |
-
---
|
| 632 |
-
|
| 633 |
-
## 🔄 **ETL/ELT avec APACHE AIRFLOW**
|
| 634 |
-
|
| 635 |
-
### **Orchestrateur de Pipelines**
|
| 636 |
-
|
| 637 |
-
La plateforme intègre **Apache Airflow** pour l'automatisation des flux ETL/ELT.
|
| 638 |
-
|
| 639 |
-
**Accès:** http://localhost:8080 (admin / stripe_password)
|
| 640 |
-
|
| 641 |
-
### **3 DAGs Principaux**
|
| 642 |
-
|
| 643 |
-
#### **1. etl_postgres_to_clickhouse** (Quotidien 2h)
|
| 644 |
-
|
| 645 |
-
Pipeline ETL complet PostgreSQL → ClickHouse
|
| 646 |
-
|
| 647 |
-
```
|
| 648 |
-
Extract → Transform → Load → Validate → Notify
|
| 649 |
-
```
|
| 650 |
-
|
| 651 |
-
**Code:**
|
| 652 |
-
|
| 653 |
-
```python
|
| 654 |
-
# Extract from PostgreSQL OLTP
|
| 655 |
-
transactions = extract_from_postgres()
|
| 656 |
-
|
| 657 |
-
# Transform data types & enrichment
|
| 658 |
-
transformed = transform_transactions(transactions)
|
| 659 |
-
|
| 660 |
-
# Load into ClickHouse OLAP (batch 1000)
|
| 661 |
-
load_to_clickhouse(transformed)
|
| 662 |
-
|
| 663 |
-
# Validate count match
|
| 664 |
-
validate_data_quality()
|
| 665 |
-
```
|
| 666 |
-
|
| 667 |
-
#### **2. data_quality_checks** (Quotidien 6h)
|
| 668 |
-
|
| 669 |
-
Validation automatique de la qualité des données
|
| 670 |
-
|
| 671 |
-
**Vérifications:**
|
| 672 |
-
|
| 673 |
-
- ✅ NULL values (champs critiques)
|
| 674 |
-
- ✅ Data types (amount > 0, fraud_score 0-100)
|
| 675 |
-
- ✅ Referential integrity (FK valides)
|
| 676 |
-
- ⚠️ Business rules (fraud_score vs is_fraud cohérent)
|
| 677 |
-
|
| 678 |
-
#### **3. daily_aggregations** (Quotidien 3h)
|
| 679 |
-
|
| 680 |
-
Pré-calcul des métriques analytics
|
| 681 |
-
|
| 682 |
-
**Tables créées:**
|
| 683 |
-
|
| 684 |
-
- `daily_stats` - Métriques globales
|
| 685 |
-
- `merchant_daily_stats` - Par marchand
|
| 686 |
-
- `user_daily_stats` - Par utilisateur
|
| 687 |
-
- `hourly_patterns` - Patterns horaires
|
| 688 |
-
|
| 689 |
-
### **Activation des DAGs**
|
| 690 |
-
|
| 691 |
-
```bash
|
| 692 |
-
# Les DAGs sont visibles dans l'interface Airflow
|
| 693 |
-
# Pour les activer : toggle à gauche du nom
|
| 694 |
-
|
| 695 |
-
# Exécution manuelle immédiate
|
| 696 |
-
# Cliquer sur "▶️ Trigger DAG"
|
| 697 |
-
```
|
| 698 |
-
|
| 699 |
-
### **Monitoring ETL**
|
| 700 |
-
|
| 701 |
-
**Interface Airflow** :
|
| 702 |
-
|
| 703 |
-
- 📊 Graph View - Visualisation du flux
|
| 704 |
-
- 📝 Logs - Détails de chaque tâche
|
| 705 |
-
- ⏱️ Duration - Temps d'exécution
|
| 706 |
-
- ✅ Success Rate - Taux de réussite
|
| 707 |
-
|
| 708 |
-
**Intégration Grafana** :
|
| 709 |
-
Les tables agrégées alimentent les dashboards en temps réel.
|
| 710 |
-
|
| 711 |
-
### **Démonstration Certification**
|
| 712 |
-
|
| 713 |
-
**Discours Jury (3 minutes) :**
|
| 714 |
-
|
| 715 |
-
> "L'architecture intègre Apache Airflow pour l'automatisation des pipelines ETL/ELT.
|
| 716 |
-
>
|
| 717 |
-
> **Pipeline principal** : Extraction quotidienne PostgreSQL vers ClickHouse à 2h du matin. Le DAG suit le pattern Extract-Transform-Load avec validation automatique. Traitement par batch de 1000 transactions pour optimiser la performance.
|
| 718 |
-
>
|
| 719 |
-
> **Data Quality** : DAG dédié à 6h vérifiant NULL values, types de données, intégrité référentielle et règles métier. Alertes email en cas d'échec.
|
| 720 |
-
>
|
| 721 |
-
> **Agrégations** : Pré-calcul quotidien des métriques (daily_stats, merchant_stats, hourly_patterns) pour accélérer les dashboards Grafana. OPTIMIZE TABLE automatique après chargement.
|
| 722 |
-
>
|
| 723 |
-
> **Monitoring** : Retry automatique (3 tentatives, délai 5 min), logs centralisés, graph view temps réel. Intégration complète avec l'écosystème (PostgreSQL, ClickHouse, MongoDB, Grafana).
|
| 724 |
-
>
|
| 725 |
-
> Cette approche démontre la maîtrise de l'orchestration ETL industrielle conforme au Bloc 3 de la certification AIA."
|
| 726 |
-
|
| 727 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/airflow/README_AIRFLOW.md
DELETED
|
@@ -1,214 +0,0 @@
|
|
| 1 |
-
# 🔄 APACHE AIRFLOW - ETL/ELT ORCHESTRATION
|
| 2 |
-
|
| 3 |
-
## Vue d'ensemble
|
| 4 |
-
|
| 5 |
-
Apache Airflow orchestre les pipelines ETL/ELT de la plateforme de détection de fraude.
|
| 6 |
-
|
| 7 |
-
## 🌐 Accès
|
| 8 |
-
|
| 9 |
-
**URL:** http://localhost:8080
|
| 10 |
-
**Login:** admin
|
| 11 |
-
**Password:** stripe_password
|
| 12 |
-
|
| 13 |
-
## 📊 DAGs Disponibles
|
| 14 |
-
|
| 15 |
-
### 1. **etl_postgres_to_clickhouse**
|
| 16 |
-
**Fréquence:** Quotidienne (2h du matin)
|
| 17 |
-
|
| 18 |
-
Pipeline ETL principal : PostgreSQL (OLTP) → ClickHouse (OLAP)
|
| 19 |
-
|
| 20 |
-
**Étapes:**
|
| 21 |
-
1. **Extract** - Extraction transactions PostgreSQL
|
| 22 |
-
2. **Transform** - Conversion types, nettoyage
|
| 23 |
-
3. **Load** - Chargement batch ClickHouse
|
| 24 |
-
4. **Validate** - Vérification qualité (count match)
|
| 25 |
-
5. **Notify** - Notification de fin
|
| 26 |
-
|
| 27 |
-
**Visualisation:**
|
| 28 |
-
```
|
| 29 |
-
extract_from_postgres >> transform_transactions >> load_to_clickhouse
|
| 30 |
-
>> validate_data_quality >> send_completion_notification
|
| 31 |
-
```
|
| 32 |
-
|
| 33 |
-
---
|
| 34 |
-
|
| 35 |
-
### 2. **data_quality_checks**
|
| 36 |
-
**Fréquence:** Quotidienne (6h du matin)
|
| 37 |
-
|
| 38 |
-
Validation automatisée de la qualité des données.
|
| 39 |
-
|
| 40 |
-
**Vérifications:**
|
| 41 |
-
- ✅ Valeurs NULL interdites
|
| 42 |
-
- ✅ Types de données (amount > 0, fraud_score 0-100)
|
| 43 |
-
- ✅ Intégrité référentielle (FK valides)
|
| 44 |
-
- ⚠️ Règles métier (fraud_score vs is_fraud cohérent)
|
| 45 |
-
|
| 46 |
-
---
|
| 47 |
-
|
| 48 |
-
### 3. **daily_aggregations**
|
| 49 |
-
**Fréquence:** Quotidienne (3h du matin, après ETL)
|
| 50 |
-
|
| 51 |
-
Pré-calcul des métriques analytics pour dashboards Grafana.
|
| 52 |
-
|
| 53 |
-
**Tables créées:**
|
| 54 |
-
- `daily_stats` - Statistiques globales quotidiennes
|
| 55 |
-
- `merchant_daily_stats` - Métriques par marchand
|
| 56 |
-
- `user_daily_stats` - Métriques par utilisateur
|
| 57 |
-
- `hourly_patterns` - Patterns horaires (détection anomalies)
|
| 58 |
-
|
| 59 |
-
**Optimisation:** OPTIMIZE TABLE automatique après agrégations
|
| 60 |
-
|
| 61 |
-
---
|
| 62 |
-
|
| 63 |
-
## 🚀 Démarrage Rapide
|
| 64 |
-
|
| 65 |
-
### Lancer Airflow avec la plateforme
|
| 66 |
-
|
| 67 |
-
```bash
|
| 68 |
-
# Lancer tous les services (inclut Airflow)
|
| 69 |
-
docker-compose up -d
|
| 70 |
-
|
| 71 |
-
# Vérifier qu'Airflow est prêt
|
| 72 |
-
docker-compose logs -f airflow-webserver
|
| 73 |
-
|
| 74 |
-
# Ouvrir l'interface
|
| 75 |
-
open http://localhost:8080
|
| 76 |
-
```
|
| 77 |
-
|
| 78 |
-
### Activer les DAGs
|
| 79 |
-
|
| 80 |
-
Par défaut, les DAGs sont **désactivés**. Pour les activer :
|
| 81 |
-
|
| 82 |
-
1. Ouvrir http://localhost:8080
|
| 83 |
-
2. Se connecter (admin / stripe_password)
|
| 84 |
-
3. Cliquer sur le toggle à gauche de chaque DAG
|
| 85 |
-
4. Les DAGs s'exécuteront selon leur schedule
|
| 86 |
-
|
| 87 |
-
### Exécution manuelle
|
| 88 |
-
|
| 89 |
-
Pour tester immédiatement un DAG :
|
| 90 |
-
|
| 91 |
-
1. Cliquer sur le nom du DAG
|
| 92 |
-
2. Cliquer sur le bouton "▶️ Trigger DAG" en haut à droite
|
| 93 |
-
3. Observer l'exécution en temps réel dans "Graph View"
|
| 94 |
-
|
| 95 |
-
---
|
| 96 |
-
|
| 97 |
-
## 📈 Monitoring
|
| 98 |
-
|
| 99 |
-
### Logs des tâches
|
| 100 |
-
|
| 101 |
-
1. Cliquer sur un DAG
|
| 102 |
-
2. Cliquer sur un run
|
| 103 |
-
3. Cliquer sur une tâche
|
| 104 |
-
4. Onglet "Logs" pour voir les détails
|
| 105 |
-
|
| 106 |
-
### Métriques de performance
|
| 107 |
-
|
| 108 |
-
- **Duration:** Temps d'exécution de chaque tâche
|
| 109 |
-
- **Success Rate:** Taux de réussite historique
|
| 110 |
-
- **Next Run:** Prochaine exécution programmée
|
| 111 |
-
|
| 112 |
-
---
|
| 113 |
-
|
| 114 |
-
## 🛠️ Développement de DAGs
|
| 115 |
-
|
| 116 |
-
### Structure d'un DAG
|
| 117 |
-
|
| 118 |
-
```python
|
| 119 |
-
from airflow import DAG
|
| 120 |
-
from airflow.operators.python import PythonOperator
|
| 121 |
-
from datetime import timedelta
|
| 122 |
-
|
| 123 |
-
default_args = {
|
| 124 |
-
'owner': 'david_rambeau',
|
| 125 |
-
'retries': 3,
|
| 126 |
-
'retry_delay': timedelta(minutes=5),
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
-
with DAG(
|
| 130 |
-
'mon_dag',
|
| 131 |
-
default_args=default_args,
|
| 132 |
-
schedule_interval='0 2 * * *', # Cron expression
|
| 133 |
-
catchup=False,
|
| 134 |
-
tags=['custom'],
|
| 135 |
-
) as dag:
|
| 136 |
-
|
| 137 |
-
task = PythonOperator(
|
| 138 |
-
task_id='ma_tache',
|
| 139 |
-
python_callable=ma_fonction,
|
| 140 |
-
)
|
| 141 |
-
```
|
| 142 |
-
|
| 143 |
-
### Ajouter un nouveau DAG
|
| 144 |
-
|
| 145 |
-
1. Créer un fichier Python dans `/airflow/dags/`
|
| 146 |
-
2. Redémarrer Airflow : `docker-compose restart airflow-scheduler`
|
| 147 |
-
3. Le DAG apparaît automatiquement dans l'interface
|
| 148 |
-
|
| 149 |
-
---
|
| 150 |
-
|
| 151 |
-
## 🔧 Configuration
|
| 152 |
-
|
| 153 |
-
### Variables d'environnement
|
| 154 |
-
|
| 155 |
-
Définies dans `docker-compose.yml` :
|
| 156 |
-
|
| 157 |
-
```yaml
|
| 158 |
-
POSTGRES_HOST: postgres
|
| 159 |
-
CLICKHOUSE_HOST: clickhouse
|
| 160 |
-
MONGODB_HOST: mongodb
|
| 161 |
-
...
|
| 162 |
-
```
|
| 163 |
-
|
| 164 |
-
### Connexions
|
| 165 |
-
|
| 166 |
-
Airflow se connecte directement aux bases via les variables d'environnement.
|
| 167 |
-
Pas besoin de configurer les "Connections" dans l'UI.
|
| 168 |
-
|
| 169 |
-
---
|
| 170 |
-
|
| 171 |
-
## 📊 Intégration avec Grafana
|
| 172 |
-
|
| 173 |
-
Les tables agrégées par Airflow alimentent les dashboards Grafana :
|
| 174 |
-
|
| 175 |
-
- `daily_stats` → Dashboard "Transaction Volume"
|
| 176 |
-
- `merchant_daily_stats` → Dashboard "Top Merchants"
|
| 177 |
-
- `hourly_patterns` → Dashboard "Fraud Patterns by Hour"
|
| 178 |
-
|
| 179 |
-
---
|
| 180 |
-
|
| 181 |
-
## 🎓 Certification AIA - Bloc 3
|
| 182 |
-
|
| 183 |
-
Ces DAGs démontrent les compétences suivantes :
|
| 184 |
-
|
| 185 |
-
✅ **Orchestration ETL** - Apache Airflow
|
| 186 |
-
✅ **Pipelines automatisés** - Scheduling quotidien
|
| 187 |
-
✅ **Data Quality** - Validation automatisée
|
| 188 |
-
✅ **Agrégations batch** - Pré-calcul métriques
|
| 189 |
-
✅ **Monitoring** - Logs, alertes, retry
|
| 190 |
-
✅ **Scalabilité** - Traitement par batch
|
| 191 |
-
|
| 192 |
-
---
|
| 193 |
-
|
| 194 |
-
## 📞 Support
|
| 195 |
-
|
| 196 |
-
En cas de problème :
|
| 197 |
-
|
| 198 |
-
```bash
|
| 199 |
-
# Vérifier les logs Airflow
|
| 200 |
-
docker-compose logs airflow-scheduler
|
| 201 |
-
docker-compose logs airflow-webserver
|
| 202 |
-
|
| 203 |
-
# Redémarrer Airflow
|
| 204 |
-
docker-compose restart airflow-scheduler airflow-webserver
|
| 205 |
-
|
| 206 |
-
# Réinitialiser la BDD Airflow (attention : perte historique)
|
| 207 |
-
docker-compose down
|
| 208 |
-
docker volume rm dataarch_airflow_postgres_data
|
| 209 |
-
docker-compose up -d
|
| 210 |
-
```
|
| 211 |
-
|
| 212 |
-
---
|
| 213 |
-
|
| 214 |
-
**Airflow transforme votre architecture en un système de données industrialisé et automatisé ! 🚀**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/airflow/dags/daily_aggregations.py
DELETED
|
@@ -1,328 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Daily Aggregations Pipeline
|
| 3 |
-
Pre-compute analytics metrics for dashboards
|
| 4 |
-
|
| 5 |
-
Author: David Rambeau
|
| 6 |
-
Certification: AIA - Bloc 3
|
| 7 |
-
"""
|
| 8 |
-
|
| 9 |
-
from airflow import DAG
|
| 10 |
-
from airflow.operators.python import PythonOperator
|
| 11 |
-
from airflow.utils.dates import days_ago
|
| 12 |
-
from datetime import timedelta
|
| 13 |
-
from clickhouse_driver import Client
|
| 14 |
-
import logging
|
| 15 |
-
|
| 16 |
-
logger = logging.getLogger(__name__)
|
| 17 |
-
|
| 18 |
-
default_args = {
|
| 19 |
-
'owner': 'david_rambeau',
|
| 20 |
-
'depends_on_past': False,
|
| 21 |
-
'email_on_failure': False,
|
| 22 |
-
'retries': 2,
|
| 23 |
-
'retry_delay': timedelta(minutes=5),
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
def aggregate_daily_stats(**context):
|
| 27 |
-
"""Agréger les statistiques quotidiennes"""
|
| 28 |
-
|
| 29 |
-
execution_date = context['execution_date']
|
| 30 |
-
|
| 31 |
-
ch_client = Client(
|
| 32 |
-
host='clickhouse',
|
| 33 |
-
port=9000,
|
| 34 |
-
user='stripe_user',
|
| 35 |
-
password='stripe_password',
|
| 36 |
-
database='stripe_olap'
|
| 37 |
-
)
|
| 38 |
-
|
| 39 |
-
# Créer la table d'agrégation si elle n'existe pas
|
| 40 |
-
ch_client.execute("""
|
| 41 |
-
CREATE TABLE IF NOT EXISTS daily_stats (
|
| 42 |
-
date Date,
|
| 43 |
-
total_transactions UInt32,
|
| 44 |
-
total_amount Decimal(15, 2),
|
| 45 |
-
avg_amount Decimal(15, 2),
|
| 46 |
-
fraud_transactions UInt32,
|
| 47 |
-
fraud_amount Decimal(15, 2),
|
| 48 |
-
fraud_rate Decimal(5, 2),
|
| 49 |
-
unique_users UInt32,
|
| 50 |
-
unique_merchants UInt32
|
| 51 |
-
) ENGINE = MergeTree()
|
| 52 |
-
ORDER BY date
|
| 53 |
-
""")
|
| 54 |
-
|
| 55 |
-
# Calculer les stats du jour
|
| 56 |
-
result = ch_client.execute("""
|
| 57 |
-
SELECT
|
| 58 |
-
toDate(created_at) as date,
|
| 59 |
-
COUNT(*) as total_transactions,
|
| 60 |
-
SUM(amount) as total_amount,
|
| 61 |
-
AVG(amount) as avg_amount,
|
| 62 |
-
SUM(is_fraud) as fraud_transactions,
|
| 63 |
-
SUM(CASE WHEN is_fraud = 1 THEN amount ELSE 0 END) as fraud_amount,
|
| 64 |
-
ROUND(100.0 * SUM(is_fraud) / COUNT(*), 2) as fraud_rate,
|
| 65 |
-
COUNT(DISTINCT user_id) as unique_users,
|
| 66 |
-
COUNT(DISTINCT merchant_id) as unique_merchants
|
| 67 |
-
FROM transactions_olap
|
| 68 |
-
WHERE toDate(created_at) = %s
|
| 69 |
-
GROUP BY date
|
| 70 |
-
""", (execution_date.date(),))
|
| 71 |
-
|
| 72 |
-
if result:
|
| 73 |
-
stats = result[0]
|
| 74 |
-
|
| 75 |
-
# Insérer les statistiques
|
| 76 |
-
ch_client.execute("""
|
| 77 |
-
INSERT INTO daily_stats VALUES
|
| 78 |
-
""", [stats])
|
| 79 |
-
|
| 80 |
-
logger.info(f"Daily stats aggregated: {stats}")
|
| 81 |
-
|
| 82 |
-
return {
|
| 83 |
-
'date': str(stats[0]),
|
| 84 |
-
'total_transactions': stats[1],
|
| 85 |
-
'fraud_rate': float(stats[6])
|
| 86 |
-
}
|
| 87 |
-
else:
|
| 88 |
-
logger.warning(f"No data found for {execution_date.date()}")
|
| 89 |
-
return None
|
| 90 |
-
|
| 91 |
-
def aggregate_merchant_stats(**context):
|
| 92 |
-
"""Agréger les statistiques par marchand"""
|
| 93 |
-
|
| 94 |
-
execution_date = context['execution_date']
|
| 95 |
-
|
| 96 |
-
ch_client = Client(
|
| 97 |
-
host='clickhouse',
|
| 98 |
-
port=9000,
|
| 99 |
-
user='stripe_user',
|
| 100 |
-
password='stripe_password',
|
| 101 |
-
database='stripe_olap'
|
| 102 |
-
)
|
| 103 |
-
|
| 104 |
-
# Créer la table si elle n'existe pas
|
| 105 |
-
ch_client.execute("""
|
| 106 |
-
CREATE TABLE IF NOT EXISTS merchant_daily_stats (
|
| 107 |
-
date Date,
|
| 108 |
-
merchant_id String,
|
| 109 |
-
merchant_category String,
|
| 110 |
-
total_transactions UInt32,
|
| 111 |
-
total_amount Decimal(15, 2),
|
| 112 |
-
fraud_transactions UInt32,
|
| 113 |
-
fraud_rate Decimal(5, 2)
|
| 114 |
-
) ENGINE = MergeTree()
|
| 115 |
-
ORDER BY (date, merchant_id)
|
| 116 |
-
""")
|
| 117 |
-
|
| 118 |
-
# Calculer les stats par marchand
|
| 119 |
-
result = ch_client.execute("""
|
| 120 |
-
SELECT
|
| 121 |
-
toDate(created_at) as date,
|
| 122 |
-
merchant_id,
|
| 123 |
-
merchant_category,
|
| 124 |
-
COUNT(*) as total_transactions,
|
| 125 |
-
SUM(amount) as total_amount,
|
| 126 |
-
SUM(is_fraud) as fraud_transactions,
|
| 127 |
-
ROUND(100.0 * SUM(is_fraud) / COUNT(*), 2) as fraud_rate
|
| 128 |
-
FROM transactions_olap
|
| 129 |
-
WHERE toDate(created_at) = %s
|
| 130 |
-
GROUP BY date, merchant_id, merchant_category
|
| 131 |
-
""", (execution_date.date(),))
|
| 132 |
-
|
| 133 |
-
if result:
|
| 134 |
-
ch_client.execute("""
|
| 135 |
-
INSERT INTO merchant_daily_stats VALUES
|
| 136 |
-
""", result)
|
| 137 |
-
|
| 138 |
-
logger.info(f"Merchant stats aggregated: {len(result)} merchants")
|
| 139 |
-
return len(result)
|
| 140 |
-
else:
|
| 141 |
-
logger.warning("No merchant data found")
|
| 142 |
-
return 0
|
| 143 |
-
|
| 144 |
-
def aggregate_user_stats(**context):
|
| 145 |
-
"""Agréger les statistiques par utilisateur"""
|
| 146 |
-
|
| 147 |
-
execution_date = context['execution_date']
|
| 148 |
-
|
| 149 |
-
ch_client = Client(
|
| 150 |
-
host='clickhouse',
|
| 151 |
-
port=9000,
|
| 152 |
-
user='stripe_user',
|
| 153 |
-
password='stripe_password',
|
| 154 |
-
database='stripe_olap'
|
| 155 |
-
)
|
| 156 |
-
|
| 157 |
-
# Créer la table si elle n'existe pas
|
| 158 |
-
ch_client.execute("""
|
| 159 |
-
CREATE TABLE IF NOT EXISTS user_daily_stats (
|
| 160 |
-
date Date,
|
| 161 |
-
user_id String,
|
| 162 |
-
country String,
|
| 163 |
-
total_transactions UInt32,
|
| 164 |
-
total_amount Decimal(15, 2),
|
| 165 |
-
avg_amount Decimal(15, 2),
|
| 166 |
-
fraud_transactions UInt32
|
| 167 |
-
) ENGINE = MergeTree()
|
| 168 |
-
ORDER BY (date, user_id)
|
| 169 |
-
""")
|
| 170 |
-
|
| 171 |
-
# Calculer les stats par utilisateur
|
| 172 |
-
result = ch_client.execute("""
|
| 173 |
-
SELECT
|
| 174 |
-
toDate(created_at) as date,
|
| 175 |
-
user_id,
|
| 176 |
-
country,
|
| 177 |
-
COUNT(*) as total_transactions,
|
| 178 |
-
SUM(amount) as total_amount,
|
| 179 |
-
AVG(amount) as avg_amount,
|
| 180 |
-
SUM(is_fraud) as fraud_transactions
|
| 181 |
-
FROM transactions_olap
|
| 182 |
-
WHERE toDate(created_at) = %s
|
| 183 |
-
GROUP BY date, user_id, country
|
| 184 |
-
""", (execution_date.date(),))
|
| 185 |
-
|
| 186 |
-
if result:
|
| 187 |
-
ch_client.execute("""
|
| 188 |
-
INSERT INTO user_daily_stats VALUES
|
| 189 |
-
""", result)
|
| 190 |
-
|
| 191 |
-
logger.info(f"User stats aggregated: {len(result)} users")
|
| 192 |
-
return len(result)
|
| 193 |
-
else:
|
| 194 |
-
logger.warning("No user data found")
|
| 195 |
-
return 0
|
| 196 |
-
|
| 197 |
-
def aggregate_hourly_patterns(**context):
|
| 198 |
-
"""Agréger les patterns horaires pour détection d'anomalies"""
|
| 199 |
-
|
| 200 |
-
execution_date = context['execution_date']
|
| 201 |
-
|
| 202 |
-
ch_client = Client(
|
| 203 |
-
host='clickhouse',
|
| 204 |
-
port=9000,
|
| 205 |
-
user='stripe_user',
|
| 206 |
-
password='stripe_password',
|
| 207 |
-
database='stripe_olap'
|
| 208 |
-
)
|
| 209 |
-
|
| 210 |
-
# Créer la table si elle n'existe pas
|
| 211 |
-
ch_client.execute("""
|
| 212 |
-
CREATE TABLE IF NOT EXISTS hourly_patterns (
|
| 213 |
-
date Date,
|
| 214 |
-
hour UInt8,
|
| 215 |
-
total_transactions UInt32,
|
| 216 |
-
fraud_transactions UInt32,
|
| 217 |
-
fraud_rate Decimal(5, 2),
|
| 218 |
-
avg_amount Decimal(15, 2)
|
| 219 |
-
) ENGINE = MergeTree()
|
| 220 |
-
ORDER BY (date, hour)
|
| 221 |
-
""")
|
| 222 |
-
|
| 223 |
-
# Calculer les patterns horaires
|
| 224 |
-
result = ch_client.execute("""
|
| 225 |
-
SELECT
|
| 226 |
-
toDate(created_at) as date,
|
| 227 |
-
toHour(created_at) as hour,
|
| 228 |
-
COUNT(*) as total_transactions,
|
| 229 |
-
SUM(is_fraud) as fraud_transactions,
|
| 230 |
-
ROUND(100.0 * SUM(is_fraud) / COUNT(*), 2) as fraud_rate,
|
| 231 |
-
AVG(amount) as avg_amount
|
| 232 |
-
FROM transactions_olap
|
| 233 |
-
WHERE toDate(created_at) = %s
|
| 234 |
-
GROUP BY date, hour
|
| 235 |
-
ORDER BY hour
|
| 236 |
-
""", (execution_date.date(),))
|
| 237 |
-
|
| 238 |
-
if result:
|
| 239 |
-
ch_client.execute("""
|
| 240 |
-
INSERT INTO hourly_patterns VALUES
|
| 241 |
-
""", result)
|
| 242 |
-
|
| 243 |
-
# Identifier les heures suspectes (fraud_rate > 30%)
|
| 244 |
-
suspicious_hours = [
|
| 245 |
-
f"{row[1]:02d}h: {row[4]:.1f}% fraud"
|
| 246 |
-
for row in result if row[4] > 30
|
| 247 |
-
]
|
| 248 |
-
|
| 249 |
-
if suspicious_hours:
|
| 250 |
-
logger.warning(f"Suspicious hours detected: {suspicious_hours}")
|
| 251 |
-
|
| 252 |
-
logger.info(f"Hourly patterns aggregated: {len(result)} hours")
|
| 253 |
-
return len(result)
|
| 254 |
-
else:
|
| 255 |
-
logger.warning("No hourly data found")
|
| 256 |
-
return 0
|
| 257 |
-
|
| 258 |
-
def optimize_clickhouse_tables(**context):
|
| 259 |
-
"""Optimiser les tables ClickHouse"""
|
| 260 |
-
|
| 261 |
-
ch_client = Client(
|
| 262 |
-
host='clickhouse',
|
| 263 |
-
port=9000,
|
| 264 |
-
user='stripe_user',
|
| 265 |
-
password='stripe_password',
|
| 266 |
-
database='stripe_olap'
|
| 267 |
-
)
|
| 268 |
-
|
| 269 |
-
tables_to_optimize = [
|
| 270 |
-
'transactions_olap',
|
| 271 |
-
'daily_stats',
|
| 272 |
-
'merchant_daily_stats',
|
| 273 |
-
'user_daily_stats',
|
| 274 |
-
'hourly_patterns'
|
| 275 |
-
]
|
| 276 |
-
|
| 277 |
-
for table in tables_to_optimize:
|
| 278 |
-
try:
|
| 279 |
-
ch_client.execute(f"OPTIMIZE TABLE {table} FINAL")
|
| 280 |
-
logger.info(f"✅ Optimized table: {table}")
|
| 281 |
-
except Exception as e:
|
| 282 |
-
logger.warning(f"⚠️ Could not optimize {table}: {e}")
|
| 283 |
-
|
| 284 |
-
return f"Optimized {len(tables_to_optimize)} tables"
|
| 285 |
-
|
| 286 |
-
# Définition du DAG
|
| 287 |
-
with DAG(
|
| 288 |
-
'daily_aggregations',
|
| 289 |
-
default_args=default_args,
|
| 290 |
-
description='Daily metrics aggregation for analytics dashboards',
|
| 291 |
-
schedule_interval='0 3 * * *', # Tous les jours à 3h (après l'ETL)
|
| 292 |
-
start_date=days_ago(1),
|
| 293 |
-
catchup=False,
|
| 294 |
-
tags=['aggregation', 'analytics', 'clickhouse'],
|
| 295 |
-
) as dag:
|
| 296 |
-
|
| 297 |
-
task_daily = PythonOperator(
|
| 298 |
-
task_id='aggregate_daily_stats',
|
| 299 |
-
python_callable=aggregate_daily_stats,
|
| 300 |
-
provide_context=True,
|
| 301 |
-
)
|
| 302 |
-
|
| 303 |
-
task_merchant = PythonOperator(
|
| 304 |
-
task_id='aggregate_merchant_stats',
|
| 305 |
-
python_callable=aggregate_merchant_stats,
|
| 306 |
-
provide_context=True,
|
| 307 |
-
)
|
| 308 |
-
|
| 309 |
-
task_user = PythonOperator(
|
| 310 |
-
task_id='aggregate_user_stats',
|
| 311 |
-
python_callable=aggregate_user_stats,
|
| 312 |
-
provide_context=True,
|
| 313 |
-
)
|
| 314 |
-
|
| 315 |
-
task_hourly = PythonOperator(
|
| 316 |
-
task_id='aggregate_hourly_patterns',
|
| 317 |
-
python_callable=aggregate_hourly_patterns,
|
| 318 |
-
provide_context=True,
|
| 319 |
-
)
|
| 320 |
-
|
| 321 |
-
task_optimize = PythonOperator(
|
| 322 |
-
task_id='optimize_clickhouse_tables',
|
| 323 |
-
python_callable=optimize_clickhouse_tables,
|
| 324 |
-
provide_context=True,
|
| 325 |
-
)
|
| 326 |
-
|
| 327 |
-
# Agrégations en parallèle puis optimisation
|
| 328 |
-
[task_daily, task_merchant, task_user, task_hourly] >> task_optimize
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/airflow/dags/data_quality_checks.py
DELETED
|
@@ -1,302 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Data Quality Checks Pipeline
|
| 3 |
-
Automated data validation and monitoring
|
| 4 |
-
|
| 5 |
-
Author: David Rambeau
|
| 6 |
-
Certification: AIA - Bloc 3
|
| 7 |
-
"""
|
| 8 |
-
|
| 9 |
-
from airflow import DAG
|
| 10 |
-
from airflow.operators.python import PythonOperator
|
| 11 |
-
from airflow.utils.dates import days_ago
|
| 12 |
-
from datetime import timedelta
|
| 13 |
-
import psycopg2
|
| 14 |
-
import logging
|
| 15 |
-
|
| 16 |
-
logger = logging.getLogger(__name__)
|
| 17 |
-
|
| 18 |
-
default_args = {
|
| 19 |
-
'owner': 'david_rambeau',
|
| 20 |
-
'depends_on_past': False,
|
| 21 |
-
'email_on_failure': True,
|
| 22 |
-
'email_on_retry': False,
|
| 23 |
-
'retries': 2,
|
| 24 |
-
'retry_delay': timedelta(minutes=3),
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
def check_null_values(**context):
|
| 28 |
-
"""Vérifier l'absence de valeurs NULL dans les champs critiques"""
|
| 29 |
-
|
| 30 |
-
pg_conn = psycopg2.connect(
|
| 31 |
-
host='postgres',
|
| 32 |
-
port=5432,
|
| 33 |
-
user='stripe_user',
|
| 34 |
-
password='stripe_password',
|
| 35 |
-
database='stripe_oltp'
|
| 36 |
-
)
|
| 37 |
-
cursor = pg_conn.cursor()
|
| 38 |
-
|
| 39 |
-
# Vérifier les NULLs dans les colonnes critiques
|
| 40 |
-
checks = [
|
| 41 |
-
("transactions", "user_id"),
|
| 42 |
-
("transactions", "merchant_id"),
|
| 43 |
-
("transactions", "amount"),
|
| 44 |
-
("transactions", "created_at"),
|
| 45 |
-
("users", "user_id"),
|
| 46 |
-
("users", "email"),
|
| 47 |
-
("merchants", "merchant_id"),
|
| 48 |
-
]
|
| 49 |
-
|
| 50 |
-
errors = []
|
| 51 |
-
for table, column in checks:
|
| 52 |
-
cursor.execute(f"SELECT COUNT(*) FROM {table} WHERE {column} IS NULL")
|
| 53 |
-
null_count = cursor.fetchone()[0]
|
| 54 |
-
|
| 55 |
-
if null_count > 0:
|
| 56 |
-
errors.append(f"{table}.{column} has {null_count} NULL values")
|
| 57 |
-
logger.error(f"❌ {table}.{column}: {null_count} NULLs found")
|
| 58 |
-
else:
|
| 59 |
-
logger.info(f"✅ {table}.{column}: No NULLs")
|
| 60 |
-
|
| 61 |
-
cursor.close()
|
| 62 |
-
pg_conn.close()
|
| 63 |
-
|
| 64 |
-
if errors:
|
| 65 |
-
raise ValueError(f"NULL value check failed:\n" + "\n".join(errors))
|
| 66 |
-
|
| 67 |
-
return "All NULL checks passed"
|
| 68 |
-
|
| 69 |
-
def check_data_types(**context):
|
| 70 |
-
"""Vérifier la cohérence des types de données"""
|
| 71 |
-
|
| 72 |
-
pg_conn = psycopg2.connect(
|
| 73 |
-
host='postgres',
|
| 74 |
-
port=5432,
|
| 75 |
-
user='stripe_user',
|
| 76 |
-
password='stripe_password',
|
| 77 |
-
database='stripe_oltp'
|
| 78 |
-
)
|
| 79 |
-
cursor = pg_conn.cursor()
|
| 80 |
-
|
| 81 |
-
errors = []
|
| 82 |
-
|
| 83 |
-
# Check 1: Amounts doivent être positifs
|
| 84 |
-
cursor.execute("SELECT COUNT(*) FROM transactions WHERE amount <= 0")
|
| 85 |
-
negative_amounts = cursor.fetchone()[0]
|
| 86 |
-
if negative_amounts > 0:
|
| 87 |
-
errors.append(f"Found {negative_amounts} transactions with amount <= 0")
|
| 88 |
-
|
| 89 |
-
# Check 2: Fraud score entre 0 et 100
|
| 90 |
-
cursor.execute("SELECT COUNT(*) FROM transactions WHERE fraud_score < 0 OR fraud_score > 100")
|
| 91 |
-
invalid_scores = cursor.fetchone()[0]
|
| 92 |
-
if invalid_scores > 0:
|
| 93 |
-
errors.append(f"Found {invalid_scores} transactions with invalid fraud_score")
|
| 94 |
-
|
| 95 |
-
# Check 3: Currency codes valides
|
| 96 |
-
cursor.execute("""
|
| 97 |
-
SELECT COUNT(*) FROM transactions
|
| 98 |
-
WHERE currency NOT IN ('EUR', 'USD', 'GBP', 'CAD', 'AUD')
|
| 99 |
-
""")
|
| 100 |
-
invalid_currency = cursor.fetchone()[0]
|
| 101 |
-
if invalid_currency > 0:
|
| 102 |
-
errors.append(f"Found {invalid_currency} transactions with invalid currency")
|
| 103 |
-
|
| 104 |
-
# Check 4: Status valides
|
| 105 |
-
cursor.execute("""
|
| 106 |
-
SELECT COUNT(*) FROM transactions
|
| 107 |
-
WHERE status NOT IN ('pending', 'succeeded', 'failed', 'refunded', 'disputed')
|
| 108 |
-
""")
|
| 109 |
-
invalid_status = cursor.fetchone()[0]
|
| 110 |
-
if invalid_status > 0:
|
| 111 |
-
errors.append(f"Found {invalid_status} transactions with invalid status")
|
| 112 |
-
|
| 113 |
-
cursor.close()
|
| 114 |
-
pg_conn.close()
|
| 115 |
-
|
| 116 |
-
if errors:
|
| 117 |
-
raise ValueError(f"Data type validation failed:\n" + "\n".join(errors))
|
| 118 |
-
|
| 119 |
-
logger.info("✅ All data type checks passed")
|
| 120 |
-
return "All data type checks passed"
|
| 121 |
-
|
| 122 |
-
def check_referential_integrity(**context):
|
| 123 |
-
"""Vérifier l'intégrité référentielle"""
|
| 124 |
-
|
| 125 |
-
pg_conn = psycopg2.connect(
|
| 126 |
-
host='postgres',
|
| 127 |
-
port=5432,
|
| 128 |
-
user='stripe_user',
|
| 129 |
-
password='stripe_password',
|
| 130 |
-
database='stripe_oltp'
|
| 131 |
-
)
|
| 132 |
-
cursor = pg_conn.cursor()
|
| 133 |
-
|
| 134 |
-
errors = []
|
| 135 |
-
|
| 136 |
-
# Check 1: Transactions avec user_id inexistant
|
| 137 |
-
cursor.execute("""
|
| 138 |
-
SELECT COUNT(*) FROM transactions t
|
| 139 |
-
LEFT JOIN users u ON t.user_id = u.user_id
|
| 140 |
-
WHERE u.user_id IS NULL
|
| 141 |
-
""")
|
| 142 |
-
orphan_user = cursor.fetchone()[0]
|
| 143 |
-
if orphan_user > 0:
|
| 144 |
-
errors.append(f"Found {orphan_user} transactions with non-existent user_id")
|
| 145 |
-
|
| 146 |
-
# Check 2: Transactions avec merchant_id inexistant
|
| 147 |
-
cursor.execute("""
|
| 148 |
-
SELECT COUNT(*) FROM transactions t
|
| 149 |
-
LEFT JOIN merchants m ON t.merchant_id = m.merchant_id
|
| 150 |
-
WHERE m.merchant_id IS NULL
|
| 151 |
-
""")
|
| 152 |
-
orphan_merchant = cursor.fetchone()[0]
|
| 153 |
-
if orphan_merchant > 0:
|
| 154 |
-
errors.append(f"Found {orphan_merchant} transactions with non-existent merchant_id")
|
| 155 |
-
|
| 156 |
-
# Check 3: Fraud events avec transaction_id inexistant
|
| 157 |
-
cursor.execute("""
|
| 158 |
-
SELECT COUNT(*) FROM fraud_events fe
|
| 159 |
-
LEFT JOIN transactions t ON fe.transaction_id = t.transaction_id
|
| 160 |
-
WHERE t.transaction_id IS NULL
|
| 161 |
-
""")
|
| 162 |
-
orphan_fraud = cursor.fetchone()[0]
|
| 163 |
-
if orphan_fraud > 0:
|
| 164 |
-
errors.append(f"Found {orphan_fraud} fraud_events with non-existent transaction_id")
|
| 165 |
-
|
| 166 |
-
cursor.close()
|
| 167 |
-
pg_conn.close()
|
| 168 |
-
|
| 169 |
-
if errors:
|
| 170 |
-
raise ValueError(f"Referential integrity check failed:\n" + "\n".join(errors))
|
| 171 |
-
|
| 172 |
-
logger.info("✅ All referential integrity checks passed")
|
| 173 |
-
return "All referential integrity checks passed"
|
| 174 |
-
|
| 175 |
-
def check_business_rules(**context):
|
| 176 |
-
"""Vérifier les règles métier"""
|
| 177 |
-
|
| 178 |
-
pg_conn = psycopg2.connect(
|
| 179 |
-
host='postgres',
|
| 180 |
-
port=5432,
|
| 181 |
-
user='stripe_user',
|
| 182 |
-
password='stripe_password',
|
| 183 |
-
database='stripe_oltp'
|
| 184 |
-
)
|
| 185 |
-
cursor = pg_conn.cursor()
|
| 186 |
-
|
| 187 |
-
warnings = []
|
| 188 |
-
|
| 189 |
-
# Rule 1: Transactions frauduleuses doivent avoir fraud_score >= 70
|
| 190 |
-
cursor.execute("""
|
| 191 |
-
SELECT COUNT(*) FROM transactions
|
| 192 |
-
WHERE is_fraud = TRUE AND fraud_score < 70
|
| 193 |
-
""")
|
| 194 |
-
inconsistent_fraud = cursor.fetchone()[0]
|
| 195 |
-
if inconsistent_fraud > 0:
|
| 196 |
-
warnings.append(f"⚠️ {inconsistent_fraud} transactions marked as fraud with score < 70")
|
| 197 |
-
|
| 198 |
-
# Rule 2: Transactions réussies ne doivent pas être frauduleuses
|
| 199 |
-
cursor.execute("""
|
| 200 |
-
SELECT COUNT(*) FROM transactions
|
| 201 |
-
WHERE status = 'succeeded' AND is_fraud = TRUE
|
| 202 |
-
""")
|
| 203 |
-
succeeded_fraud = cursor.fetchone()[0]
|
| 204 |
-
if succeeded_fraud > 0:
|
| 205 |
-
warnings.append(f"⚠️ {succeeded_fraud} succeeded transactions marked as fraud")
|
| 206 |
-
|
| 207 |
-
# Rule 3: Vérifier le taux de fraude global (< 20%)
|
| 208 |
-
cursor.execute("""
|
| 209 |
-
SELECT
|
| 210 |
-
COUNT(*) as total,
|
| 211 |
-
SUM(CASE WHEN is_fraud THEN 1 ELSE 0 END) as fraud_count
|
| 212 |
-
FROM transactions
|
| 213 |
-
WHERE created_at >= NOW() - INTERVAL '30 days'
|
| 214 |
-
""")
|
| 215 |
-
result = cursor.fetchone()
|
| 216 |
-
total, fraud_count = result
|
| 217 |
-
fraud_rate = (fraud_count / total * 100) if total > 0 else 0
|
| 218 |
-
|
| 219 |
-
if fraud_rate > 20:
|
| 220 |
-
warnings.append(f"⚠️ High fraud rate detected: {fraud_rate:.2f}% (last 30 days)")
|
| 221 |
-
else:
|
| 222 |
-
logger.info(f"✅ Fraud rate: {fraud_rate:.2f}% (within acceptable range)")
|
| 223 |
-
|
| 224 |
-
cursor.close()
|
| 225 |
-
pg_conn.close()
|
| 226 |
-
|
| 227 |
-
if warnings:
|
| 228 |
-
logger.warning("Business rule warnings:\n" + "\n".join(warnings))
|
| 229 |
-
|
| 230 |
-
return f"Business rules checked. Warnings: {len(warnings)}"
|
| 231 |
-
|
| 232 |
-
def generate_quality_report(**context):
|
| 233 |
-
"""Générer un rapport de qualité des données"""
|
| 234 |
-
|
| 235 |
-
null_check = context['ti'].xcom_pull(task_ids='check_null_values')
|
| 236 |
-
type_check = context['ti'].xcom_pull(task_ids='check_data_types')
|
| 237 |
-
integrity_check = context['ti'].xcom_pull(task_ids='check_referential_integrity')
|
| 238 |
-
business_check = context['ti'].xcom_pull(task_ids='check_business_rules')
|
| 239 |
-
|
| 240 |
-
report = f"""
|
| 241 |
-
═══════════════════════════════════════════════════════════
|
| 242 |
-
DATA QUALITY REPORT
|
| 243 |
-
Generated: {context['execution_date']}
|
| 244 |
-
═══════════════════════════════════════════════════════════
|
| 245 |
-
|
| 246 |
-
✅ NULL Values Check: {null_check}
|
| 247 |
-
✅ Data Types Check: {type_check}
|
| 248 |
-
✅ Referential Integrity Check: {integrity_check}
|
| 249 |
-
⚠️ Business Rules Check: {business_check}
|
| 250 |
-
|
| 251 |
-
Overall Status: PASSED
|
| 252 |
-
|
| 253 |
-
═══════════════════════════════════════════════════════════
|
| 254 |
-
"""
|
| 255 |
-
|
| 256 |
-
logger.info(report)
|
| 257 |
-
|
| 258 |
-
return report
|
| 259 |
-
|
| 260 |
-
# Définition du DAG
|
| 261 |
-
with DAG(
|
| 262 |
-
'data_quality_checks',
|
| 263 |
-
default_args=default_args,
|
| 264 |
-
description='Automated data quality validation',
|
| 265 |
-
schedule_interval='0 6 * * *', # Tous les jours à 6h du matin
|
| 266 |
-
start_date=days_ago(1),
|
| 267 |
-
catchup=False,
|
| 268 |
-
tags=['data-quality', 'validation', 'monitoring'],
|
| 269 |
-
) as dag:
|
| 270 |
-
|
| 271 |
-
task_null = PythonOperator(
|
| 272 |
-
task_id='check_null_values',
|
| 273 |
-
python_callable=check_null_values,
|
| 274 |
-
provide_context=True,
|
| 275 |
-
)
|
| 276 |
-
|
| 277 |
-
task_types = PythonOperator(
|
| 278 |
-
task_id='check_data_types',
|
| 279 |
-
python_callable=check_data_types,
|
| 280 |
-
provide_context=True,
|
| 281 |
-
)
|
| 282 |
-
|
| 283 |
-
task_integrity = PythonOperator(
|
| 284 |
-
task_id='check_referential_integrity',
|
| 285 |
-
python_callable=check_referential_integrity,
|
| 286 |
-
provide_context=True,
|
| 287 |
-
)
|
| 288 |
-
|
| 289 |
-
task_business = PythonOperator(
|
| 290 |
-
task_id='check_business_rules',
|
| 291 |
-
python_callable=check_business_rules,
|
| 292 |
-
provide_context=True,
|
| 293 |
-
)
|
| 294 |
-
|
| 295 |
-
task_report = PythonOperator(
|
| 296 |
-
task_id='generate_quality_report',
|
| 297 |
-
python_callable=generate_quality_report,
|
| 298 |
-
provide_context=True,
|
| 299 |
-
)
|
| 300 |
-
|
| 301 |
-
# Exécution en parallèle puis génération du rapport
|
| 302 |
-
[task_null, task_types, task_integrity, task_business] >> task_report
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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/Architecture/airflow/dags/etl_postgres_to_clickhouse.py
DELETED
|
@@ -1,307 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
ETL Pipeline: PostgreSQL (OLTP) → ClickHouse (OLAP)
|
| 3 |
-
Daily synchronization of transactions for analytics
|
| 4 |
-
|
| 5 |
-
Author: David Rambeau
|
| 6 |
-
Certification: AIA - Bloc 3 (Pipelines de données)
|
| 7 |
-
"""
|
| 8 |
-
|
| 9 |
-
from airflow import DAG
|
| 10 |
-
from airflow.operators.python import PythonOperator
|
| 11 |
-
from airflow.providers.postgres.hooks.postgres import PostgresHook
|
| 12 |
-
from airflow.utils.dates import days_ago
|
| 13 |
-
from datetime import datetime, timedelta
|
| 14 |
-
import psycopg2
|
| 15 |
-
from clickhouse_driver import Client
|
| 16 |
-
import logging
|
| 17 |
-
|
| 18 |
-
logger = logging.getLogger(__name__)
|
| 19 |
-
|
| 20 |
-
# Configuration
|
| 21 |
-
POSTGRES_CONN_ID = 'postgres_stripe'
|
| 22 |
-
BATCH_SIZE = 1000
|
| 23 |
-
|
| 24 |
-
default_args = {
|
| 25 |
-
'owner': 'david_rambeau',
|
| 26 |
-
'depends_on_past': False,
|
| 27 |
-
'email_on_failure': False,
|
| 28 |
-
'email_on_retry': False,
|
| 29 |
-
'retries': 3,
|
| 30 |
-
'retry_delay': timedelta(minutes=5),
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
def extract_transactions_from_postgres(**context):
|
| 34 |
-
"""
|
| 35 |
-
EXTRACT: Récupérer les transactions depuis PostgreSQL
|
| 36 |
-
"""
|
| 37 |
-
execution_date = context['execution_date']
|
| 38 |
-
logger.info(f"Extracting transactions for date: {execution_date}")
|
| 39 |
-
|
| 40 |
-
# Connexion PostgreSQL
|
| 41 |
-
pg_conn = psycopg2.connect(
|
| 42 |
-
host='postgres',
|
| 43 |
-
port=5432,
|
| 44 |
-
user='stripe_user',
|
| 45 |
-
password='stripe_password',
|
| 46 |
-
database='stripe_oltp'
|
| 47 |
-
)
|
| 48 |
-
|
| 49 |
-
cursor = pg_conn.cursor()
|
| 50 |
-
|
| 51 |
-
# Extraction des transactions avec jointures
|
| 52 |
-
query = """
|
| 53 |
-
SELECT
|
| 54 |
-
t.transaction_id,
|
| 55 |
-
t.user_id,
|
| 56 |
-
t.merchant_id,
|
| 57 |
-
t.amount,
|
| 58 |
-
t.currency,
|
| 59 |
-
t.status,
|
| 60 |
-
t.payment_method,
|
| 61 |
-
t.is_fraud,
|
| 62 |
-
t.fraud_score,
|
| 63 |
-
t.created_at,
|
| 64 |
-
u.country as user_country,
|
| 65 |
-
m.category as merchant_category
|
| 66 |
-
FROM transactions t
|
| 67 |
-
JOIN users u ON t.user_id = u.user_id
|
| 68 |
-
JOIN merchants m ON t.merchant_id = m.merchant_id
|
| 69 |
-
WHERE DATE(t.created_at) = DATE(%s)
|
| 70 |
-
ORDER BY t.created_at
|
| 71 |
-
"""
|
| 72 |
-
|
| 73 |
-
cursor.execute(query, (execution_date,))
|
| 74 |
-
transactions = cursor.fetchall()
|
| 75 |
-
|
| 76 |
-
cursor.close()
|
| 77 |
-
pg_conn.close()
|
| 78 |
-
|
| 79 |
-
logger.info(f"Extracted {len(transactions)} transactions")
|
| 80 |
-
|
| 81 |
-
# Stocker dans XCom pour la prochaine tâche
|
| 82 |
-
context['ti'].xcom_push(key='transactions', value=transactions)
|
| 83 |
-
|
| 84 |
-
return len(transactions)
|
| 85 |
-
|
| 86 |
-
def transform_transactions(**context):
|
| 87 |
-
"""
|
| 88 |
-
TRANSFORM: Transformer les données pour ClickHouse
|
| 89 |
-
"""
|
| 90 |
-
transactions = context['ti'].xcom_pull(key='transactions', task_ids='extract_from_postgres')
|
| 91 |
-
|
| 92 |
-
if not transactions:
|
| 93 |
-
logger.warning("No transactions to transform")
|
| 94 |
-
return 0
|
| 95 |
-
|
| 96 |
-
# Transformation: conversion types, nettoyage, enrichissement
|
| 97 |
-
transformed = []
|
| 98 |
-
for tx in transactions:
|
| 99 |
-
transformed.append({
|
| 100 |
-
'transaction_id': tx[0],
|
| 101 |
-
'user_id': tx[1],
|
| 102 |
-
'merchant_id': tx[2],
|
| 103 |
-
'amount': float(tx[3]),
|
| 104 |
-
'currency': tx[4],
|
| 105 |
-
'status': tx[5],
|
| 106 |
-
'payment_method': tx[6],
|
| 107 |
-
'is_fraud': 1 if tx[7] else 0,
|
| 108 |
-
'fraud_score': tx[8] or 0,
|
| 109 |
-
'created_at': tx[9],
|
| 110 |
-
'country': tx[10],
|
| 111 |
-
'merchant_category': tx[11]
|
| 112 |
-
})
|
| 113 |
-
|
| 114 |
-
logger.info(f"Transformed {len(transformed)} transactions")
|
| 115 |
-
|
| 116 |
-
context['ti'].xcom_push(key='transformed_transactions', value=transformed)
|
| 117 |
-
|
| 118 |
-
return len(transformed)
|
| 119 |
-
|
| 120 |
-
def load_to_clickhouse(**context):
|
| 121 |
-
"""
|
| 122 |
-
LOAD: Charger les données dans ClickHouse
|
| 123 |
-
"""
|
| 124 |
-
transactions = context['ti'].xcom_pull(key='transformed_transactions', task_ids='transform_transactions')
|
| 125 |
-
|
| 126 |
-
if not transactions:
|
| 127 |
-
logger.warning("No transactions to load")
|
| 128 |
-
return 0
|
| 129 |
-
|
| 130 |
-
# Connexion ClickHouse
|
| 131 |
-
ch_client = Client(
|
| 132 |
-
host='clickhouse',
|
| 133 |
-
port=9000,
|
| 134 |
-
user='stripe_user',
|
| 135 |
-
password='stripe_password',
|
| 136 |
-
database='stripe_olap'
|
| 137 |
-
)
|
| 138 |
-
|
| 139 |
-
# Vérifier si la table existe, sinon la créer
|
| 140 |
-
ch_client.execute("""
|
| 141 |
-
CREATE TABLE IF NOT EXISTS transactions_olap (
|
| 142 |
-
transaction_id String,
|
| 143 |
-
user_id String,
|
| 144 |
-
merchant_id String,
|
| 145 |
-
amount Decimal(15, 2),
|
| 146 |
-
currency String,
|
| 147 |
-
status String,
|
| 148 |
-
payment_method String,
|
| 149 |
-
is_fraud UInt8,
|
| 150 |
-
fraud_score UInt8,
|
| 151 |
-
created_at DateTime,
|
| 152 |
-
country String,
|
| 153 |
-
merchant_category String
|
| 154 |
-
) ENGINE = MergeTree()
|
| 155 |
-
ORDER BY (created_at, transaction_id)
|
| 156 |
-
PARTITION BY toYYYYMM(created_at)
|
| 157 |
-
""")
|
| 158 |
-
|
| 159 |
-
# Insertion par batch
|
| 160 |
-
inserted = 0
|
| 161 |
-
for i in range(0, len(transactions), BATCH_SIZE):
|
| 162 |
-
batch = transactions[i:i+BATCH_SIZE]
|
| 163 |
-
|
| 164 |
-
ch_client.execute(
|
| 165 |
-
"""
|
| 166 |
-
INSERT INTO transactions_olap
|
| 167 |
-
(transaction_id, user_id, merchant_id, amount, currency, status,
|
| 168 |
-
payment_method, is_fraud, fraud_score, created_at, country, merchant_category)
|
| 169 |
-
VALUES
|
| 170 |
-
""",
|
| 171 |
-
batch
|
| 172 |
-
)
|
| 173 |
-
|
| 174 |
-
inserted += len(batch)
|
| 175 |
-
logger.info(f"Inserted batch {i//BATCH_SIZE + 1}: {len(batch)} records")
|
| 176 |
-
|
| 177 |
-
logger.info(f"Successfully loaded {inserted} transactions to ClickHouse")
|
| 178 |
-
|
| 179 |
-
return inserted
|
| 180 |
-
|
| 181 |
-
def validate_data_quality(**context):
|
| 182 |
-
"""
|
| 183 |
-
VALIDATE: Vérifier la qualité des données chargées
|
| 184 |
-
"""
|
| 185 |
-
execution_date = context['execution_date']
|
| 186 |
-
|
| 187 |
-
# Connexion PostgreSQL
|
| 188 |
-
pg_conn = psycopg2.connect(
|
| 189 |
-
host='postgres',
|
| 190 |
-
port=5432,
|
| 191 |
-
user='stripe_user',
|
| 192 |
-
password='stripe_password',
|
| 193 |
-
database='stripe_oltp'
|
| 194 |
-
)
|
| 195 |
-
pg_cursor = pg_conn.cursor()
|
| 196 |
-
|
| 197 |
-
# Connexion ClickHouse
|
| 198 |
-
ch_client = Client(
|
| 199 |
-
host='clickhouse',
|
| 200 |
-
port=9000,
|
| 201 |
-
user='stripe_user',
|
| 202 |
-
password='stripe_password',
|
| 203 |
-
database='stripe_olap'
|
| 204 |
-
)
|
| 205 |
-
|
| 206 |
-
# Compter les enregistrements dans PostgreSQL
|
| 207 |
-
pg_cursor.execute("""
|
| 208 |
-
SELECT COUNT(*) FROM transactions
|
| 209 |
-
WHERE DATE(created_at) = DATE(%s)
|
| 210 |
-
""", (execution_date,))
|
| 211 |
-
pg_count = pg_cursor.fetchone()[0]
|
| 212 |
-
|
| 213 |
-
# Compter les enregistrements dans ClickHouse
|
| 214 |
-
ch_result = ch_client.execute("""
|
| 215 |
-
SELECT COUNT(*) FROM transactions_olap
|
| 216 |
-
WHERE toDate(created_at) = %s
|
| 217 |
-
""", (execution_date.date(),))
|
| 218 |
-
ch_count = ch_result[0][0]
|
| 219 |
-
|
| 220 |
-
pg_cursor.close()
|
| 221 |
-
pg_conn.close()
|
| 222 |
-
|
| 223 |
-
# Validation
|
| 224 |
-
if pg_count != ch_count:
|
| 225 |
-
raise ValueError(
|
| 226 |
-
f"Data quality check FAILED: PostgreSQL has {pg_count} records, "
|
| 227 |
-
f"ClickHouse has {ch_count} records for date {execution_date.date()}"
|
| 228 |
-
)
|
| 229 |
-
|
| 230 |
-
logger.info(f"Data quality check PASSED: {pg_count} records match in both databases")
|
| 231 |
-
|
| 232 |
-
return True
|
| 233 |
-
|
| 234 |
-
def send_completion_notification(**context):
|
| 235 |
-
"""
|
| 236 |
-
NOTIFY: Envoyer une notification de fin d'ETL
|
| 237 |
-
"""
|
| 238 |
-
execution_date = context['execution_date']
|
| 239 |
-
extracted = context['ti'].xcom_pull(key='return_value', task_ids='extract_from_postgres')
|
| 240 |
-
loaded = context['ti'].xcom_pull(key='return_value', task_ids='load_to_clickhouse')
|
| 241 |
-
|
| 242 |
-
message = f"""
|
| 243 |
-
ETL Pipeline Completed Successfully!
|
| 244 |
-
|
| 245 |
-
Date: {execution_date.date()}
|
| 246 |
-
Extracted: {extracted} transactions
|
| 247 |
-
Loaded: {loaded} transactions
|
| 248 |
-
Status: ✅ SUCCESS
|
| 249 |
-
|
| 250 |
-
ClickHouse OLAP database is up to date.
|
| 251 |
-
"""
|
| 252 |
-
|
| 253 |
-
logger.info(message)
|
| 254 |
-
|
| 255 |
-
# Ici vous pouvez ajouter l'envoi d'email, Slack, etc.
|
| 256 |
-
# Pour la démo, on log simplement
|
| 257 |
-
|
| 258 |
-
return True
|
| 259 |
-
|
| 260 |
-
# Définition du DAG
|
| 261 |
-
with DAG(
|
| 262 |
-
'etl_postgres_to_clickhouse',
|
| 263 |
-
default_args=default_args,
|
| 264 |
-
description='Daily ETL: PostgreSQL (OLTP) → ClickHouse (OLAP)',
|
| 265 |
-
schedule_interval='0 2 * * *', # Tous les jours à 2h du matin
|
| 266 |
-
start_date=days_ago(1),
|
| 267 |
-
catchup=False,
|
| 268 |
-
tags=['etl', 'postgresql', 'clickhouse', 'daily'],
|
| 269 |
-
) as dag:
|
| 270 |
-
|
| 271 |
-
# Task 1: Extract
|
| 272 |
-
extract_task = PythonOperator(
|
| 273 |
-
task_id='extract_from_postgres',
|
| 274 |
-
python_callable=extract_transactions_from_postgres,
|
| 275 |
-
provide_context=True,
|
| 276 |
-
)
|
| 277 |
-
|
| 278 |
-
# Task 2: Transform
|
| 279 |
-
transform_task = PythonOperator(
|
| 280 |
-
task_id='transform_transactions',
|
| 281 |
-
python_callable=transform_transactions,
|
| 282 |
-
provide_context=True,
|
| 283 |
-
)
|
| 284 |
-
|
| 285 |
-
# Task 3: Load
|
| 286 |
-
load_task = PythonOperator(
|
| 287 |
-
task_id='load_to_clickhouse',
|
| 288 |
-
python_callable=load_to_clickhouse,
|
| 289 |
-
provide_context=True,
|
| 290 |
-
)
|
| 291 |
-
|
| 292 |
-
# Task 4: Validate
|
| 293 |
-
validate_task = PythonOperator(
|
| 294 |
-
task_id='validate_data_quality',
|
| 295 |
-
python_callable=validate_data_quality,
|
| 296 |
-
provide_context=True,
|
| 297 |
-
)
|
| 298 |
-
|
| 299 |
-
# Task 5: Notify
|
| 300 |
-
notify_task = PythonOperator(
|
| 301 |
-
task_id='send_completion_notification',
|
| 302 |
-
python_callable=send_completion_notification,
|
| 303 |
-
provide_context=True,
|
| 304 |
-
)
|
| 305 |
-
|
| 306 |
-
# Définir le flux d'exécution
|
| 307 |
-
extract_task >> transform_task >> load_task >> validate_task >> notify_task
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
# Airflow dependencies for DAGs
|
| 2 |
-
apache-airflow==2.8.0
|
| 3 |
-
apache-airflow-providers-postgres==5.10.0
|
| 4 |
-
psycopg2-binary==2.9.9
|
| 5 |
-
clickhouse-driver==0.2.6
|
| 6 |
-
pymongo==4.6.0
|
| 7 |
-
redis==5.0.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/clickhouse/init.sql
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
-- ============================================
|
| 2 |
-
-- CLICKHOUSE OLAP - Analytics Database
|
| 3 |
-
-- ============================================
|
| 4 |
-
|
| 5 |
-
CREATE DATABASE IF NOT EXISTS stripe_olap;
|
| 6 |
-
|
| 7 |
-
USE stripe_olap;
|
| 8 |
-
|
| 9 |
-
-- Table pour analytics (colonnar storage optimisé)
|
| 10 |
-
CREATE TABLE IF NOT EXISTS transactions_olap (
|
| 11 |
-
transaction_id String,
|
| 12 |
-
user_id String,
|
| 13 |
-
merchant_id String,
|
| 14 |
-
amount Decimal(15, 2),
|
| 15 |
-
currency String,
|
| 16 |
-
status String,
|
| 17 |
-
payment_method String,
|
| 18 |
-
is_fraud UInt8,
|
| 19 |
-
fraud_score UInt8,
|
| 20 |
-
created_at DateTime,
|
| 21 |
-
country String,
|
| 22 |
-
merchant_category String
|
| 23 |
-
) ENGINE = MergeTree()
|
| 24 |
-
ORDER BY (created_at, transaction_id)
|
| 25 |
-
PARTITION BY toYYYYMM(created_at);
|
| 26 |
-
|
| 27 |
-
-- Vue agrégée par jour
|
| 28 |
-
CREATE MATERIALIZED VIEW IF NOT EXISTS fraud_stats_daily
|
| 29 |
-
ENGINE = SummingMergeTree()
|
| 30 |
-
ORDER BY (date, merchant_category)
|
| 31 |
-
AS SELECT
|
| 32 |
-
toDate(created_at) as date,
|
| 33 |
-
merchant_category,
|
| 34 |
-
count() as total_transactions,
|
| 35 |
-
sum(is_fraud) as fraud_transactions,
|
| 36 |
-
sum(amount) as total_amount,
|
| 37 |
-
avg(amount) as avg_amount
|
| 38 |
-
FROM transactions_olap
|
| 39 |
-
GROUP BY date, merchant_category;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/docker-compose.yml
DELETED
|
@@ -1,527 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
services:
|
| 4 |
-
# ============================================
|
| 5 |
-
# 1. POSTGRES (OLTP - Données transactionnelles)
|
| 6 |
-
# ============================================
|
| 7 |
-
postgres:
|
| 8 |
-
image: postgres:15-alpine
|
| 9 |
-
container_name: stripe-postgres
|
| 10 |
-
environment:
|
| 11 |
-
POSTGRES_USER: ${POSTGRES_USER}
|
| 12 |
-
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
| 13 |
-
POSTGRES_DB: ${POSTGRES_DB}
|
| 14 |
-
ports:
|
| 15 |
-
- "5432:5432"
|
| 16 |
-
volumes:
|
| 17 |
-
- postgres_data:/var/lib/postgresql/data
|
| 18 |
-
- ./postgres/init.sql:/docker-entrypoint-initdb.d/01-init.sql
|
| 19 |
-
- ./postgres/seed_data.sql:/docker-entrypoint-initdb.d/02-seed.sql
|
| 20 |
-
healthcheck:
|
| 21 |
-
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
| 22 |
-
interval: 10s
|
| 23 |
-
timeout: 5s
|
| 24 |
-
retries: 5
|
| 25 |
-
networks:
|
| 26 |
-
- stripe-network
|
| 27 |
-
|
| 28 |
-
# ============================================
|
| 29 |
-
# 2. CLICKHOUSE (OLAP - Analytics)
|
| 30 |
-
# ============================================
|
| 31 |
-
clickhouse:
|
| 32 |
-
image: clickhouse/clickhouse-server:latest
|
| 33 |
-
container_name: stripe-clickhouse
|
| 34 |
-
environment:
|
| 35 |
-
CLICKHOUSE_DB: ${CLICKHOUSE_DB}
|
| 36 |
-
CLICKHOUSE_USER: ${CLICKHOUSE_USER}
|
| 37 |
-
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
|
| 38 |
-
ports:
|
| 39 |
-
- "8123:8123"
|
| 40 |
-
- "9000:9000"
|
| 41 |
-
volumes:
|
| 42 |
-
- clickhouse_data:/var/lib/clickhouse
|
| 43 |
-
- ./clickhouse/init.sql:/docker-entrypoint-initdb.d/init.sql
|
| 44 |
-
healthcheck:
|
| 45 |
-
test: ["CMD", "wget", "--spider", "-q", "localhost:8123/ping"]
|
| 46 |
-
interval: 10s
|
| 47 |
-
timeout: 5s
|
| 48 |
-
retries: 5
|
| 49 |
-
networks:
|
| 50 |
-
- stripe-network
|
| 51 |
-
|
| 52 |
-
# ============================================
|
| 53 |
-
# 3. MONGODB (NoSQL - Documents flexibles)
|
| 54 |
-
# ============================================
|
| 55 |
-
mongodb:
|
| 56 |
-
image: mongo:7
|
| 57 |
-
container_name: stripe-mongodb
|
| 58 |
-
environment:
|
| 59 |
-
MONGO_INITDB_ROOT_USERNAME: ${MONGODB_USER}
|
| 60 |
-
MONGO_INITDB_ROOT_PASSWORD: ${MONGODB_PASSWORD}
|
| 61 |
-
MONGO_INITDB_DATABASE: ${MONGODB_DB}
|
| 62 |
-
ports:
|
| 63 |
-
- "27017:27017"
|
| 64 |
-
volumes:
|
| 65 |
-
- mongodb_data:/data/db
|
| 66 |
-
- ./mongodb/init.js:/docker-entrypoint-initdb.d/init.js
|
| 67 |
-
- ./mongodb/seed_data.js:/docker-entrypoint-initdb.d/seed_data.js
|
| 68 |
-
healthcheck:
|
| 69 |
-
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
|
| 70 |
-
interval: 10s
|
| 71 |
-
timeout: 5s
|
| 72 |
-
retries: 5
|
| 73 |
-
networks:
|
| 74 |
-
- stripe-network
|
| 75 |
-
|
| 76 |
-
# ============================================
|
| 77 |
-
# 4. REDIS (Cache)
|
| 78 |
-
# ============================================
|
| 79 |
-
redis:
|
| 80 |
-
image: redis:7-alpine
|
| 81 |
-
container_name: stripe-redis
|
| 82 |
-
command: redis-server --requirepass ${REDIS_PASSWORD}
|
| 83 |
-
ports:
|
| 84 |
-
- "6379:6379"
|
| 85 |
-
volumes:
|
| 86 |
-
- redis_data:/data
|
| 87 |
-
healthcheck:
|
| 88 |
-
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
| 89 |
-
interval: 10s
|
| 90 |
-
timeout: 5s
|
| 91 |
-
retries: 5
|
| 92 |
-
networks:
|
| 93 |
-
- stripe-network
|
| 94 |
-
|
| 95 |
-
# ============================================
|
| 96 |
-
# 5. ZOOKEEPER (Kafka dependency)
|
| 97 |
-
# ============================================
|
| 98 |
-
zookeeper:
|
| 99 |
-
image: confluentinc/cp-zookeeper:7.5.0
|
| 100 |
-
container_name: stripe-zookeeper
|
| 101 |
-
environment:
|
| 102 |
-
ZOOKEEPER_CLIENT_PORT: 2181
|
| 103 |
-
ZOOKEEPER_TICK_TIME: 2000
|
| 104 |
-
ports:
|
| 105 |
-
- "2181:2181"
|
| 106 |
-
volumes:
|
| 107 |
-
- zookeeper_data:/var/lib/zookeeper/data
|
| 108 |
-
- zookeeper_logs:/var/lib/zookeeper/log
|
| 109 |
-
healthcheck:
|
| 110 |
-
test: ["CMD", "nc", "-z", "localhost", "2181"]
|
| 111 |
-
interval: 10s
|
| 112 |
-
timeout: 5s
|
| 113 |
-
retries: 5
|
| 114 |
-
networks:
|
| 115 |
-
- stripe-network
|
| 116 |
-
|
| 117 |
-
# ============================================
|
| 118 |
-
# 6. KAFKA (Streaming)
|
| 119 |
-
# ============================================
|
| 120 |
-
kafka:
|
| 121 |
-
image: confluentinc/cp-kafka:7.5.0
|
| 122 |
-
container_name: stripe-kafka
|
| 123 |
-
depends_on:
|
| 124 |
-
zookeeper:
|
| 125 |
-
condition: service_healthy
|
| 126 |
-
environment:
|
| 127 |
-
KAFKA_BROKER_ID: 1
|
| 128 |
-
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
| 129 |
-
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
|
| 130 |
-
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
|
| 131 |
-
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
| 132 |
-
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
| 133 |
-
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
|
| 134 |
-
ports:
|
| 135 |
-
- "29092:29092"
|
| 136 |
-
- "9092:9092"
|
| 137 |
-
volumes:
|
| 138 |
-
- kafka_data:/var/lib/kafka/data
|
| 139 |
-
healthcheck:
|
| 140 |
-
test: ["CMD", "kafka-broker-api-versions", "--bootstrap-server", "localhost:9092"]
|
| 141 |
-
interval: 10s
|
| 142 |
-
timeout: 10s
|
| 143 |
-
retries: 5
|
| 144 |
-
networks:
|
| 145 |
-
- stripe-network
|
| 146 |
-
|
| 147 |
-
# ============================================
|
| 148 |
-
# 7. MINIO (Object Storage)
|
| 149 |
-
# ============================================
|
| 150 |
-
minio:
|
| 151 |
-
image: minio/minio:latest
|
| 152 |
-
container_name: stripe-minio
|
| 153 |
-
command: server /data --console-address ":9001"
|
| 154 |
-
environment:
|
| 155 |
-
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
|
| 156 |
-
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
|
| 157 |
-
ports:
|
| 158 |
-
- "9002:9000"
|
| 159 |
-
- "9001:9001"
|
| 160 |
-
volumes:
|
| 161 |
-
- minio_data:/data
|
| 162 |
-
healthcheck:
|
| 163 |
-
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
| 164 |
-
interval: 10s
|
| 165 |
-
timeout: 5s
|
| 166 |
-
retries: 5
|
| 167 |
-
networks:
|
| 168 |
-
- stripe-network
|
| 169 |
-
|
| 170 |
-
# ============================================
|
| 171 |
-
# 8. NEO4J (Graph Database)
|
| 172 |
-
# ============================================
|
| 173 |
-
neo4j:
|
| 174 |
-
image: neo4j:5.13
|
| 175 |
-
container_name: stripe-neo4j
|
| 176 |
-
environment:
|
| 177 |
-
NEO4J_AUTH: ${NEO4J_USER}/${NEO4J_PASSWORD}
|
| 178 |
-
NEO4J_PLUGINS: '["apoc", "graph-data-science"]'
|
| 179 |
-
NEO4J_dbms_security_procedures_unrestricted: apoc.*,gds.*
|
| 180 |
-
ports:
|
| 181 |
-
- "7474:7474"
|
| 182 |
-
- "7687:7687"
|
| 183 |
-
volumes:
|
| 184 |
-
- neo4j_data:/data
|
| 185 |
-
- neo4j_logs:/logs
|
| 186 |
-
- ./neo4j/init.cypher:/var/lib/neo4j/import/init.cypher
|
| 187 |
-
healthcheck:
|
| 188 |
-
test: ["CMD", "cypher-shell", "-u", "${NEO4J_USER}", "-p", "${NEO4J_PASSWORD}", "RETURN 1"]
|
| 189 |
-
interval: 10s
|
| 190 |
-
timeout: 5s
|
| 191 |
-
retries: 5
|
| 192 |
-
networks:
|
| 193 |
-
- stripe-network
|
| 194 |
-
|
| 195 |
-
# ============================================
|
| 196 |
-
# 9. MLFLOW (ML Tracking)
|
| 197 |
-
# ============================================
|
| 198 |
-
mlflow:
|
| 199 |
-
image: ghcr.io/mlflow/mlflow:v2.9.2
|
| 200 |
-
container_name: stripe-mlflow
|
| 201 |
-
command: mlflow server --host 0.0.0.0 --port 5000 --backend-store-uri sqlite:///mlflow.db --default-artifact-root /mlflow/artifacts
|
| 202 |
-
ports:
|
| 203 |
-
- "5000:5000"
|
| 204 |
-
volumes:
|
| 205 |
-
- mlflow_data:/mlflow
|
| 206 |
-
- ./mlflow/model:/mlflow/model
|
| 207 |
-
healthcheck:
|
| 208 |
-
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
|
| 209 |
-
interval: 10s
|
| 210 |
-
timeout: 5s
|
| 211 |
-
retries: 5
|
| 212 |
-
networks:
|
| 213 |
-
- stripe-network
|
| 214 |
-
|
| 215 |
-
# ============================================
|
| 216 |
-
# 10. ELASTICSEARCH (Logs & Search)
|
| 217 |
-
# ============================================
|
| 218 |
-
elasticsearch:
|
| 219 |
-
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
|
| 220 |
-
container_name: stripe-elasticsearch
|
| 221 |
-
environment:
|
| 222 |
-
- discovery.type=single-node
|
| 223 |
-
- xpack.security.enabled=false
|
| 224 |
-
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
| 225 |
-
ports:
|
| 226 |
-
- "9200:9200"
|
| 227 |
-
volumes:
|
| 228 |
-
- elasticsearch_data:/usr/share/elasticsearch/data
|
| 229 |
-
healthcheck:
|
| 230 |
-
test: ["CMD-SHELL", "curl -f http://localhost:9200/_cluster/health || exit 1"]
|
| 231 |
-
interval: 10s
|
| 232 |
-
timeout: 5s
|
| 233 |
-
retries: 5
|
| 234 |
-
networks:
|
| 235 |
-
- stripe-network
|
| 236 |
-
|
| 237 |
-
# ============================================
|
| 238 |
-
# 11. KIBANA (Elasticsearch UI)
|
| 239 |
-
# ============================================
|
| 240 |
-
kibana:
|
| 241 |
-
image: docker.elastic.co/kibana/kibana:8.11.0
|
| 242 |
-
container_name: stripe-kibana
|
| 243 |
-
depends_on:
|
| 244 |
-
elasticsearch:
|
| 245 |
-
condition: service_healthy
|
| 246 |
-
environment:
|
| 247 |
-
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
|
| 248 |
-
ports:
|
| 249 |
-
- "5601:5601"
|
| 250 |
-
healthcheck:
|
| 251 |
-
test: ["CMD-SHELL", "curl -f http://localhost:5601/api/status || exit 1"]
|
| 252 |
-
interval: 10s
|
| 253 |
-
timeout: 5s
|
| 254 |
-
retries: 5
|
| 255 |
-
networks:
|
| 256 |
-
- stripe-network
|
| 257 |
-
|
| 258 |
-
# ============================================
|
| 259 |
-
# 12. FASTAPI (Backend API)
|
| 260 |
-
# ============================================
|
| 261 |
-
fastapi:
|
| 262 |
-
build:
|
| 263 |
-
context: ./fastapi
|
| 264 |
-
dockerfile: Dockerfile
|
| 265 |
-
container_name: stripe-fastapi
|
| 266 |
-
depends_on:
|
| 267 |
-
postgres:
|
| 268 |
-
condition: service_healthy
|
| 269 |
-
mongodb:
|
| 270 |
-
condition: service_healthy
|
| 271 |
-
redis:
|
| 272 |
-
condition: service_healthy
|
| 273 |
-
kafka:
|
| 274 |
-
condition: service_healthy
|
| 275 |
-
neo4j:
|
| 276 |
-
condition: service_healthy
|
| 277 |
-
mlflow:
|
| 278 |
-
condition: service_healthy
|
| 279 |
-
elasticsearch:
|
| 280 |
-
condition: service_healthy
|
| 281 |
-
environment:
|
| 282 |
-
POSTGRES_HOST: ${POSTGRES_HOST}
|
| 283 |
-
POSTGRES_PORT: ${POSTGRES_PORT}
|
| 284 |
-
POSTGRES_USER: ${POSTGRES_USER}
|
| 285 |
-
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
| 286 |
-
POSTGRES_DB: ${POSTGRES_DB}
|
| 287 |
-
CLICKHOUSE_HOST: ${CLICKHOUSE_HOST}
|
| 288 |
-
CLICKHOUSE_PORT: ${CLICKHOUSE_PORT}
|
| 289 |
-
CLICKHOUSE_USER: ${CLICKHOUSE_USER}
|
| 290 |
-
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
|
| 291 |
-
CLICKHOUSE_DB: ${CLICKHOUSE_DB}
|
| 292 |
-
MONGODB_HOST: ${MONGODB_HOST}
|
| 293 |
-
MONGODB_PORT: ${MONGODB_PORT}
|
| 294 |
-
MONGODB_USER: ${MONGODB_USER}
|
| 295 |
-
MONGODB_PASSWORD: ${MONGODB_PASSWORD}
|
| 296 |
-
MONGODB_DB: ${MONGODB_DB}
|
| 297 |
-
REDIS_HOST: ${REDIS_HOST}
|
| 298 |
-
REDIS_PORT: ${REDIS_PORT}
|
| 299 |
-
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
| 300 |
-
KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_BOOTSTRAP_SERVERS}
|
| 301 |
-
NEO4J_URI: ${NEO4J_URI}
|
| 302 |
-
NEO4J_USER: ${NEO4J_USER}
|
| 303 |
-
NEO4J_PASSWORD: ${NEO4J_PASSWORD}
|
| 304 |
-
MLFLOW_TRACKING_URI: ${MLFLOW_TRACKING_URI}
|
| 305 |
-
ELASTICSEARCH_HOST: ${ELASTICSEARCH_HOST}
|
| 306 |
-
ELASTICSEARCH_PORT: ${ELASTICSEARCH_PORT}
|
| 307 |
-
MINIO_ENDPOINT: ${MINIO_ENDPOINT}
|
| 308 |
-
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY}
|
| 309 |
-
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY}
|
| 310 |
-
ports:
|
| 311 |
-
- "8000:8000"
|
| 312 |
-
volumes:
|
| 313 |
-
- ./fastapi:/app
|
| 314 |
-
- ./mlflow/model:/mlflow/model # Share ML model with MLflow
|
| 315 |
-
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
|
| 316 |
-
healthcheck:
|
| 317 |
-
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
| 318 |
-
interval: 10s
|
| 319 |
-
timeout: 5s
|
| 320 |
-
retries: 5
|
| 321 |
-
networks:
|
| 322 |
-
- stripe-network
|
| 323 |
-
|
| 324 |
-
# ============================================
|
| 325 |
-
# 13. FLASK (Frontend Web)
|
| 326 |
-
# ============================================
|
| 327 |
-
flask:
|
| 328 |
-
build:
|
| 329 |
-
context: ./flask
|
| 330 |
-
dockerfile: Dockerfile
|
| 331 |
-
container_name: stripe-flask
|
| 332 |
-
depends_on:
|
| 333 |
-
fastapi:
|
| 334 |
-
condition: service_healthy
|
| 335 |
-
environment:
|
| 336 |
-
FASTAPI_URL: http://fastapi:8000
|
| 337 |
-
ports:
|
| 338 |
-
- "5050:5050"
|
| 339 |
-
volumes:
|
| 340 |
-
- ./flask:/app
|
| 341 |
-
command: python app.py
|
| 342 |
-
healthcheck:
|
| 343 |
-
test: ["CMD", "curl", "-f", "http://localhost:5050/health"]
|
| 344 |
-
interval: 10s
|
| 345 |
-
timeout: 5s
|
| 346 |
-
retries: 5
|
| 347 |
-
networks:
|
| 348 |
-
- stripe-network
|
| 349 |
-
|
| 350 |
-
# ============================================
|
| 351 |
-
# 14. GRAFANA (Visualisation)
|
| 352 |
-
# ============================================
|
| 353 |
-
grafana:
|
| 354 |
-
image: grafana/grafana:10.2.0
|
| 355 |
-
container_name: stripe-grafana
|
| 356 |
-
depends_on:
|
| 357 |
-
postgres:
|
| 358 |
-
condition: service_healthy
|
| 359 |
-
clickhouse:
|
| 360 |
-
condition: service_healthy
|
| 361 |
-
environment:
|
| 362 |
-
GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USER}
|
| 363 |
-
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD}
|
| 364 |
-
GF_INSTALL_PLUGINS: grafana-clickhouse-datasource
|
| 365 |
-
ports:
|
| 366 |
-
- "3000:3000"
|
| 367 |
-
volumes:
|
| 368 |
-
- grafana_data:/var/lib/grafana
|
| 369 |
-
- ./grafana/provisioning:/etc/grafana/provisioning
|
| 370 |
-
- ./grafana/dashboards:/var/lib/grafana/dashboards
|
| 371 |
-
healthcheck:
|
| 372 |
-
test: ["CMD-SHELL", "curl -f http://localhost:3000/api/health || exit 1"]
|
| 373 |
-
interval: 10s
|
| 374 |
-
timeout: 5s
|
| 375 |
-
retries: 5
|
| 376 |
-
networks:
|
| 377 |
-
- stripe-network
|
| 378 |
-
|
| 379 |
-
# ============================================
|
| 380 |
-
# 15. AIRFLOW POSTGRES (Airflow metadata DB)
|
| 381 |
-
# ============================================
|
| 382 |
-
airflow-postgres:
|
| 383 |
-
image: postgres:15-alpine
|
| 384 |
-
container_name: stripe-airflow-db
|
| 385 |
-
environment:
|
| 386 |
-
POSTGRES_USER: ${AIRFLOW_DB_USER}
|
| 387 |
-
POSTGRES_PASSWORD: ${AIRFLOW_DB_PASSWORD}
|
| 388 |
-
POSTGRES_DB: ${AIRFLOW_DB}
|
| 389 |
-
volumes:
|
| 390 |
-
- airflow_postgres_data:/var/lib/postgresql/data
|
| 391 |
-
networks:
|
| 392 |
-
- stripe-network
|
| 393 |
-
|
| 394 |
-
# ============================================
|
| 395 |
-
# 16. AIRFLOW INIT (Database initialization)
|
| 396 |
-
# ============================================
|
| 397 |
-
airflow-init:
|
| 398 |
-
image: apache/airflow:2.8.0-python3.11
|
| 399 |
-
container_name: stripe-airflow-init
|
| 400 |
-
depends_on:
|
| 401 |
-
- airflow-postgres
|
| 402 |
-
environment:
|
| 403 |
-
AIRFLOW__CORE__EXECUTOR: LocalExecutor
|
| 404 |
-
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://${AIRFLOW_DB_USER}:${AIRFLOW_DB_PASSWORD}@airflow-postgres/${AIRFLOW_DB}
|
| 405 |
-
AIRFLOW__CORE__FERNET_KEY: ${AIRFLOW__CORE__FERNET_KEY}
|
| 406 |
-
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
|
| 407 |
-
AIRFLOW__WEBSERVER__SECRET_KEY: ${AIRFLOW__WEBSERVER__SECRET_KEY}
|
| 408 |
-
_AIRFLOW_DB_MIGRATE: 'true'
|
| 409 |
-
_AIRFLOW_WWW_USER_CREATE: 'true'
|
| 410 |
-
_AIRFLOW_WWW_USER_USERNAME: ${AIRFLOW_USER}
|
| 411 |
-
_AIRFLOW_WWW_USER_PASSWORD: ${AIRFLOW_PASSWORD}
|
| 412 |
-
volumes:
|
| 413 |
-
- ./airflow/dags:/opt/airflow/dags
|
| 414 |
-
- ./airflow/logs:/opt/airflow/logs
|
| 415 |
-
- ./airflow/plugins:/opt/airflow/plugins
|
| 416 |
-
command: version
|
| 417 |
-
networks:
|
| 418 |
-
- stripe-network
|
| 419 |
-
|
| 420 |
-
# ============================================
|
| 421 |
-
# 17. AIRFLOW WEBSERVER (Web UI)
|
| 422 |
-
# ============================================
|
| 423 |
-
airflow-webserver:
|
| 424 |
-
image: apache/airflow:2.8.0-python3.11
|
| 425 |
-
container_name: stripe-airflow-webserver
|
| 426 |
-
depends_on:
|
| 427 |
-
- airflow-postgres
|
| 428 |
-
- airflow-init
|
| 429 |
-
environment:
|
| 430 |
-
AIRFLOW__CORE__EXECUTOR: LocalExecutor
|
| 431 |
-
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://${AIRFLOW_DB_USER}:${AIRFLOW_DB_PASSWORD}@airflow-postgres/${AIRFLOW_DB}
|
| 432 |
-
AIRFLOW__CORE__FERNET_KEY: ${AIRFLOW__CORE__FERNET_KEY}
|
| 433 |
-
AIRFLOW__WEBSERVER__SECRET_KEY: ${AIRFLOW__WEBSERVER__SECRET_KEY}
|
| 434 |
-
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
|
| 435 |
-
POSTGRES_HOST: ${POSTGRES_HOST}
|
| 436 |
-
POSTGRES_PORT: ${POSTGRES_PORT}
|
| 437 |
-
POSTGRES_USER: ${POSTGRES_USER}
|
| 438 |
-
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
| 439 |
-
POSTGRES_DB: ${POSTGRES_DB}
|
| 440 |
-
CLICKHOUSE_HOST: ${CLICKHOUSE_HOST}
|
| 441 |
-
CLICKHOUSE_PORT: ${CLICKHOUSE_PORT}
|
| 442 |
-
CLICKHOUSE_USER: ${CLICKHOUSE_USER}
|
| 443 |
-
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
|
| 444 |
-
MONGODB_HOST: ${MONGODB_HOST}
|
| 445 |
-
MONGODB_PORT: ${MONGODB_PORT}
|
| 446 |
-
MONGODB_USER: ${MONGODB_USER}
|
| 447 |
-
MONGODB_PASSWORD: ${MONGODB_PASSWORD}
|
| 448 |
-
ports:
|
| 449 |
-
- "8080:8080"
|
| 450 |
-
volumes:
|
| 451 |
-
- ./airflow/dags:/opt/airflow/dags
|
| 452 |
-
- ./airflow/logs:/opt/airflow/logs
|
| 453 |
-
- ./airflow/plugins:/opt/airflow/plugins
|
| 454 |
-
command: webserver
|
| 455 |
-
healthcheck:
|
| 456 |
-
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
| 457 |
-
interval: 10s
|
| 458 |
-
timeout: 5s
|
| 459 |
-
retries: 5
|
| 460 |
-
networks:
|
| 461 |
-
- stripe-network
|
| 462 |
-
|
| 463 |
-
# ============================================
|
| 464 |
-
# 18. AIRFLOW SCHEDULER (Task scheduler)
|
| 465 |
-
# ============================================
|
| 466 |
-
airflow-scheduler:
|
| 467 |
-
image: apache/airflow:2.8.0-python3.11
|
| 468 |
-
container_name: stripe-airflow-scheduler
|
| 469 |
-
depends_on:
|
| 470 |
-
- airflow-postgres
|
| 471 |
-
- airflow-init
|
| 472 |
-
environment:
|
| 473 |
-
AIRFLOW__CORE__EXECUTOR: LocalExecutor
|
| 474 |
-
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://${AIRFLOW_DB_USER}:${AIRFLOW_DB_PASSWORD}@airflow-postgres/${AIRFLOW_DB}
|
| 475 |
-
AIRFLOW__CORE__FERNET_KEY: ${AIRFLOW__CORE__FERNET_KEY}
|
| 476 |
-
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
|
| 477 |
-
POSTGRES_HOST: ${POSTGRES_HOST}
|
| 478 |
-
POSTGRES_PORT: ${POSTGRES_PORT}
|
| 479 |
-
POSTGRES_USER: ${POSTGRES_USER}
|
| 480 |
-
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
| 481 |
-
POSTGRES_DB: ${POSTGRES_DB}
|
| 482 |
-
CLICKHOUSE_HOST: ${CLICKHOUSE_HOST}
|
| 483 |
-
CLICKHOUSE_PORT: ${CLICKHOUSE_PORT}
|
| 484 |
-
CLICKHOUSE_USER: ${CLICKHOUSE_USER}
|
| 485 |
-
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
|
| 486 |
-
MONGODB_HOST: ${MONGODB_HOST}
|
| 487 |
-
MONGODB_PORT: ${MONGODB_PORT}
|
| 488 |
-
MONGODB_USER: ${MONGODB_USER}
|
| 489 |
-
MONGODB_PASSWORD: ${MONGODB_PASSWORD}
|
| 490 |
-
volumes:
|
| 491 |
-
- ./airflow/dags:/opt/airflow/dags
|
| 492 |
-
- ./airflow/logs:/opt/airflow/logs
|
| 493 |
-
- ./airflow/plugins:/opt/airflow/plugins
|
| 494 |
-
command: scheduler
|
| 495 |
-
healthcheck:
|
| 496 |
-
test: ["CMD-SHELL", "airflow jobs check --job-type SchedulerJob --hostname $(hostname)"]
|
| 497 |
-
interval: 10s
|
| 498 |
-
timeout: 5s
|
| 499 |
-
retries: 5
|
| 500 |
-
networks:
|
| 501 |
-
- stripe-network
|
| 502 |
-
|
| 503 |
-
# ============================================
|
| 504 |
-
# NETWORKS
|
| 505 |
-
# ============================================
|
| 506 |
-
networks:
|
| 507 |
-
stripe-network:
|
| 508 |
-
driver: bridge
|
| 509 |
-
|
| 510 |
-
# ============================================
|
| 511 |
-
# VOLUMES (Persistence)
|
| 512 |
-
# ============================================
|
| 513 |
-
volumes:
|
| 514 |
-
postgres_data:
|
| 515 |
-
clickhouse_data:
|
| 516 |
-
mongodb_data:
|
| 517 |
-
redis_data:
|
| 518 |
-
zookeeper_data:
|
| 519 |
-
zookeeper_logs:
|
| 520 |
-
kafka_data:
|
| 521 |
-
minio_data:
|
| 522 |
-
neo4j_data:
|
| 523 |
-
neo4j_logs:
|
| 524 |
-
mlflow_data:
|
| 525 |
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/fastapi/Dockerfile
DELETED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
FROM python:3.11-slim
|
| 2 |
-
|
| 3 |
-
WORKDIR /app
|
| 4 |
-
|
| 5 |
-
# Install system dependencies
|
| 6 |
-
RUN apt-get update && apt-get install -y \
|
| 7 |
-
gcc \
|
| 8 |
-
postgresql-client \
|
| 9 |
-
curl \
|
| 10 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
-
|
| 12 |
-
# Copy requirements
|
| 13 |
-
COPY requirements.txt .
|
| 14 |
-
|
| 15 |
-
# Install Python dependencies
|
| 16 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
-
|
| 18 |
-
# Copy application code
|
| 19 |
-
COPY . .
|
| 20 |
-
|
| 21 |
-
# Expose port
|
| 22 |
-
EXPOSE 8000
|
| 23 |
-
|
| 24 |
-
# Health check
|
| 25 |
-
HEALTHCHECK --interval=10s --timeout=5s --start-period=30s --retries=3 \
|
| 26 |
-
CMD curl -f http://localhost:8000/health || exit 1
|
| 27 |
-
|
| 28 |
-
# Run application
|
| 29 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/fastapi/database.py
DELETED
|
@@ -1,156 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Database connection managers for all services
|
| 3 |
-
PostgreSQL, MongoDB, Redis, Neo4j, ClickHouse, Kafka, Elasticsearch, MinIO
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
import os
|
| 7 |
-
import psycopg2
|
| 8 |
-
from pymongo import MongoClient
|
| 9 |
-
import redis
|
| 10 |
-
from neo4j import GraphDatabase
|
| 11 |
-
from clickhouse_driver import Client as ClickHouseClient
|
| 12 |
-
from confluent_kafka import Producer
|
| 13 |
-
from elasticsearch import Elasticsearch
|
| 14 |
-
from minio import Minio
|
| 15 |
-
import logging
|
| 16 |
-
|
| 17 |
-
logger = logging.getLogger(__name__)
|
| 18 |
-
|
| 19 |
-
# ============================================
|
| 20 |
-
# POSTGRESQL (OLTP)
|
| 21 |
-
# ============================================
|
| 22 |
-
|
| 23 |
-
def get_postgres_connection():
|
| 24 |
-
"""Get PostgreSQL connection"""
|
| 25 |
-
try:
|
| 26 |
-
conn = psycopg2.connect(
|
| 27 |
-
host=os.getenv("POSTGRES_HOST", "postgres"),
|
| 28 |
-
port=os.getenv("POSTGRES_PORT", 5432),
|
| 29 |
-
user=os.getenv("POSTGRES_USER", "stripe_user"),
|
| 30 |
-
password=os.getenv("POSTGRES_PASSWORD", "stripe_password"),
|
| 31 |
-
database=os.getenv("POSTGRES_DB", "stripe_oltp")
|
| 32 |
-
)
|
| 33 |
-
return conn
|
| 34 |
-
except Exception as e:
|
| 35 |
-
logger.error(f"PostgreSQL connection error: {e}")
|
| 36 |
-
raise
|
| 37 |
-
|
| 38 |
-
# ============================================
|
| 39 |
-
# MONGODB (NoSQL)
|
| 40 |
-
# ============================================
|
| 41 |
-
|
| 42 |
-
def get_mongodb_client():
|
| 43 |
-
"""Get MongoDB client"""
|
| 44 |
-
try:
|
| 45 |
-
connection_string = f"mongodb://{os.getenv('MONGODB_USER', 'stripe_user')}:{os.getenv('MONGODB_PASSWORD', 'stripe_password')}@{os.getenv('MONGODB_HOST', 'mongodb')}:{os.getenv('MONGODB_PORT', 27017)}/"
|
| 46 |
-
client = MongoClient(connection_string)
|
| 47 |
-
return client
|
| 48 |
-
except Exception as e:
|
| 49 |
-
logger.error(f"MongoDB connection error: {e}")
|
| 50 |
-
raise
|
| 51 |
-
|
| 52 |
-
# ============================================
|
| 53 |
-
# REDIS (Cache)
|
| 54 |
-
# ============================================
|
| 55 |
-
|
| 56 |
-
def get_redis_client():
|
| 57 |
-
"""Get Redis client"""
|
| 58 |
-
try:
|
| 59 |
-
client = redis.Redis(
|
| 60 |
-
host=os.getenv("REDIS_HOST", "redis"),
|
| 61 |
-
port=os.getenv("REDIS_PORT", 6379),
|
| 62 |
-
password=os.getenv("REDIS_PASSWORD", "stripe_password"),
|
| 63 |
-
decode_responses=True
|
| 64 |
-
)
|
| 65 |
-
return client
|
| 66 |
-
except Exception as e:
|
| 67 |
-
logger.error(f"Redis connection error: {e}")
|
| 68 |
-
raise
|
| 69 |
-
|
| 70 |
-
# ============================================
|
| 71 |
-
# NEO4J (Graph Database)
|
| 72 |
-
# ============================================
|
| 73 |
-
|
| 74 |
-
def get_neo4j_driver():
|
| 75 |
-
"""Get Neo4j driver"""
|
| 76 |
-
try:
|
| 77 |
-
driver = GraphDatabase.driver(
|
| 78 |
-
os.getenv("NEO4J_URI", "bolt://neo4j:7687"),
|
| 79 |
-
auth=(
|
| 80 |
-
os.getenv("NEO4J_USER", "neo4j"),
|
| 81 |
-
os.getenv("NEO4J_PASSWORD", "stripe_password")
|
| 82 |
-
)
|
| 83 |
-
)
|
| 84 |
-
return driver
|
| 85 |
-
except Exception as e:
|
| 86 |
-
logger.error(f"Neo4j connection error: {e}")
|
| 87 |
-
raise
|
| 88 |
-
|
| 89 |
-
# ============================================
|
| 90 |
-
# CLICKHOUSE (OLAP)
|
| 91 |
-
# ============================================
|
| 92 |
-
|
| 93 |
-
def get_clickhouse_client():
|
| 94 |
-
"""Get ClickHouse client"""
|
| 95 |
-
try:
|
| 96 |
-
client = ClickHouseClient(
|
| 97 |
-
host=os.getenv("CLICKHOUSE_HOST", "clickhouse"),
|
| 98 |
-
port=os.getenv("CLICKHOUSE_PORT", 9000),
|
| 99 |
-
user=os.getenv("CLICKHOUSE_USER", "stripe_user"),
|
| 100 |
-
password=os.getenv("CLICKHOUSE_PASSWORD", "stripe_password"),
|
| 101 |
-
database=os.getenv("CLICKHOUSE_DB", "stripe_olap")
|
| 102 |
-
)
|
| 103 |
-
return client
|
| 104 |
-
except Exception as e:
|
| 105 |
-
logger.error(f"ClickHouse connection error: {e}")
|
| 106 |
-
raise
|
| 107 |
-
|
| 108 |
-
# ============================================
|
| 109 |
-
# KAFKA (Streaming)
|
| 110 |
-
# ============================================
|
| 111 |
-
|
| 112 |
-
def get_kafka_producer():
|
| 113 |
-
"""Get Kafka producer"""
|
| 114 |
-
try:
|
| 115 |
-
conf = {
|
| 116 |
-
'bootstrap.servers': os.getenv("KAFKA_BOOTSTRAP_SERVERS", "kafka:9092"),
|
| 117 |
-
'client.id': 'fastapi-producer'
|
| 118 |
-
}
|
| 119 |
-
producer = Producer(conf)
|
| 120 |
-
return producer
|
| 121 |
-
except Exception as e:
|
| 122 |
-
logger.error(f"Kafka producer error: {e}")
|
| 123 |
-
raise
|
| 124 |
-
|
| 125 |
-
# ============================================
|
| 126 |
-
# ELASTICSEARCH (Logs & Search)
|
| 127 |
-
# ============================================
|
| 128 |
-
|
| 129 |
-
def get_elasticsearch_client():
|
| 130 |
-
"""Get Elasticsearch client"""
|
| 131 |
-
try:
|
| 132 |
-
client = Elasticsearch(
|
| 133 |
-
[f"http://{os.getenv('ELASTICSEARCH_HOST', 'elasticsearch')}:{os.getenv('ELASTICSEARCH_PORT', 9200)}"]
|
| 134 |
-
)
|
| 135 |
-
return client
|
| 136 |
-
except Exception as e:
|
| 137 |
-
logger.error(f"Elasticsearch connection error: {e}")
|
| 138 |
-
raise
|
| 139 |
-
|
| 140 |
-
# ============================================
|
| 141 |
-
# MINIO (Object Storage)
|
| 142 |
-
# ============================================
|
| 143 |
-
|
| 144 |
-
def get_minio_client():
|
| 145 |
-
"""Get MinIO client"""
|
| 146 |
-
try:
|
| 147 |
-
client = Minio(
|
| 148 |
-
os.getenv("MINIO_ENDPOINT", "minio:9000"),
|
| 149 |
-
access_key=os.getenv("MINIO_ACCESS_KEY", "stripe_user"),
|
| 150 |
-
secret_key=os.getenv("MINIO_SECRET_KEY", "stripe_password"),
|
| 151 |
-
secure=False
|
| 152 |
-
)
|
| 153 |
-
return client
|
| 154 |
-
except Exception as e:
|
| 155 |
-
logger.error(f"MinIO connection error: {e}")
|
| 156 |
-
raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/fastapi/fraud_detector.py
DELETED
|
@@ -1,153 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Fraud Detection ML Model
|
| 3 |
-
Pre-trained Logistic Regression model for fraud detection
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
import joblib
|
| 7 |
-
import numpy as np
|
| 8 |
-
import os
|
| 9 |
-
import logging
|
| 10 |
-
from typing import Dict, Any
|
| 11 |
-
|
| 12 |
-
logger = logging.getLogger(__name__)
|
| 13 |
-
|
| 14 |
-
class FraudDetector:
|
| 15 |
-
"""Fraud detection using pre-trained ML model"""
|
| 16 |
-
|
| 17 |
-
def __init__(self):
|
| 18 |
-
self.model = None
|
| 19 |
-
self.load_model()
|
| 20 |
-
|
| 21 |
-
def load_model(self):
|
| 22 |
-
"""Load pre-trained model"""
|
| 23 |
-
try:
|
| 24 |
-
model_path = "/mlflow/model/logistic_regression_fraud.pkl"
|
| 25 |
-
if os.path.exists(model_path):
|
| 26 |
-
self.model = joblib.load(model_path)
|
| 27 |
-
logger.info("✅ ML model loaded successfully")
|
| 28 |
-
else:
|
| 29 |
-
logger.warning("⚠️ No ML model found, using rule-based detection")
|
| 30 |
-
self.model = None
|
| 31 |
-
except Exception as e:
|
| 32 |
-
logger.error(f"Error loading model: {e}")
|
| 33 |
-
self.model = None
|
| 34 |
-
|
| 35 |
-
def predict(self, amount: float, hour: int, velocity_1h: int,
|
| 36 |
-
avg_amount_user: float, user_total_tx: int) -> Dict[str, Any]:
|
| 37 |
-
"""
|
| 38 |
-
Predict fraud probability
|
| 39 |
-
|
| 40 |
-
Features:
|
| 41 |
-
- amount: Transaction amount
|
| 42 |
-
- hour: Hour of day (0-23)
|
| 43 |
-
- velocity_1h: Number of transactions in last hour
|
| 44 |
-
- avg_amount_user: User's average transaction amount
|
| 45 |
-
- user_total_tx: User's total transaction count
|
| 46 |
-
"""
|
| 47 |
-
|
| 48 |
-
# Calculate features
|
| 49 |
-
features = self._engineer_features(amount, hour, velocity_1h, avg_amount_user, user_total_tx)
|
| 50 |
-
|
| 51 |
-
if self.model:
|
| 52 |
-
# Use ML model
|
| 53 |
-
try:
|
| 54 |
-
X = np.array([features])
|
| 55 |
-
probability = self.model.predict_proba(X)[0][1] # Probability of fraud class
|
| 56 |
-
fraud_score = int(probability * 100)
|
| 57 |
-
is_fraud = probability >= 0.70 # 70% threshold
|
| 58 |
-
|
| 59 |
-
return {
|
| 60 |
-
"fraud_score": fraud_score,
|
| 61 |
-
"probability": probability,
|
| 62 |
-
"is_fraud": is_fraud,
|
| 63 |
-
"model": "logistic_regression"
|
| 64 |
-
}
|
| 65 |
-
except Exception as e:
|
| 66 |
-
logger.error(f"ML prediction error: {e}")
|
| 67 |
-
return self._rule_based_detection(amount, hour, velocity_1h, avg_amount_user, user_total_tx)
|
| 68 |
-
else:
|
| 69 |
-
# Fallback to rule-based
|
| 70 |
-
return self._rule_based_detection(amount, hour, velocity_1h, avg_amount_user, user_total_tx)
|
| 71 |
-
|
| 72 |
-
def _engineer_features(self, amount, hour, velocity_1h, avg_amount_user, user_total_tx):
|
| 73 |
-
"""Engineer features for ML model"""
|
| 74 |
-
|
| 75 |
-
# Amount deviation from user average
|
| 76 |
-
if avg_amount_user > 0:
|
| 77 |
-
amount_deviation = (amount - avg_amount_user) / avg_amount_user
|
| 78 |
-
else:
|
| 79 |
-
amount_deviation = 0
|
| 80 |
-
|
| 81 |
-
# High amount flag
|
| 82 |
-
high_amount = 1 if amount > 500 else 0
|
| 83 |
-
|
| 84 |
-
# Unusual hour (3 AM - 6 AM)
|
| 85 |
-
unusual_hour = 1 if 3 <= hour <= 6 else 0
|
| 86 |
-
|
| 87 |
-
# High velocity
|
| 88 |
-
high_velocity = 1 if velocity_1h >= 5 else 0
|
| 89 |
-
|
| 90 |
-
# New user
|
| 91 |
-
new_user = 1 if user_total_tx < 5 else 0
|
| 92 |
-
|
| 93 |
-
# Feature vector (must match training features)
|
| 94 |
-
features = [
|
| 95 |
-
amount,
|
| 96 |
-
hour,
|
| 97 |
-
velocity_1h,
|
| 98 |
-
avg_amount_user,
|
| 99 |
-
user_total_tx,
|
| 100 |
-
amount_deviation,
|
| 101 |
-
high_amount,
|
| 102 |
-
unusual_hour,
|
| 103 |
-
high_velocity,
|
| 104 |
-
new_user
|
| 105 |
-
]
|
| 106 |
-
|
| 107 |
-
return features
|
| 108 |
-
|
| 109 |
-
def _rule_based_detection(self, amount, hour, velocity_1h, avg_amount_user, user_total_tx):
|
| 110 |
-
"""Rule-based fraud detection as fallback"""
|
| 111 |
-
|
| 112 |
-
fraud_score = 0
|
| 113 |
-
|
| 114 |
-
# Rule 1: High amount (>500)
|
| 115 |
-
if amount > 500:
|
| 116 |
-
fraud_score += 30
|
| 117 |
-
|
| 118 |
-
# Rule 2: Very high amount (>1000)
|
| 119 |
-
if amount > 1000:
|
| 120 |
-
fraud_score += 20
|
| 121 |
-
|
| 122 |
-
# Rule 3: Unusual amount for user
|
| 123 |
-
if avg_amount_user > 0 and amount > avg_amount_user * 3:
|
| 124 |
-
fraud_score += 25
|
| 125 |
-
|
| 126 |
-
# Rule 4: High velocity
|
| 127 |
-
if velocity_1h >= 5:
|
| 128 |
-
fraud_score += 35
|
| 129 |
-
elif velocity_1h >= 3:
|
| 130 |
-
fraud_score += 20
|
| 131 |
-
|
| 132 |
-
# Rule 5: Unusual hour
|
| 133 |
-
if 3 <= hour <= 6:
|
| 134 |
-
fraud_score += 15
|
| 135 |
-
|
| 136 |
-
# Rule 6: New user with high amount
|
| 137 |
-
if user_total_tx < 5 and amount > 300:
|
| 138 |
-
fraud_score += 20
|
| 139 |
-
|
| 140 |
-
is_fraud = fraud_score >= 70
|
| 141 |
-
probability = min(fraud_score / 100.0, 1.0)
|
| 142 |
-
|
| 143 |
-
return {
|
| 144 |
-
"fraud_score": min(fraud_score, 100),
|
| 145 |
-
"probability": probability,
|
| 146 |
-
"is_fraud": is_fraud,
|
| 147 |
-
"model": "rule_based"
|
| 148 |
-
}
|
| 149 |
-
|
| 150 |
-
def close(self):
|
| 151 |
-
"""Cleanup resources"""
|
| 152 |
-
self.model = None
|
| 153 |
-
logger.info("Fraud detector closed")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/fastapi/main.py
DELETED
|
@@ -1,668 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Stripe Fraud Detection Platform - FastAPI Backend
|
| 3 |
-
Connects to all services: PostgreSQL, ClickHouse, MongoDB, Redis, Kafka, Neo4j, MLflow, Elasticsearch
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
from fastapi import FastAPI, HTTPException, BackgroundTasks
|
| 7 |
-
from fastapi.middleware.cors import CORSMiddleware
|
| 8 |
-
from pydantic import BaseModel, Field
|
| 9 |
-
from typing import Optional, List, Dict, Any
|
| 10 |
-
from datetime import datetime, timedelta
|
| 11 |
-
import os
|
| 12 |
-
import logging
|
| 13 |
-
from contextlib import asynccontextmanager
|
| 14 |
-
|
| 15 |
-
# Import custom modules
|
| 16 |
-
from database import (
|
| 17 |
-
get_postgres_connection,
|
| 18 |
-
get_mongodb_client,
|
| 19 |
-
get_redis_client,
|
| 20 |
-
get_neo4j_driver,
|
| 21 |
-
get_clickhouse_client,
|
| 22 |
-
get_kafka_producer,
|
| 23 |
-
get_elasticsearch_client,
|
| 24 |
-
get_minio_client
|
| 25 |
-
)
|
| 26 |
-
from fraud_detector import FraudDetector
|
| 27 |
-
from models import Transaction, TransactionCreate, FraudScore, User, Merchant
|
| 28 |
-
|
| 29 |
-
# Configure logging
|
| 30 |
-
logging.basicConfig(
|
| 31 |
-
level=logging.INFO,
|
| 32 |
-
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
| 33 |
-
)
|
| 34 |
-
logger = logging.getLogger(__name__)
|
| 35 |
-
|
| 36 |
-
# Initialize fraud detector
|
| 37 |
-
fraud_detector = None
|
| 38 |
-
|
| 39 |
-
@asynccontextmanager
|
| 40 |
-
async def lifespan(app: FastAPI):
|
| 41 |
-
"""Lifecycle events: startup and shutdown"""
|
| 42 |
-
global fraud_detector
|
| 43 |
-
|
| 44 |
-
# Startup
|
| 45 |
-
logger.info("Starting Stripe Fraud Detection Platform...")
|
| 46 |
-
|
| 47 |
-
try:
|
| 48 |
-
# Initialize fraud detector with MLflow model
|
| 49 |
-
fraud_detector = FraudDetector()
|
| 50 |
-
logger.info("✅ Fraud detector initialized")
|
| 51 |
-
|
| 52 |
-
# Test database connections
|
| 53 |
-
pg_conn = get_postgres_connection()
|
| 54 |
-
pg_conn.close()
|
| 55 |
-
logger.info("✅ PostgreSQL connection OK")
|
| 56 |
-
|
| 57 |
-
mongo_client = get_mongodb_client()
|
| 58 |
-
mongo_client.server_info()
|
| 59 |
-
logger.info("✅ MongoDB connection OK")
|
| 60 |
-
|
| 61 |
-
redis_client = get_redis_client()
|
| 62 |
-
redis_client.ping()
|
| 63 |
-
logger.info("✅ Redis connection OK")
|
| 64 |
-
|
| 65 |
-
neo4j_driver = get_neo4j_driver()
|
| 66 |
-
neo4j_driver.verify_connectivity()
|
| 67 |
-
logger.info("✅ Neo4j connection OK")
|
| 68 |
-
|
| 69 |
-
ch_client = get_clickhouse_client()
|
| 70 |
-
ch_client.execute("SELECT 1")
|
| 71 |
-
logger.info("✅ ClickHouse connection OK")
|
| 72 |
-
|
| 73 |
-
logger.info("🚀 All services connected successfully!")
|
| 74 |
-
|
| 75 |
-
except Exception as e:
|
| 76 |
-
logger.error(f"❌ Startup error: {e}")
|
| 77 |
-
|
| 78 |
-
yield
|
| 79 |
-
|
| 80 |
-
# Shutdown
|
| 81 |
-
logger.info("Shutting down...")
|
| 82 |
-
if fraud_detector:
|
| 83 |
-
fraud_detector.close()
|
| 84 |
-
|
| 85 |
-
# Create FastAPI app
|
| 86 |
-
app = FastAPI(
|
| 87 |
-
title="Stripe Fraud Detection API",
|
| 88 |
-
description="Complete fraud detection platform with ML, streaming, and analytics",
|
| 89 |
-
version="1.0.0",
|
| 90 |
-
lifespan=lifespan
|
| 91 |
-
)
|
| 92 |
-
|
| 93 |
-
# CORS middleware
|
| 94 |
-
app.add_middleware(
|
| 95 |
-
CORSMiddleware,
|
| 96 |
-
allow_origins=["*"],
|
| 97 |
-
allow_credentials=True,
|
| 98 |
-
allow_methods=["*"],
|
| 99 |
-
allow_headers=["*"],
|
| 100 |
-
)
|
| 101 |
-
|
| 102 |
-
# ============================================
|
| 103 |
-
# HEALTH & STATUS ENDPOINTS
|
| 104 |
-
# ============================================
|
| 105 |
-
|
| 106 |
-
@app.get("/health")
|
| 107 |
-
async def health_check():
|
| 108 |
-
"""Health check endpoint"""
|
| 109 |
-
return {
|
| 110 |
-
"status": "healthy",
|
| 111 |
-
"timestamp": datetime.now().isoformat(),
|
| 112 |
-
"services": {
|
| 113 |
-
"api": "running",
|
| 114 |
-
"fraud_detector": "active" if fraud_detector else "inactive"
|
| 115 |
-
}
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
@app.get("/status")
|
| 119 |
-
async def get_status():
|
| 120 |
-
"""Get detailed status of all services"""
|
| 121 |
-
status = {"timestamp": datetime.now().isoformat()}
|
| 122 |
-
|
| 123 |
-
# Test each service
|
| 124 |
-
try:
|
| 125 |
-
pg_conn = get_postgres_connection()
|
| 126 |
-
cursor = pg_conn.cursor()
|
| 127 |
-
cursor.execute("SELECT COUNT(*) FROM transactions")
|
| 128 |
-
tx_count = cursor.fetchone()[0]
|
| 129 |
-
cursor.close()
|
| 130 |
-
pg_conn.close()
|
| 131 |
-
status["postgres"] = {"status": "connected", "transactions_count": tx_count}
|
| 132 |
-
except Exception as e:
|
| 133 |
-
status["postgres"] = {"status": "error", "message": str(e)}
|
| 134 |
-
|
| 135 |
-
try:
|
| 136 |
-
mongo_client = get_mongodb_client()
|
| 137 |
-
db = mongo_client["stripe_nosql"]
|
| 138 |
-
disputes_count = db["disputes"].count_documents({})
|
| 139 |
-
status["mongodb"] = {"status": "connected", "disputes_count": disputes_count}
|
| 140 |
-
except Exception as e:
|
| 141 |
-
status["mongodb"] = {"status": "error", "message": str(e)}
|
| 142 |
-
|
| 143 |
-
try:
|
| 144 |
-
redis_client = get_redis_client()
|
| 145 |
-
redis_info = redis_client.info("keyspace")
|
| 146 |
-
status["redis"] = {"status": "connected", "keys": redis_info.get("db0", {}).get("keys", 0)}
|
| 147 |
-
except Exception as e:
|
| 148 |
-
status["redis"] = {"status": "error", "message": str(e)}
|
| 149 |
-
|
| 150 |
-
try:
|
| 151 |
-
neo4j_driver = get_neo4j_driver()
|
| 152 |
-
neo4j_driver.verify_connectivity()
|
| 153 |
-
status["neo4j"] = {"status": "connected"}
|
| 154 |
-
except Exception as e:
|
| 155 |
-
status["neo4j"] = {"status": "error", "message": str(e)}
|
| 156 |
-
|
| 157 |
-
try:
|
| 158 |
-
ch_client = get_clickhouse_client()
|
| 159 |
-
result = ch_client.execute("SELECT COUNT(*) FROM transactions_olap")
|
| 160 |
-
status["clickhouse"] = {"status": "connected", "analytics_records": result[0][0] if result else 0}
|
| 161 |
-
except Exception as e:
|
| 162 |
-
status["clickhouse"] = {"status": "error", "message": str(e)}
|
| 163 |
-
|
| 164 |
-
status["mlflow"] = {"status": "active" if fraud_detector and fraud_detector.model else "no_model"}
|
| 165 |
-
|
| 166 |
-
return status
|
| 167 |
-
|
| 168 |
-
# ============================================
|
| 169 |
-
# TRANSACTION ENDPOINTS
|
| 170 |
-
# ============================================
|
| 171 |
-
|
| 172 |
-
@app.post("/api/transactions", response_model=Dict[str, Any])
|
| 173 |
-
async def create_transaction(transaction: TransactionCreate, background_tasks: BackgroundTasks):
|
| 174 |
-
"""
|
| 175 |
-
Create a new transaction and detect fraud in real-time
|
| 176 |
-
"""
|
| 177 |
-
try:
|
| 178 |
-
# Generate transaction ID
|
| 179 |
-
tx_id = f"txn_{datetime.now().strftime('%Y%m%d%H%M%S')}_{transaction.user_id[-4:]}"
|
| 180 |
-
|
| 181 |
-
# 1. Check Redis cache for user fraud history
|
| 182 |
-
redis_client = get_redis_client()
|
| 183 |
-
user_fraud_key = f"user_fraud:{transaction.user_id}"
|
| 184 |
-
cached_risk = redis_client.get(user_fraud_key)
|
| 185 |
-
|
| 186 |
-
base_risk_score = 0
|
| 187 |
-
if cached_risk:
|
| 188 |
-
base_risk_score = int(cached_risk)
|
| 189 |
-
logger.info(f"User {transaction.user_id} cached risk: {base_risk_score}")
|
| 190 |
-
|
| 191 |
-
# 2. Get user context from PostgreSQL
|
| 192 |
-
pg_conn = get_postgres_connection()
|
| 193 |
-
cursor = pg_conn.cursor()
|
| 194 |
-
|
| 195 |
-
cursor.execute("""
|
| 196 |
-
SELECT total_transactions, avg_amount, country
|
| 197 |
-
FROM users WHERE user_id = %s
|
| 198 |
-
""", (transaction.user_id,))
|
| 199 |
-
user_data = cursor.fetchone()
|
| 200 |
-
|
| 201 |
-
if not user_data:
|
| 202 |
-
cursor.close()
|
| 203 |
-
pg_conn.close()
|
| 204 |
-
raise HTTPException(status_code=404, detail="User not found")
|
| 205 |
-
|
| 206 |
-
total_tx, avg_amount, user_country = user_data
|
| 207 |
-
|
| 208 |
-
# 3. Calculate velocity (transactions in last hour)
|
| 209 |
-
cursor.execute("""
|
| 210 |
-
SELECT COUNT(*) FROM transactions
|
| 211 |
-
WHERE user_id = %s AND created_at >= NOW() - INTERVAL '1 hour'
|
| 212 |
-
""", (transaction.user_id,))
|
| 213 |
-
velocity = cursor.fetchone()[0]
|
| 214 |
-
|
| 215 |
-
# 4. Calculate fraud score using ML model
|
| 216 |
-
if fraud_detector and fraud_detector.model:
|
| 217 |
-
fraud_result = fraud_detector.predict(
|
| 218 |
-
amount=float(transaction.amount),
|
| 219 |
-
hour=datetime.now().hour,
|
| 220 |
-
velocity_1h=velocity,
|
| 221 |
-
avg_amount_user=float(avg_amount) if avg_amount else 0,
|
| 222 |
-
user_total_tx=total_tx or 0
|
| 223 |
-
)
|
| 224 |
-
fraud_score = fraud_result["fraud_score"]
|
| 225 |
-
ml_probability = fraud_result["probability"]
|
| 226 |
-
is_fraud = fraud_result["is_fraud"]
|
| 227 |
-
else:
|
| 228 |
-
# Fallback: rule-based scoring
|
| 229 |
-
fraud_score = base_risk_score
|
| 230 |
-
|
| 231 |
-
# Rule 1: Amount threshold
|
| 232 |
-
if transaction.amount > 500:
|
| 233 |
-
fraud_score += 30
|
| 234 |
-
|
| 235 |
-
# Rule 2: Unusual amount for user
|
| 236 |
-
if avg_amount and transaction.amount > avg_amount * 3:
|
| 237 |
-
fraud_score += 25
|
| 238 |
-
|
| 239 |
-
# Rule 3: High velocity
|
| 240 |
-
if velocity >= 5:
|
| 241 |
-
fraud_score += 35
|
| 242 |
-
|
| 243 |
-
# Rule 4: Unusual hour (3 AM - 6 AM)
|
| 244 |
-
current_hour = datetime.now().hour
|
| 245 |
-
if 3 <= current_hour <= 6:
|
| 246 |
-
fraud_score += 20
|
| 247 |
-
|
| 248 |
-
is_fraud = fraud_score >= 70
|
| 249 |
-
ml_probability = fraud_score / 100.0
|
| 250 |
-
|
| 251 |
-
# 5. Determine transaction status
|
| 252 |
-
if fraud_score >= 90:
|
| 253 |
-
status = "failed" # Blocked
|
| 254 |
-
elif fraud_score >= 70:
|
| 255 |
-
status = "pending" # Manual review
|
| 256 |
-
else:
|
| 257 |
-
status = "succeeded"
|
| 258 |
-
|
| 259 |
-
# 6. Insert transaction into PostgreSQL
|
| 260 |
-
cursor.execute("""
|
| 261 |
-
INSERT INTO transactions (
|
| 262 |
-
transaction_id, user_id, merchant_id, amount, currency,
|
| 263 |
-
status, payment_method, card_last4, is_fraud, fraud_score,
|
| 264 |
-
ml_fraud_probability, ip_address, device_type, created_at
|
| 265 |
-
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
| 266 |
-
""", (
|
| 267 |
-
tx_id, transaction.user_id, transaction.merchant_id, transaction.amount,
|
| 268 |
-
transaction.currency, status, transaction.payment_method,
|
| 269 |
-
transaction.card_last4, is_fraud, fraud_score, ml_probability,
|
| 270 |
-
transaction.ip_address, transaction.device_type, datetime.now()
|
| 271 |
-
))
|
| 272 |
-
|
| 273 |
-
# 7. Insert fraud events if suspicious
|
| 274 |
-
if is_fraud:
|
| 275 |
-
if transaction.amount > 500:
|
| 276 |
-
cursor.execute("""
|
| 277 |
-
INSERT INTO fraud_events (transaction_id, rule_triggered, severity, score_contribution, details)
|
| 278 |
-
VALUES (%s, %s, %s, %s, %s)
|
| 279 |
-
""", (tx_id, "amount_threshold_exceeded", "high", 30, f'{{"amount": {transaction.amount}}}'))
|
| 280 |
-
|
| 281 |
-
if velocity >= 5:
|
| 282 |
-
cursor.execute("""
|
| 283 |
-
INSERT INTO fraud_events (transaction_id, rule_triggered, severity, score_contribution, details)
|
| 284 |
-
VALUES (%s, %s, %s, %s, %s)
|
| 285 |
-
""", (tx_id, "velocity_check_failed", "critical", 35, f'{{"velocity": {velocity}}}'))
|
| 286 |
-
|
| 287 |
-
pg_conn.commit()
|
| 288 |
-
cursor.close()
|
| 289 |
-
pg_conn.close()
|
| 290 |
-
|
| 291 |
-
# 8. Update Redis cache
|
| 292 |
-
redis_client.setex(f"fraud_score:{tx_id}", 3600, fraud_score) # TTL 1h
|
| 293 |
-
if is_fraud:
|
| 294 |
-
redis_client.incr(user_fraud_key)
|
| 295 |
-
redis_client.expire(user_fraud_key, 86400) # TTL 24h
|
| 296 |
-
|
| 297 |
-
# 9. Publish to Kafka (async background task)
|
| 298 |
-
background_tasks.add_task(publish_transaction_event, tx_id, transaction.dict(), fraud_score, is_fraud)
|
| 299 |
-
|
| 300 |
-
# 10. Store in MongoDB for flexible queries
|
| 301 |
-
background_tasks.add_task(store_transaction_mongodb, tx_id, transaction.dict(), fraud_score)
|
| 302 |
-
|
| 303 |
-
# 11. Log to Elasticsearch
|
| 304 |
-
background_tasks.add_task(log_to_elasticsearch, tx_id, "transaction_created", fraud_score, status)
|
| 305 |
-
|
| 306 |
-
# 12. Update Neo4j graph (if fraud detected)
|
| 307 |
-
if is_fraud:
|
| 308 |
-
background_tasks.add_task(create_fraud_relationship, transaction.user_id, transaction.merchant_id, tx_id)
|
| 309 |
-
|
| 310 |
-
return {
|
| 311 |
-
"transaction_id": tx_id,
|
| 312 |
-
"status": status,
|
| 313 |
-
"fraud_score": fraud_score,
|
| 314 |
-
"ml_probability": round(ml_probability, 4),
|
| 315 |
-
"is_fraud": is_fraud,
|
| 316 |
-
"processing_time_ms": 110,
|
| 317 |
-
"message": "Transaction blocked" if status == "failed" else "Transaction requires review" if status == "pending" else "Transaction approved"
|
| 318 |
-
}
|
| 319 |
-
|
| 320 |
-
except Exception as e:
|
| 321 |
-
logger.error(f"Error creating transaction: {e}")
|
| 322 |
-
raise HTTPException(status_code=500, detail=str(e))
|
| 323 |
-
|
| 324 |
-
@app.get("/api/transactions/{transaction_id}")
|
| 325 |
-
async def get_transaction(transaction_id: str):
|
| 326 |
-
"""Get transaction details by ID"""
|
| 327 |
-
try:
|
| 328 |
-
pg_conn = get_postgres_connection()
|
| 329 |
-
cursor = pg_conn.cursor()
|
| 330 |
-
|
| 331 |
-
cursor.execute("""
|
| 332 |
-
SELECT
|
| 333 |
-
t.transaction_id, t.user_id, t.merchant_id, t.amount, t.currency,
|
| 334 |
-
t.status, t.payment_method, t.card_last4, t.is_fraud, t.fraud_score,
|
| 335 |
-
t.ml_fraud_probability, t.created_at, t.ip_address, t.device_type,
|
| 336 |
-
u.email, u.name, m.name as merchant_name, m.category
|
| 337 |
-
FROM transactions t
|
| 338 |
-
JOIN users u ON t.user_id = u.user_id
|
| 339 |
-
JOIN merchants m ON t.merchant_id = m.merchant_id
|
| 340 |
-
WHERE t.transaction_id = %s
|
| 341 |
-
""", (transaction_id,))
|
| 342 |
-
|
| 343 |
-
row = cursor.fetchone()
|
| 344 |
-
cursor.close()
|
| 345 |
-
pg_conn.close()
|
| 346 |
-
|
| 347 |
-
if not row:
|
| 348 |
-
raise HTTPException(status_code=404, detail="Transaction not found")
|
| 349 |
-
|
| 350 |
-
return {
|
| 351 |
-
"transaction_id": row[0],
|
| 352 |
-
"user_id": row[1],
|
| 353 |
-
"merchant_id": row[2],
|
| 354 |
-
"amount": float(row[3]),
|
| 355 |
-
"currency": row[4],
|
| 356 |
-
"status": row[5],
|
| 357 |
-
"payment_method": row[6],
|
| 358 |
-
"card_last4": row[7],
|
| 359 |
-
"is_fraud": row[8],
|
| 360 |
-
"fraud_score": row[9],
|
| 361 |
-
"ml_fraud_probability": float(row[10]) if row[10] else None,
|
| 362 |
-
"created_at": row[11].isoformat(),
|
| 363 |
-
"ip_address": str(row[12]),
|
| 364 |
-
"device_type": row[13],
|
| 365 |
-
"user_email": row[14],
|
| 366 |
-
"user_name": row[15],
|
| 367 |
-
"merchant_name": row[16],
|
| 368 |
-
"merchant_category": row[17]
|
| 369 |
-
}
|
| 370 |
-
|
| 371 |
-
except HTTPException:
|
| 372 |
-
raise
|
| 373 |
-
except Exception as e:
|
| 374 |
-
logger.error(f"Error fetching transaction: {e}")
|
| 375 |
-
raise HTTPException(status_code=500, detail=str(e))
|
| 376 |
-
|
| 377 |
-
@app.get("/api/transactions")
|
| 378 |
-
async def list_transactions(limit: int = 20, offset: int = 0, is_fraud: Optional[bool] = None):
|
| 379 |
-
"""List transactions with pagination"""
|
| 380 |
-
try:
|
| 381 |
-
pg_conn = get_postgres_connection()
|
| 382 |
-
cursor = pg_conn.cursor()
|
| 383 |
-
|
| 384 |
-
query = """
|
| 385 |
-
SELECT
|
| 386 |
-
transaction_id, user_id, merchant_id, amount, currency,
|
| 387 |
-
status, is_fraud, fraud_score, created_at
|
| 388 |
-
FROM transactions
|
| 389 |
-
"""
|
| 390 |
-
|
| 391 |
-
params = []
|
| 392 |
-
if is_fraud is not None:
|
| 393 |
-
query += " WHERE is_fraud = %s"
|
| 394 |
-
params.append(is_fraud)
|
| 395 |
-
|
| 396 |
-
query += " ORDER BY created_at DESC LIMIT %s OFFSET %s"
|
| 397 |
-
params.extend([limit, offset])
|
| 398 |
-
|
| 399 |
-
cursor.execute(query, params)
|
| 400 |
-
rows = cursor.fetchall()
|
| 401 |
-
|
| 402 |
-
transactions = []
|
| 403 |
-
for row in rows:
|
| 404 |
-
transactions.append({
|
| 405 |
-
"transaction_id": row[0],
|
| 406 |
-
"user_id": row[1],
|
| 407 |
-
"merchant_id": row[2],
|
| 408 |
-
"amount": float(row[3]),
|
| 409 |
-
"currency": row[4],
|
| 410 |
-
"status": row[5],
|
| 411 |
-
"is_fraud": row[6],
|
| 412 |
-
"fraud_score": row[7],
|
| 413 |
-
"created_at": row[8].isoformat()
|
| 414 |
-
})
|
| 415 |
-
|
| 416 |
-
cursor.close()
|
| 417 |
-
pg_conn.close()
|
| 418 |
-
|
| 419 |
-
return {
|
| 420 |
-
"transactions": transactions,
|
| 421 |
-
"count": len(transactions),
|
| 422 |
-
"limit": limit,
|
| 423 |
-
"offset": offset
|
| 424 |
-
}
|
| 425 |
-
|
| 426 |
-
except Exception as e:
|
| 427 |
-
logger.error(f"Error listing transactions: {e}")
|
| 428 |
-
raise HTTPException(status_code=500, detail=str(e))
|
| 429 |
-
|
| 430 |
-
# ============================================
|
| 431 |
-
# ANALYTICS ENDPOINTS (ClickHouse)
|
| 432 |
-
# ============================================
|
| 433 |
-
|
| 434 |
-
@app.get("/api/analytics/fraud-rate")
|
| 435 |
-
async def get_fraud_rate(days: int = 7):
|
| 436 |
-
"""Get fraud rate for last N days"""
|
| 437 |
-
try:
|
| 438 |
-
ch_client = get_clickhouse_client()
|
| 439 |
-
|
| 440 |
-
query = f"""
|
| 441 |
-
SELECT
|
| 442 |
-
toDate(created_at) as date,
|
| 443 |
-
COUNT(*) as total_transactions,
|
| 444 |
-
SUM(CASE WHEN is_fraud = 1 THEN 1 ELSE 0 END) as fraud_transactions,
|
| 445 |
-
ROUND(100.0 * SUM(CASE WHEN is_fraud = 1 THEN 1 ELSE 0 END) / COUNT(*), 2) as fraud_rate
|
| 446 |
-
FROM transactions_olap
|
| 447 |
-
WHERE created_at >= now() - INTERVAL {days} DAY
|
| 448 |
-
GROUP BY date
|
| 449 |
-
ORDER BY date DESC
|
| 450 |
-
"""
|
| 451 |
-
|
| 452 |
-
result = ch_client.execute(query)
|
| 453 |
-
|
| 454 |
-
analytics = []
|
| 455 |
-
for row in result:
|
| 456 |
-
analytics.append({
|
| 457 |
-
"date": row[0].isoformat(),
|
| 458 |
-
"total_transactions": row[1],
|
| 459 |
-
"fraud_transactions": row[2],
|
| 460 |
-
"fraud_rate": float(row[3])
|
| 461 |
-
})
|
| 462 |
-
|
| 463 |
-
return {"analytics": analytics, "period_days": days}
|
| 464 |
-
|
| 465 |
-
except Exception as e:
|
| 466 |
-
logger.error(f"Error fetching analytics: {e}")
|
| 467 |
-
# Fallback to PostgreSQL if ClickHouse not available
|
| 468 |
-
return await get_fraud_rate_postgres(days)
|
| 469 |
-
|
| 470 |
-
async def get_fraud_rate_postgres(days: int):
|
| 471 |
-
"""Fallback fraud rate calculation using PostgreSQL"""
|
| 472 |
-
try:
|
| 473 |
-
pg_conn = get_postgres_connection()
|
| 474 |
-
cursor = pg_conn.cursor()
|
| 475 |
-
|
| 476 |
-
cursor.execute("""
|
| 477 |
-
SELECT
|
| 478 |
-
DATE(created_at) as date,
|
| 479 |
-
COUNT(*) as total_tx,
|
| 480 |
-
SUM(CASE WHEN is_fraud THEN 1 ELSE 0 END) as fraud_tx,
|
| 481 |
-
ROUND(100.0 * SUM(CASE WHEN is_fraud THEN 1 ELSE 0 END) / COUNT(*), 2) as fraud_rate
|
| 482 |
-
FROM transactions
|
| 483 |
-
WHERE created_at >= NOW() - INTERVAL '%s days'
|
| 484 |
-
GROUP BY DATE(created_at)
|
| 485 |
-
ORDER BY date DESC
|
| 486 |
-
""", (days,))
|
| 487 |
-
|
| 488 |
-
rows = cursor.fetchall()
|
| 489 |
-
cursor.close()
|
| 490 |
-
pg_conn.close()
|
| 491 |
-
|
| 492 |
-
analytics = []
|
| 493 |
-
for row in rows:
|
| 494 |
-
analytics.append({
|
| 495 |
-
"date": row[0].isoformat(),
|
| 496 |
-
"total_transactions": row[1],
|
| 497 |
-
"fraud_transactions": row[2],
|
| 498 |
-
"fraud_rate": float(row[3])
|
| 499 |
-
})
|
| 500 |
-
|
| 501 |
-
return {"analytics": analytics, "period_days": days, "source": "postgres_fallback"}
|
| 502 |
-
|
| 503 |
-
except Exception as e:
|
| 504 |
-
logger.error(f"Error in PostgreSQL fallback: {e}")
|
| 505 |
-
raise HTTPException(status_code=500, detail=str(e))
|
| 506 |
-
|
| 507 |
-
@app.get("/api/analytics/top-merchants")
|
| 508 |
-
async def get_top_merchants(limit: int = 10):
|
| 509 |
-
"""Get top merchants by transaction volume"""
|
| 510 |
-
try:
|
| 511 |
-
pg_conn = get_postgres_connection()
|
| 512 |
-
cursor = pg_conn.cursor()
|
| 513 |
-
|
| 514 |
-
cursor.execute("""
|
| 515 |
-
SELECT
|
| 516 |
-
m.merchant_id,
|
| 517 |
-
m.name,
|
| 518 |
-
m.category,
|
| 519 |
-
COUNT(t.transaction_id) as total_transactions,
|
| 520 |
-
SUM(t.amount) as total_amount,
|
| 521 |
-
SUM(CASE WHEN t.is_fraud THEN 1 ELSE 0 END) as fraud_count,
|
| 522 |
-
ROUND(100.0 * SUM(CASE WHEN t.is_fraud THEN 1 ELSE 0 END) / NULLIF(COUNT(t.transaction_id), 0), 2) as fraud_rate
|
| 523 |
-
FROM merchants m
|
| 524 |
-
LEFT JOIN transactions t ON m.merchant_id = t.merchant_id
|
| 525 |
-
GROUP BY m.merchant_id, m.name, m.category
|
| 526 |
-
ORDER BY total_amount DESC
|
| 527 |
-
LIMIT %s
|
| 528 |
-
""", (limit,))
|
| 529 |
-
|
| 530 |
-
rows = cursor.fetchall()
|
| 531 |
-
cursor.close()
|
| 532 |
-
pg_conn.close()
|
| 533 |
-
|
| 534 |
-
merchants = []
|
| 535 |
-
for row in rows:
|
| 536 |
-
merchants.append({
|
| 537 |
-
"merchant_id": row[0],
|
| 538 |
-
"name": row[1],
|
| 539 |
-
"category": row[2],
|
| 540 |
-
"total_transactions": row[3],
|
| 541 |
-
"total_amount": float(row[4]) if row[4] else 0,
|
| 542 |
-
"fraud_count": row[5],
|
| 543 |
-
"fraud_rate": float(row[6]) if row[6] else 0
|
| 544 |
-
})
|
| 545 |
-
|
| 546 |
-
return {"merchants": merchants}
|
| 547 |
-
|
| 548 |
-
except Exception as e:
|
| 549 |
-
logger.error(f"Error fetching top merchants: {e}")
|
| 550 |
-
raise HTTPException(status_code=500, detail=str(e))
|
| 551 |
-
|
| 552 |
-
# ============================================
|
| 553 |
-
# GRAPH ANALYTICS (Neo4j)
|
| 554 |
-
# ============================================
|
| 555 |
-
|
| 556 |
-
@app.get("/api/graph/fraud-network/{user_id}")
|
| 557 |
-
async def get_fraud_network(user_id: str, depth: int = 2):
|
| 558 |
-
"""Get fraud network for a user using Neo4j graph traversal"""
|
| 559 |
-
try:
|
| 560 |
-
neo4j_driver = get_neo4j_driver()
|
| 561 |
-
|
| 562 |
-
with neo4j_driver.session() as session:
|
| 563 |
-
result = session.run("""
|
| 564 |
-
MATCH path = (u:User {user_id: $user_id})-[:TRANSACTED_WITH*1..{depth}]-(m:Merchant)
|
| 565 |
-
WHERE EXISTS((u)-[:FRAUD_DETECTED]-(m))
|
| 566 |
-
RETURN u.user_id as user_id, m.merchant_id as merchant_id, m.name as merchant_name
|
| 567 |
-
LIMIT 50
|
| 568 |
-
""".replace("{depth}", str(depth)), user_id=user_id)
|
| 569 |
-
|
| 570 |
-
network = []
|
| 571 |
-
for record in result:
|
| 572 |
-
network.append({
|
| 573 |
-
"user_id": record["user_id"],
|
| 574 |
-
"merchant_id": record["merchant_id"],
|
| 575 |
-
"merchant_name": record["merchant_name"]
|
| 576 |
-
})
|
| 577 |
-
|
| 578 |
-
return {"fraud_network": network, "depth": depth}
|
| 579 |
-
|
| 580 |
-
except Exception as e:
|
| 581 |
-
logger.error(f"Error fetching fraud network: {e}")
|
| 582 |
-
return {"fraud_network": [], "error": str(e)}
|
| 583 |
-
|
| 584 |
-
# ============================================
|
| 585 |
-
# BACKGROUND TASKS
|
| 586 |
-
# ============================================
|
| 587 |
-
|
| 588 |
-
def publish_transaction_event(tx_id: str, transaction_data: dict, fraud_score: int, is_fraud: bool):
|
| 589 |
-
"""Publish transaction event to Kafka"""
|
| 590 |
-
try:
|
| 591 |
-
producer = get_kafka_producer()
|
| 592 |
-
|
| 593 |
-
event = {
|
| 594 |
-
"transaction_id": tx_id,
|
| 595 |
-
"timestamp": datetime.now().isoformat(),
|
| 596 |
-
"fraud_score": fraud_score,
|
| 597 |
-
"is_fraud": is_fraud,
|
| 598 |
-
**transaction_data
|
| 599 |
-
}
|
| 600 |
-
|
| 601 |
-
topic = "fraud.alerts" if is_fraud else "payment.events"
|
| 602 |
-
producer.produce(topic, key=tx_id, value=str(event))
|
| 603 |
-
producer.flush()
|
| 604 |
-
|
| 605 |
-
logger.info(f"Published event to Kafka topic: {topic}")
|
| 606 |
-
except Exception as e:
|
| 607 |
-
logger.error(f"Error publishing to Kafka: {e}")
|
| 608 |
-
|
| 609 |
-
def store_transaction_mongodb(tx_id: str, transaction_data: dict, fraud_score: int):
|
| 610 |
-
"""Store transaction in MongoDB for flexible queries"""
|
| 611 |
-
try:
|
| 612 |
-
mongo_client = get_mongodb_client()
|
| 613 |
-
db = mongo_client["stripe_nosql"]
|
| 614 |
-
collection = db["transactions"]
|
| 615 |
-
|
| 616 |
-
document = {
|
| 617 |
-
"transaction_id": tx_id,
|
| 618 |
-
"created_at": datetime.now(),
|
| 619 |
-
"fraud_score": fraud_score,
|
| 620 |
-
**transaction_data
|
| 621 |
-
}
|
| 622 |
-
|
| 623 |
-
collection.insert_one(document)
|
| 624 |
-
logger.info(f"Stored transaction in MongoDB: {tx_id}")
|
| 625 |
-
except Exception as e:
|
| 626 |
-
logger.error(f"Error storing in MongoDB: {e}")
|
| 627 |
-
|
| 628 |
-
def log_to_elasticsearch(tx_id: str, event_type: str, fraud_score: int, status: str):
|
| 629 |
-
"""Log event to Elasticsearch"""
|
| 630 |
-
try:
|
| 631 |
-
es_client = get_elasticsearch_client()
|
| 632 |
-
|
| 633 |
-
doc = {
|
| 634 |
-
"transaction_id": tx_id,
|
| 635 |
-
"event_type": event_type,
|
| 636 |
-
"fraud_score": fraud_score,
|
| 637 |
-
"status": status,
|
| 638 |
-
"timestamp": datetime.now().isoformat()
|
| 639 |
-
}
|
| 640 |
-
|
| 641 |
-
es_client.index(index="stripe-transactions", document=doc)
|
| 642 |
-
logger.info(f"Logged to Elasticsearch: {tx_id}")
|
| 643 |
-
except Exception as e:
|
| 644 |
-
logger.error(f"Error logging to Elasticsearch: {e}")
|
| 645 |
-
|
| 646 |
-
def create_fraud_relationship(user_id: str, merchant_id: str, tx_id: str):
|
| 647 |
-
"""Create fraud relationship in Neo4j graph"""
|
| 648 |
-
try:
|
| 649 |
-
neo4j_driver = get_neo4j_driver()
|
| 650 |
-
|
| 651 |
-
with neo4j_driver.session() as session:
|
| 652 |
-
session.run("""
|
| 653 |
-
MERGE (u:User {user_id: $user_id})
|
| 654 |
-
MERGE (m:Merchant {merchant_id: $merchant_id})
|
| 655 |
-
CREATE (u)-[:FRAUD_DETECTED {transaction_id: $tx_id, timestamp: datetime()}]->(m)
|
| 656 |
-
""", user_id=user_id, merchant_id=merchant_id, tx_id=tx_id)
|
| 657 |
-
|
| 658 |
-
logger.info(f"Created fraud relationship in Neo4j: {user_id} -> {merchant_id}")
|
| 659 |
-
except Exception as e:
|
| 660 |
-
logger.error(f"Error creating Neo4j relationship: {e}")
|
| 661 |
-
|
| 662 |
-
# ============================================
|
| 663 |
-
# STARTUP MESSAGE
|
| 664 |
-
# ============================================
|
| 665 |
-
|
| 666 |
-
if __name__ == "__main__":
|
| 667 |
-
import uvicorn
|
| 668 |
-
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
-
from pydantic import BaseModel, Field, validator
|
| 6 |
-
from typing import Optional, List
|
| 7 |
-
from datetime import datetime
|
| 8 |
-
from decimal import Decimal
|
| 9 |
-
|
| 10 |
-
class TransactionCreate(BaseModel):
|
| 11 |
-
user_id: str = Field(..., example="user_001")
|
| 12 |
-
merchant_id: str = Field(..., example="merchant_001")
|
| 13 |
-
amount: Decimal = Field(..., gt=0, example=99.99)
|
| 14 |
-
currency: str = Field(default="EUR", example="EUR")
|
| 15 |
-
payment_method: str = Field(..., example="card")
|
| 16 |
-
card_last4: Optional[str] = Field(None, example="1234")
|
| 17 |
-
ip_address: Optional[str] = Field(None, example="82.65.123.45")
|
| 18 |
-
device_type: Optional[str] = Field(default="mobile", example="mobile")
|
| 19 |
-
|
| 20 |
-
@validator('currency')
|
| 21 |
-
def validate_currency(cls, v):
|
| 22 |
-
allowed = ['EUR', 'USD', 'GBP', 'CAD', 'AUD']
|
| 23 |
-
if v not in allowed:
|
| 24 |
-
raise ValueError(f'Currency must be one of {allowed}')
|
| 25 |
-
return v
|
| 26 |
-
|
| 27 |
-
class Transaction(BaseModel):
|
| 28 |
-
transaction_id: str
|
| 29 |
-
user_id: str
|
| 30 |
-
merchant_id: str
|
| 31 |
-
amount: Decimal
|
| 32 |
-
currency: str
|
| 33 |
-
status: str
|
| 34 |
-
payment_method: str
|
| 35 |
-
card_last4: Optional[str]
|
| 36 |
-
is_fraud: bool
|
| 37 |
-
fraud_score: int
|
| 38 |
-
ml_fraud_probability: Optional[float]
|
| 39 |
-
created_at: datetime
|
| 40 |
-
ip_address: Optional[str]
|
| 41 |
-
device_type: Optional[str]
|
| 42 |
-
|
| 43 |
-
class FraudScore(BaseModel):
|
| 44 |
-
transaction_id: str
|
| 45 |
-
fraud_score: int
|
| 46 |
-
probability: float
|
| 47 |
-
is_fraud: bool
|
| 48 |
-
rules_triggered: List[str] = []
|
| 49 |
-
|
| 50 |
-
class User(BaseModel):
|
| 51 |
-
user_id: str
|
| 52 |
-
email: str
|
| 53 |
-
name: str
|
| 54 |
-
country: str
|
| 55 |
-
total_transactions: int
|
| 56 |
-
avg_amount: Decimal
|
| 57 |
-
is_active: bool
|
| 58 |
-
|
| 59 |
-
class Merchant(BaseModel):
|
| 60 |
-
merchant_id: str
|
| 61 |
-
name: str
|
| 62 |
-
category: str
|
| 63 |
-
country: str
|
| 64 |
-
risk_score: int
|
| 65 |
-
is_active: bool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/fastapi/requirements.txt
DELETED
|
@@ -1,37 +0,0 @@
|
|
| 1 |
-
fastapi==0.104.1
|
| 2 |
-
uvicorn[standard]==0.24.0
|
| 3 |
-
pydantic==2.5.0
|
| 4 |
-
pydantic-settings==2.1.0
|
| 5 |
-
|
| 6 |
-
# Database drivers
|
| 7 |
-
psycopg2-binary==2.9.9
|
| 8 |
-
pymongo==4.6.0
|
| 9 |
-
redis==5.0.1
|
| 10 |
-
neo4j==5.14.1
|
| 11 |
-
clickhouse-driver==0.2.6
|
| 12 |
-
|
| 13 |
-
# Kafka
|
| 14 |
-
confluent-kafka==2.3.0
|
| 15 |
-
kafka-python==2.0.2
|
| 16 |
-
|
| 17 |
-
# ML & Data Science
|
| 18 |
-
scikit-learn==1.3.2
|
| 19 |
-
pandas==2.1.3
|
| 20 |
-
numpy==1.26.2
|
| 21 |
-
joblib==1.3.2
|
| 22 |
-
mlflow==2.9.2
|
| 23 |
-
|
| 24 |
-
# Storage
|
| 25 |
-
boto3==1.29.7
|
| 26 |
-
minio==7.2.0
|
| 27 |
-
|
| 28 |
-
# Monitoring & Logging
|
| 29 |
-
elasticsearch==8.11.0
|
| 30 |
-
python-json-logger==2.0.7
|
| 31 |
-
|
| 32 |
-
# Utilities
|
| 33 |
-
httpx==0.25.2
|
| 34 |
-
python-multipart==0.0.6
|
| 35 |
-
python-jose[cryptography]==3.3.0
|
| 36 |
-
passlib[bcrypt]==1.7.4
|
| 37 |
-
python-dateutil==2.8.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/flask/Dockerfile
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
FROM python:3.11-slim
|
| 2 |
-
|
| 3 |
-
WORKDIR /app
|
| 4 |
-
|
| 5 |
-
COPY requirements.txt .
|
| 6 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
-
|
| 8 |
-
COPY . .
|
| 9 |
-
|
| 10 |
-
EXPOSE 5050
|
| 11 |
-
|
| 12 |
-
HEALTHCHECK --interval=10s --timeout=5s --start-period=30s --retries=3 \
|
| 13 |
-
CMD curl -f http://localhost:5050/health || exit 1
|
| 14 |
-
|
| 15 |
-
CMD ["python", "app.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/flask/app.py
DELETED
|
@@ -1,105 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Flask Web Interface for Stripe Fraud Detection
|
| 3 |
-
Bootstrap UI for transaction simulation
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
from flask import Flask, render_template, request, jsonify
|
| 7 |
-
from flask_cors import CORS
|
| 8 |
-
import requests
|
| 9 |
-
import os
|
| 10 |
-
import logging
|
| 11 |
-
from datetime import datetime
|
| 12 |
-
import random
|
| 13 |
-
|
| 14 |
-
app = Flask(__name__)
|
| 15 |
-
CORS(app)
|
| 16 |
-
|
| 17 |
-
logging.basicConfig(level=logging.INFO)
|
| 18 |
-
logger = logging.getLogger(__name__)
|
| 19 |
-
|
| 20 |
-
FASTAPI_URL = os.getenv("FASTAPI_URL", "http://localhost:8000")
|
| 21 |
-
|
| 22 |
-
@app.route("/")
|
| 23 |
-
def index():
|
| 24 |
-
"""Main page"""
|
| 25 |
-
return render_template("index.html")
|
| 26 |
-
|
| 27 |
-
@app.route("/health")
|
| 28 |
-
def health():
|
| 29 |
-
"""Health check"""
|
| 30 |
-
return jsonify({"status": "healthy", "timestamp": datetime.now().isoformat()})
|
| 31 |
-
|
| 32 |
-
@app.route("/api/simulate", methods=["POST"])
|
| 33 |
-
def simulate_transaction():
|
| 34 |
-
"""Simulate a transaction"""
|
| 35 |
-
try:
|
| 36 |
-
data = request.json
|
| 37 |
-
|
| 38 |
-
# Call FastAPI backend
|
| 39 |
-
response = requests.post(
|
| 40 |
-
f"{FASTAPI_URL}/api/transactions",
|
| 41 |
-
json=data,
|
| 42 |
-
timeout=30
|
| 43 |
-
)
|
| 44 |
-
|
| 45 |
-
return jsonify(response.json()), response.status_code
|
| 46 |
-
|
| 47 |
-
except requests.exceptions.RequestException as e:
|
| 48 |
-
logger.error(f"Error calling FastAPI: {e}")
|
| 49 |
-
return jsonify({"error": "Backend service unavailable"}), 503
|
| 50 |
-
except Exception as e:
|
| 51 |
-
logger.error(f"Error simulating transaction: {e}")
|
| 52 |
-
return jsonify({"error": str(e)}), 500
|
| 53 |
-
|
| 54 |
-
@app.route("/api/transactions/<transaction_id>")
|
| 55 |
-
def get_transaction(transaction_id):
|
| 56 |
-
"""Get transaction details"""
|
| 57 |
-
try:
|
| 58 |
-
response = requests.get(
|
| 59 |
-
f"{FASTAPI_URL}/api/transactions/{transaction_id}",
|
| 60 |
-
timeout=30
|
| 61 |
-
)
|
| 62 |
-
return jsonify(response.json()), response.status_code
|
| 63 |
-
except Exception as e:
|
| 64 |
-
logger.error(f"Error fetching transaction: {e}")
|
| 65 |
-
return jsonify({"error": str(e)}), 500
|
| 66 |
-
|
| 67 |
-
@app.route("/api/transactions")
|
| 68 |
-
def list_transactions():
|
| 69 |
-
"""List recent transactions"""
|
| 70 |
-
try:
|
| 71 |
-
limit = request.args.get("limit", 20, type=int)
|
| 72 |
-
offset = request.args.get("offset", 0, type=int)
|
| 73 |
-
is_fraud = request.args.get("is_fraud", None)
|
| 74 |
-
|
| 75 |
-
params = {"limit": limit, "offset": offset}
|
| 76 |
-
if is_fraud is not None:
|
| 77 |
-
params["is_fraud"] = is_fraud.lower() == "true"
|
| 78 |
-
|
| 79 |
-
# Increased timeout for large transaction queries
|
| 80 |
-
response = requests.get(
|
| 81 |
-
f"{FASTAPI_URL}/api/transactions",
|
| 82 |
-
params=params,
|
| 83 |
-
timeout=60
|
| 84 |
-
)
|
| 85 |
-
return jsonify(response.json()), response.status_code
|
| 86 |
-
except Exception as e:
|
| 87 |
-
logger.error(f"Error listing transactions: {e}")
|
| 88 |
-
return jsonify({"error": str(e)}), 500
|
| 89 |
-
|
| 90 |
-
@app.route("/api/status")
|
| 91 |
-
def get_status():
|
| 92 |
-
"""Get backend status"""
|
| 93 |
-
try:
|
| 94 |
-
# Increased timeout for slow status queries
|
| 95 |
-
response = requests.get(f"{FASTAPI_URL}/status", timeout=90)
|
| 96 |
-
return jsonify(response.json()), response.status_code
|
| 97 |
-
except requests.exceptions.Timeout:
|
| 98 |
-
logger.error("FastAPI status check timed out after 90 seconds")
|
| 99 |
-
return jsonify({"error": "Backend status check timeout"}), 504
|
| 100 |
-
except Exception as e:
|
| 101 |
-
logger.error(f"Error checking backend status: {e}")
|
| 102 |
-
return jsonify({"error": "Backend unavailable"}), 503
|
| 103 |
-
|
| 104 |
-
if __name__ == "__main__":
|
| 105 |
-
app.run(host="0.0.0.0", port=5050, debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/flask/requirements.txt
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
Flask==3.0.0
|
| 2 |
-
requests==2.31.0
|
| 3 |
-
flask-cors==4.0.0
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/flask/templates/index.html
DELETED
|
@@ -1,361 +0,0 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="fr">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>Certification Jedha Bloc 2 - Stripe</title>
|
| 7 |
-
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
| 8 |
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
|
| 9 |
-
<style>
|
| 10 |
-
body { background: #f8f9fa; }
|
| 11 |
-
.fraud-score-high { color: #dc3545; font-weight: bold; }
|
| 12 |
-
.fraud-score-medium { color: #ffc107; font-weight: bold; }
|
| 13 |
-
.fraud-score-low { color: #28a745; font-weight: bold; }
|
| 14 |
-
.card { box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
|
| 15 |
-
.transaction-card { transition: all 0.3s; }
|
| 16 |
-
.transaction-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
|
| 17 |
-
</style>
|
| 18 |
-
</head>
|
| 19 |
-
<body>
|
| 20 |
-
<nav class="navbar navbar-dark bg-primary mb-4">
|
| 21 |
-
<div class="container-fluid">
|
| 22 |
-
<span class="navbar-brand mb-0 h1">
|
| 23 |
-
<i class=""></i> Certification Jedha Bloc 2 - Stripe
|
| 24 |
-
</span>
|
| 25 |
-
<button class="btn btn-outline-light btn-sm" onclick="refreshStatus()">
|
| 26 |
-
<i class="bi bi-arrow-clockwise"></i> Refresh
|
| 27 |
-
</button>
|
| 28 |
-
</div>
|
| 29 |
-
</nav>
|
| 30 |
-
|
| 31 |
-
<div class="container">
|
| 32 |
-
<!-- Status Cards -->
|
| 33 |
-
<div class="row mb-4" id="statusCards">
|
| 34 |
-
<div class="col-md-3 mb-3">
|
| 35 |
-
<div class="card text-center">
|
| 36 |
-
<div class="card-body">
|
| 37 |
-
<h6 class="card-subtitle mb-2 text-muted">Services Status</h6>
|
| 38 |
-
<h3 id="servicesStatus"><span class="spinner-border spinner-border-sm"></span></h3>
|
| 39 |
-
</div>
|
| 40 |
-
</div>
|
| 41 |
-
</div>
|
| 42 |
-
<div class="col-md-3 mb-3">
|
| 43 |
-
<div class="card text-center">
|
| 44 |
-
<div class="card-body">
|
| 45 |
-
<h6 class="card-subtitle mb-2 text-muted">Total Transactions</h6>
|
| 46 |
-
<h3 id="totalTransactions">-</h3>
|
| 47 |
-
</div>
|
| 48 |
-
</div>
|
| 49 |
-
</div>
|
| 50 |
-
<div class="col-md-3 mb-3">
|
| 51 |
-
<div class="card text-center">
|
| 52 |
-
<div class="card-body">
|
| 53 |
-
<h6 class="card-subtitle mb-2 text-muted">Fraud Detected</h6>
|
| 54 |
-
<h3 id="fraudCount" class="text-danger">-</h3>
|
| 55 |
-
</div>
|
| 56 |
-
</div>
|
| 57 |
-
</div>
|
| 58 |
-
<div class="col-md-3 mb-3">
|
| 59 |
-
<div class="card text-center">
|
| 60 |
-
<div class="card-body">
|
| 61 |
-
<h6 class="card-subtitle mb-2 text-muted">Fraud Rate</h6>
|
| 62 |
-
<h3 id="fraudRate">-</h3>
|
| 63 |
-
</div>
|
| 64 |
-
</div>
|
| 65 |
-
</div>
|
| 66 |
-
</div>
|
| 67 |
-
|
| 68 |
-
<div class="row">
|
| 69 |
-
<!-- Transaction Simulation Form -->
|
| 70 |
-
<div class="col-md-4 mb-4">
|
| 71 |
-
<div class="card">
|
| 72 |
-
<div class="card-header bg-primary text-white">
|
| 73 |
-
<h5 class="mb-0"><i class="bi bi-credit-card"></i> Simulate Transaction</h5>
|
| 74 |
-
</div>
|
| 75 |
-
<div class="card-body">
|
| 76 |
-
<form id="transactionForm">
|
| 77 |
-
<div class="mb-3">
|
| 78 |
-
<label class="form-label">User</label>
|
| 79 |
-
<select class="form-select" id="userId" required>
|
| 80 |
-
<option value="user_001">Alice Martin (FR)</option>
|
| 81 |
-
<option value="user_002">Bob Smith (US)</option>
|
| 82 |
-
<option value="user_003">Claire Dubois (FR)</option>
|
| 83 |
-
<option value="user_004">David Johnson (GB)</option>
|
| 84 |
-
<option value="user_005">Emma Garcia (ES)</option>
|
| 85 |
-
<option value="user_006">Frank Mueller (DE)</option>
|
| 86 |
-
<option value="user_007">Grace Lee (CN)</option>
|
| 87 |
-
<option value="user_008">Henry Wilson (AU)</option>
|
| 88 |
-
<option value="user_009">Iris Bernard (FR)</option>
|
| 89 |
-
<option value="user_010">Jack Taylor (CA)</option>
|
| 90 |
-
</select>
|
| 91 |
-
</div>
|
| 92 |
-
|
| 93 |
-
<div class="mb-3">
|
| 94 |
-
<label class="form-label">Merchant</label>
|
| 95 |
-
<select class="form-select" id="merchantId" required>
|
| 96 |
-
<option value="merchant_001">Amazon EU</option>
|
| 97 |
-
<option value="merchant_002">Booking.com</option>
|
| 98 |
-
<option value="merchant_003">Spotify Premium</option>
|
| 99 |
-
<option value="merchant_004">Uber Technologies</option>
|
| 100 |
-
<option value="merchant_005">Steam Gaming</option>
|
| 101 |
-
<option value="merchant_006">Netflix Streaming</option>
|
| 102 |
-
<option value="merchant_007">PayPal Holdings</option>
|
| 103 |
-
<option value="merchant_008">Airbnb Stays</option>
|
| 104 |
-
<option value="merchant_009">Apple Store</option>
|
| 105 |
-
<option value="merchant_010">Nike.com</option>
|
| 106 |
-
</select>
|
| 107 |
-
</div>
|
| 108 |
-
|
| 109 |
-
<div class="mb-3">
|
| 110 |
-
<label class="form-label">Amount (€)</label>
|
| 111 |
-
<input type="number" class="form-control" id="amount" step="0.01" min="0.01" value="99.99" required>
|
| 112 |
-
</div>
|
| 113 |
-
|
| 114 |
-
<div class="mb-3">
|
| 115 |
-
<label class="form-label">Currency</label>
|
| 116 |
-
<select class="form-select" id="currency">
|
| 117 |
-
<option value="EUR" selected>EUR</option>
|
| 118 |
-
<option value="USD">USD</option>
|
| 119 |
-
<option value="GBP">GBP</option>
|
| 120 |
-
<option value="CAD">CAD</option>
|
| 121 |
-
<option value="AUD">AUD</option>
|
| 122 |
-
</select>
|
| 123 |
-
</div>
|
| 124 |
-
|
| 125 |
-
<div class="mb-3">
|
| 126 |
-
<label class="form-label">Payment Method</label>
|
| 127 |
-
<select class="form-select" id="paymentMethod">
|
| 128 |
-
<option value="card">Card</option>
|
| 129 |
-
<option value="paypal">PayPal</option>
|
| 130 |
-
<option value="bank_transfer">Bank Transfer</option>
|
| 131 |
-
</select>
|
| 132 |
-
</div>
|
| 133 |
-
|
| 134 |
-
<div class="mb-3">
|
| 135 |
-
<label class="form-label">Card Last 4</label>
|
| 136 |
-
<input type="text" class="form-control" id="cardLast4" maxlength="4" value="1234">
|
| 137 |
-
</div>
|
| 138 |
-
|
| 139 |
-
<div class="mb-3">
|
| 140 |
-
<label class="form-label">IP Address</label>
|
| 141 |
-
<input type="text" class="form-control" id="ipAddress" value="82.65.123.45">
|
| 142 |
-
</div>
|
| 143 |
-
|
| 144 |
-
<div class="mb-3">
|
| 145 |
-
<label class="form-label">Device Type</label>
|
| 146 |
-
<select class="form-select" id="deviceType">
|
| 147 |
-
<option value="mobile">Mobile</option>
|
| 148 |
-
<option value="desktop">Desktop</option>
|
| 149 |
-
<option value="tablet">Tablet</option>
|
| 150 |
-
</select>
|
| 151 |
-
</div>
|
| 152 |
-
|
| 153 |
-
<button type="submit" class="btn btn-primary w-100">
|
| 154 |
-
<i class="bi bi-play-circle"></i> Process Transaction
|
| 155 |
-
</button>
|
| 156 |
-
|
| 157 |
-
<button type="button" class="btn btn-warning w-100 mt-2" onclick="simulateFraud()">
|
| 158 |
-
<i class="bi bi-exclamation-triangle"></i> Simulate Fraud
|
| 159 |
-
</button>
|
| 160 |
-
</form>
|
| 161 |
-
</div>
|
| 162 |
-
</div>
|
| 163 |
-
</div>
|
| 164 |
-
|
| 165 |
-
<!-- Results & Transaction History -->
|
| 166 |
-
<div class="col-md-8 mb-4">
|
| 167 |
-
<!-- Result Card -->
|
| 168 |
-
<div class="card mb-4" id="resultCard" style="display:none;">
|
| 169 |
-
<div class="card-header" id="resultHeader">
|
| 170 |
-
<h5 class="mb-0">Transaction Result</h5>
|
| 171 |
-
</div>
|
| 172 |
-
<div class="card-body" id="resultBody">
|
| 173 |
-
<!-- Result will be inserted here -->
|
| 174 |
-
</div>
|
| 175 |
-
</div>
|
| 176 |
-
|
| 177 |
-
<!-- Transaction History -->
|
| 178 |
-
<div class="card">
|
| 179 |
-
<div class="card-header bg-secondary text-white d-flex justify-content-between align-items-center">
|
| 180 |
-
<h5 class="mb-0"><i class="bi bi-clock-history"></i> Recent Transactions</h5>
|
| 181 |
-
<div class="btn-group btn-group-sm" role="group">
|
| 182 |
-
<button type="button" class="btn btn-outline-light" onclick="loadTransactions('all')">All</button>
|
| 183 |
-
<button type="button" class="btn btn-outline-light" onclick="loadTransactions('fraud')">Fraud</button>
|
| 184 |
-
<button type="button" class="btn btn-outline-light" onclick="loadTransactions('normal')">Normal</button>
|
| 185 |
-
</div>
|
| 186 |
-
</div>
|
| 187 |
-
<div class="card-body">
|
| 188 |
-
<div id="transactionsList">
|
| 189 |
-
<div class="text-center">
|
| 190 |
-
<span class="spinner-border spinner-border-sm"></span> Loading transactions...
|
| 191 |
-
</div>
|
| 192 |
-
</div>
|
| 193 |
-
</div>
|
| 194 |
-
</div>
|
| 195 |
-
</div>
|
| 196 |
-
</div>
|
| 197 |
-
</div>
|
| 198 |
-
|
| 199 |
-
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
| 200 |
-
<script>
|
| 201 |
-
// Load transactions on page load
|
| 202 |
-
document.addEventListener('DOMContentLoaded', function() {
|
| 203 |
-
loadTransactions('all');
|
| 204 |
-
refreshStatus();
|
| 205 |
-
});
|
| 206 |
-
|
| 207 |
-
// Handle form submission
|
| 208 |
-
document.getElementById('transactionForm').addEventListener('submit', async function(e) {
|
| 209 |
-
e.preventDefault();
|
| 210 |
-
|
| 211 |
-
const data = {
|
| 212 |
-
user_id: document.getElementById('userId').value,
|
| 213 |
-
merchant_id: document.getElementById('merchantId').value,
|
| 214 |
-
amount: parseFloat(document.getElementById('amount').value),
|
| 215 |
-
currency: document.getElementById('currency').value,
|
| 216 |
-
payment_method: document.getElementById('paymentMethod').value,
|
| 217 |
-
card_last4: document.getElementById('cardLast4').value,
|
| 218 |
-
ip_address: document.getElementById('ipAddress').value,
|
| 219 |
-
device_type: document.getElementById('deviceType').value
|
| 220 |
-
};
|
| 221 |
-
|
| 222 |
-
try {
|
| 223 |
-
const response = await fetch('/api/simulate', {
|
| 224 |
-
method: 'POST',
|
| 225 |
-
headers: { 'Content-Type': 'application/json' },
|
| 226 |
-
body: JSON.stringify(data)
|
| 227 |
-
});
|
| 228 |
-
|
| 229 |
-
const result = await response.json();
|
| 230 |
-
displayResult(result);
|
| 231 |
-
loadTransactions('all');
|
| 232 |
-
refreshStatus();
|
| 233 |
-
} catch (error) {
|
| 234 |
-
alert('Error processing transaction: ' + error.message);
|
| 235 |
-
}
|
| 236 |
-
});
|
| 237 |
-
|
| 238 |
-
function displayResult(result) {
|
| 239 |
-
const resultCard = document.getElementById('resultCard');
|
| 240 |
-
const resultHeader = document.getElementById('resultHeader');
|
| 241 |
-
const resultBody = document.getElementById('resultBody');
|
| 242 |
-
|
| 243 |
-
const fraudClass = result.fraud_score >= 70 ? 'danger' : result.fraud_score >= 40 ? 'warning' : 'success';
|
| 244 |
-
const fraudIcon = result.is_fraud ? 'bi-shield-x' : 'bi-shield-check';
|
| 245 |
-
|
| 246 |
-
resultHeader.className = `card-header bg-${fraudClass} text-white`;
|
| 247 |
-
resultHeader.innerHTML = `<h5 class="mb-0"><i class="bi ${fraudIcon}"></i> Transaction Result</h5>`;
|
| 248 |
-
|
| 249 |
-
resultBody.innerHTML = `
|
| 250 |
-
<div class="row">
|
| 251 |
-
<div class="col-md-6">
|
| 252 |
-
<p><strong>Transaction ID:</strong> <code>${result.transaction_id}</code></p>
|
| 253 |
-
<p><strong>Status:</strong> <span class="badge bg-${fraudClass}">${result.status}</span></p>
|
| 254 |
-
<p><strong>Message:</strong> ${result.message}</p>
|
| 255 |
-
</div>
|
| 256 |
-
<div class="col-md-6">
|
| 257 |
-
<p><strong>Fraud Score:</strong> <span class="fraud-score-${fraudClass}">${result.fraud_score}/100</span></p>
|
| 258 |
-
<p><strong>ML Probability:</strong> ${(result.ml_probability * 100).toFixed(2)}%</p>
|
| 259 |
-
<p><strong>Is Fraud:</strong> ${result.is_fraud ? '<span class="badge bg-danger">YES</span>' : '<span class="badge bg-success">NO</span>'}</p>
|
| 260 |
-
</div>
|
| 261 |
-
</div>
|
| 262 |
-
`;
|
| 263 |
-
|
| 264 |
-
resultCard.style.display = 'block';
|
| 265 |
-
}
|
| 266 |
-
|
| 267 |
-
async function loadTransactions(filter) {
|
| 268 |
-
const listDiv = document.getElementById('transactionsList');
|
| 269 |
-
listDiv.innerHTML = '<div class="text-center"><span class="spinner-border spinner-border-sm"></span> Loading...</div>';
|
| 270 |
-
|
| 271 |
-
try {
|
| 272 |
-
let url = '/api/transactions?limit=10';
|
| 273 |
-
if (filter === 'fraud') url += '&is_fraud=true';
|
| 274 |
-
else if (filter === 'normal') url += '&is_fraud=false';
|
| 275 |
-
|
| 276 |
-
const response = await fetch(url);
|
| 277 |
-
const data = await response.json();
|
| 278 |
-
|
| 279 |
-
if (data.transactions && data.transactions.length > 0) {
|
| 280 |
-
listDiv.innerHTML = data.transactions.map(tx => `
|
| 281 |
-
<div class="transaction-card card mb-2">
|
| 282 |
-
<div class="card-body p-2">
|
| 283 |
-
<div class="row align-items-center">
|
| 284 |
-
<div class="col-md-3">
|
| 285 |
-
<small class="text-muted">${new Date(tx.created_at).toLocaleString()}</small><br>
|
| 286 |
-
<code>${tx.transaction_id}</code>
|
| 287 |
-
</div>
|
| 288 |
-
<div class="col-md-2">
|
| 289 |
-
${tx.amount} ${tx.currency}
|
| 290 |
-
</div>
|
| 291 |
-
<div class="col-md-2">
|
| 292 |
-
<span class="badge bg-${tx.status === 'succeeded' ? 'success' : tx.status === 'pending' ? 'warning' : 'danger'}">
|
| 293 |
-
${tx.status}
|
| 294 |
-
</span>
|
| 295 |
-
</div>
|
| 296 |
-
<div class="col-md-2">
|
| 297 |
-
<strong class="${tx.fraud_score >= 70 ? 'text-danger' : tx.fraud_score >= 40 ? 'text-warning' : 'text-success'}">
|
| 298 |
-
${tx.fraud_score}/100
|
| 299 |
-
</strong>
|
| 300 |
-
</div>
|
| 301 |
-
<div class="col-md-3 text-end">
|
| 302 |
-
${tx.is_fraud ? '<span class="badge bg-danger"><i class="bi bi-shield-x"></i> FRAUD</span>' : '<span class="badge bg-success"><i class="bi bi-shield-check"></i> OK</span>'}
|
| 303 |
-
</div>
|
| 304 |
-
</div>
|
| 305 |
-
</div>
|
| 306 |
-
</div>
|
| 307 |
-
`).join('');
|
| 308 |
-
} else {
|
| 309 |
-
listDiv.innerHTML = '<p class="text-center text-muted">No transactions found</p>';
|
| 310 |
-
}
|
| 311 |
-
} catch (error) {
|
| 312 |
-
listDiv.innerHTML = `<div class="alert alert-danger">Error loading transactions: ${error.message}</div>`;
|
| 313 |
-
}
|
| 314 |
-
}
|
| 315 |
-
|
| 316 |
-
async function refreshStatus() {
|
| 317 |
-
try {
|
| 318 |
-
const response = await fetch('/api/status');
|
| 319 |
-
const status = await response.json();
|
| 320 |
-
|
| 321 |
-
document.getElementById('servicesStatus').innerHTML =
|
| 322 |
-
status.postgres && status.postgres.status === 'connected' ?
|
| 323 |
-
'<i class="bi bi-check-circle-fill text-success"></i> OK' :
|
| 324 |
-
'<i class="bi bi-x-circle-fill text-danger"></i> Error';
|
| 325 |
-
|
| 326 |
-
document.getElementById('totalTransactions').textContent =
|
| 327 |
-
status.postgres?.transactions_count || '-';
|
| 328 |
-
|
| 329 |
-
// Load fraud stats from transactions
|
| 330 |
-
const txResponse = await fetch('/api/transactions?is_fraud=true&limit=100');
|
| 331 |
-
const txData = await txResponse.json();
|
| 332 |
-
const fraudCount = txData.count || 0;
|
| 333 |
-
|
| 334 |
-
document.getElementById('fraudCount').textContent = fraudCount;
|
| 335 |
-
|
| 336 |
-
const txAllResponse = await fetch('/api/transactions?limit=100');
|
| 337 |
-
const txAllData = await txAllResponse.json();
|
| 338 |
-
const totalCount = txAllData.count || 0;
|
| 339 |
-
|
| 340 |
-
const fraudRate = totalCount > 0 ? ((fraudCount / totalCount) * 100).toFixed(2) : '0.00';
|
| 341 |
-
document.getElementById('fraudRate').innerHTML = `${fraudRate}%`;
|
| 342 |
-
|
| 343 |
-
} catch (error) {
|
| 344 |
-
console.error('Error refreshing status:', error);
|
| 345 |
-
}
|
| 346 |
-
}
|
| 347 |
-
|
| 348 |
-
function simulateFraud() {
|
| 349 |
-
// Fill form with suspicious values
|
| 350 |
-
document.getElementById('amount').value = '2999.99';
|
| 351 |
-
document.getElementById('ipAddress').value = '185.220.102.8';
|
| 352 |
-
document.getElementById('cardLast4').value = '9999';
|
| 353 |
-
|
| 354 |
-
alert('Form filled with suspicious values. Click "Process Transaction" to simulate fraud detection.');
|
| 355 |
-
}
|
| 356 |
-
|
| 357 |
-
// Refresh status every 30 seconds
|
| 358 |
-
setInterval(refreshStatus, 30000);
|
| 359 |
-
</script>
|
| 360 |
-
</body>
|
| 361 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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Deletion: false
|
| 9 |
-
editable: true
|
| 10 |
-
options:
|
| 11 |
-
path: /var/lib/grafana/dashboards
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/grafana/provisioning/datasources/datasources.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
apiVersion: 1
|
| 2 |
-
|
| 3 |
-
datasources:
|
| 4 |
-
- name: PostgreSQL
|
| 5 |
-
type: postgres
|
| 6 |
-
access: proxy
|
| 7 |
-
url: postgres:5432
|
| 8 |
-
database: stripe_oltp
|
| 9 |
-
user: stripe_user
|
| 10 |
-
secureJsonData:
|
| 11 |
-
password: stripe_password
|
| 12 |
-
jsonData:
|
| 13 |
-
sslmode: 'disable'
|
| 14 |
-
postgresVersion: 1500
|
| 15 |
-
editable: true
|
| 16 |
-
|
| 17 |
-
- name: ClickHouse
|
| 18 |
-
type: grafana-clickhouse-datasource
|
| 19 |
-
access: proxy
|
| 20 |
-
url: http://clickhouse:8123
|
| 21 |
-
database: stripe_olap
|
| 22 |
-
basicAuth: true
|
| 23 |
-
basicAuthUser: stripe_user
|
| 24 |
-
secureJsonData:
|
| 25 |
-
basicAuthPassword: stripe_password
|
| 26 |
-
editable: true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/init-minio.sh
DELETED
|
@@ -1,73 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
# ============================================
|
| 3 |
-
# MinIO Initialization Script
|
| 4 |
-
# ============================================
|
| 5 |
-
# This script creates buckets and sets up MinIO for the Stripe architecture
|
| 6 |
-
# ============================================
|
| 7 |
-
|
| 8 |
-
echo "============================================"
|
| 9 |
-
echo " Initializing MinIO"
|
| 10 |
-
echo "============================================"
|
| 11 |
-
echo ""
|
| 12 |
-
|
| 13 |
-
# Load credentials
|
| 14 |
-
source secret.sh
|
| 15 |
-
|
| 16 |
-
# MinIO endpoint (inside Docker network)
|
| 17 |
-
MINIO_ENDPOINT="http://minio:9000"
|
| 18 |
-
MINIO_ALIAS="stripe-minio"
|
| 19 |
-
|
| 20 |
-
echo "[1/4] Configuring MinIO client (mc)..."
|
| 21 |
-
docker exec stripe-minio mc alias set $MINIO_ALIAS $MINIO_ENDPOINT $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
|
| 22 |
-
|
| 23 |
-
if [ $? -eq 0 ]; then
|
| 24 |
-
echo " ✓ MinIO client configured"
|
| 25 |
-
else
|
| 26 |
-
echo " ✗ Failed to configure MinIO client"
|
| 27 |
-
exit 1
|
| 28 |
-
fi
|
| 29 |
-
|
| 30 |
-
echo ""
|
| 31 |
-
echo "[2/4] Creating buckets..."
|
| 32 |
-
|
| 33 |
-
# Create bucket for ML models
|
| 34 |
-
docker exec stripe-minio mc mb --ignore-existing $MINIO_ALIAS/mlflow
|
| 35 |
-
echo " ✓ Created bucket: mlflow (for ML models)"
|
| 36 |
-
|
| 37 |
-
# Create bucket for data lake
|
| 38 |
-
docker exec stripe-minio mc mb --ignore-existing $MINIO_ALIAS/datalake
|
| 39 |
-
echo " ✓ Created bucket: datalake (for raw data)"
|
| 40 |
-
|
| 41 |
-
# Create bucket for backups
|
| 42 |
-
docker exec stripe-minio mc mb --ignore-existing $MINIO_ALIAS/backups
|
| 43 |
-
echo " ✓ Created bucket: backups (for database backups)"
|
| 44 |
-
|
| 45 |
-
# Create bucket for logs
|
| 46 |
-
docker exec stripe-minio mc mb --ignore-existing $MINIO_ALIAS/logs
|
| 47 |
-
echo " ✓ Created bucket: logs (for application logs)"
|
| 48 |
-
|
| 49 |
-
echo ""
|
| 50 |
-
echo "[3/4] Setting bucket policies (public read for mlflow)..."
|
| 51 |
-
docker exec stripe-minio mc anonymous set download $MINIO_ALIAS/mlflow
|
| 52 |
-
echo " ✓ MLflow bucket is publicly readable"
|
| 53 |
-
|
| 54 |
-
echo ""
|
| 55 |
-
echo "[4/4] Verifying setup..."
|
| 56 |
-
docker exec stripe-minio mc ls $MINIO_ALIAS
|
| 57 |
-
|
| 58 |
-
echo ""
|
| 59 |
-
echo "============================================"
|
| 60 |
-
echo " MinIO Initialization Complete!"
|
| 61 |
-
echo "============================================"
|
| 62 |
-
echo ""
|
| 63 |
-
echo "Access MinIO Console:"
|
| 64 |
-
echo " URL: http://localhost:9001"
|
| 65 |
-
echo " Username: $MINIO_ACCESS_KEY"
|
| 66 |
-
echo " Password: $MINIO_SECRET_KEY"
|
| 67 |
-
echo ""
|
| 68 |
-
echo "Buckets created:"
|
| 69 |
-
echo " - mlflow (ML models and artifacts)"
|
| 70 |
-
echo " - datalake (raw data storage)"
|
| 71 |
-
echo " - backups (database backups)"
|
| 72 |
-
echo " - logs (application logs)"
|
| 73 |
-
echo ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/mlflow/model/README.md
DELETED
|
@@ -1,24 +0,0 @@
|
|
| 1 |
-
# Pre-trained Fraud Detection Model
|
| 2 |
-
|
| 3 |
-
This directory contains a pre-trained logistic regression model for fraud detection.
|
| 4 |
-
|
| 5 |
-
## Model Details
|
| 6 |
-
- Algorithm: Logistic Regression
|
| 7 |
-
- Features: 10 engineered features
|
| 8 |
-
- Accuracy: ~85% (on test set)
|
| 9 |
-
- Fraud Detection Threshold: 70%
|
| 10 |
-
|
| 11 |
-
## Features Used:
|
| 12 |
-
1. amount - Transaction amount
|
| 13 |
-
2. hour - Hour of day (0-23)
|
| 14 |
-
3. velocity_1h - Transactions in last hour
|
| 15 |
-
4. avg_amount_user - User's average transaction
|
| 16 |
-
5. user_total_tx - User's total transactions
|
| 17 |
-
6. amount_deviation - Deviation from user average
|
| 18 |
-
7. high_amount - Binary flag (amount > 500)
|
| 19 |
-
8. unusual_hour - Binary flag (3 AM - 6 AM)
|
| 20 |
-
9. high_velocity - Binary flag (velocity >= 5)
|
| 21 |
-
10. new_user - Binary flag (total_tx < 5)
|
| 22 |
-
|
| 23 |
-
## Usage
|
| 24 |
-
The model is automatically loaded by FastAPI on startup via the FraudDetector class.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/mlflow/model/logistic_regression_fraud.pkl
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:b5a758f946e8fa509e27ab5c765301b4145ab6bdffcacbf3eb99144f24b680dc
|
| 3 |
-
size 943
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/mlflow/train_model.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Train a simple fraud detection model
|
| 3 |
-
Pre-trained logistic regression model for demo
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
import numpy as np
|
| 7 |
-
from sklearn.linear_model import LogisticRegression
|
| 8 |
-
from sklearn.model_selection import train_test_split
|
| 9 |
-
import joblib
|
| 10 |
-
import os
|
| 11 |
-
|
| 12 |
-
# Generate synthetic training data
|
| 13 |
-
np.random.seed(42)
|
| 14 |
-
n_samples = 1000
|
| 15 |
-
|
| 16 |
-
# Features: amount, hour, velocity, avg_amount_user, total_tx, amount_deviation,
|
| 17 |
-
# high_amount, unusual_hour, high_velocity, new_user
|
| 18 |
-
X = np.random.randn(n_samples, 10)
|
| 19 |
-
|
| 20 |
-
# Labels: fraud (1) or not (0) - ~15% fraud rate
|
| 21 |
-
y = np.random.binomial(1, 0.15, n_samples)
|
| 22 |
-
|
| 23 |
-
# Train logistic regression
|
| 24 |
-
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
|
| 25 |
-
|
| 26 |
-
model = LogisticRegression(max_iter=1000, random_state=42)
|
| 27 |
-
model.fit(X_train, y_train)
|
| 28 |
-
|
| 29 |
-
# Save model
|
| 30 |
-
os.makedirs('/mlflow/model', exist_ok=True)
|
| 31 |
-
joblib.dump(model, '/mlflow/model/logistic_regression_fraud.pkl')
|
| 32 |
-
|
| 33 |
-
print(f'Model trained! Accuracy: {model.score(X_test, y_test):.2%}')
|
| 34 |
-
print('Model saved to /mlflow/model/logistic_regression_fraud.pkl')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/mongodb/init.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
| 1 |
-
// ============================================
|
| 2 |
-
// MONGODB - NoSQL Database Initialization
|
| 3 |
-
// ============================================
|
| 4 |
-
|
| 5 |
-
db = db.getSiblingDB('stripe_nosql');
|
| 6 |
-
|
| 7 |
-
// Create disputes collection
|
| 8 |
-
db.createCollection('disputes');
|
| 9 |
-
db.disputes.createIndex({ "transaction_id": 1 }, { unique: true });
|
| 10 |
-
db.disputes.createIndex({ "status": 1 });
|
| 11 |
-
db.disputes.createIndex({ "created_at": -1 });
|
| 12 |
-
|
| 13 |
-
// Create transactions collection (flexible schema)
|
| 14 |
-
db.createCollection('transactions');
|
| 15 |
-
db.transactions.createIndex({ "transaction_id": 1 }, { unique: true });
|
| 16 |
-
db.transactions.createIndex({ "user_id": 1 });
|
| 17 |
-
db.transactions.createIndex({ "created_at": -1 });
|
| 18 |
-
db.transactions.createIndex({ "fraud_score": -1 });
|
| 19 |
-
|
| 20 |
-
// Create product_catalog collection
|
| 21 |
-
db.createCollection('product_catalog');
|
| 22 |
-
db.product_catalog.createIndex({ "merchant_id": 1 });
|
| 23 |
-
db.product_catalog.createIndex({ "category": 1 });
|
| 24 |
-
|
| 25 |
-
print('MongoDB collections created successfully');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/mongodb/seed_data.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
| 1 |
-
// ============================================
|
| 2 |
-
// MONGODB - Seed Data
|
| 3 |
-
// ============================================
|
| 4 |
-
|
| 5 |
-
db = db.getSiblingDB('stripe_nosql');
|
| 6 |
-
|
| 7 |
-
// Insert sample disputes
|
| 8 |
-
db.disputes.insertMany([
|
| 9 |
-
{
|
| 10 |
-
transaction_id: "txn_0086",
|
| 11 |
-
user_id: "user_001",
|
| 12 |
-
reason: "unauthorized_transaction",
|
| 13 |
-
status: "pending",
|
| 14 |
-
amount: 2499.99,
|
| 15 |
-
evidence: {
|
| 16 |
-
customer_statement: "I did not authorize this purchase",
|
| 17 |
-
ip_mismatch: true,
|
| 18 |
-
device_unknown: true
|
| 19 |
-
},
|
| 20 |
-
created_at: new Date()
|
| 21 |
-
},
|
| 22 |
-
{
|
| 23 |
-
transaction_id: "txn_0087",
|
| 24 |
-
user_id: "user_003",
|
| 25 |
-
reason: "fraudulent",
|
| 26 |
-
status: "resolved",
|
| 27 |
-
amount: 4999.00,
|
| 28 |
-
evidence: {
|
| 29 |
-
customer_statement: "Card stolen",
|
| 30 |
-
police_report: true,
|
| 31 |
-
ip_address: "103.45.78.90"
|
| 32 |
-
},
|
| 33 |
-
created_at: new Date(Date.now() - 86400000)
|
| 34 |
-
}
|
| 35 |
-
]);
|
| 36 |
-
|
| 37 |
-
// Insert sample product catalog
|
| 38 |
-
db.product_catalog.insertMany([
|
| 39 |
-
{
|
| 40 |
-
merchant_id: "merchant_001",
|
| 41 |
-
products: [
|
| 42 |
-
{ sku: "AMZ-001", name: "Laptop Dell XPS", price: 1299.00, category: "electronics" },
|
| 43 |
-
{ sku: "AMZ-002", name: "iPhone 15 Pro", price: 1099.00, category: "electronics" }
|
| 44 |
-
]
|
| 45 |
-
},
|
| 46 |
-
{
|
| 47 |
-
merchant_id: "merchant_005",
|
| 48 |
-
products: [
|
| 49 |
-
{ sku: "STM-001", name: "Cyberpunk 2077", price: 59.99, category: "games" },
|
| 50 |
-
{ sku: "STM-002", name: "Baldur's Gate 3", price: 69.99, category: "games" }
|
| 51 |
-
]
|
| 52 |
-
}
|
| 53 |
-
]);
|
| 54 |
-
|
| 55 |
-
print('MongoDB seed data inserted');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/neo4j/init.cypher
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
// ============================================
|
| 2 |
-
// NEO4J - Graph Database Initialization
|
| 3 |
-
// ============================================
|
| 4 |
-
|
| 5 |
-
// Create constraints
|
| 6 |
-
CREATE CONSTRAINT user_id_unique IF NOT EXISTS FOR (u:User) REQUIRE u.user_id IS UNIQUE;
|
| 7 |
-
CREATE CONSTRAINT merchant_id_unique IF NOT EXISTS FOR (m:Merchant) REQUIRE m.merchant_id IS UNIQUE;
|
| 8 |
-
|
| 9 |
-
// Create indexes
|
| 10 |
-
CREATE INDEX user_country IF NOT EXISTS FOR (u:User) ON (u.country);
|
| 11 |
-
CREATE INDEX merchant_category IF NOT EXISTS FOR (m:Merchant) ON (m.category);
|
| 12 |
-
|
| 13 |
-
// Insert sample users
|
| 14 |
-
CREATE (u1:User {user_id: 'user_001', name: 'Alice Martin', country: 'FR'});
|
| 15 |
-
CREATE (u2:User {user_id: 'user_002', name: 'Bob Smith', country: 'US'});
|
| 16 |
-
CREATE (u3:User {user_id: 'user_003', name: 'Claire Dubois', country: 'FR'});
|
| 17 |
-
|
| 18 |
-
// Insert sample merchants
|
| 19 |
-
CREATE (m1:Merchant {merchant_id: 'merchant_001', name: 'Amazon EU', category: 'retail'});
|
| 20 |
-
CREATE (m2:Merchant {merchant_id: 'merchant_005', name: 'Steam Gaming', category: 'gaming'});
|
| 21 |
-
CREATE (m3:Merchant {merchant_id: 'merchant_009', name: 'Apple Store', category: 'retail'});
|
| 22 |
-
|
| 23 |
-
// Create sample relationships
|
| 24 |
-
MATCH (u:User {user_id: 'user_001'}), (m:Merchant {merchant_id: 'merchant_001'})
|
| 25 |
-
CREATE (u)-[:TRANSACTED_WITH {count: 5, total_amount: 450.00}]->(m);
|
| 26 |
-
|
| 27 |
-
MATCH (u:User {user_id: 'user_001'}), (m:Merchant {merchant_id: 'merchant_005'})
|
| 28 |
-
CREATE (u)-[:FRAUD_DETECTED {transaction_id: 'txn_0086', amount: 2499.99, timestamp: datetime()}]->(m);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/postgres/init.sql
DELETED
|
@@ -1,183 +0,0 @@
|
|
| 1 |
-
-- ============================================
|
| 2 |
-
-- STRIPE FRAUD DETECTION - POSTGRESQL OLTP
|
| 3 |
-
-- Schéma pour données transactionnelles
|
| 4 |
-
-- ============================================
|
| 5 |
-
|
| 6 |
-
-- Création de l'extension pour UUID
|
| 7 |
-
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
| 8 |
-
|
| 9 |
-
-- ============================================
|
| 10 |
-
-- TABLE: users
|
| 11 |
-
-- ============================================
|
| 12 |
-
CREATE TABLE users (
|
| 13 |
-
user_id VARCHAR(50) PRIMARY KEY,
|
| 14 |
-
email VARCHAR(255) UNIQUE NOT NULL,
|
| 15 |
-
name VARCHAR(255) NOT NULL,
|
| 16 |
-
country VARCHAR(2) NOT NULL,
|
| 17 |
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
| 18 |
-
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
| 19 |
-
total_transactions INTEGER DEFAULT 0,
|
| 20 |
-
avg_amount DECIMAL(15,2) DEFAULT 0.00,
|
| 21 |
-
is_active BOOLEAN DEFAULT TRUE
|
| 22 |
-
);
|
| 23 |
-
|
| 24 |
-
CREATE INDEX idx_users_country ON users(country);
|
| 25 |
-
CREATE INDEX idx_users_created_at ON users(created_at);
|
| 26 |
-
|
| 27 |
-
-- ============================================
|
| 28 |
-
-- TABLE: merchants
|
| 29 |
-
-- ============================================
|
| 30 |
-
CREATE TABLE merchants (
|
| 31 |
-
merchant_id VARCHAR(50) PRIMARY KEY,
|
| 32 |
-
name VARCHAR(255) NOT NULL,
|
| 33 |
-
category VARCHAR(100) NOT NULL,
|
| 34 |
-
country VARCHAR(2) NOT NULL,
|
| 35 |
-
risk_score INTEGER DEFAULT 50,
|
| 36 |
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
| 37 |
-
is_active BOOLEAN DEFAULT TRUE
|
| 38 |
-
);
|
| 39 |
-
|
| 40 |
-
CREATE INDEX idx_merchants_category ON merchants(category);
|
| 41 |
-
CREATE INDEX idx_merchants_risk_score ON merchants(risk_score);
|
| 42 |
-
|
| 43 |
-
-- ============================================
|
| 44 |
-
-- TABLE: transactions
|
| 45 |
-
-- ============================================
|
| 46 |
-
CREATE TABLE transactions (
|
| 47 |
-
transaction_id VARCHAR(50) PRIMARY KEY,
|
| 48 |
-
user_id VARCHAR(50) NOT NULL REFERENCES users(user_id),
|
| 49 |
-
merchant_id VARCHAR(50) NOT NULL REFERENCES merchants(merchant_id),
|
| 50 |
-
amount DECIMAL(15,2) NOT NULL CHECK (amount >= 0),
|
| 51 |
-
currency VARCHAR(3) NOT NULL DEFAULT 'EUR',
|
| 52 |
-
status VARCHAR(20) NOT NULL DEFAULT 'pending',
|
| 53 |
-
payment_method VARCHAR(50) NOT NULL,
|
| 54 |
-
card_last4 VARCHAR(4),
|
| 55 |
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
| 56 |
-
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
| 57 |
-
ip_address INET,
|
| 58 |
-
device_type VARCHAR(50),
|
| 59 |
-
is_fraud BOOLEAN DEFAULT FALSE,
|
| 60 |
-
fraud_score INTEGER DEFAULT 0,
|
| 61 |
-
ml_fraud_probability DECIMAL(5,4),
|
| 62 |
-
CHECK (status IN ('pending', 'succeeded', 'failed', 'refunded', 'disputed'))
|
| 63 |
-
);
|
| 64 |
-
|
| 65 |
-
CREATE INDEX idx_transactions_user_id ON transactions(user_id);
|
| 66 |
-
CREATE INDEX idx_transactions_merchant_id ON transactions(merchant_id);
|
| 67 |
-
CREATE INDEX idx_transactions_created_at ON transactions(created_at DESC);
|
| 68 |
-
CREATE INDEX idx_transactions_status ON transactions(status);
|
| 69 |
-
CREATE INDEX idx_transactions_is_fraud ON transactions(is_fraud);
|
| 70 |
-
CREATE INDEX idx_transactions_amount ON transactions(amount);
|
| 71 |
-
|
| 72 |
-
-- Partitionnement par date (mensuel) pour scalabilité
|
| 73 |
-
-- CREATE TABLE transactions_2024_11 PARTITION OF transactions
|
| 74 |
-
-- FOR VALUES FROM ('2024-11-01') TO ('2024-12-01');
|
| 75 |
-
|
| 76 |
-
-- ============================================
|
| 77 |
-
-- TABLE: fraud_events
|
| 78 |
-
-- ============================================
|
| 79 |
-
CREATE TABLE fraud_events (
|
| 80 |
-
event_id SERIAL PRIMARY KEY,
|
| 81 |
-
transaction_id VARCHAR(50) NOT NULL REFERENCES transactions(transaction_id),
|
| 82 |
-
rule_triggered VARCHAR(100) NOT NULL,
|
| 83 |
-
severity VARCHAR(20) NOT NULL DEFAULT 'medium',
|
| 84 |
-
score_contribution INTEGER NOT NULL,
|
| 85 |
-
details JSONB,
|
| 86 |
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
| 87 |
-
CHECK (severity IN ('low', 'medium', 'high', 'critical'))
|
| 88 |
-
);
|
| 89 |
-
|
| 90 |
-
CREATE INDEX idx_fraud_events_transaction_id ON fraud_events(transaction_id);
|
| 91 |
-
CREATE INDEX idx_fraud_events_severity ON fraud_events(severity);
|
| 92 |
-
CREATE INDEX idx_fraud_events_created_at ON fraud_events(created_at DESC);
|
| 93 |
-
|
| 94 |
-
-- ============================================
|
| 95 |
-
-- TABLE: refunds
|
| 96 |
-
-- ============================================
|
| 97 |
-
CREATE TABLE refunds (
|
| 98 |
-
refund_id VARCHAR(50) PRIMARY KEY,
|
| 99 |
-
transaction_id VARCHAR(50) NOT NULL REFERENCES transactions(transaction_id),
|
| 100 |
-
amount DECIMAL(15,2) NOT NULL CHECK (amount >= 0),
|
| 101 |
-
reason VARCHAR(255),
|
| 102 |
-
status VARCHAR(20) NOT NULL DEFAULT 'pending',
|
| 103 |
-
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
| 104 |
-
processed_at TIMESTAMP,
|
| 105 |
-
CHECK (status IN ('pending', 'succeeded', 'failed', 'cancelled'))
|
| 106 |
-
);
|
| 107 |
-
|
| 108 |
-
CREATE INDEX idx_refunds_transaction_id ON refunds(transaction_id);
|
| 109 |
-
CREATE INDEX idx_refunds_status ON refunds(status);
|
| 110 |
-
|
| 111 |
-
-- ============================================
|
| 112 |
-
-- FONCTION: Mise à jour automatique updated_at
|
| 113 |
-
-- ============================================
|
| 114 |
-
CREATE OR REPLACE FUNCTION update_updated_at_column()
|
| 115 |
-
RETURNS TRIGGER AS $$
|
| 116 |
-
BEGIN
|
| 117 |
-
NEW.updated_at = CURRENT_TIMESTAMP;
|
| 118 |
-
RETURN NEW;
|
| 119 |
-
END;
|
| 120 |
-
$$ language 'plpgsql';
|
| 121 |
-
|
| 122 |
-
CREATE TRIGGER update_users_updated_at BEFORE UPDATE ON users
|
| 123 |
-
FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();
|
| 124 |
-
|
| 125 |
-
CREATE TRIGGER update_transactions_updated_at BEFORE UPDATE ON transactions
|
| 126 |
-
FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();
|
| 127 |
-
|
| 128 |
-
-- ============================================
|
| 129 |
-
-- VUE: Transactions avec détails complets
|
| 130 |
-
-- ============================================
|
| 131 |
-
CREATE OR REPLACE VIEW v_transactions_detailed AS
|
| 132 |
-
SELECT
|
| 133 |
-
t.transaction_id,
|
| 134 |
-
t.amount,
|
| 135 |
-
t.currency,
|
| 136 |
-
t.status,
|
| 137 |
-
t.created_at,
|
| 138 |
-
t.is_fraud,
|
| 139 |
-
t.fraud_score,
|
| 140 |
-
t.ml_fraud_probability,
|
| 141 |
-
u.user_id,
|
| 142 |
-
u.email,
|
| 143 |
-
u.name as user_name,
|
| 144 |
-
u.country as user_country,
|
| 145 |
-
m.merchant_id,
|
| 146 |
-
m.name as merchant_name,
|
| 147 |
-
m.category as merchant_category,
|
| 148 |
-
m.risk_score as merchant_risk_score,
|
| 149 |
-
COUNT(fe.event_id) as fraud_events_count
|
| 150 |
-
FROM transactions t
|
| 151 |
-
JOIN users u ON t.user_id = u.user_id
|
| 152 |
-
JOIN merchants m ON t.merchant_id = m.merchant_id
|
| 153 |
-
LEFT JOIN fraud_events fe ON t.transaction_id = fe.transaction_id
|
| 154 |
-
GROUP BY t.transaction_id, u.user_id, u.email, u.name, u.country, m.merchant_id, m.name, m.category, m.risk_score;
|
| 155 |
-
|
| 156 |
-
-- ============================================
|
| 157 |
-
-- VUE: Statistiques fraude par marchand
|
| 158 |
-
-- ============================================
|
| 159 |
-
CREATE OR REPLACE VIEW v_merchant_fraud_stats AS
|
| 160 |
-
SELECT
|
| 161 |
-
m.merchant_id,
|
| 162 |
-
m.name as merchant_name,
|
| 163 |
-
m.category,
|
| 164 |
-
COUNT(t.transaction_id) as total_transactions,
|
| 165 |
-
SUM(CASE WHEN t.is_fraud THEN 1 ELSE 0 END) as fraud_transactions,
|
| 166 |
-
ROUND(100.0 * SUM(CASE WHEN t.is_fraud THEN 1 ELSE 0 END) / NULLIF(COUNT(t.transaction_id), 0), 2) as fraud_rate,
|
| 167 |
-
SUM(t.amount) as total_amount,
|
| 168 |
-
AVG(t.amount) as avg_amount
|
| 169 |
-
FROM merchants m
|
| 170 |
-
LEFT JOIN transactions t ON m.merchant_id = t.merchant_id
|
| 171 |
-
GROUP BY m.merchant_id, m.name, m.category;
|
| 172 |
-
|
| 173 |
-
-- ============================================
|
| 174 |
-
-- PERMISSIONS
|
| 175 |
-
-- ============================================
|
| 176 |
-
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO stripe_user;
|
| 177 |
-
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO stripe_user;
|
| 178 |
-
GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA public TO stripe_user;
|
| 179 |
-
|
| 180 |
-
-- ============================================
|
| 181 |
-
-- INFO
|
| 182 |
-
-- ============================================
|
| 183 |
-
SELECT 'PostgreSQL OLTP schema initialized successfully!' as message;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/postgres/seed_data.sql
DELETED
|
@@ -1,200 +0,0 @@
|
|
| 1 |
-
-- ============================================
|
| 2 |
-
-- SEED DATA - PostgreSQL OLTP
|
| 3 |
-
-- Données de démonstration (légères)
|
| 4 |
-
-- ============================================
|
| 5 |
-
|
| 6 |
-
-- ============================================
|
| 7 |
-
-- INSERT: 10 Users
|
| 8 |
-
-- ============================================
|
| 9 |
-
INSERT INTO users (user_id, email, name, country, total_transactions, avg_amount) VALUES
|
| 10 |
-
('user_001', 'alice.martin@email.fr', 'Alice Martin', 'FR', 15, 89.50),
|
| 11 |
-
('user_002', 'bob.smith@email.com', 'Bob Smith', 'US', 22, 156.30),
|
| 12 |
-
('user_003', 'claire.dubois@email.fr', 'Claire Dubois', 'FR', 8, 45.20),
|
| 13 |
-
('user_004', 'david.johnson@email.uk', 'David Johnson', 'GB', 31, 203.80),
|
| 14 |
-
('user_005', 'emma.garcia@email.es', 'Emma Garcia', 'ES', 12, 67.90),
|
| 15 |
-
('user_006', 'frank.mueller@email.de', 'Frank Mueller', 'DE', 19, 124.50),
|
| 16 |
-
('user_007', 'grace.lee@email.cn', 'Grace Lee', 'CN', 5, 92.40),
|
| 17 |
-
('user_008', 'henry.wilson@email.au', 'Henry Wilson', 'AU', 27, 178.60),
|
| 18 |
-
('user_009', 'iris.bernard@email.fr', 'Iris Bernard', 'FR', 14, 98.70),
|
| 19 |
-
('user_010', 'jack.taylor@email.ca', 'Jack Taylor', 'CA', 9, 54.30);
|
| 20 |
-
|
| 21 |
-
-- ============================================
|
| 22 |
-
-- INSERT: 10 Merchants
|
| 23 |
-
-- ============================================
|
| 24 |
-
INSERT INTO merchants (merchant_id, name, category, country, risk_score) VALUES
|
| 25 |
-
('merchant_001', 'Amazon EU', 'retail', 'LU', 20),
|
| 26 |
-
('merchant_002', 'Booking.com', 'travel', 'NL', 25),
|
| 27 |
-
('merchant_003', 'Spotify Premium', 'subscription', 'SE', 15),
|
| 28 |
-
('merchant_004', 'Uber Technologies', 'transport', 'US', 30),
|
| 29 |
-
('merchant_005', 'Steam Gaming', 'gaming', 'US', 40),
|
| 30 |
-
('merchant_006', 'Netflix Streaming', 'subscription', 'US', 18),
|
| 31 |
-
('merchant_007', 'PayPal Holdings', 'fintech', 'US', 22),
|
| 32 |
-
('merchant_008', 'Airbnb Stays', 'hospitality', 'IE', 28),
|
| 33 |
-
('merchant_009', 'Apple Store', 'retail', 'US', 12),
|
| 34 |
-
('merchant_010', 'Nike.com', 'fashion', 'US', 16);
|
| 35 |
-
|
| 36 |
-
-- ============================================
|
| 37 |
-
-- INSERT: 100 Transactions (mix légitimes + fraudes)
|
| 38 |
-
-- ============================================
|
| 39 |
-
|
| 40 |
-
-- Transactions LÉGITIMES (85 transactions, fraud_score < 70)
|
| 41 |
-
INSERT INTO transactions (transaction_id, user_id, merchant_id, amount, currency, status, payment_method, card_last4, is_fraud, fraud_score, ml_fraud_probability, created_at, ip_address, device_type) VALUES
|
| 42 |
-
-- User 001 (Alice) - Transactions normales France
|
| 43 |
-
('txn_0001', 'user_001', 'merchant_001', 49.99, 'EUR', 'succeeded', 'card', '1234', FALSE, 15, 0.0823, NOW() - INTERVAL '10 days', '82.65.123.45', 'mobile'),
|
| 44 |
-
('txn_0002', 'user_001', 'merchant_003', 9.99, 'EUR', 'succeeded', 'card', '1234', FALSE, 12, 0.0645, NOW() - INTERVAL '9 days', '82.65.123.45', 'desktop'),
|
| 45 |
-
('txn_0003', 'user_001', 'merchant_006', 13.99, 'EUR', 'succeeded', 'card', '1234', FALSE, 18, 0.0987, NOW() - INTERVAL '7 days', '82.65.123.47', 'mobile'),
|
| 46 |
-
|
| 47 |
-
-- User 002 (Bob) - Transactions normales USA
|
| 48 |
-
('txn_0004', 'user_002', 'merchant_004', 45.80, 'USD', 'succeeded', 'card', '5678', FALSE, 22, 0.1234, NOW() - INTERVAL '8 days', '74.125.45.123', 'mobile'),
|
| 49 |
-
('txn_0005', 'user_002', 'merchant_007', 125.50, 'USD', 'succeeded', 'card', '5678', FALSE, 28, 0.1567, NOW() - INTERVAL '6 days', '74.125.45.123', 'desktop'),
|
| 50 |
-
('txn_0006', 'user_002', 'merchant_009', 999.00, 'USD', 'succeeded', 'card', '5678', FALSE, 35, 0.1890, NOW() - INTERVAL '4 days', '74.125.45.124', 'mobile'),
|
| 51 |
-
|
| 52 |
-
-- User 003 (Claire) - Petites transactions fréquentes
|
| 53 |
-
('txn_0007', 'user_003', 'merchant_003', 9.99, 'EUR', 'succeeded', 'card', '9012', FALSE, 10, 0.0534, NOW() - INTERVAL '5 days', '92.134.56.78', 'mobile'),
|
| 54 |
-
('txn_0008', 'user_003', 'merchant_006', 13.99, 'EUR', 'succeeded', 'card', '9012', FALSE, 11, 0.0612, NOW() - INTERVAL '3 days', '92.134.56.78', 'mobile'),
|
| 55 |
-
('txn_0009', 'user_003', 'merchant_001', 23.45, 'EUR', 'succeeded', 'card', '9012', FALSE, 14, 0.0789, NOW() - INTERVAL '2 days', '92.134.56.79', 'desktop'),
|
| 56 |
-
|
| 57 |
-
-- User 004 (David) - High spender UK
|
| 58 |
-
('txn_0010', 'user_004', 'merchant_002', 450.00, 'GBP', 'succeeded', 'card', '3456', FALSE, 32, 0.1823, NOW() - INTERVAL '12 days', '81.98.123.45', 'desktop'),
|
| 59 |
-
('txn_0011', 'user_004', 'merchant_008', 890.50, 'GBP', 'succeeded', 'card', '3456', FALSE, 38, 0.2145, NOW() - INTERVAL '10 days', '81.98.123.45', 'desktop'),
|
| 60 |
-
('txn_0012', 'user_004', 'merchant_009', 1299.00, 'GBP', 'succeeded', 'card', '3456', FALSE, 42, 0.2389, NOW() - INTERVAL '5 days', '81.98.123.46', 'mobile'),
|
| 61 |
-
|
| 62 |
-
-- User 005 (Emma) - Spain normal pattern
|
| 63 |
-
('txn_0013', 'user_005', 'merchant_001', 67.80, 'EUR', 'succeeded', 'card', '7890', FALSE, 19, 0.1012, NOW() - INTERVAL '9 days', '88.26.34.56', 'desktop'),
|
| 64 |
-
('txn_0014', 'user_005', 'merchant_010', 89.99, 'EUR', 'succeeded', 'card', '7890', FALSE, 21, 0.1178, NOW() - INTERVAL '7 days', '88.26.34.56', 'mobile'),
|
| 65 |
-
('txn_0015', 'user_005', 'merchant_003', 9.99, 'EUR', 'succeeded', 'card', '7890', FALSE, 13, 0.0723, NOW() - INTERVAL '4 days', '88.26.34.57', 'mobile'),
|
| 66 |
-
|
| 67 |
-
-- User 006 (Frank) - Germany normal
|
| 68 |
-
('txn_0016', 'user_006', 'merchant_001', 234.50, 'EUR', 'succeeded', 'card', '2345', FALSE, 29, 0.1623, NOW() - INTERVAL '11 days', '87.122.45.67', 'desktop'),
|
| 69 |
-
('txn_0017', 'user_006', 'merchant_005', 59.99, 'EUR', 'succeeded', 'card', '2345', FALSE, 25, 0.1401, NOW() - INTERVAL '8 days', '87.122.45.67', 'desktop'),
|
| 70 |
-
('txn_0018', 'user_006', 'merchant_009', 699.00, 'EUR', 'succeeded', 'card', '2345', FALSE, 34, 0.1934, NOW() - INTERVAL '3 days', '87.122.45.68', 'mobile'),
|
| 71 |
-
|
| 72 |
-
-- User 007 (Grace) - China small amounts
|
| 73 |
-
('txn_0019', 'user_007', 'merchant_005', 29.99, 'USD', 'succeeded', 'card', '6789', FALSE, 27, 0.1512, NOW() - INTERVAL '6 days', '120.244.12.34', 'desktop'),
|
| 74 |
-
('txn_0020', 'user_007', 'merchant_001', 45.80, 'USD', 'succeeded', 'card', '6789', FALSE, 23, 0.1289, NOW() - INTERVAL '4 days', '120.244.12.34', 'desktop'),
|
| 75 |
-
|
| 76 |
-
-- User 008 (Henry) - Australia high volume
|
| 77 |
-
('txn_0021', 'user_008', 'merchant_004', 67.50, 'AUD', 'succeeded', 'card', '0123', FALSE, 24, 0.1345, NOW() - INTERVAL '13 days', '203.45.78.90', 'mobile'),
|
| 78 |
-
('txn_0022', 'user_008', 'merchant_007', 345.00, 'AUD', 'succeeded', 'card', '0123', FALSE, 31, 0.1756, NOW() - INTERVAL '11 days', '203.45.78.90', 'desktop'),
|
| 79 |
-
('txn_0023', 'user_008', 'merchant_002', 1250.00, 'AUD', 'succeeded', 'card', '0123', FALSE, 45, 0.2567, NOW() - INTERVAL '7 days', '203.45.78.91', 'desktop'),
|
| 80 |
-
|
| 81 |
-
-- User 009 (Iris) - France subscription pattern
|
| 82 |
-
('txn_0024', 'user_009', 'merchant_003', 9.99, 'EUR', 'succeeded', 'card', '4567', FALSE, 11, 0.0601, NOW() - INTERVAL '14 days', '90.34.56.78', 'mobile'),
|
| 83 |
-
('txn_0025', 'user_009', 'merchant_006', 13.99, 'EUR', 'succeeded', 'card', '4567', FALSE, 12, 0.0678, NOW() - INTERVAL '12 days', '90.34.56.78', 'mobile'),
|
| 84 |
-
('txn_0026', 'user_009', 'merchant_001', 78.90, 'EUR', 'succeeded', 'card', '4567', FALSE, 20, 0.1123, NOW() - INTERVAL '5 days', '90.34.56.79', 'desktop'),
|
| 85 |
-
|
| 86 |
-
-- User 010 (Jack) - Canada normal
|
| 87 |
-
('txn_0027', 'user_010', 'merchant_001', 123.45, 'CAD', 'succeeded', 'card', '8901', FALSE, 26, 0.1456, NOW() - INTERVAL '10 days', '142.34.67.89', 'desktop'),
|
| 88 |
-
('txn_0028', 'user_010', 'merchant_010', 89.00, 'CAD', 'succeeded', 'card', '8901', FALSE, 22, 0.1234, NOW() - INTERVAL '6 days', '142.34.67.89', 'mobile'),
|
| 89 |
-
|
| 90 |
-
-- Transactions supplémentaires légitimes (pour atteindre 85)
|
| 91 |
-
('txn_0029', 'user_001', 'merchant_010', 67.50, 'EUR', 'succeeded', 'card', '1234', FALSE, 17, 0.0912, NOW() - INTERVAL '6 days', '82.65.123.45', 'mobile'),
|
| 92 |
-
('txn_0030', 'user_002', 'merchant_005', 59.99, 'USD', 'succeeded', 'card', '5678', FALSE, 24, 0.1345, NOW() - INTERVAL '5 days', '74.125.45.123', 'desktop'),
|
| 93 |
-
('txn_0031', 'user_003', 'merchant_010', 45.00, 'EUR', 'succeeded', 'card', '9012', FALSE, 16, 0.0867, NOW() - INTERVAL '4 days', '92.134.56.78', 'mobile'),
|
| 94 |
-
('txn_0032', 'user_004', 'merchant_001', 234.90, 'GBP', 'succeeded', 'card', '3456', FALSE, 30, 0.1678, NOW() - INTERVAL '3 days', '81.98.123.45', 'desktop'),
|
| 95 |
-
('txn_0033', 'user_005', 'merchant_006', 13.99, 'EUR', 'succeeded', 'card', '7890', FALSE, 14, 0.0756, NOW() - INTERVAL '3 days', '88.26.34.56', 'mobile'),
|
| 96 |
-
('txn_0034', 'user_006', 'merchant_003', 9.99, 'EUR', 'succeeded', 'card', '2345', FALSE, 12, 0.0634, NOW() - INTERVAL '2 days', '87.122.45.67', 'mobile'),
|
| 97 |
-
('txn_0035', 'user_007', 'merchant_009', 799.00, 'USD', 'succeeded', 'card', '6789', FALSE, 36, 0.2012, NOW() - INTERVAL '2 days', '120.244.12.34', 'desktop'),
|
| 98 |
-
('txn_0036', 'user_008', 'merchant_006', 13.99, 'AUD', 'succeeded', 'card', '0123', FALSE, 13, 0.0712, NOW() - INTERVAL '2 days', '203.45.78.90', 'mobile'),
|
| 99 |
-
('txn_0037', 'user_009', 'merchant_010', 123.45, 'EUR', 'succeeded', 'card', '4567', FALSE, 25, 0.1401, NOW() - INTERVAL '1 day', '90.34.56.78', 'mobile'),
|
| 100 |
-
('txn_0038', 'user_010', 'merchant_003', 9.99, 'CAD', 'succeeded', 'card', '8901', FALSE, 11, 0.0589, NOW() - INTERVAL '1 day', '142.34.67.89', 'mobile');
|
| 101 |
-
|
| 102 |
-
-- Continue avec plus de transactions légitimes variées...
|
| 103 |
-
-- (Ajoutez 47 transactions supplémentaires similaires pour atteindre 85)
|
| 104 |
-
|
| 105 |
-
-- Transactions FRAUDULEUSES (15 transactions, fraud_score >= 70)
|
| 106 |
-
-- Pattern 1: Montants élevés inhabituels
|
| 107 |
-
INSERT INTO transactions (transaction_id, user_id, merchant_id, amount, currency, status, payment_method, card_last4, is_fraud, fraud_score, ml_fraud_probability, created_at, ip_address, device_type) VALUES
|
| 108 |
-
('txn_0086', 'user_001', 'merchant_005', 2499.99, 'EUR', 'failed', 'card', '9999', TRUE, 95, 0.9823, NOW() - INTERVAL '3 days', '45.123.67.89', 'desktop'),
|
| 109 |
-
('txn_0087', 'user_003', 'merchant_009', 4999.00, 'EUR', 'failed', 'card', '8888', TRUE, 98, 0.9912, NOW() - INTERVAL '2 days', '103.45.78.90', 'desktop');
|
| 110 |
-
|
| 111 |
-
-- Pattern 2: Vélocité élevée (multiple transactions rapides)
|
| 112 |
-
INSERT INTO transactions (transaction_id, user_id, merchant_id, amount, currency, status, payment_method, card_last4, is_fraud, fraud_score, ml_fraud_probability, created_at, ip_address, device_type) VALUES
|
| 113 |
-
('txn_0088', 'user_002', 'merchant_001', 599.00, 'USD', 'failed', 'card', '7777', TRUE, 88, 0.9234, NOW() - INTERVAL '1 hour', '67.234.12.34', 'mobile'),
|
| 114 |
-
('txn_0089', 'user_002', 'merchant_007', 799.00, 'USD', 'failed', 'card', '7777', TRUE, 92, 0.9456, NOW() - INTERVAL '45 minutes', '67.234.12.34', 'mobile'),
|
| 115 |
-
('txn_0090', 'user_002', 'merchant_009', 1299.00, 'USD', 'failed', 'card', '7777', TRUE, 96, 0.9678, NOW() - INTERVAL '30 minutes', '67.234.12.34', 'mobile');
|
| 116 |
-
|
| 117 |
-
-- Pattern 3: Localisation géographique suspecte
|
| 118 |
-
INSERT INTO transactions (transaction_id, user_id, merchant_id, amount, currency, status, payment_method, card_last4, is_fraud, fraud_score, ml_fraud_probability, created_at, ip_address, device_type) VALUES
|
| 119 |
-
('txn_0091', 'user_004', 'merchant_001', 1899.00, 'GBP', 'failed', 'card', '6666', TRUE, 91, 0.9389, NOW() - INTERVAL '5 hours', '185.220.102.8', 'desktop'),
|
| 120 |
-
('txn_0092', 'user_006', 'merchant_005', 899.99, 'EUR', 'failed', 'card', '5555', TRUE, 87, 0.9123, NOW() - INTERVAL '4 hours', '185.220.102.9', 'desktop');
|
| 121 |
-
|
| 122 |
-
-- Pattern 4: Heure inhabituelle (3h du matin)
|
| 123 |
-
INSERT INTO transactions (transaction_id, user_id, merchant_id, amount, currency, status, payment_method, card_last4, is_fraud, fraud_score, ml_fraud_probability, created_at, ip_address, device_type) VALUES
|
| 124 |
-
('txn_0093', 'user_005', 'merchant_007', 1599.00, 'EUR', 'failed', 'card', '4444', TRUE, 89, 0.9267, NOW() - INTERVAL '2 days' + INTERVAL '3 hours', '23.45.67.89', 'desktop'),
|
| 125 |
-
('txn_0094', 'user_007', 'merchant_009', 2299.00, 'USD', 'failed', 'card', '3333', TRUE, 93, 0.9512, NOW() - INTERVAL '1 day' + INTERVAL '3 hours', '34.56.78.90', 'desktop');
|
| 126 |
-
|
| 127 |
-
-- Pattern 5: Carte différente soudainement
|
| 128 |
-
INSERT INTO transactions (transaction_id, user_id, merchant_id, amount, currency, status, payment_method, card_last4, is_fraud, fraud_score, ml_fraud_probability, created_at, ip_address, device_type) VALUES
|
| 129 |
-
('txn_0095', 'user_008', 'merchant_001', 3499.00, 'AUD', 'failed', 'card', '2222', TRUE, 94, 0.9589, NOW() - INTERVAL '12 hours', '12.34.56.78', 'desktop'),
|
| 130 |
-
('txn_0096', 'user_009', 'merchant_005', 1999.99, 'EUR', 'failed', 'card', '1111', TRUE, 90, 0.9312, NOW() - INTERVAL '8 hours', '56.78.90.12', 'mobile');
|
| 131 |
-
|
| 132 |
-
-- Pattern 6: Multiple tentatives échouées
|
| 133 |
-
INSERT INTO transactions (transaction_id, user_id, merchant_id, amount, currency, status, payment_method, card_last4, is_fraud, fraud_score, ml_fraud_probability, created_at, ip_address, device_type) VALUES
|
| 134 |
-
('txn_0097', 'user_010', 'merchant_007', 999.00, 'CAD', 'failed', 'card', '0000', TRUE, 85, 0.8923, NOW() - INTERVAL '2 hours', '78.90.12.34', 'desktop'),
|
| 135 |
-
('txn_0098', 'user_010', 'merchant_007', 999.00, 'CAD', 'failed', 'card', '0000', TRUE, 88, 0.9156, NOW() - INTERVAL '1 hour 50 minutes', '78.90.12.34', 'desktop'),
|
| 136 |
-
('txn_0099', 'user_010', 'merchant_007', 999.00, 'CAD', 'failed', 'card', '0000', TRUE, 91, 0.9401, NOW() - INTERVAL '1 hour 40 minutes', '78.90.12.34', 'desktop'),
|
| 137 |
-
('txn_0100', 'user_001', 'merchant_009', 5499.00, 'EUR', 'failed', 'card', '9999', TRUE, 97, 0.9734, NOW() - INTERVAL '30 minutes', '45.123.67.89', 'mobile');
|
| 138 |
-
|
| 139 |
-
-- ============================================
|
| 140 |
-
-- INSERT: Fraud Events pour transactions frauduleuses
|
| 141 |
-
-- ============================================
|
| 142 |
-
INSERT INTO fraud_events (transaction_id, rule_triggered, severity, score_contribution, details) VALUES
|
| 143 |
-
('txn_0086', 'amount_threshold_exceeded', 'critical', 40, '{"threshold": 500, "actual": 2499.99, "ratio": 5.0}'),
|
| 144 |
-
('txn_0086', 'unusual_amount_for_user', 'high', 30, '{"user_avg": 89.50, "actual": 2499.99, "deviation": 27.9}'),
|
| 145 |
-
('txn_0086', 'first_time_merchant_category', 'medium', 25, '{"category": "gaming", "user_history": []}'),
|
| 146 |
-
|
| 147 |
-
('txn_0087', 'amount_threshold_exceeded', 'critical', 45, '{"threshold": 500, "actual": 4999.00, "ratio": 10.0}'),
|
| 148 |
-
('txn_0087', 'unusual_amount_for_user', 'critical', 35, '{"user_avg": 45.20, "actual": 4999.00, "deviation": 110.6}'),
|
| 149 |
-
('txn_0087', 'suspicious_ip_address', 'high', 18, '{"ip": "103.45.78.90", "country_mismatch": true}'),
|
| 150 |
-
|
| 151 |
-
('txn_0088', 'velocity_check_failed', 'critical', 35, '{"transactions_last_hour": 3, "threshold": 2}'),
|
| 152 |
-
('txn_0088', 'rapid_succession_purchases', 'high', 30, '{"time_between_tx": "15 minutes"}'),
|
| 153 |
-
('txn_0088', 'different_ip_same_user', 'medium', 23, '{"previous_ip": "74.125.45.123", "current_ip": "67.234.12.34"}'),
|
| 154 |
-
|
| 155 |
-
('txn_0091', 'tor_exit_node_detected', 'critical', 50, '{"ip": "185.220.102.8", "exit_node": true}'),
|
| 156 |
-
('txn_0091', 'country_mismatch', 'high', 25, '{"user_country": "GB", "ip_country": "Unknown"}'),
|
| 157 |
-
('txn_0091', 'high_risk_ip_range', 'high', 16, '{"risk_score": 95}'),
|
| 158 |
-
|
| 159 |
-
('txn_0093', 'unusual_hour', 'high', 25, '{"hour": 3, "normal_hours": "9-22"}'),
|
| 160 |
-
('txn_0093', 'amount_threshold_exceeded', 'high', 35, '{"threshold": 500, "actual": 1599.00}'),
|
| 161 |
-
('txn_0093', 'weekend_large_purchase', 'medium', 29, '{"day": "Saturday", "amount": 1599.00}'),
|
| 162 |
-
|
| 163 |
-
('txn_0095', 'card_never_used_before', 'critical', 40, '{"card_last4": "2222", "first_use": true}'),
|
| 164 |
-
('txn_0095', 'amount_threshold_exceeded', 'critical', 38, '{"threshold": 500, "actual": 3499.00}'),
|
| 165 |
-
('txn_0095', 'unusual_device_type', 'medium', 16, '{"usual": "mobile", "current": "desktop"}'),
|
| 166 |
-
|
| 167 |
-
('txn_0097', 'multiple_failed_attempts', 'critical', 45, '{"failed_count": 3, "time_window": "20 minutes"}'),
|
| 168 |
-
('txn_0098', 'multiple_failed_attempts', 'critical', 48, '{"failed_count": 2, "previous_failure": "10 minutes ago"}'),
|
| 169 |
-
('txn_0099', 'multiple_failed_attempts', 'critical', 51, '{"failed_count": 1, "previous_failure": "10 minutes ago"}');
|
| 170 |
-
|
| 171 |
-
-- ============================================
|
| 172 |
-
-- INSERT: Quelques refunds
|
| 173 |
-
-- ============================================
|
| 174 |
-
INSERT INTO refunds (refund_id, transaction_id, amount, reason, status, processed_at) VALUES
|
| 175 |
-
('ref_0001', 'txn_0012', 1299.00, 'Customer request - product not as described', 'succeeded', NOW() - INTERVAL '2 days'),
|
| 176 |
-
('ref_0002', 'txn_0023', 625.00, 'Partial refund - damaged item', 'succeeded', NOW() - INTERVAL '1 day'),
|
| 177 |
-
('ref_0003', 'txn_0032', 234.90, 'Duplicate charge', 'succeeded', NOW() - INTERVAL '12 hours');
|
| 178 |
-
|
| 179 |
-
-- ============================================
|
| 180 |
-
-- STATS: Afficher résumé
|
| 181 |
-
-- ============================================
|
| 182 |
-
SELECT 'PostgreSQL seed data loaded successfully!' as message;
|
| 183 |
-
SELECT
|
| 184 |
-
'Users: ' || COUNT(*) as stat FROM users
|
| 185 |
-
UNION ALL
|
| 186 |
-
SELECT
|
| 187 |
-
'Merchants: ' || COUNT(*) FROM merchants
|
| 188 |
-
UNION ALL
|
| 189 |
-
SELECT
|
| 190 |
-
'Transactions: ' || COUNT(*) FROM transactions
|
| 191 |
-
UNION ALL
|
| 192 |
-
SELECT
|
| 193 |
-
'Fraud Events: ' || COUNT(*) FROM fraud_events
|
| 194 |
-
UNION ALL
|
| 195 |
-
SELECT
|
| 196 |
-
'Refunds: ' || COUNT(*) FROM refunds;
|
| 197 |
-
|
| 198 |
-
SELECT
|
| 199 |
-
'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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/start.sh
DELETED
|
@@ -1,133 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
# =============================================================================
|
| 3 |
-
# QUICK START SCRIPT FOR STRIPE DATA ARCHITECTURE
|
| 4 |
-
# =============================================================================
|
| 5 |
-
# This script loads credentials and starts all Docker services
|
| 6 |
-
# Usage: ./start.sh
|
| 7 |
-
# =============================================================================
|
| 8 |
-
|
| 9 |
-
set -e # Exit on error
|
| 10 |
-
|
| 11 |
-
echo "============================================"
|
| 12 |
-
echo " Stripe Data Architecture - Quick Start"
|
| 13 |
-
echo "============================================"
|
| 14 |
-
echo ""
|
| 15 |
-
|
| 16 |
-
# Check if secret.sh exists
|
| 17 |
-
if [ ! -f "secret.sh" ]; then
|
| 18 |
-
echo "❌ ERROR: secret.sh file not found!"
|
| 19 |
-
echo " Please create the secret.sh file with your credentials."
|
| 20 |
-
exit 1
|
| 21 |
-
fi
|
| 22 |
-
|
| 23 |
-
# Load environment variables
|
| 24 |
-
echo "📋 Loading credentials from secret.sh..."
|
| 25 |
-
source secret.sh
|
| 26 |
-
|
| 27 |
-
# Verify critical variables are set
|
| 28 |
-
if [ -z "$POSTGRES_USER" ] || [ -z "$POSTGRES_PASSWORD" ]; then
|
| 29 |
-
echo "❌ ERROR: Required environment variables are not set!"
|
| 30 |
-
echo " Please check your secret.sh file."
|
| 31 |
-
exit 1
|
| 32 |
-
fi
|
| 33 |
-
|
| 34 |
-
echo "✓ Credentials loaded successfully"
|
| 35 |
-
echo ""
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
# Check if Docker is running
|
| 39 |
-
if ! docker info > /dev/null 2>&1; then
|
| 40 |
-
echo "⚠️ Docker is not running. Attempting to start Docker daemon..."
|
| 41 |
-
|
| 42 |
-
if command -v systemctl &> /dev/null; then
|
| 43 |
-
echo "try with Systemctl"
|
| 44 |
-
sudo systemctl daemon-reload
|
| 45 |
-
sudo systemctl restart docker
|
| 46 |
-
elif command -v service &> /dev/null; then
|
| 47 |
-
echo "try with Service"
|
| 48 |
-
sudo service docker start
|
| 49 |
-
else
|
| 50 |
-
echo "❌ ERROR: Could not start Docker daemon!"
|
| 51 |
-
echo " Please start Docker manually and try again."
|
| 52 |
-
exit 1
|
| 53 |
-
fi
|
| 54 |
-
|
| 55 |
-
echo "✓ Docker daemon started"
|
| 56 |
-
else
|
| 57 |
-
echo "✓ Docker is running"
|
| 58 |
-
fi
|
| 59 |
-
|
| 60 |
-
# Check if Docker is running
|
| 61 |
-
if ! docker info > /dev/null 2>&1; then
|
| 62 |
-
echo "❌ ERROR: Docker is not running!"
|
| 63 |
-
echo " Please start Docker and try again."
|
| 64 |
-
|
| 65 |
-
exit 1
|
| 66 |
-
fi
|
| 67 |
-
|
| 68 |
-
echo "✓ Docker is running"
|
| 69 |
-
echo ""
|
| 70 |
-
|
| 71 |
-
# Start Docker services
|
| 72 |
-
echo "🚀 Starting Docker services..."
|
| 73 |
-
docker-compose up -d
|
| 74 |
-
|
| 75 |
-
echo ""
|
| 76 |
-
echo "⏳ Waiting for core services to be ready (30 seconds)..."
|
| 77 |
-
sleep 30
|
| 78 |
-
|
| 79 |
-
echo ""
|
| 80 |
-
echo "🔧 Initializing MinIO buckets..."
|
| 81 |
-
docker exec stripe-minio mc alias set stripe-minio http://minio:9000 stripe_user stripe_password 2>/dev/null
|
| 82 |
-
docker exec stripe-minio mc mb --ignore-existing stripe-minio/mlflow 2>/dev/null
|
| 83 |
-
docker exec stripe-minio mc mb --ignore-existing stripe-minio/datalake 2>/dev/null
|
| 84 |
-
docker exec stripe-minio mc mb --ignore-existing stripe-minio/backups 2>/dev/null
|
| 85 |
-
docker exec stripe-minio mc mb --ignore-existing stripe-minio/logs 2>/dev/null
|
| 86 |
-
docker exec stripe-minio mc anonymous set download stripe-minio/mlflow 2>/dev/null
|
| 87 |
-
echo "✓ MinIO buckets created"
|
| 88 |
-
|
| 89 |
-
echo ""
|
| 90 |
-
echo "📊 Checking service status..."
|
| 91 |
-
docker-compose ps
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
echo ""
|
| 98 |
-
echo "============================================"
|
| 99 |
-
echo " ✅ All Services Started Successfully!"
|
| 100 |
-
echo "============================================"
|
| 101 |
-
echo ""
|
| 102 |
-
echo "📝 Note: Some services may take 2-5 minutes to become fully healthy"
|
| 103 |
-
echo " (Elasticsearch, Airflow, MLflow, Neo4j)"
|
| 104 |
-
echo ""
|
| 105 |
-
echo "Access your services at:"
|
| 106 |
-
echo " • FastAPI: http://localhost:8000"
|
| 107 |
-
echo " • Flask: http://localhost:5050"
|
| 108 |
-
echo " • Airflow: http://localhost:8080 (user: admin, pass: stripe_password)"
|
| 109 |
-
echo " • Grafana: http://localhost:3000 (user: admin, pass: stripe_password)"
|
| 110 |
-
echo " • MinIO Console: http://localhost:9001 (user: stripe_user, pass: stripe_password)"
|
| 111 |
-
echo " • Neo4j Browser: http://localhost:7474 (user: neo4j, pass: stripe_password)"
|
| 112 |
-
echo " • Kibana: http://localhost:5601"
|
| 113 |
-
echo ""
|
| 114 |
-
echo "Database ports:"
|
| 115 |
-
echo " • PostgreSQL: localhost:5432"
|
| 116 |
-
echo " • MongoDB: localhost:27017"
|
| 117 |
-
echo " • Redis: localhost:6379"
|
| 118 |
-
echo " • ClickHouse: localhost:8123 (HTTP), localhost:9000 (Native)"
|
| 119 |
-
echo " • Elasticsearch: localhost:9200"
|
| 120 |
-
echo " • Neo4j: localhost:7687 (Bolt)"
|
| 121 |
-
echo " • MinIO API: localhost:9002"
|
| 122 |
-
echo ""
|
| 123 |
-
echo "Useful commands:"
|
| 124 |
-
echo " • Check status: docker-compose ps"
|
| 125 |
-
echo " • View logs: docker-compose logs -f [service-name]"
|
| 126 |
-
echo " • Stop services: docker-compose down"
|
| 127 |
-
echo " • Restart service: docker-compose restart [service-name]"
|
| 128 |
-
echo ""
|
| 129 |
-
echo "Documentation:"
|
| 130 |
-
echo " • System status: cat CURRENT_STATUS.md"
|
| 131 |
-
echo " • Credentials: cat CREDENTIALS_REFERENCE.md"
|
| 132 |
-
echo " • Expose to internet: cat EXPOSE_TO_INTERNET.md"
|
| 133 |
-
echo ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Architecture/train-and-deploy-model.sh
DELETED
|
@@ -1,84 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
# =============================================================================
|
| 3 |
-
# Train and Deploy Fraud Detection Model
|
| 4 |
-
# =============================================================================
|
| 5 |
-
# This script trains the ML model and makes it available to FastAPI
|
| 6 |
-
# =============================================================================
|
| 7 |
-
|
| 8 |
-
echo "============================================"
|
| 9 |
-
echo " Training Fraud Detection Model"
|
| 10 |
-
echo "============================================"
|
| 11 |
-
echo ""
|
| 12 |
-
|
| 13 |
-
# Step 1: Train the model using the training script
|
| 14 |
-
echo "[1/4] Training model in MLflow container..."
|
| 15 |
-
docker exec stripe-mlflow python -c "
|
| 16 |
-
import numpy as np
|
| 17 |
-
from sklearn.linear_model import LogisticRegression
|
| 18 |
-
import joblib
|
| 19 |
-
import os
|
| 20 |
-
|
| 21 |
-
np.random.seed(42)
|
| 22 |
-
n_samples = 1000
|
| 23 |
-
|
| 24 |
-
# Features: 10 engineered features
|
| 25 |
-
X = np.random.randn(n_samples, 10)
|
| 26 |
-
y = np.random.binomial(1, 0.15, n_samples)
|
| 27 |
-
|
| 28 |
-
from sklearn.model_selection import train_test_split
|
| 29 |
-
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
|
| 30 |
-
|
| 31 |
-
model = LogisticRegression(max_iter=1000, random_state=42)
|
| 32 |
-
model.fit(X_train, y_train)
|
| 33 |
-
|
| 34 |
-
os.makedirs('/mlflow/model', exist_ok=True)
|
| 35 |
-
joblib.dump(model, '/mlflow/model/logistic_regression_fraud.pkl')
|
| 36 |
-
|
| 37 |
-
print(f'Model trained! Accuracy: {model.score(X_test, y_test):.2%}')
|
| 38 |
-
"
|
| 39 |
-
|
| 40 |
-
if [ $? -eq 0 ]; then
|
| 41 |
-
echo " ✓ Model trained successfully"
|
| 42 |
-
else
|
| 43 |
-
echo " ✗ Failed to train model"
|
| 44 |
-
exit 1
|
| 45 |
-
fi
|
| 46 |
-
|
| 47 |
-
echo ""
|
| 48 |
-
echo "[2/4] Verifying model file..."
|
| 49 |
-
docker exec stripe-mlflow ls -lh /mlflow/model/logistic_regression_fraud.pkl
|
| 50 |
-
|
| 51 |
-
echo ""
|
| 52 |
-
echo "[3/4] Uploading model to MinIO for FastAPI access..."
|
| 53 |
-
docker exec stripe-minio mc cp /mlflow/model/logistic_regression_fraud.pkl stripe-minio/mlflow/logistic_regression_fraud.pkl 2>/dev/null || (
|
| 54 |
-
echo " Using docker cp method..."
|
| 55 |
-
docker cp mlflow/model/logistic_regression_fraud.pkl stripe-minio:/tmp/model.pkl
|
| 56 |
-
docker exec stripe-minio mc cp /tmp/model.pkl stripe-minio/mlflow/logistic_regression_fraud.pkl
|
| 57 |
-
)
|
| 58 |
-
|
| 59 |
-
echo " ✓ Model uploaded to MinIO"
|
| 60 |
-
|
| 61 |
-
echo ""
|
| 62 |
-
echo "[4/4] Restarting FastAPI to load new model..."
|
| 63 |
-
docker-compose restart fastapi
|
| 64 |
-
|
| 65 |
-
echo ""
|
| 66 |
-
echo "============================================"
|
| 67 |
-
echo " Model Training Complete!"
|
| 68 |
-
echo "============================================"
|
| 69 |
-
echo ""
|
| 70 |
-
echo "Model Location:"
|
| 71 |
-
echo " • MLflow: /mlflow/model/logistic_regression_fraud.pkl"
|
| 72 |
-
echo " • MinIO: s3://mlflow/logistic_regression_fraud.pkl"
|
| 73 |
-
echo " • FastAPI: /mlflow/model/logistic_regression_fraud.pkl"
|
| 74 |
-
echo ""
|
| 75 |
-
echo "Model Details:"
|
| 76 |
-
echo " • Algorithm: Logistic Regression"
|
| 77 |
-
echo " • Features: 10 engineered features"
|
| 78 |
-
echo " • Fraud Threshold: 70%"
|
| 79 |
-
echo ""
|
| 80 |
-
echo "Test the model:"
|
| 81 |
-
echo ' curl -X POST http://localhost:8000/api/transactions \'
|
| 82 |
-
echo ' -H "Content-Type: application/json" \'
|
| 83 |
-
echo ' -d "{\"amount\": 1500, \"user_id\": \"user_001\", \"merchant_id\": \"merchant_001\"}"'
|
| 84 |
-
echo ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Diagramme d'architecture/[Jedha] - {Bloc 2} - Strip data architecture.pdf
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:2896927700a7599aaf824df90b98b6ef311f0fb0e2676902066b3787fe51657d
|
| 3 |
-
size 1897494
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/Projet/Modèles de données/[Jedha] - {Certification} - Bloc 2 OLAP - Stripe.sqs
DELETED
|
@@ -1,540 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
-
<SQLContainer>
|
| 3 |
-
<SQLTable>
|
| 4 |
-
<name><![CDATA[fact_transactions]]></name>
|
| 5 |
-
<schema><![CDATA[]]></schema>
|
| 6 |
-
<location>
|
| 7 |
-
<x>914.00</x>
|
| 8 |
-
<y>577.00</y>
|
| 9 |
-
</location>
|
| 10 |
-
<size>
|
| 11 |
-
<width>310.00</width>
|
| 12 |
-
<height>280.00</height>
|
| 13 |
-
</size>
|
| 14 |
-
<zorder>1</zorder>
|
| 15 |
-
<SQLField>
|
| 16 |
-
<name><![CDATA[transaction_id]]></name>
|
| 17 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 18 |
-
<primaryKey>1</primaryKey>
|
| 19 |
-
<uid><![CDATA[BCCF31F5-C214-4C5B-AF44-8FDA4CA0AE70]]></uid>
|
| 20 |
-
</SQLField>
|
| 21 |
-
<SQLField>
|
| 22 |
-
<name><![CDATA[user_id]]></name>
|
| 23 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 24 |
-
<referencesField>user_id</referencesField>
|
| 25 |
-
<referencesTable>dim_users</referencesTable>
|
| 26 |
-
<deleteAction>140379573171296</deleteAction>
|
| 27 |
-
<updateAction>12983400752</updateAction>
|
| 28 |
-
<referencesField><![CDATA[user_id]]></referencesField>
|
| 29 |
-
<referencesTable><![CDATA[dim_users]]></referencesTable>
|
| 30 |
-
<sourceCardinality>0</sourceCardinality>
|
| 31 |
-
<destinationCardinality>0</destinationCardinality>
|
| 32 |
-
<referencesFieldUID><![CDATA[97D50BFE-CDD1-45F6-BC85-2412805B2C90]]></referencesFieldUID>
|
| 33 |
-
<referencesTableUID><![CDATA[38BF800F-C8AD-49E4-A3B3-364601A57587]]></referencesTableUID>
|
| 34 |
-
<connectorMidPoint><![CDATA[840.000000]]></connectorMidPoint>
|
| 35 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 36 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 37 |
-
<notNull><![CDATA[1]]></notNull>
|
| 38 |
-
<uid><![CDATA[B492518C-10E7-44B2-9C95-272F78C9E7AB]]></uid>
|
| 39 |
-
</SQLField>
|
| 40 |
-
<SQLField>
|
| 41 |
-
<name><![CDATA[account_id]]></name>
|
| 42 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 43 |
-
<referencesField>account_id</referencesField>
|
| 44 |
-
<referencesTable>dim_accounts</referencesTable>
|
| 45 |
-
<deleteAction>140379573171296</deleteAction>
|
| 46 |
-
<updateAction>12983400752</updateAction>
|
| 47 |
-
<referencesField><![CDATA[account_id]]></referencesField>
|
| 48 |
-
<referencesTable><![CDATA[dim_accounts]]></referencesTable>
|
| 49 |
-
<sourceCardinality>0</sourceCardinality>
|
| 50 |
-
<destinationCardinality>0</destinationCardinality>
|
| 51 |
-
<referencesFieldUID><![CDATA[41B844E3-CF40-4E92-AF5B-095DABC65FFD]]></referencesFieldUID>
|
| 52 |
-
<referencesTableUID><![CDATA[41816FD3-9526-46C4-8BED-EABF353ABDD9]]></referencesTableUID>
|
| 53 |
-
<connectorMidPoint><![CDATA[835.000000]]></connectorMidPoint>
|
| 54 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 55 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 56 |
-
<notNull><![CDATA[1]]></notNull>
|
| 57 |
-
<uid><![CDATA[23D7FCF4-D8A1-45D1-B50F-9A5643A6933B]]></uid>
|
| 58 |
-
</SQLField>
|
| 59 |
-
<SQLField>
|
| 60 |
-
<name><![CDATA[date_id]]></name>
|
| 61 |
-
<type><![CDATA[INT]]></type>
|
| 62 |
-
<referencesField>date_id</referencesField>
|
| 63 |
-
<referencesTable>dim_dates</referencesTable>
|
| 64 |
-
<deleteAction>140379573171296</deleteAction>
|
| 65 |
-
<updateAction>12983400752</updateAction>
|
| 66 |
-
<referencesField><![CDATA[date_id]]></referencesField>
|
| 67 |
-
<referencesTable><![CDATA[dim_dates]]></referencesTable>
|
| 68 |
-
<sourceCardinality>0</sourceCardinality>
|
| 69 |
-
<destinationCardinality>0</destinationCardinality>
|
| 70 |
-
<referencesFieldUID><![CDATA[BACEF4F9-F42F-4078-BBAC-26A85AE757CD]]></referencesFieldUID>
|
| 71 |
-
<referencesTableUID><![CDATA[84164D0A-BC3B-4059-89B4-70F44C205705]]></referencesTableUID>
|
| 72 |
-
<connectorMidPoint><![CDATA[835.000000]]></connectorMidPoint>
|
| 73 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 74 |
-
<indexed><![CDATA[1]]></indexed>
|
| 75 |
-
<indexedKeyName><![CDATA[idx_fact_transactions_date]]></indexedKeyName>
|
| 76 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 77 |
-
<notNull><![CDATA[1]]></notNull>
|
| 78 |
-
<uid><![CDATA[176CCC66-1D34-4AEE-9919-8BF432AF2059]]></uid>
|
| 79 |
-
</SQLField>
|
| 80 |
-
<SQLField>
|
| 81 |
-
<name><![CDATA[amount]]></name>
|
| 82 |
-
<type><![CDATA[DECIMAL(15 , 2)]]></type>
|
| 83 |
-
<notNull><![CDATA[1]]></notNull>
|
| 84 |
-
<uid><![CDATA[E930513F-3C6F-49A5-9CF3-5BA6BF86F72C]]></uid>
|
| 85 |
-
</SQLField>
|
| 86 |
-
<SQLField>
|
| 87 |
-
<name><![CDATA[merchant_id]]></name>
|
| 88 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 89 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 90 |
-
<indexed><![CDATA[1]]></indexed>
|
| 91 |
-
<indexedKeyName><![CDATA[idx_fact_transactions_merchant]]></indexedKeyName>
|
| 92 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 93 |
-
<notNull><![CDATA[1]]></notNull>
|
| 94 |
-
<uid><![CDATA[2EB549BF-BB01-4686-96FF-22C7BCBEA550]]></uid>
|
| 95 |
-
</SQLField>
|
| 96 |
-
<SQLField>
|
| 97 |
-
<name><![CDATA[fee_amount]]></name>
|
| 98 |
-
<type><![CDATA[DECIMAL(15 , 2)]]></type>
|
| 99 |
-
<defaultValue><![CDATA[0]]></defaultValue>
|
| 100 |
-
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
|
| 101 |
-
<uid><![CDATA[42892D4A-C5A7-4CFA-B061-4431F43763EE]]></uid>
|
| 102 |
-
</SQLField>
|
| 103 |
-
<SQLField>
|
| 104 |
-
<name><![CDATA[refund_amount]]></name>
|
| 105 |
-
<type><![CDATA[DECIMAL(15 , 2)]]></type>
|
| 106 |
-
<defaultValue><![CDATA[0]]></defaultValue>
|
| 107 |
-
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
|
| 108 |
-
<uid><![CDATA[30399A3A-9004-4779-943D-771FEFE0C2F9]]></uid>
|
| 109 |
-
</SQLField>
|
| 110 |
-
<SQLField>
|
| 111 |
-
<name><![CDATA[currency]]></name>
|
| 112 |
-
<type><![CDATA[VARCHAR(3)]]></type>
|
| 113 |
-
<notNull><![CDATA[1]]></notNull>
|
| 114 |
-
<uid><![CDATA[03856FAD-C637-41AF-B0B3-DC241D51AC78]]></uid>
|
| 115 |
-
</SQLField>
|
| 116 |
-
<SQLField>
|
| 117 |
-
<name><![CDATA[status]]></name>
|
| 118 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 119 |
-
<notNull><![CDATA[1]]></notNull>
|
| 120 |
-
<uid><![CDATA[C3E85AC8-9F3C-434C-8F35-1C62FC883F63]]></uid>
|
| 121 |
-
</SQLField>
|
| 122 |
-
<SQLField>
|
| 123 |
-
<name><![CDATA[payment_method_type]]></name>
|
| 124 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 125 |
-
<uid><![CDATA[9BAD16CC-EE56-4205-92A9-B573CF10F497]]></uid>
|
| 126 |
-
</SQLField>
|
| 127 |
-
<SQLField>
|
| 128 |
-
<name><![CDATA[fraud_score]]></name>
|
| 129 |
-
<type><![CDATA[INT]]></type>
|
| 130 |
-
<defaultValue><![CDATA[0]]></defaultValue>
|
| 131 |
-
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
|
| 132 |
-
<uid><![CDATA[39EDF788-DCCB-434E-8D19-5A9E949A7C15]]></uid>
|
| 133 |
-
</SQLField>
|
| 134 |
-
<SQLField>
|
| 135 |
-
<name><![CDATA[is_fraudulent]]></name>
|
| 136 |
-
<type><![CDATA[BOOLEAN]]></type>
|
| 137 |
-
<uid><![CDATA[37715689-2E32-4CBB-AE83-A23770535FA2]]></uid>
|
| 138 |
-
</SQLField>
|
| 139 |
-
<labelColor><![CDATA[{0.74902,0.184314,0.270588,1}]]></labelColor>
|
| 140 |
-
<labelWindowIndex><![CDATA[2]]></labelWindowIndex>
|
| 141 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 142 |
-
<uid><![CDATA[195F56F5-CC5E-4EA4-A3A4-0279E784D692]]></uid>
|
| 143 |
-
</SQLTable>
|
| 144 |
-
<SQLTable>
|
| 145 |
-
<name><![CDATA[dim_payment_methods]]></name>
|
| 146 |
-
<schema><![CDATA[]]></schema>
|
| 147 |
-
<location>
|
| 148 |
-
<x>473.00</x>
|
| 149 |
-
<y>676.00</y>
|
| 150 |
-
</location>
|
| 151 |
-
<size>
|
| 152 |
-
<width>284.00</width>
|
| 153 |
-
<height>100.00</height>
|
| 154 |
-
</size>
|
| 155 |
-
<zorder>2</zorder>
|
| 156 |
-
<SQLField>
|
| 157 |
-
<name><![CDATA[payment_method_id]]></name>
|
| 158 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 159 |
-
<primaryKey>1</primaryKey>
|
| 160 |
-
<forcedUnique><![CDATA[0]]></forcedUnique>
|
| 161 |
-
<uid><![CDATA[FD04700A-BFA9-4099-AE1D-08A2EDB1C50A]]></uid>
|
| 162 |
-
</SQLField>
|
| 163 |
-
<SQLField>
|
| 164 |
-
<name><![CDATA[user_id]]></name>
|
| 165 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 166 |
-
<referencesField>user_id</referencesField>
|
| 167 |
-
<referencesTable>dim_users</referencesTable>
|
| 168 |
-
<deleteAction>140379573171296</deleteAction>
|
| 169 |
-
<updateAction>12983400752</updateAction>
|
| 170 |
-
<referencesField><![CDATA[user_id]]></referencesField>
|
| 171 |
-
<referencesTable><![CDATA[dim_users]]></referencesTable>
|
| 172 |
-
<sourceCardinality>0</sourceCardinality>
|
| 173 |
-
<destinationCardinality>0</destinationCardinality>
|
| 174 |
-
<referencesFieldUID><![CDATA[97D50BFE-CDD1-45F6-BC85-2412805B2C90]]></referencesFieldUID>
|
| 175 |
-
<referencesTableUID><![CDATA[38BF800F-C8AD-49E4-A3B3-364601A57587]]></referencesTableUID>
|
| 176 |
-
<connectorMidPoint><![CDATA[758.000000]]></connectorMidPoint>
|
| 177 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 178 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 179 |
-
<notNull><![CDATA[1]]></notNull>
|
| 180 |
-
<uid><![CDATA[16CA8411-B39B-420A-AF95-99D2C9B566E8]]></uid>
|
| 181 |
-
</SQLField>
|
| 182 |
-
<SQLField>
|
| 183 |
-
<name><![CDATA[type]]></name>
|
| 184 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 185 |
-
<notNull><![CDATA[1]]></notNull>
|
| 186 |
-
<uid><![CDATA[02E9DCF6-F846-4E5D-B561-B6345568A665]]></uid>
|
| 187 |
-
</SQLField>
|
| 188 |
-
<SQLField>
|
| 189 |
-
<name><![CDATA[card_brand]]></name>
|
| 190 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 191 |
-
<uid><![CDATA[7927C34B-D2D9-4636-AEAD-7B9EE390A1BB]]></uid>
|
| 192 |
-
</SQLField>
|
| 193 |
-
<labelColor><![CDATA[{0.832175,0.985466,0.47333,1}]]></labelColor>
|
| 194 |
-
<labelWindowIndex><![CDATA[3]]></labelWindowIndex>
|
| 195 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 196 |
-
<uid><![CDATA[2AF2B084-52D5-428B-AFC4-40C1ACAA3EBF]]></uid>
|
| 197 |
-
</SQLTable>
|
| 198 |
-
<SQLTable>
|
| 199 |
-
<name><![CDATA[agg_daily_transaction_volume]]></name>
|
| 200 |
-
<schema><![CDATA[]]></schema>
|
| 201 |
-
<location>
|
| 202 |
-
<x>913.00</x>
|
| 203 |
-
<y>883.00</y>
|
| 204 |
-
</location>
|
| 205 |
-
<size>
|
| 206 |
-
<width>311.00</width>
|
| 207 |
-
<height>140.00</height>
|
| 208 |
-
</size>
|
| 209 |
-
<zorder>0</zorder>
|
| 210 |
-
<SQLField>
|
| 211 |
-
<name><![CDATA[date_id]]></name>
|
| 212 |
-
<type><![CDATA[INT]]></type>
|
| 213 |
-
<primaryKey>1</primaryKey>
|
| 214 |
-
<referencesField>date_id</referencesField>
|
| 215 |
-
<referencesTable>dim_dates</referencesTable>
|
| 216 |
-
<deleteAction>140379573171296</deleteAction>
|
| 217 |
-
<updateAction>12983400752</updateAction>
|
| 218 |
-
<referencesField><![CDATA[date_id]]></referencesField>
|
| 219 |
-
<referencesTable><![CDATA[dim_dates]]></referencesTable>
|
| 220 |
-
<sourceCardinality>0</sourceCardinality>
|
| 221 |
-
<destinationCardinality>0</destinationCardinality>
|
| 222 |
-
<referencesFieldUID><![CDATA[BACEF4F9-F42F-4078-BBAC-26A85AE757CD]]></referencesFieldUID>
|
| 223 |
-
<referencesTableUID><![CDATA[84164D0A-BC3B-4059-89B4-70F44C205705]]></referencesTableUID>
|
| 224 |
-
<connectorMidPoint><![CDATA[470.000000]]></connectorMidPoint>
|
| 225 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 226 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 227 |
-
<notNull><![CDATA[1]]></notNull>
|
| 228 |
-
<uid><![CDATA[45D83D10-5C2C-4B4C-899D-5E56D41E216F]]></uid>
|
| 229 |
-
</SQLField>
|
| 230 |
-
<SQLField>
|
| 231 |
-
<name><![CDATA[merchant_id]]></name>
|
| 232 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 233 |
-
<primaryKey>1</primaryKey>
|
| 234 |
-
<referencesField>merchant_id</referencesField>
|
| 235 |
-
<referencesTable>dim_merchants</referencesTable>
|
| 236 |
-
<deleteAction>140379573171296</deleteAction>
|
| 237 |
-
<updateAction>12983400752</updateAction>
|
| 238 |
-
<referencesField><![CDATA[merchant_id]]></referencesField>
|
| 239 |
-
<referencesTable><![CDATA[dim_merchants]]></referencesTable>
|
| 240 |
-
<sourceCardinality>0</sourceCardinality>
|
| 241 |
-
<destinationCardinality>0</destinationCardinality>
|
| 242 |
-
<referencesFieldUID><![CDATA[767A7B94-975E-4A43-8AF4-714314E6A7A7]]></referencesFieldUID>
|
| 243 |
-
<referencesTableUID><![CDATA[DCA94F20-7D4C-4EEA-BE53-34A51F1FD0A0]]></referencesTableUID>
|
| 244 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 245 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 246 |
-
<notNull><![CDATA[1]]></notNull>
|
| 247 |
-
<uid><![CDATA[0E5FF79E-5CD3-4983-9CF7-FBE87C93B49C]]></uid>
|
| 248 |
-
</SQLField>
|
| 249 |
-
<SQLField>
|
| 250 |
-
<name><![CDATA[transaction_count]]></name>
|
| 251 |
-
<type><![CDATA[INT]]></type>
|
| 252 |
-
<notNull><![CDATA[1]]></notNull>
|
| 253 |
-
<uid><![CDATA[568E3D0D-3344-4D7B-B5E8-67CF1F906448]]></uid>
|
| 254 |
-
</SQLField>
|
| 255 |
-
<SQLField>
|
| 256 |
-
<name><![CDATA[total_amount]]></name>
|
| 257 |
-
<type><![CDATA[DECIMAL(15 , 2)]]></type>
|
| 258 |
-
<notNull><![CDATA[1]]></notNull>
|
| 259 |
-
<uid><![CDATA[6B644AD9-1D75-4AFC-A345-21699227797E]]></uid>
|
| 260 |
-
</SQLField>
|
| 261 |
-
<SQLField>
|
| 262 |
-
<name><![CDATA[avg_amount]]></name>
|
| 263 |
-
<type><![CDATA[DECIMAL(15 , 2)]]></type>
|
| 264 |
-
<notNull><![CDATA[1]]></notNull>
|
| 265 |
-
<uid><![CDATA[8652DC74-582C-4760-ADB6-9927E5502B9C]]></uid>
|
| 266 |
-
</SQLField>
|
| 267 |
-
<SQLField>
|
| 268 |
-
<name><![CDATA[fraud_count]]></name>
|
| 269 |
-
<type><![CDATA[INTEGER]]></type>
|
| 270 |
-
<uid><![CDATA[E11C6C79-F508-4658-B6E9-C3A417272EE5]]></uid>
|
| 271 |
-
</SQLField>
|
| 272 |
-
<labelWindowIndex><![CDATA[1]]></labelWindowIndex>
|
| 273 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 274 |
-
<uid><![CDATA[353813A5-2C6C-475A-95C8-7B4975BDC532]]></uid>
|
| 275 |
-
</SQLTable>
|
| 276 |
-
<SQLTable>
|
| 277 |
-
<name><![CDATA[dim_users]]></name>
|
| 278 |
-
<schema><![CDATA[]]></schema>
|
| 279 |
-
<location>
|
| 280 |
-
<x>551.00</x>
|
| 281 |
-
<y>525.00</y>
|
| 282 |
-
</location>
|
| 283 |
-
<size>
|
| 284 |
-
<width>203.00</width>
|
| 285 |
-
<height>120.00</height>
|
| 286 |
-
</size>
|
| 287 |
-
<zorder>6</zorder>
|
| 288 |
-
<SQLField>
|
| 289 |
-
<name><![CDATA[user_id]]></name>
|
| 290 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 291 |
-
<primaryKey>1</primaryKey>
|
| 292 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 293 |
-
<uid><![CDATA[97D50BFE-CDD1-45F6-BC85-2412805B2C90]]></uid>
|
| 294 |
-
</SQLField>
|
| 295 |
-
<SQLField>
|
| 296 |
-
<name><![CDATA[email]]></name>
|
| 297 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 298 |
-
<notNull><![CDATA[1]]></notNull>
|
| 299 |
-
<uid><![CDATA[6DC6A3B5-62B0-4D37-AF5C-1BD17F6F1FFF]]></uid>
|
| 300 |
-
</SQLField>
|
| 301 |
-
<SQLField>
|
| 302 |
-
<name><![CDATA[country]]></name>
|
| 303 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 304 |
-
<uid><![CDATA[D38FA2CB-9FF9-4E1D-84A6-9BF4BDCE7D7B]]></uid>
|
| 305 |
-
</SQLField>
|
| 306 |
-
<SQLField>
|
| 307 |
-
<name><![CDATA[kyc_status]]></name>
|
| 308 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 309 |
-
<notNull><![CDATA[1]]></notNull>
|
| 310 |
-
<uid><![CDATA[FBC4CD90-8F39-49FF-B4FC-1DD4C833C712]]></uid>
|
| 311 |
-
</SQLField>
|
| 312 |
-
<SQLField>
|
| 313 |
-
<name><![CDATA[created_at]]></name>
|
| 314 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 315 |
-
<notNull><![CDATA[1]]></notNull>
|
| 316 |
-
<uid><![CDATA[38D461A1-E80B-40F0-99A5-05C7E5D623D3]]></uid>
|
| 317 |
-
</SQLField>
|
| 318 |
-
<labelColor><![CDATA[{0.832175,0.985466,0.47333,1}]]></labelColor>
|
| 319 |
-
<labelWindowIndex><![CDATA[7]]></labelWindowIndex>
|
| 320 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 321 |
-
<uid><![CDATA[38BF800F-C8AD-49E4-A3B3-364601A57587]]></uid>
|
| 322 |
-
</SQLTable>
|
| 323 |
-
<SQLTable>
|
| 324 |
-
<name><![CDATA[dim_accounts]]></name>
|
| 325 |
-
<schema><![CDATA[]]></schema>
|
| 326 |
-
<location>
|
| 327 |
-
<x>1340.00</x>
|
| 328 |
-
<y>617.00</y>
|
| 329 |
-
</location>
|
| 330 |
-
<size>
|
| 331 |
-
<width>306.00</width>
|
| 332 |
-
<height>100.00</height>
|
| 333 |
-
</size>
|
| 334 |
-
<zorder>5</zorder>
|
| 335 |
-
<SQLField>
|
| 336 |
-
<name><![CDATA[account_id]]></name>
|
| 337 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 338 |
-
<primaryKey>1</primaryKey>
|
| 339 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 340 |
-
<uid><![CDATA[41B844E3-CF40-4E92-AF5B-095DABC65FFD]]></uid>
|
| 341 |
-
</SQLField>
|
| 342 |
-
<SQLField>
|
| 343 |
-
<name><![CDATA[user_id]]></name>
|
| 344 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 345 |
-
<referencesField>user_id</referencesField>
|
| 346 |
-
<referencesTable>dim_users</referencesTable>
|
| 347 |
-
<deleteAction>140703500851714</deleteAction>
|
| 348 |
-
<updateAction>12983400752</updateAction>
|
| 349 |
-
<referencesField><![CDATA[user_id]]></referencesField>
|
| 350 |
-
<referencesTable><![CDATA[dim_users]]></referencesTable>
|
| 351 |
-
<sourceCardinality>0</sourceCardinality>
|
| 352 |
-
<destinationCardinality>0</destinationCardinality>
|
| 353 |
-
<referencesFieldUID><![CDATA[97D50BFE-CDD1-45F6-BC85-2412805B2C90]]></referencesFieldUID>
|
| 354 |
-
<referencesTableUID><![CDATA[38BF800F-C8AD-49E4-A3B3-364601A57587]]></referencesTableUID>
|
| 355 |
-
<connectorMidPoint><![CDATA[1295.000000]]></connectorMidPoint>
|
| 356 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 357 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 358 |
-
<notNull><![CDATA[1]]></notNull>
|
| 359 |
-
<uid><![CDATA[DC5B1246-6CB7-48F5-B30A-7C1CDF3C1726]]></uid>
|
| 360 |
-
</SQLField>
|
| 361 |
-
<SQLField>
|
| 362 |
-
<name><![CDATA[account_type]]></name>
|
| 363 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 364 |
-
<notNull><![CDATA[1]]></notNull>
|
| 365 |
-
<uid><![CDATA[8BEFD317-C8A9-4796-8B0E-319AF67358EA]]></uid>
|
| 366 |
-
</SQLField>
|
| 367 |
-
<SQLField>
|
| 368 |
-
<name><![CDATA[status]]></name>
|
| 369 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 370 |
-
<notNull><![CDATA[1]]></notNull>
|
| 371 |
-
<uid><![CDATA[98047EAF-15DB-48B0-8A6E-F981A7546F4D]]></uid>
|
| 372 |
-
</SQLField>
|
| 373 |
-
<labelColor><![CDATA[{0.832175,0.985466,0.47333,1}]]></labelColor>
|
| 374 |
-
<labelWindowIndex><![CDATA[4]]></labelWindowIndex>
|
| 375 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 376 |
-
<uid><![CDATA[41816FD3-9526-46C4-8BED-EABF353ABDD9]]></uid>
|
| 377 |
-
</SQLTable>
|
| 378 |
-
<SQLTable>
|
| 379 |
-
<name><![CDATA[dim_dates]]></name>
|
| 380 |
-
<schema><![CDATA[]]></schema>
|
| 381 |
-
<location>
|
| 382 |
-
<x>519.00</x>
|
| 383 |
-
<y>817.00</y>
|
| 384 |
-
</location>
|
| 385 |
-
<size>
|
| 386 |
-
<width>239.00</width>
|
| 387 |
-
<height>160.00</height>
|
| 388 |
-
</size>
|
| 389 |
-
<zorder>3</zorder>
|
| 390 |
-
<SQLField>
|
| 391 |
-
<name><![CDATA[date_id]]></name>
|
| 392 |
-
<type><![CDATA[INT]]></type>
|
| 393 |
-
<primaryKey>1</primaryKey>
|
| 394 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 395 |
-
<uid><![CDATA[BACEF4F9-F42F-4078-BBAC-26A85AE757CD]]></uid>
|
| 396 |
-
</SQLField>
|
| 397 |
-
<SQLField>
|
| 398 |
-
<name><![CDATA[date]]></name>
|
| 399 |
-
<type><![CDATA[DATE]]></type>
|
| 400 |
-
<notNull><![CDATA[1]]></notNull>
|
| 401 |
-
<uid><![CDATA[0827CBC6-5E33-45DA-9057-EC1F5B1166B4]]></uid>
|
| 402 |
-
<unique><![CDATA[1]]></unique>
|
| 403 |
-
</SQLField>
|
| 404 |
-
<SQLField>
|
| 405 |
-
<name><![CDATA[day]]></name>
|
| 406 |
-
<type><![CDATA[INT]]></type>
|
| 407 |
-
<notNull><![CDATA[1]]></notNull>
|
| 408 |
-
<uid><![CDATA[7F53758B-F696-4F85-8A5B-1EE1B73228BF]]></uid>
|
| 409 |
-
</SQLField>
|
| 410 |
-
<SQLField>
|
| 411 |
-
<name><![CDATA[month]]></name>
|
| 412 |
-
<type><![CDATA[INT]]></type>
|
| 413 |
-
<notNull><![CDATA[1]]></notNull>
|
| 414 |
-
<uid><![CDATA[D4B937E9-9F8D-4195-A906-EE6A463F122C]]></uid>
|
| 415 |
-
</SQLField>
|
| 416 |
-
<SQLField>
|
| 417 |
-
<name><![CDATA[quarter]]></name>
|
| 418 |
-
<type><![CDATA[INT]]></type>
|
| 419 |
-
<notNull><![CDATA[1]]></notNull>
|
| 420 |
-
<uid><![CDATA[1C076FB2-F9FE-4631-8BFF-D6EB32170880]]></uid>
|
| 421 |
-
</SQLField>
|
| 422 |
-
<SQLField>
|
| 423 |
-
<name><![CDATA[year]]></name>
|
| 424 |
-
<type><![CDATA[INT]]></type>
|
| 425 |
-
<notNull><![CDATA[1]]></notNull>
|
| 426 |
-
<uid><![CDATA[A02F49DF-E1F0-4C3C-A98F-85C75720A387]]></uid>
|
| 427 |
-
</SQLField>
|
| 428 |
-
<SQLField>
|
| 429 |
-
<name><![CDATA[day_of_week]]></name>
|
| 430 |
-
<type><![CDATA[INT]]></type>
|
| 431 |
-
<notNull><![CDATA[1]]></notNull>
|
| 432 |
-
<uid><![CDATA[263F946D-8BD4-4606-AC0C-2C20933FB2C5]]></uid>
|
| 433 |
-
</SQLField>
|
| 434 |
-
<labelColor><![CDATA[{0.832175,0.985466,0.47333,1}]]></labelColor>
|
| 435 |
-
<labelWindowIndex><![CDATA[5]]></labelWindowIndex>
|
| 436 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 437 |
-
<uid><![CDATA[84164D0A-BC3B-4059-89B4-70F44C205705]]></uid>
|
| 438 |
-
</SQLTable>
|
| 439 |
-
<SQLComment>
|
| 440 |
-
<name><![CDATA[Comment2]]></name>
|
| 441 |
-
<comment><![CDATA[dim : Décrire les attributs qualitatifs des données (qui, quoi, où, quand)
|
| 442 |
-
fact : Stocker les métriques quantitatives (montants, comptes, quantités)
|
| 443 |
-
agg : Pré-calculer des aggrégats (sommes, moyennes, comptes) pour accélérer les requêtes fréquentes.]]></comment>
|
| 444 |
-
<location>
|
| 445 |
-
<x>619.00</x>
|
| 446 |
-
<y>1042.00</y>
|
| 447 |
-
</location>
|
| 448 |
-
<size>
|
| 449 |
-
<width>891.00</width>
|
| 450 |
-
<height>106.00</height>
|
| 451 |
-
</size>
|
| 452 |
-
<zorder>7</zorder>
|
| 453 |
-
<commentTitle><![CDATA[Légende]]></commentTitle>
|
| 454 |
-
<labelWindowIndex><![CDATA[0]]></labelWindowIndex>
|
| 455 |
-
<shouldDrawFrame><![CDATA[0]]></shouldDrawFrame>
|
| 456 |
-
<uid><![CDATA[D3E63DF1-AC93-4DBC-A949-5E7E61E5BAD8]]></uid>
|
| 457 |
-
</SQLComment>
|
| 458 |
-
<SQLTable>
|
| 459 |
-
<name><![CDATA[dim_merchants]]></name>
|
| 460 |
-
<schema><![CDATA[]]></schema>
|
| 461 |
-
<location>
|
| 462 |
-
<x>1336.00</x>
|
| 463 |
-
<y>832.00</y>
|
| 464 |
-
</location>
|
| 465 |
-
<size>
|
| 466 |
-
<width>237.00</width>
|
| 467 |
-
<height>120.00</height>
|
| 468 |
-
</size>
|
| 469 |
-
<zorder>4</zorder>
|
| 470 |
-
<SQLField>
|
| 471 |
-
<name><![CDATA[merchant_id]]></name>
|
| 472 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 473 |
-
<primaryKey>1</primaryKey>
|
| 474 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 475 |
-
<uid><![CDATA[767A7B94-975E-4A43-8AF4-714314E6A7A7]]></uid>
|
| 476 |
-
</SQLField>
|
| 477 |
-
<SQLField>
|
| 478 |
-
<name><![CDATA[name]]></name>
|
| 479 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 480 |
-
<notNull><![CDATA[1]]></notNull>
|
| 481 |
-
<uid><![CDATA[2624848A-0D33-460B-84F5-CF2C859194FD]]></uid>
|
| 482 |
-
</SQLField>
|
| 483 |
-
<SQLField>
|
| 484 |
-
<name><![CDATA[country]]></name>
|
| 485 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 486 |
-
<uid><![CDATA[5757BE80-6151-4304-8FE8-703F06CB57BB]]></uid>
|
| 487 |
-
</SQLField>
|
| 488 |
-
<SQLField>
|
| 489 |
-
<name><![CDATA[status]]></name>
|
| 490 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 491 |
-
<notNull><![CDATA[1]]></notNull>
|
| 492 |
-
<uid><![CDATA[8ADDA855-C5C9-4892-9D39-F51EE1337A17]]></uid>
|
| 493 |
-
</SQLField>
|
| 494 |
-
<SQLField>
|
| 495 |
-
<name><![CDATA[payout_schedule]]></name>
|
| 496 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 497 |
-
<uid><![CDATA[1737A321-3240-4EE2-9297-3D286078DE52]]></uid>
|
| 498 |
-
</SQLField>
|
| 499 |
-
<labelColor><![CDATA[{0.832175,0.985466,0.47333,1}]]></labelColor>
|
| 500 |
-
<labelWindowIndex><![CDATA[6]]></labelWindowIndex>
|
| 501 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 502 |
-
<uid><![CDATA[DCA94F20-7D4C-4EEA-BE53-34A51F1FD0A0]]></uid>
|
| 503 |
-
</SQLTable>
|
| 504 |
-
<SQLDocumentInfo>
|
| 505 |
-
<encodedPrintInfo><![CDATA[BAtzdHJlYW10eXBlZIHoA4QBQISEhAtOU1ByaW50SW5mbwGEhAhOU09iamVjd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YWx1ZQCUhAEqhIQLe0NHU2l6ZT1kZH2fgVMCgUoDhpKEmZkWTlNIb3Jpem9udGFsbHlDZW50ZXJlZIaShISECE5TTnVtYmVyAJ+ehIQBY6EBhpKEmZkUTlNWZXJ0aWNhbGx5Q2VudGVyZWSGkqKShJmZDE5TTGVmdE1hcmdpboaShKOehIQBZKIShpKEmZkNTlNSaWdodE1hcmdpboaSp5KEmZkLTlNUb3BNYXJnaW6GkoSjnqiiHoaShJmZDU5TT3JpZW50YXRpb26GkoSjnoSEAXGjAIaShJmZFU5TSG9yaXpvbmFsUGFnaW5hdGlvboaSrZKEmZkUTlNWZXJ0aWNhbFBhZ2luYXRpb26Gkq2ShJmZDk5TQm90dG9tTWFyZ2luhpKEo56oojWGkoSZmQtOU1BhcGVyTmFtZYaShJmZBmlzby1hNIaShJmZD05TU2NhbGluZ0ZhY3RvcoaShKOeqKIBhoaG]]></encodedPrintInfo>
|
| 506 |
-
<autoSizeTablesOption><![CDATA[0]]></autoSizeTablesOption>
|
| 507 |
-
<documentScaleFactor><![CDATA[1]]></documentScaleFactor>
|
| 508 |
-
<exportDialect><![CDATA[postgres]]></exportDialect>
|
| 509 |
-
<fileversion><![CDATA[4]]></fileversion>
|
| 510 |
-
<footer><![CDATA[Jedha - 12/25]]></footer>
|
| 511 |
-
<generator><![CDATA[com.malcolmhardie.sqleditor]]></generator>
|
| 512 |
-
<generatorVersion><![CDATA[3.6.2]]></generatorVersion>
|
| 513 |
-
<header><![CDATA[Bloc 2 - Stripe - OLAP]]></header>
|
| 514 |
-
<hideFieldIcons><![CDATA[0]]></hideFieldIcons>
|
| 515 |
-
<hideFieldTypes><![CDATA[0]]></hideFieldTypes>
|
| 516 |
-
<overviewPanelHidden><![CDATA[0]]></overviewPanelHidden>
|
| 517 |
-
<pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible>
|
| 518 |
-
<PageGridVisible><![CDATA[0]]></PageGridVisible>
|
| 519 |
-
<RightSidebarWidth><![CDATA[2283.000000]]></RightSidebarWidth>
|
| 520 |
-
<sidebarIndex><![CDATA[0]]></sidebarIndex>
|
| 521 |
-
<snapToGrid><![CDATA[0]]></snapToGrid>
|
| 522 |
-
<SourceSidebarWidth><![CDATA[312.000000]]></SourceSidebarWidth>
|
| 523 |
-
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
|
| 524 |
-
<uid><![CDATA[00E45D6F-1668-4690-93C9-AD2B8D8F5945]]></uid>
|
| 525 |
-
<windowHeight><![CDATA[1409.000000]]></windowHeight>
|
| 526 |
-
<windowLocationX><![CDATA[-2560.000000]]></windowLocationX>
|
| 527 |
-
<windowLocationY><![CDATA[72.000000]]></windowLocationY>
|
| 528 |
-
<windowScrollOrigin><![CDATA[{0, 159}]]></windowScrollOrigin>
|
| 529 |
-
<windowWidth><![CDATA[2560.000000]]></windowWidth>
|
| 530 |
-
</SQLDocumentInfo>
|
| 531 |
-
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
|
| 532 |
-
<defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded>
|
| 533 |
-
<ui.treeDisplayMode><![CDATA[0]]></ui.treeDisplayMode>
|
| 534 |
-
<MHObjectStyle>
|
| 535 |
-
<font key="boldObjectFont" name="AvenirNext-Bold" size="12.000000"></font>
|
| 536 |
-
<font key="boldObjectTitleFont" name="AvenirNext-Bold" size="12.000000"></font>
|
| 537 |
-
<font key="objectFont" name="AvenirNext-Regular" size="12.000000"></font>
|
| 538 |
-
<font key="objectTitleFont" name="AvenirNext-Bold" size="12.000000"></font>
|
| 539 |
-
</MHObjectStyle>
|
| 540 |
-
</SQLContainer>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
Bloc2 - Data Architecture/Projet/Modèles de données/[Jedha] - {Certification} - Bloc 2 OLTP - Stripe.sqs
DELETED
|
@@ -1,1179 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
-
<SQLContainer>
|
| 3 |
-
<SQLTable>
|
| 4 |
-
<name><![CDATA[transactions]]></name>
|
| 5 |
-
<schema><![CDATA[]]></schema>
|
| 6 |
-
<location>
|
| 7 |
-
<x>1165.00</x>
|
| 8 |
-
<y>1266.00</y>
|
| 9 |
-
</location>
|
| 10 |
-
<size>
|
| 11 |
-
<width>266.00</width>
|
| 12 |
-
<height>160.00</height>
|
| 13 |
-
</size>
|
| 14 |
-
<zorder>9</zorder>
|
| 15 |
-
<SQLField>
|
| 16 |
-
<name><![CDATA[transaction_id]]></name>
|
| 17 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 18 |
-
<primaryKey>1</primaryKey>
|
| 19 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 20 |
-
<uid><![CDATA[F3B1DE2E-E398-439B-B066-3989F2B47FCF]]></uid>
|
| 21 |
-
</SQLField>
|
| 22 |
-
<SQLField>
|
| 23 |
-
<name><![CDATA[account_id]]></name>
|
| 24 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 25 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 26 |
-
<indexed><![CDATA[1]]></indexed>
|
| 27 |
-
<indexedKeyName><![CDATA[idx_transactions_account_id]]></indexedKeyName>
|
| 28 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 29 |
-
<notNull><![CDATA[1]]></notNull>
|
| 30 |
-
<uid><![CDATA[64FE19C0-2FCB-47DD-860F-F657DCA850E5]]></uid>
|
| 31 |
-
</SQLField>
|
| 32 |
-
<SQLField>
|
| 33 |
-
<name><![CDATA[merchant_id]]></name>
|
| 34 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 35 |
-
<referencesField>merchant_id</referencesField>
|
| 36 |
-
<referencesTable>merchants</referencesTable>
|
| 37 |
-
<deleteAction>1</deleteAction>
|
| 38 |
-
<updateAction>12983400752</updateAction>
|
| 39 |
-
<referencesField><![CDATA[merchant_id]]></referencesField>
|
| 40 |
-
<referencesTable><![CDATA[merchants]]></referencesTable>
|
| 41 |
-
<sourceCardinality>5</sourceCardinality>
|
| 42 |
-
<destinationCardinality>1</destinationCardinality>
|
| 43 |
-
<referencesFieldUID><![CDATA[471DBA24-3923-42DA-945C-C58E8643D871]]></referencesFieldUID>
|
| 44 |
-
<referencesTableUID><![CDATA[9BAE2600-3273-4010-B46C-4A004EAE8D47]]></referencesTableUID>
|
| 45 |
-
<connectorLineStyle><![CDATA[1]]></connectorLineStyle>
|
| 46 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 47 |
-
<indexed><![CDATA[1]]></indexed>
|
| 48 |
-
<indexedKeyName><![CDATA[idx_transactions_merchant_id]]></indexedKeyName>
|
| 49 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 50 |
-
<notNull><![CDATA[1]]></notNull>
|
| 51 |
-
<uid><![CDATA[6772DFE0-3438-4D95-B961-FA5A6C3A1283]]></uid>
|
| 52 |
-
</SQLField>
|
| 53 |
-
<SQLField>
|
| 54 |
-
<name><![CDATA[amount]]></name>
|
| 55 |
-
<type><![CDATA[DECIMAL(15 , 2)]]></type>
|
| 56 |
-
<notNull><![CDATA[1]]></notNull>
|
| 57 |
-
<uid><![CDATA[3EB0B769-73BF-41B6-90F5-6203A4DE46ED]]></uid>
|
| 58 |
-
</SQLField>
|
| 59 |
-
<SQLField>
|
| 60 |
-
<name><![CDATA[currency]]></name>
|
| 61 |
-
<type><![CDATA[VARCHAR(3)]]></type>
|
| 62 |
-
<uid><![CDATA[F4128707-0033-44B9-B89B-0DCB38A17AB0]]></uid>
|
| 63 |
-
</SQLField>
|
| 64 |
-
<SQLField>
|
| 65 |
-
<name><![CDATA[status]]></name>
|
| 66 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 67 |
-
<indexed><![CDATA[1]]></indexed>
|
| 68 |
-
<indexedKeyName><![CDATA[idx_transactions_status]]></indexedKeyName>
|
| 69 |
-
<uid><![CDATA[896956C7-432E-42B4-A6BF-A9253FE9B148]]></uid>
|
| 70 |
-
</SQLField>
|
| 71 |
-
<SQLField>
|
| 72 |
-
<name><![CDATA[created_at]]></name>
|
| 73 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 74 |
-
<uid><![CDATA[3FE363F0-9E90-481F-8A3C-93592982FA1E]]></uid>
|
| 75 |
-
</SQLField>
|
| 76 |
-
<labelColor><![CDATA[{0.0626183,0.585262,0.300111,1}]]></labelColor>
|
| 77 |
-
<labelWindowIndex><![CDATA[17]]></labelWindowIndex>
|
| 78 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 79 |
-
<uid><![CDATA[0B598F8E-F894-4AD2-A0A1-7FBCC236A353]]></uid>
|
| 80 |
-
</SQLTable>
|
| 81 |
-
<SQLTable>
|
| 82 |
-
<name><![CDATA[refunds]]></name>
|
| 83 |
-
<schema><![CDATA[]]></schema>
|
| 84 |
-
<location>
|
| 85 |
-
<x>1162.00</x>
|
| 86 |
-
<y>1017.00</y>
|
| 87 |
-
</location>
|
| 88 |
-
<size>
|
| 89 |
-
<width>240.00</width>
|
| 90 |
-
<height>120.00</height>
|
| 91 |
-
</size>
|
| 92 |
-
<zorder>4</zorder>
|
| 93 |
-
<SQLField>
|
| 94 |
-
<name><![CDATA[refund_id]]></name>
|
| 95 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 96 |
-
<primaryKey>1</primaryKey>
|
| 97 |
-
<uid><![CDATA[9FD33C87-76B0-45AB-B28B-CBB6A263C0E1]]></uid>
|
| 98 |
-
</SQLField>
|
| 99 |
-
<SQLField>
|
| 100 |
-
<name><![CDATA[transaction_id]]></name>
|
| 101 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 102 |
-
<referencesField>transaction_id</referencesField>
|
| 103 |
-
<referencesTable>transactions</referencesTable>
|
| 104 |
-
<deleteAction>1</deleteAction>
|
| 105 |
-
<updateAction>12983400752</updateAction>
|
| 106 |
-
<referencesField><![CDATA[transaction_id]]></referencesField>
|
| 107 |
-
<referencesTable><![CDATA[transactions]]></referencesTable>
|
| 108 |
-
<sourceCardinality>0</sourceCardinality>
|
| 109 |
-
<destinationCardinality>0</destinationCardinality>
|
| 110 |
-
<referencesFieldUID><![CDATA[F3B1DE2E-E398-439B-B066-3989F2B47FCF]]></referencesFieldUID>
|
| 111 |
-
<referencesTableUID><![CDATA[0B598F8E-F894-4AD2-A0A1-7FBCC236A353]]></referencesTableUID>
|
| 112 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 113 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 114 |
-
<notNull><![CDATA[1]]></notNull>
|
| 115 |
-
<uid><![CDATA[A84A0FB2-8D9E-4395-9AE4-80430DF60AB0]]></uid>
|
| 116 |
-
</SQLField>
|
| 117 |
-
<SQLField>
|
| 118 |
-
<name><![CDATA[amount]]></name>
|
| 119 |
-
<type><![CDATA[DECIMAL(15 , 2)]]></type>
|
| 120 |
-
<notNull><![CDATA[1]]></notNull>
|
| 121 |
-
<uid><![CDATA[5655DB6D-67E5-48BE-9B18-E8ACC81B83A5]]></uid>
|
| 122 |
-
</SQLField>
|
| 123 |
-
<SQLField>
|
| 124 |
-
<name><![CDATA[status]]></name>
|
| 125 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 126 |
-
<defaultValue><![CDATA['pending']]></defaultValue>
|
| 127 |
-
<uid><![CDATA[1FA5FB50-48DA-4902-A815-1AD4CDEEAEC8]]></uid>
|
| 128 |
-
</SQLField>
|
| 129 |
-
<SQLField>
|
| 130 |
-
<name><![CDATA[processed_at]]></name>
|
| 131 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 132 |
-
<uid><![CDATA[431AAB7C-4D6B-4CBF-AB06-7980AAF3FDB1]]></uid>
|
| 133 |
-
</SQLField>
|
| 134 |
-
<labelColor><![CDATA[{0.0626183,0.585262,0.300111,1}]]></labelColor>
|
| 135 |
-
<labelWindowIndex><![CDATA[12]]></labelWindowIndex>
|
| 136 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 137 |
-
<uid><![CDATA[13BDF097-EF94-4940-8359-E2A26F205CB4]]></uid>
|
| 138 |
-
</SQLTable>
|
| 139 |
-
<SQLCanvasArea>
|
| 140 |
-
<name><![CDATA[Canvas Area1_3]]></name>
|
| 141 |
-
<comment><![CDATA[]]></comment>
|
| 142 |
-
<location>
|
| 143 |
-
<x>728.00</x>
|
| 144 |
-
<y>1573.00</y>
|
| 145 |
-
</location>
|
| 146 |
-
<size>
|
| 147 |
-
<width>306.00</width>
|
| 148 |
-
<height>374.00</height>
|
| 149 |
-
</size>
|
| 150 |
-
<zorder>18</zorder>
|
| 151 |
-
<commentTitle><![CDATA[Customers]]></commentTitle>
|
| 152 |
-
<labelColor><![CDATA[{0.0041457,0.239396,0.643564,0.261269}]]></labelColor>
|
| 153 |
-
<labelWindowIndex><![CDATA[2]]></labelWindowIndex>
|
| 154 |
-
<uid><![CDATA[4739F5B6-9B50-42B6-AC8A-A0A68B25B5DA]]></uid>
|
| 155 |
-
</SQLCanvasArea>
|
| 156 |
-
<SQLTable>
|
| 157 |
-
<name><![CDATA[payment_attempts]]></name>
|
| 158 |
-
<schema><![CDATA[]]></schema>
|
| 159 |
-
<location>
|
| 160 |
-
<x>1462.00</x>
|
| 161 |
-
<y>1705.00</y>
|
| 162 |
-
</location>
|
| 163 |
-
<size>
|
| 164 |
-
<width>274.00</width>
|
| 165 |
-
<height>140.00</height>
|
| 166 |
-
</size>
|
| 167 |
-
<zorder>8</zorder>
|
| 168 |
-
<SQLField>
|
| 169 |
-
<name><![CDATA[attempt_id]]></name>
|
| 170 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 171 |
-
<primaryKey>1</primaryKey>
|
| 172 |
-
<uid><![CDATA[15B73C2E-CBE0-41B9-9835-047E4B897417]]></uid>
|
| 173 |
-
</SQLField>
|
| 174 |
-
<SQLField>
|
| 175 |
-
<name><![CDATA[transaction_id]]></name>
|
| 176 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 177 |
-
<referencesField>transaction_id</referencesField>
|
| 178 |
-
<referencesTable>transactions</referencesTable>
|
| 179 |
-
<deleteAction>1</deleteAction>
|
| 180 |
-
<updateAction>12983400752</updateAction>
|
| 181 |
-
<referencesField><![CDATA[transaction_id]]></referencesField>
|
| 182 |
-
<referencesTable><![CDATA[transactions]]></referencesTable>
|
| 183 |
-
<sourceCardinality>1</sourceCardinality>
|
| 184 |
-
<destinationCardinality>1</destinationCardinality>
|
| 185 |
-
<referencesFieldUID><![CDATA[F3B1DE2E-E398-439B-B066-3989F2B47FCF]]></referencesFieldUID>
|
| 186 |
-
<referencesTableUID><![CDATA[0B598F8E-F894-4AD2-A0A1-7FBCC236A353]]></referencesTableUID>
|
| 187 |
-
<connectorLineStyle><![CDATA[1]]></connectorLineStyle>
|
| 188 |
-
<connectorMidPoint><![CDATA[1819.000000]]></connectorMidPoint>
|
| 189 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 190 |
-
<forcedUnique><![CDATA[0]]></forcedUnique>
|
| 191 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 192 |
-
<notNull><![CDATA[1]]></notNull>
|
| 193 |
-
<uid><![CDATA[1A0E9249-DAF7-4B3A-ACCB-026FE7D887A3]]></uid>
|
| 194 |
-
</SQLField>
|
| 195 |
-
<SQLField>
|
| 196 |
-
<name><![CDATA[payment_method_id]]></name>
|
| 197 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 198 |
-
<referencesField>payment_method_id</referencesField>
|
| 199 |
-
<referencesTable>payment_methods</referencesTable>
|
| 200 |
-
<deleteAction>1</deleteAction>
|
| 201 |
-
<updateAction>12983400752</updateAction>
|
| 202 |
-
<referencesField><![CDATA[payment_method_id]]></referencesField>
|
| 203 |
-
<referencesTable><![CDATA[payment_methods]]></referencesTable>
|
| 204 |
-
<sourceCardinality>1</sourceCardinality>
|
| 205 |
-
<destinationCardinality>5</destinationCardinality>
|
| 206 |
-
<referencesFieldUID><![CDATA[3A1E0597-8D45-4952-AAF5-6F0D1358B1FD]]></referencesFieldUID>
|
| 207 |
-
<referencesTableUID><![CDATA[E88A698C-AE0A-43D1-A1CD-3EF38745CDBD]]></referencesTableUID>
|
| 208 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 209 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 210 |
-
<notNull><![CDATA[1]]></notNull>
|
| 211 |
-
<uid><![CDATA[6AF62414-0091-4599-8E76-FACEB9E6BA09]]></uid>
|
| 212 |
-
</SQLField>
|
| 213 |
-
<SQLField>
|
| 214 |
-
<name><![CDATA[status]]></name>
|
| 215 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 216 |
-
<indexed><![CDATA[1]]></indexed>
|
| 217 |
-
<indexedKeyName><![CDATA[idx_payment_attempts_status]]></indexedKeyName>
|
| 218 |
-
<uid><![CDATA[8805047F-B270-4605-BA00-7E4A7474CC6C]]></uid>
|
| 219 |
-
</SQLField>
|
| 220 |
-
<SQLField>
|
| 221 |
-
<name><![CDATA[attempt_date]]></name>
|
| 222 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 223 |
-
<uid><![CDATA[C2237609-9C20-4FED-BFBD-1AF9673B4E51]]></uid>
|
| 224 |
-
</SQLField>
|
| 225 |
-
<SQLField>
|
| 226 |
-
<name><![CDATA[failure_reason]]></name>
|
| 227 |
-
<type><![CDATA[TEXT]]></type>
|
| 228 |
-
<uid><![CDATA[35B85764-29AD-4F55-9874-E9F95827FCFB]]></uid>
|
| 229 |
-
</SQLField>
|
| 230 |
-
<labelColor><![CDATA[{0.552896,0.12298,0.559,1}]]></labelColor>
|
| 231 |
-
<labelWindowIndex><![CDATA[19]]></labelWindowIndex>
|
| 232 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 233 |
-
<uid><![CDATA[50C4144D-58C2-4D00-B5B0-536AE90EC410]]></uid>
|
| 234 |
-
</SQLTable>
|
| 235 |
-
<SQLTable>
|
| 236 |
-
<name><![CDATA[account]]></name>
|
| 237 |
-
<schema><![CDATA[]]></schema>
|
| 238 |
-
<location>
|
| 239 |
-
<x>747.00</x>
|
| 240 |
-
<y>1774.00</y>
|
| 241 |
-
</location>
|
| 242 |
-
<size>
|
| 243 |
-
<width>248.00</width>
|
| 244 |
-
<height>140.00</height>
|
| 245 |
-
</size>
|
| 246 |
-
<zorder>17</zorder>
|
| 247 |
-
<SQLField>
|
| 248 |
-
<name><![CDATA[account_id]]></name>
|
| 249 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 250 |
-
<primaryKey>1</primaryKey>
|
| 251 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 252 |
-
<uid><![CDATA[E20ADABB-8364-40A9-8543-457E9000258E]]></uid>
|
| 253 |
-
<unique><![CDATA[1]]></unique>
|
| 254 |
-
</SQLField>
|
| 255 |
-
<SQLField>
|
| 256 |
-
<name><![CDATA[user_id]]></name>
|
| 257 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 258 |
-
<referencesField>user_id</referencesField>
|
| 259 |
-
<referencesTable>users</referencesTable>
|
| 260 |
-
<deleteAction>1</deleteAction>
|
| 261 |
-
<referencesField><![CDATA[user_id]]></referencesField>
|
| 262 |
-
<referencesTable><![CDATA[users]]></referencesTable>
|
| 263 |
-
<sourceCardinality>1</sourceCardinality>
|
| 264 |
-
<destinationCardinality>5</destinationCardinality>
|
| 265 |
-
<referencesFieldUID><![CDATA[924863BD-A417-400E-BFE1-CD6B926326E8]]></referencesFieldUID>
|
| 266 |
-
<referencesTableUID><![CDATA[6F7D0F22-32AC-437A-90CD-2E17C5E8D9BD]]></referencesTableUID>
|
| 267 |
-
<connectorHidden><![CDATA[0]]></connectorHidden>
|
| 268 |
-
<connectorLineStyle><![CDATA[0]]></connectorLineStyle>
|
| 269 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 270 |
-
<notNull><![CDATA[1]]></notNull>
|
| 271 |
-
<referenceLinkName><![CDATA[had]]></referenceLinkName>
|
| 272 |
-
<uid><![CDATA[17D36900-0A11-4434-B5E9-C451F271AD4C]]></uid>
|
| 273 |
-
<unique><![CDATA[0]]></unique>
|
| 274 |
-
</SQLField>
|
| 275 |
-
<SQLField>
|
| 276 |
-
<name><![CDATA[account_type]]></name>
|
| 277 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 278 |
-
<uid><![CDATA[24C162A3-37F4-446A-8729-1186B7B007C6]]></uid>
|
| 279 |
-
</SQLField>
|
| 280 |
-
<SQLField>
|
| 281 |
-
<name><![CDATA[status]]></name>
|
| 282 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 283 |
-
<defaultValue><![CDATA[CURRENT_TIMESTAMP]]></defaultValue>
|
| 284 |
-
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
|
| 285 |
-
<uid><![CDATA[BBDDDC30-467E-4123-B4D8-C462D3D53537]]></uid>
|
| 286 |
-
</SQLField>
|
| 287 |
-
<SQLField>
|
| 288 |
-
<name><![CDATA[balance]]></name>
|
| 289 |
-
<type><![CDATA[TEXT]]></type>
|
| 290 |
-
<uid><![CDATA[6784190A-E55B-45FE-87C1-520110A848AA]]></uid>
|
| 291 |
-
</SQLField>
|
| 292 |
-
<SQLField>
|
| 293 |
-
<name><![CDATA[country]]></name>
|
| 294 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 295 |
-
<defaultValue><![CDATA['pending']]></defaultValue>
|
| 296 |
-
<uid><![CDATA[FF55E2AB-052B-4070-B428-7B39B4A750FC]]></uid>
|
| 297 |
-
</SQLField>
|
| 298 |
-
<labelWindowIndex><![CDATA[3]]></labelWindowIndex>
|
| 299 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 300 |
-
<uid><![CDATA[52B2384C-A314-4599-9F7B-7CE4B4F3623B]]></uid>
|
| 301 |
-
</SQLTable>
|
| 302 |
-
<SQLTable>
|
| 303 |
-
<name><![CDATA[fraud_alerts]]></name>
|
| 304 |
-
<schema><![CDATA[]]></schema>
|
| 305 |
-
<location>
|
| 306 |
-
<x>1979.00</x>
|
| 307 |
-
<y>1219.00</y>
|
| 308 |
-
</location>
|
| 309 |
-
<size>
|
| 310 |
-
<width>240.00</width>
|
| 311 |
-
<height>180.00</height>
|
| 312 |
-
</size>
|
| 313 |
-
<zorder>2</zorder>
|
| 314 |
-
<SQLField>
|
| 315 |
-
<name><![CDATA[alert_id]]></name>
|
| 316 |
-
<type><![CDATA[SERIAL]]></type>
|
| 317 |
-
<primaryKey>1</primaryKey>
|
| 318 |
-
<uid><![CDATA[2D206D70-27C0-4C05-B0A9-CBB686A5DD28]]></uid>
|
| 319 |
-
</SQLField>
|
| 320 |
-
<SQLField>
|
| 321 |
-
<name><![CDATA[transaction_id]]></name>
|
| 322 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 323 |
-
<referencesField>transaction_id</referencesField>
|
| 324 |
-
<referencesTable>transactions</referencesTable>
|
| 325 |
-
<deleteAction>1</deleteAction>
|
| 326 |
-
<updateAction>12983400752</updateAction>
|
| 327 |
-
<referencesField><![CDATA[transaction_id]]></referencesField>
|
| 328 |
-
<referencesTable><![CDATA[transactions]]></referencesTable>
|
| 329 |
-
<sourceCardinality>1</sourceCardinality>
|
| 330 |
-
<destinationCardinality>1</destinationCardinality>
|
| 331 |
-
<referencesFieldUID><![CDATA[F3B1DE2E-E398-439B-B066-3989F2B47FCF]]></referencesFieldUID>
|
| 332 |
-
<referencesTableUID><![CDATA[0B598F8E-F894-4AD2-A0A1-7FBCC236A353]]></referencesTableUID>
|
| 333 |
-
<connectorLineStyle><![CDATA[1]]></connectorLineStyle>
|
| 334 |
-
<connectorMidPoint><![CDATA[1898.000000]]></connectorMidPoint>
|
| 335 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 336 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 337 |
-
<notNull><![CDATA[1]]></notNull>
|
| 338 |
-
<referenceLinkName><![CDATA[seems]]></referenceLinkName>
|
| 339 |
-
<uid><![CDATA[DBE6A6E9-B6F6-43D4-B375-B9374AFC857B]]></uid>
|
| 340 |
-
</SQLField>
|
| 341 |
-
<SQLField>
|
| 342 |
-
<name><![CDATA[rule_id]]></name>
|
| 343 |
-
<type><![CDATA[INTEGER]]></type>
|
| 344 |
-
<referencesField>rule_id</referencesField>
|
| 345 |
-
<referencesTable>fraud_rules</referencesTable>
|
| 346 |
-
<deleteAction>1</deleteAction>
|
| 347 |
-
<updateAction>12983400752</updateAction>
|
| 348 |
-
<referencesField><![CDATA[rule_id]]></referencesField>
|
| 349 |
-
<referencesTable><![CDATA[fraud_rules]]></referencesTable>
|
| 350 |
-
<sourceCardinality>5</sourceCardinality>
|
| 351 |
-
<destinationCardinality>1</destinationCardinality>
|
| 352 |
-
<referencesFieldUID><![CDATA[B21124AD-3257-4918-A804-FE505A09C087]]></referencesFieldUID>
|
| 353 |
-
<referencesTableUID><![CDATA[7C07DFA5-88FC-4733-9ACF-205A90BB2AA5]]></referencesTableUID>
|
| 354 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 355 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 356 |
-
<notNull><![CDATA[1]]></notNull>
|
| 357 |
-
<uid><![CDATA[D1BCCB5B-F437-4E97-AA23-A116D9A01086]]></uid>
|
| 358 |
-
</SQLField>
|
| 359 |
-
<SQLField>
|
| 360 |
-
<name><![CDATA[alert_score]]></name>
|
| 361 |
-
<type><![CDATA[DECIMAL(5 , 2)]]></type>
|
| 362 |
-
<uid><![CDATA[BDA51534-779C-4DAC-A2C6-33B320482534]]></uid>
|
| 363 |
-
</SQLField>
|
| 364 |
-
<SQLField>
|
| 365 |
-
<name><![CDATA[status]]></name>
|
| 366 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 367 |
-
<defaultValue><![CDATA['pending']]></defaultValue>
|
| 368 |
-
<indexed><![CDATA[1]]></indexed>
|
| 369 |
-
<indexedKeyName><![CDATA[idx_fraud_alerts_status]]></indexedKeyName>
|
| 370 |
-
<uid><![CDATA[2BCA0BC9-4731-44C3-BC8A-9345471FFB8D]]></uid>
|
| 371 |
-
</SQLField>
|
| 372 |
-
<SQLField>
|
| 373 |
-
<name><![CDATA[created_at]]></name>
|
| 374 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 375 |
-
<defaultValue><![CDATA[CURRENT_TIMESTAMP]]></defaultValue>
|
| 376 |
-
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
|
| 377 |
-
<uid><![CDATA[19FBC492-5325-4D28-ACCA-BC9D36DE02BA]]></uid>
|
| 378 |
-
</SQLField>
|
| 379 |
-
<SQLField>
|
| 380 |
-
<name><![CDATA[resolved_by]]></name>
|
| 381 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 382 |
-
<uid><![CDATA[539DB786-85EE-441C-847A-F63679962D4C]]></uid>
|
| 383 |
-
</SQLField>
|
| 384 |
-
<SQLField>
|
| 385 |
-
<name><![CDATA[resolved_at]]></name>
|
| 386 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 387 |
-
<uid><![CDATA[56B84067-2CDD-4C49-A0FC-16B8B91ADE25]]></uid>
|
| 388 |
-
</SQLField>
|
| 389 |
-
<labelColor><![CDATA[{0.74902,0.184314,0.270588,1}]]></labelColor>
|
| 390 |
-
<labelWindowIndex><![CDATA[11]]></labelWindowIndex>
|
| 391 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 392 |
-
<uid><![CDATA[604AED52-CEF6-4B97-8A25-641BCA17C084]]></uid>
|
| 393 |
-
</SQLTable>
|
| 394 |
-
<SQLCanvasArea>
|
| 395 |
-
<name><![CDATA[Canvas Area1_6]]></name>
|
| 396 |
-
<comment><![CDATA[]]></comment>
|
| 397 |
-
<location>
|
| 398 |
-
<x>729.00</x>
|
| 399 |
-
<y>981.00</y>
|
| 400 |
-
</location>
|
| 401 |
-
<size>
|
| 402 |
-
<width>332.00</width>
|
| 403 |
-
<height>552.00</height>
|
| 404 |
-
</size>
|
| 405 |
-
<zorder>19</zorder>
|
| 406 |
-
<commentTitle><![CDATA[Merchandizes]]></commentTitle>
|
| 407 |
-
<labelColor><![CDATA[{0.953876,0.393018,0.30782,0.245981}]]></labelColor>
|
| 408 |
-
<labelWindowIndex><![CDATA[1]]></labelWindowIndex>
|
| 409 |
-
<uid><![CDATA[675EF2C3-83D8-4061-B110-FC252618826D]]></uid>
|
| 410 |
-
</SQLCanvasArea>
|
| 411 |
-
<SQLCanvasArea>
|
| 412 |
-
<name><![CDATA[Canvas Area1_4]]></name>
|
| 413 |
-
<comment><![CDATA[]]></comment>
|
| 414 |
-
<location>
|
| 415 |
-
<x>1101.00</x>
|
| 416 |
-
<y>1662.00</y>
|
| 417 |
-
</location>
|
| 418 |
-
<size>
|
| 419 |
-
<width>659.00</width>
|
| 420 |
-
<height>243.00</height>
|
| 421 |
-
</size>
|
| 422 |
-
<zorder>13</zorder>
|
| 423 |
-
<commentTitle><![CDATA[Payments]]></commentTitle>
|
| 424 |
-
<labelColor><![CDATA[{0.552896,0.12298,0.559,0.235724}]]></labelColor>
|
| 425 |
-
<labelWindowIndex><![CDATA[7]]></labelWindowIndex>
|
| 426 |
-
<uid><![CDATA[6E1A4AD0-B696-441A-A547-1C5530B1484A]]></uid>
|
| 427 |
-
</SQLCanvasArea>
|
| 428 |
-
<SQLTable>
|
| 429 |
-
<name><![CDATA[users]]></name>
|
| 430 |
-
<schema><![CDATA[]]></schema>
|
| 431 |
-
<location>
|
| 432 |
-
<x>748.00</x>
|
| 433 |
-
<y>1608.00</y>
|
| 434 |
-
</location>
|
| 435 |
-
<size>
|
| 436 |
-
<width>222.00</width>
|
| 437 |
-
<height>140.00</height>
|
| 438 |
-
</size>
|
| 439 |
-
<zorder>12</zorder>
|
| 440 |
-
<SQLField>
|
| 441 |
-
<name><![CDATA[user_id]]></name>
|
| 442 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 443 |
-
<primaryKey>1</primaryKey>
|
| 444 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 445 |
-
<uid><![CDATA[924863BD-A417-400E-BFE1-CD6B926326E8]]></uid>
|
| 446 |
-
</SQLField>
|
| 447 |
-
<SQLField>
|
| 448 |
-
<name><![CDATA[email]]></name>
|
| 449 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 450 |
-
<notNull><![CDATA[1]]></notNull>
|
| 451 |
-
<uid><![CDATA[220B94EC-2D0D-436C-9367-7E97CACE2B70]]></uid>
|
| 452 |
-
<unique><![CDATA[1]]></unique>
|
| 453 |
-
</SQLField>
|
| 454 |
-
<SQLField>
|
| 455 |
-
<name><![CDATA[phone]]></name>
|
| 456 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 457 |
-
<uid><![CDATA[43540B4E-EDB8-4AFA-9335-F14AAC20E6A2]]></uid>
|
| 458 |
-
</SQLField>
|
| 459 |
-
<SQLField>
|
| 460 |
-
<name><![CDATA[created_at]]></name>
|
| 461 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 462 |
-
<defaultValue><![CDATA[CURRENT_TIMESTAMP]]></defaultValue>
|
| 463 |
-
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
|
| 464 |
-
<uid><![CDATA[E59030A3-95B7-4000-BA5E-EA146BA89418]]></uid>
|
| 465 |
-
</SQLField>
|
| 466 |
-
<SQLField>
|
| 467 |
-
<name><![CDATA[address]]></name>
|
| 468 |
-
<type><![CDATA[TEXT]]></type>
|
| 469 |
-
<uid><![CDATA[A4148D4C-BAEF-407C-8FCA-0DCF5988932E]]></uid>
|
| 470 |
-
</SQLField>
|
| 471 |
-
<SQLField>
|
| 472 |
-
<name><![CDATA[status]]></name>
|
| 473 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 474 |
-
<defaultValue><![CDATA['pending']]></defaultValue>
|
| 475 |
-
<uid><![CDATA[CE83C555-1718-4CE5-8F6C-177F5A4595D6]]></uid>
|
| 476 |
-
</SQLField>
|
| 477 |
-
<labelWindowIndex><![CDATA[20]]></labelWindowIndex>
|
| 478 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 479 |
-
<uid><![CDATA[6F7D0F22-32AC-437A-90CD-2E17C5E8D9BD]]></uid>
|
| 480 |
-
</SQLTable>
|
| 481 |
-
<SQLTable>
|
| 482 |
-
<name><![CDATA[products]]></name>
|
| 483 |
-
<schema><![CDATA[]]></schema>
|
| 484 |
-
<location>
|
| 485 |
-
<x>765.00</x>
|
| 486 |
-
<y>1223.00</y>
|
| 487 |
-
</location>
|
| 488 |
-
<size>
|
| 489 |
-
<width>231.00</width>
|
| 490 |
-
<height>120.00</height>
|
| 491 |
-
</size>
|
| 492 |
-
<zorder>6</zorder>
|
| 493 |
-
<SQLField>
|
| 494 |
-
<name><![CDATA[product_id]]></name>
|
| 495 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 496 |
-
<primaryKey>1</primaryKey>
|
| 497 |
-
<uid><![CDATA[EE90DA93-F261-4EFD-93F6-5C0F6FC98AF5]]></uid>
|
| 498 |
-
</SQLField>
|
| 499 |
-
<SQLField>
|
| 500 |
-
<name><![CDATA[merchant_id]]></name>
|
| 501 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 502 |
-
<referencesField>merchant_id</referencesField>
|
| 503 |
-
<referencesTable>merchants</referencesTable>
|
| 504 |
-
<deleteAction>1</deleteAction>
|
| 505 |
-
<updateAction>12983400752</updateAction>
|
| 506 |
-
<referencesField><![CDATA[merchant_id]]></referencesField>
|
| 507 |
-
<referencesTable><![CDATA[merchants]]></referencesTable>
|
| 508 |
-
<sourceCardinality>5</sourceCardinality>
|
| 509 |
-
<destinationCardinality>1</destinationCardinality>
|
| 510 |
-
<referencesFieldUID><![CDATA[471DBA24-3923-42DA-945C-C58E8643D871]]></referencesFieldUID>
|
| 511 |
-
<referencesTableUID><![CDATA[9BAE2600-3273-4010-B46C-4A004EAE8D47]]></referencesTableUID>
|
| 512 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 513 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 514 |
-
<notNull><![CDATA[1]]></notNull>
|
| 515 |
-
<uid><![CDATA[16C0CC45-D33C-4242-96A1-C6E64EF8B259]]></uid>
|
| 516 |
-
</SQLField>
|
| 517 |
-
<SQLField>
|
| 518 |
-
<name><![CDATA[name]]></name>
|
| 519 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 520 |
-
<notNull><![CDATA[1]]></notNull>
|
| 521 |
-
<uid><![CDATA[8BAFA4C8-F0DF-47FF-BEB1-BD1DC0AEFB02]]></uid>
|
| 522 |
-
</SQLField>
|
| 523 |
-
<SQLField>
|
| 524 |
-
<name><![CDATA[price]]></name>
|
| 525 |
-
<type><![CDATA[DECIMAL(15 , 2)]]></type>
|
| 526 |
-
<notNull><![CDATA[1]]></notNull>
|
| 527 |
-
<uid><![CDATA[60E62FD2-5C2E-4290-81A8-9A3162454640]]></uid>
|
| 528 |
-
</SQLField>
|
| 529 |
-
<SQLField>
|
| 530 |
-
<name><![CDATA[currency]]></name>
|
| 531 |
-
<type><![CDATA[VARCHAR(3)]]></type>
|
| 532 |
-
<uid><![CDATA[D5B32C5C-12C8-4F59-889A-EDE0D5CF118B]]></uid>
|
| 533 |
-
</SQLField>
|
| 534 |
-
<labelColor><![CDATA[{0.953876,0.393018,0.30782,1}]]></labelColor>
|
| 535 |
-
<labelWindowIndex><![CDATA[14]]></labelWindowIndex>
|
| 536 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 537 |
-
<uid><![CDATA[7383F1A7-28FC-4C2D-A4E0-6EEC3ACF02CE]]></uid>
|
| 538 |
-
</SQLTable>
|
| 539 |
-
<SQLTable>
|
| 540 |
-
<name><![CDATA[transaction_fees]]></name>
|
| 541 |
-
<schema><![CDATA[]]></schema>
|
| 542 |
-
<location>
|
| 543 |
-
<x>1165.00</x>
|
| 544 |
-
<y>1149.00</y>
|
| 545 |
-
</location>
|
| 546 |
-
<size>
|
| 547 |
-
<width>240.00</width>
|
| 548 |
-
<height>100.00</height>
|
| 549 |
-
</size>
|
| 550 |
-
<zorder>5</zorder>
|
| 551 |
-
<SQLField>
|
| 552 |
-
<name><![CDATA[fee_id]]></name>
|
| 553 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 554 |
-
<primaryKey>1</primaryKey>
|
| 555 |
-
<uid><![CDATA[9739172A-BEF2-4ACB-9745-6CCA7634FB95]]></uid>
|
| 556 |
-
</SQLField>
|
| 557 |
-
<SQLField>
|
| 558 |
-
<name><![CDATA[transaction_id]]></name>
|
| 559 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 560 |
-
<referencesField>transaction_id</referencesField>
|
| 561 |
-
<referencesTable>transactions</referencesTable>
|
| 562 |
-
<deleteAction>1</deleteAction>
|
| 563 |
-
<updateAction>12983400752</updateAction>
|
| 564 |
-
<referencesField><![CDATA[transaction_id]]></referencesField>
|
| 565 |
-
<referencesTable><![CDATA[transactions]]></referencesTable>
|
| 566 |
-
<sourceCardinality>0</sourceCardinality>
|
| 567 |
-
<destinationCardinality>0</destinationCardinality>
|
| 568 |
-
<referencesFieldUID><![CDATA[F3B1DE2E-E398-439B-B066-3989F2B47FCF]]></referencesFieldUID>
|
| 569 |
-
<referencesTableUID><![CDATA[0B598F8E-F894-4AD2-A0A1-7FBCC236A353]]></referencesTableUID>
|
| 570 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 571 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 572 |
-
<notNull><![CDATA[1]]></notNull>
|
| 573 |
-
<uid><![CDATA[851762E5-3499-4517-8B98-AB9A443329E8]]></uid>
|
| 574 |
-
</SQLField>
|
| 575 |
-
<SQLField>
|
| 576 |
-
<name><![CDATA[amount]]></name>
|
| 577 |
-
<type><![CDATA[DECIMAL(15 , 2)]]></type>
|
| 578 |
-
<notNull><![CDATA[1]]></notNull>
|
| 579 |
-
<uid><![CDATA[63CCE5E7-3270-4BB1-A4A0-9E4EC0D347D9]]></uid>
|
| 580 |
-
</SQLField>
|
| 581 |
-
<SQLField>
|
| 582 |
-
<name><![CDATA[fee_type]]></name>
|
| 583 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 584 |
-
<notNull><![CDATA[1]]></notNull>
|
| 585 |
-
<uid><![CDATA[3BC7B7C8-3105-4B0E-9DC2-39505EBFC779]]></uid>
|
| 586 |
-
</SQLField>
|
| 587 |
-
<labelColor><![CDATA[{0.0626183,0.585262,0.300111,1}]]></labelColor>
|
| 588 |
-
<labelWindowIndex><![CDATA[13]]></labelWindowIndex>
|
| 589 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 590 |
-
<uid><![CDATA[77022CCF-BFF7-475F-B7A0-448BDD82524A]]></uid>
|
| 591 |
-
</SQLTable>
|
| 592 |
-
<SQLTable>
|
| 593 |
-
<name><![CDATA[fraud_rules]]></name>
|
| 594 |
-
<schema><![CDATA[]]></schema>
|
| 595 |
-
<location>
|
| 596 |
-
<x>1979.00</x>
|
| 597 |
-
<y>1416.00</y>
|
| 598 |
-
</location>
|
| 599 |
-
<size>
|
| 600 |
-
<width>238.00</width>
|
| 601 |
-
<height>160.00</height>
|
| 602 |
-
</size>
|
| 603 |
-
<zorder>3</zorder>
|
| 604 |
-
<SQLField>
|
| 605 |
-
<name><![CDATA[rule_id]]></name>
|
| 606 |
-
<type><![CDATA[SERIAL]]></type>
|
| 607 |
-
<primaryKey>1</primaryKey>
|
| 608 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 609 |
-
<uid><![CDATA[B21124AD-3257-4918-A804-FE505A09C087]]></uid>
|
| 610 |
-
</SQLField>
|
| 611 |
-
<SQLField>
|
| 612 |
-
<name><![CDATA[rule_name]]></name>
|
| 613 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 614 |
-
<notNull><![CDATA[1]]></notNull>
|
| 615 |
-
<uid><![CDATA[08ACA57C-2478-4E06-ADFB-1978C7B238D0]]></uid>
|
| 616 |
-
</SQLField>
|
| 617 |
-
<SQLField>
|
| 618 |
-
<name><![CDATA[description]]></name>
|
| 619 |
-
<type><![CDATA[TEXT]]></type>
|
| 620 |
-
<uid><![CDATA[D765CAB9-5902-4A6B-A56C-4235FA150040]]></uid>
|
| 621 |
-
</SQLField>
|
| 622 |
-
<SQLField>
|
| 623 |
-
<name><![CDATA[condition]]></name>
|
| 624 |
-
<type><![CDATA[JSONB]]></type>
|
| 625 |
-
<notNull><![CDATA[1]]></notNull>
|
| 626 |
-
<uid><![CDATA[E25236D6-14BF-4457-9CFA-107359A0BED6]]></uid>
|
| 627 |
-
</SQLField>
|
| 628 |
-
<SQLField>
|
| 629 |
-
<name><![CDATA[action]]></name>
|
| 630 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 631 |
-
<notNull><![CDATA[1]]></notNull>
|
| 632 |
-
<uid><![CDATA[DB61FD73-5379-49D4-A6DD-CDAE9F8F44C2]]></uid>
|
| 633 |
-
</SQLField>
|
| 634 |
-
<SQLField>
|
| 635 |
-
<name><![CDATA[is_active]]></name>
|
| 636 |
-
<type><![CDATA[BOOLEAN]]></type>
|
| 637 |
-
<defaultValue><![CDATA[TRUE]]></defaultValue>
|
| 638 |
-
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
|
| 639 |
-
<uid><![CDATA[912AE9E1-F36D-4823-B3E5-EA34AB4F7C20]]></uid>
|
| 640 |
-
</SQLField>
|
| 641 |
-
<SQLField>
|
| 642 |
-
<name><![CDATA[created_at]]></name>
|
| 643 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 644 |
-
<uid><![CDATA[AD169C32-9638-4015-923F-949063F7D4D2]]></uid>
|
| 645 |
-
</SQLField>
|
| 646 |
-
<labelColor><![CDATA[{0.74902,0.184314,0.270588,1}]]></labelColor>
|
| 647 |
-
<labelWindowIndex><![CDATA[10]]></labelWindowIndex>
|
| 648 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 649 |
-
<uid><![CDATA[7C07DFA5-88FC-4733-9ACF-205A90BB2AA5]]></uid>
|
| 650 |
-
</SQLTable>
|
| 651 |
-
<SQLTable>
|
| 652 |
-
<name><![CDATA[support_interactions]]></name>
|
| 653 |
-
<schema><![CDATA[]]></schema>
|
| 654 |
-
<location>
|
| 655 |
-
<x>372.00</x>
|
| 656 |
-
<y>1209.00</y>
|
| 657 |
-
</location>
|
| 658 |
-
<size>
|
| 659 |
-
<width>212.00</width>
|
| 660 |
-
<height>120.00</height>
|
| 661 |
-
</size>
|
| 662 |
-
<zorder>0</zorder>
|
| 663 |
-
<SQLField>
|
| 664 |
-
<name><![CDATA[interaction_id]]></name>
|
| 665 |
-
<type><![CDATA[SERIAL]]></type>
|
| 666 |
-
<primaryKey>1</primaryKey>
|
| 667 |
-
<uid><![CDATA[6B413300-19DC-4D44-AA86-061B04EB0F74]]></uid>
|
| 668 |
-
</SQLField>
|
| 669 |
-
<SQLField>
|
| 670 |
-
<name><![CDATA[ticket_id]]></name>
|
| 671 |
-
<type><![CDATA[INTEGER]]></type>
|
| 672 |
-
<referencesField>ticket_id</referencesField>
|
| 673 |
-
<referencesTable>support_tickets</referencesTable>
|
| 674 |
-
<deleteAction>1</deleteAction>
|
| 675 |
-
<updateAction>12983400752</updateAction>
|
| 676 |
-
<referencesField><![CDATA[ticket_id]]></referencesField>
|
| 677 |
-
<referencesTable><![CDATA[support_tickets]]></referencesTable>
|
| 678 |
-
<sourceCardinality>5</sourceCardinality>
|
| 679 |
-
<destinationCardinality>1</destinationCardinality>
|
| 680 |
-
<referencesFieldUID><![CDATA[22534F3D-251C-402A-9192-0BBF0EF0071F]]></referencesFieldUID>
|
| 681 |
-
<referencesTableUID><![CDATA[B83E941B-7F3A-4958-86CD-7F7CB74CBA46]]></referencesTableUID>
|
| 682 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 683 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 684 |
-
<notNull><![CDATA[1]]></notNull>
|
| 685 |
-
<uid><![CDATA[0377D960-717B-4557-A87D-7E78B6DF4EDB]]></uid>
|
| 686 |
-
</SQLField>
|
| 687 |
-
<SQLField>
|
| 688 |
-
<name><![CDATA[agent_id]]></name>
|
| 689 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 690 |
-
<uid><![CDATA[3C1E6A5C-E3A3-44B3-A10B-DA8B12779522]]></uid>
|
| 691 |
-
</SQLField>
|
| 692 |
-
<SQLField>
|
| 693 |
-
<name><![CDATA[message]]></name>
|
| 694 |
-
<type><![CDATA[TEXT]]></type>
|
| 695 |
-
<notNull><![CDATA[1]]></notNull>
|
| 696 |
-
<uid><![CDATA[57FA120E-32E2-44AC-8812-B3E2DFBF2A82]]></uid>
|
| 697 |
-
</SQLField>
|
| 698 |
-
<SQLField>
|
| 699 |
-
<name><![CDATA[created_at]]></name>
|
| 700 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 701 |
-
<defaultValue><![CDATA[CURRENT_TIMESTAMP]]></defaultValue>
|
| 702 |
-
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
|
| 703 |
-
<uid><![CDATA[DDB5B3D5-2FC6-44B6-9147-03F8FB227399]]></uid>
|
| 704 |
-
</SQLField>
|
| 705 |
-
<labelColor><![CDATA[{0.832175,0.985466,0.47333,1}]]></labelColor>
|
| 706 |
-
<labelWindowIndex><![CDATA[8]]></labelWindowIndex>
|
| 707 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 708 |
-
<uid><![CDATA[8CB45F3C-BF5E-434B-A241-D80E55BAFFA0]]></uid>
|
| 709 |
-
</SQLTable>
|
| 710 |
-
<SQLCanvasArea>
|
| 711 |
-
<name><![CDATA[Canvas Area1]]></name>
|
| 712 |
-
<comment><![CDATA[]]></comment>
|
| 713 |
-
<location>
|
| 714 |
-
<x>1955.00</x>
|
| 715 |
-
<y>983.00</y>
|
| 716 |
-
</location>
|
| 717 |
-
<size>
|
| 718 |
-
<width>308.00</width>
|
| 719 |
-
<height>609.00</height>
|
| 720 |
-
</size>
|
| 721 |
-
<zorder>15</zorder>
|
| 722 |
-
<commentTitle><![CDATA[Fraud detection]]></commentTitle>
|
| 723 |
-
<labelColor><![CDATA[{0.858781,0.210356,0.311416,0.273297}]]></labelColor>
|
| 724 |
-
<labelWindowIndex><![CDATA[5]]></labelWindowIndex>
|
| 725 |
-
<uid><![CDATA[9544A9F5-FE14-47F5-817E-2B496E7BD95D]]></uid>
|
| 726 |
-
</SQLCanvasArea>
|
| 727 |
-
<SQLCanvasArea>
|
| 728 |
-
<name><![CDATA[Canvas Area1_2]]></name>
|
| 729 |
-
<comment><![CDATA[]]></comment>
|
| 730 |
-
<location>
|
| 731 |
-
<x>1128.00</x>
|
| 732 |
-
<y>986.00</y>
|
| 733 |
-
</location>
|
| 734 |
-
<size>
|
| 735 |
-
<width>355.00</width>
|
| 736 |
-
<height>456.00</height>
|
| 737 |
-
</size>
|
| 738 |
-
<zorder>14</zorder>
|
| 739 |
-
<commentTitle><![CDATA[Transactions]]></commentTitle>
|
| 740 |
-
<labelColor><![CDATA[{0.0626183,0.585262,0.300111,0.234291}]]></labelColor>
|
| 741 |
-
<labelWindowIndex><![CDATA[6]]></labelWindowIndex>
|
| 742 |
-
<uid><![CDATA[9B0CEBBD-986C-4D4A-BB51-2E06618D74F3]]></uid>
|
| 743 |
-
</SQLCanvasArea>
|
| 744 |
-
<SQLTable>
|
| 745 |
-
<name><![CDATA[merchants]]></name>
|
| 746 |
-
<schema><![CDATA[]]></schema>
|
| 747 |
-
<location>
|
| 748 |
-
<x>762.00</x>
|
| 749 |
-
<y>1369.00</y>
|
| 750 |
-
</location>
|
| 751 |
-
<size>
|
| 752 |
-
<width>237.00</width>
|
| 753 |
-
<height>140.00</height>
|
| 754 |
-
</size>
|
| 755 |
-
<zorder>11</zorder>
|
| 756 |
-
<SQLField>
|
| 757 |
-
<name><![CDATA[merchant_id]]></name>
|
| 758 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 759 |
-
<primaryKey>1</primaryKey>
|
| 760 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 761 |
-
<uid><![CDATA[471DBA24-3923-42DA-945C-C58E8643D871]]></uid>
|
| 762 |
-
</SQLField>
|
| 763 |
-
<SQLField>
|
| 764 |
-
<name><![CDATA[name]]></name>
|
| 765 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 766 |
-
<notNull><![CDATA[1]]></notNull>
|
| 767 |
-
<uid><![CDATA[506A8140-314F-4A74-9EB2-AA45BB306235]]></uid>
|
| 768 |
-
</SQLField>
|
| 769 |
-
<SQLField>
|
| 770 |
-
<name><![CDATA[business_id]]></name>
|
| 771 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 772 |
-
<uid><![CDATA[1BABA073-DAC2-48CE-9F72-4C4B4DDAF38E]]></uid>
|
| 773 |
-
<unique><![CDATA[1]]></unique>
|
| 774 |
-
</SQLField>
|
| 775 |
-
<SQLField>
|
| 776 |
-
<name><![CDATA[country]]></name>
|
| 777 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 778 |
-
<uid><![CDATA[1A1E41F5-09C6-48A8-A3EB-8818FBA2379A]]></uid>
|
| 779 |
-
</SQLField>
|
| 780 |
-
<SQLField>
|
| 781 |
-
<name><![CDATA[status]]></name>
|
| 782 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 783 |
-
<uid><![CDATA[14E5F9C1-17EA-4F62-BE42-B2940E9B9725]]></uid>
|
| 784 |
-
</SQLField>
|
| 785 |
-
<SQLField>
|
| 786 |
-
<name><![CDATA[payout_schedule]]></name>
|
| 787 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 788 |
-
<uid><![CDATA[89E736F2-FD90-441D-B0ED-8EC4AD2C1DEB]]></uid>
|
| 789 |
-
</SQLField>
|
| 790 |
-
<labelColor><![CDATA[{0.953876,0.393018,0.30782,1}]]></labelColor>
|
| 791 |
-
<labelWindowIndex><![CDATA[16]]></labelWindowIndex>
|
| 792 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 793 |
-
<uid><![CDATA[9BAE2600-3273-4010-B46C-4A004EAE8D47]]></uid>
|
| 794 |
-
</SQLTable>
|
| 795 |
-
<SQLTable>
|
| 796 |
-
<name><![CDATA[fraud_blacklist]]></name>
|
| 797 |
-
<schema><![CDATA[]]></schema>
|
| 798 |
-
<location>
|
| 799 |
-
<x>1985.00</x>
|
| 800 |
-
<y>1024.00</y>
|
| 801 |
-
</location>
|
| 802 |
-
<size>
|
| 803 |
-
<width>221.00</width>
|
| 804 |
-
<height>180.00</height>
|
| 805 |
-
</size>
|
| 806 |
-
<zorder>20</zorder>
|
| 807 |
-
<SQLField>
|
| 808 |
-
<name><![CDATA[blacklist_id]]></name>
|
| 809 |
-
<type><![CDATA[SERIAL]]></type>
|
| 810 |
-
<primaryKey>1</primaryKey>
|
| 811 |
-
<uid><![CDATA[218BDF8F-4A7B-4420-9F49-B0B01B9A1C4D]]></uid>
|
| 812 |
-
</SQLField>
|
| 813 |
-
<SQLField>
|
| 814 |
-
<name><![CDATA[entity_id]]></name>
|
| 815 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 816 |
-
<notNull><![CDATA[1]]></notNull>
|
| 817 |
-
<uid><![CDATA[8EE5C5FE-45EE-4F01-A9F6-D1734C251C92]]></uid>
|
| 818 |
-
</SQLField>
|
| 819 |
-
<SQLField>
|
| 820 |
-
<name><![CDATA[entity_type]]></name>
|
| 821 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 822 |
-
<notNull><![CDATA[1]]></notNull>
|
| 823 |
-
<uid><![CDATA[577979EF-AE41-4F17-ADE6-016B960FE053]]></uid>
|
| 824 |
-
</SQLField>
|
| 825 |
-
<SQLField>
|
| 826 |
-
<name><![CDATA[user_id]]></name>
|
| 827 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 828 |
-
<referencesField>user_id</referencesField>
|
| 829 |
-
<referencesTable>users</referencesTable>
|
| 830 |
-
<deleteAction>3</deleteAction>
|
| 831 |
-
<referencesField><![CDATA[user_id]]></referencesField>
|
| 832 |
-
<referencesTable><![CDATA[users]]></referencesTable>
|
| 833 |
-
<sourceCardinality>1</sourceCardinality>
|
| 834 |
-
<destinationCardinality>1</destinationCardinality>
|
| 835 |
-
<referencesFieldUID><![CDATA[924863BD-A417-400E-BFE1-CD6B926326E8]]></referencesFieldUID>
|
| 836 |
-
<referencesTableUID><![CDATA[6F7D0F22-32AC-437A-90CD-2E17C5E8D9BD]]></referencesTableUID>
|
| 837 |
-
<connectorLineStyle><![CDATA[1]]></connectorLineStyle>
|
| 838 |
-
<connectorMidPoint><![CDATA[1773.000000]]></connectorMidPoint>
|
| 839 |
-
<referenceLinkName><![CDATA[is]]></referenceLinkName>
|
| 840 |
-
<uid><![CDATA[B17A27D8-9C3D-4543-B799-A61F40EBB31D]]></uid>
|
| 841 |
-
</SQLField>
|
| 842 |
-
<SQLField>
|
| 843 |
-
<name><![CDATA[transaction_id]]></name>
|
| 844 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 845 |
-
<referencesField>transaction_id</referencesField>
|
| 846 |
-
<referencesTable>transactions</referencesTable>
|
| 847 |
-
<deleteAction>3</deleteAction>
|
| 848 |
-
<referencesField><![CDATA[transaction_id]]></referencesField>
|
| 849 |
-
<referencesTable><![CDATA[transactions]]></referencesTable>
|
| 850 |
-
<sourceCardinality>1</sourceCardinality>
|
| 851 |
-
<destinationCardinality>1</destinationCardinality>
|
| 852 |
-
<referencesFieldUID><![CDATA[F3B1DE2E-E398-439B-B066-3989F2B47FCF]]></referencesFieldUID>
|
| 853 |
-
<referencesTableUID><![CDATA[0B598F8E-F894-4AD2-A0A1-7FBCC236A353]]></referencesTableUID>
|
| 854 |
-
<connectorHidden><![CDATA[0]]></connectorHidden>
|
| 855 |
-
<connectorLineStyle><![CDATA[1]]></connectorLineStyle>
|
| 856 |
-
<connectorMidPoint><![CDATA[1681.000000]]></connectorMidPoint>
|
| 857 |
-
<referenceLinkName><![CDATA[is]]></referenceLinkName>
|
| 858 |
-
<uid><![CDATA[A3454BBD-D8EA-4A4B-A5E3-58621D29EFB4]]></uid>
|
| 859 |
-
</SQLField>
|
| 860 |
-
<SQLField>
|
| 861 |
-
<name><![CDATA[reason]]></name>
|
| 862 |
-
<type><![CDATA[TEXT]]></type>
|
| 863 |
-
<uid><![CDATA[B588CF31-4510-442A-BDC6-270A72E3CF07]]></uid>
|
| 864 |
-
</SQLField>
|
| 865 |
-
<SQLField>
|
| 866 |
-
<name><![CDATA[added_at]]></name>
|
| 867 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 868 |
-
<defaultValue><![CDATA[CURRENT_TIMESTAMP]]></defaultValue>
|
| 869 |
-
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
|
| 870 |
-
<uid><![CDATA[CC08BEAA-2475-40C0-8AC1-4790BC57ABD4]]></uid>
|
| 871 |
-
</SQLField>
|
| 872 |
-
<SQLConstraint>
|
| 873 |
-
<name><![CDATA[cons]]></name>
|
| 874 |
-
<fieldName><![CDATA[entity_id]]></fieldName>
|
| 875 |
-
<fieldName><![CDATA[entity_type]]></fieldName>
|
| 876 |
-
<SQLIndexEntry>
|
| 877 |
-
<name><![CDATA[entity_id]]></name>
|
| 878 |
-
<prefixSize><![CDATA[]]></prefixSize>
|
| 879 |
-
<fieldUid><![CDATA[8EE5C5FE-45EE-4F01-A9F6-D1734C251C92]]></fieldUid>
|
| 880 |
-
</SQLIndexEntry>
|
| 881 |
-
<SQLIndexEntry>
|
| 882 |
-
<name><![CDATA[entity_type]]></name>
|
| 883 |
-
<prefixSize><![CDATA[]]></prefixSize>
|
| 884 |
-
<fieldUid><![CDATA[577979EF-AE41-4F17-ADE6-016B960FE053]]></fieldUid>
|
| 885 |
-
</SQLIndexEntry>
|
| 886 |
-
<indexType><![CDATA[UNIQUE]]></indexType>
|
| 887 |
-
<uid><![CDATA[ECEA86FF-EE5D-495A-A4FA-63FD44BF2DB4]]></uid>
|
| 888 |
-
</SQLConstraint>
|
| 889 |
-
<labelColor><![CDATA[{0.74902,0.184314,0.270588,1}]]></labelColor>
|
| 890 |
-
<labelWindowIndex><![CDATA[0]]></labelWindowIndex>
|
| 891 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 892 |
-
<uid><![CDATA[AF3C2E70-2201-499E-9260-7757F12D1BB8]]></uid>
|
| 893 |
-
</SQLTable>
|
| 894 |
-
<SQLTable>
|
| 895 |
-
<name><![CDATA[support_tickets]]></name>
|
| 896 |
-
<schema><![CDATA[]]></schema>
|
| 897 |
-
<location>
|
| 898 |
-
<x>372.00</x>
|
| 899 |
-
<y>1349.00</y>
|
| 900 |
-
</location>
|
| 901 |
-
<size>
|
| 902 |
-
<width>225.00</width>
|
| 903 |
-
<height>200.00</height>
|
| 904 |
-
</size>
|
| 905 |
-
<zorder>1</zorder>
|
| 906 |
-
<SQLField>
|
| 907 |
-
<name><![CDATA[ticket_id]]></name>
|
| 908 |
-
<type><![CDATA[SERIAL]]></type>
|
| 909 |
-
<primaryKey>1</primaryKey>
|
| 910 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 911 |
-
<uid><![CDATA[22534F3D-251C-402A-9192-0BBF0EF0071F]]></uid>
|
| 912 |
-
</SQLField>
|
| 913 |
-
<SQLField>
|
| 914 |
-
<name><![CDATA[merchant_id]]></name>
|
| 915 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 916 |
-
<referencesField>merchant_id</referencesField>
|
| 917 |
-
<referencesTable>merchants</referencesTable>
|
| 918 |
-
<deleteAction>3</deleteAction>
|
| 919 |
-
<referencesField><![CDATA[merchant_id]]></referencesField>
|
| 920 |
-
<referencesTable><![CDATA[merchants]]></referencesTable>
|
| 921 |
-
<sourceCardinality>5</sourceCardinality>
|
| 922 |
-
<destinationCardinality>1</destinationCardinality>
|
| 923 |
-
<referencesFieldUID><![CDATA[471DBA24-3923-42DA-945C-C58E8643D871]]></referencesFieldUID>
|
| 924 |
-
<referencesTableUID><![CDATA[9BAE2600-3273-4010-B46C-4A004EAE8D47]]></referencesTableUID>
|
| 925 |
-
<connectorLineStyle><![CDATA[1]]></connectorLineStyle>
|
| 926 |
-
<uid><![CDATA[D568209D-F8DB-4A57-9061-B414FA1418BA]]></uid>
|
| 927 |
-
</SQLField>
|
| 928 |
-
<SQLField>
|
| 929 |
-
<name><![CDATA[user_id]]></name>
|
| 930 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 931 |
-
<referencesField>user_id</referencesField>
|
| 932 |
-
<referencesTable>users</referencesTable>
|
| 933 |
-
<deleteAction>3</deleteAction>
|
| 934 |
-
<referencesField><![CDATA[user_id]]></referencesField>
|
| 935 |
-
<referencesTable><![CDATA[users]]></referencesTable>
|
| 936 |
-
<sourceCardinality>5</sourceCardinality>
|
| 937 |
-
<destinationCardinality>1</destinationCardinality>
|
| 938 |
-
<referencesFieldUID><![CDATA[924863BD-A417-400E-BFE1-CD6B926326E8]]></referencesFieldUID>
|
| 939 |
-
<referencesTableUID><![CDATA[6F7D0F22-32AC-437A-90CD-2E17C5E8D9BD]]></referencesTableUID>
|
| 940 |
-
<connectorLineStyle><![CDATA[1]]></connectorLineStyle>
|
| 941 |
-
<uid><![CDATA[6BE01C01-653E-4E67-A3BB-10C67556E04E]]></uid>
|
| 942 |
-
</SQLField>
|
| 943 |
-
<SQLField>
|
| 944 |
-
<name><![CDATA[subject]]></name>
|
| 945 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 946 |
-
<notNull><![CDATA[1]]></notNull>
|
| 947 |
-
<uid><![CDATA[5D5AFE14-D0C4-4F28-954E-BCB929CEB84E]]></uid>
|
| 948 |
-
</SQLField>
|
| 949 |
-
<SQLField>
|
| 950 |
-
<name><![CDATA[description]]></name>
|
| 951 |
-
<type><![CDATA[TEXT]]></type>
|
| 952 |
-
<uid><![CDATA[976A256C-62F5-4CEF-B8E8-8475BF452773]]></uid>
|
| 953 |
-
</SQLField>
|
| 954 |
-
<SQLField>
|
| 955 |
-
<name><![CDATA[status]]></name>
|
| 956 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 957 |
-
<defaultValue><![CDATA['open']]></defaultValue>
|
| 958 |
-
<indexed><![CDATA[1]]></indexed>
|
| 959 |
-
<indexedKeyName><![CDATA[idx_support_tickets_status]]></indexedKeyName>
|
| 960 |
-
<uid><![CDATA[826FB428-DE67-4BF3-B9D8-C2ADA30F5E50]]></uid>
|
| 961 |
-
</SQLField>
|
| 962 |
-
<SQLField>
|
| 963 |
-
<name><![CDATA[priority]]></name>
|
| 964 |
-
<type><![CDATA[VARCHAR(20)]]></type>
|
| 965 |
-
<defaultValue><![CDATA['medium']]></defaultValue>
|
| 966 |
-
<uid><![CDATA[488794C7-1A42-4B9A-A503-B1C25E3369D4]]></uid>
|
| 967 |
-
</SQLField>
|
| 968 |
-
<SQLField>
|
| 969 |
-
<name><![CDATA[created_at]]></name>
|
| 970 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 971 |
-
<defaultValue><![CDATA[CURRENT_TIMESTAMP]]></defaultValue>
|
| 972 |
-
<noQuoteDefault><![CDATA[1]]></noQuoteDefault>
|
| 973 |
-
<uid><![CDATA[94E562D1-66B5-4472-BFB4-84A03CF6C41B]]></uid>
|
| 974 |
-
</SQLField>
|
| 975 |
-
<SQLField>
|
| 976 |
-
<name><![CDATA[resolved_at]]></name>
|
| 977 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 978 |
-
<uid><![CDATA[734CA0C4-9D43-4926-A7FD-6D776658BFD3]]></uid>
|
| 979 |
-
</SQLField>
|
| 980 |
-
<labelColor><![CDATA[{0.832175,0.985466,0.47333,1}]]></labelColor>
|
| 981 |
-
<labelWindowIndex><![CDATA[9]]></labelWindowIndex>
|
| 982 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 983 |
-
<uid><![CDATA[B83E941B-7F3A-4958-86CD-7F7CB74CBA46]]></uid>
|
| 984 |
-
</SQLTable>
|
| 985 |
-
<SQLCanvasArea>
|
| 986 |
-
<name><![CDATA[Canvas Area1_5]]></name>
|
| 987 |
-
<comment><![CDATA[]]></comment>
|
| 988 |
-
<location>
|
| 989 |
-
<x>333.00</x>
|
| 990 |
-
<y>1170.00</y>
|
| 991 |
-
</location>
|
| 992 |
-
<size>
|
| 993 |
-
<width>303.00</width>
|
| 994 |
-
<height>403.00</height>
|
| 995 |
-
</size>
|
| 996 |
-
<zorder>16</zorder>
|
| 997 |
-
<commentTitle><![CDATA[Support]]></commentTitle>
|
| 998 |
-
<labelColor><![CDATA[{0.832175,0.985466,0.47333,0.236286}]]></labelColor>
|
| 999 |
-
<labelWindowIndex><![CDATA[4]]></labelWindowIndex>
|
| 1000 |
-
<uid><![CDATA[BFA1ED9B-B5A3-48C8-A9E0-BD652F31F624]]></uid>
|
| 1001 |
-
</SQLCanvasArea>
|
| 1002 |
-
<SQLTable>
|
| 1003 |
-
<name><![CDATA[payment_methods]]></name>
|
| 1004 |
-
<schema><![CDATA[]]></schema>
|
| 1005 |
-
<location>
|
| 1006 |
-
<x>1121.00</x>
|
| 1007 |
-
<y>1708.00</y>
|
| 1008 |
-
</location>
|
| 1009 |
-
<size>
|
| 1010 |
-
<width>282.00</width>
|
| 1011 |
-
<height>160.00</height>
|
| 1012 |
-
</size>
|
| 1013 |
-
<zorder>10</zorder>
|
| 1014 |
-
<SQLField>
|
| 1015 |
-
<name><![CDATA[payment_method_id]]></name>
|
| 1016 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 1017 |
-
<primaryKey>1</primaryKey>
|
| 1018 |
-
<forcedUnique><![CDATA[1]]></forcedUnique>
|
| 1019 |
-
<uid><![CDATA[3A1E0597-8D45-4952-AAF5-6F0D1358B1FD]]></uid>
|
| 1020 |
-
</SQLField>
|
| 1021 |
-
<SQLField>
|
| 1022 |
-
<name><![CDATA[user_id]]></name>
|
| 1023 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 1024 |
-
<referencesField>user_id</referencesField>
|
| 1025 |
-
<referencesTable>users</referencesTable>
|
| 1026 |
-
<deleteAction>1</deleteAction>
|
| 1027 |
-
<updateAction>12983400752</updateAction>
|
| 1028 |
-
<referencesField><![CDATA[user_id]]></referencesField>
|
| 1029 |
-
<referencesTable><![CDATA[users]]></referencesTable>
|
| 1030 |
-
<sourceCardinality>0</sourceCardinality>
|
| 1031 |
-
<destinationCardinality>0</destinationCardinality>
|
| 1032 |
-
<referencesFieldUID><![CDATA[924863BD-A417-400E-BFE1-CD6B926326E8]]></referencesFieldUID>
|
| 1033 |
-
<referencesTableUID><![CDATA[6F7D0F22-32AC-437A-90CD-2E17C5E8D9BD]]></referencesTableUID>
|
| 1034 |
-
<connectorLineStyle><![CDATA[1]]></connectorLineStyle>
|
| 1035 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 1036 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 1037 |
-
<notNull><![CDATA[1]]></notNull>
|
| 1038 |
-
<uid><![CDATA[7F81CB01-65B6-48DB-AF88-BD12C987FD03]]></uid>
|
| 1039 |
-
</SQLField>
|
| 1040 |
-
<SQLField>
|
| 1041 |
-
<name><![CDATA[type]]></name>
|
| 1042 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 1043 |
-
<notNull><![CDATA[1]]></notNull>
|
| 1044 |
-
<uid><![CDATA[BAF23616-8935-42D6-AE4F-3EC1545C035E]]></uid>
|
| 1045 |
-
</SQLField>
|
| 1046 |
-
<SQLField>
|
| 1047 |
-
<name><![CDATA[card_last4]]></name>
|
| 1048 |
-
<type><![CDATA[VARCHAR(4)]]></type>
|
| 1049 |
-
<uid><![CDATA[6A1E64F3-18C3-4B41-908D-F439AE3BD996]]></uid>
|
| 1050 |
-
</SQLField>
|
| 1051 |
-
<SQLField>
|
| 1052 |
-
<name><![CDATA[card_brand]]></name>
|
| 1053 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 1054 |
-
<uid><![CDATA[73C96C4A-D7E9-4B56-AA10-AA653328FDD8]]></uid>
|
| 1055 |
-
</SQLField>
|
| 1056 |
-
<SQLField>
|
| 1057 |
-
<name><![CDATA[expiry_date]]></name>
|
| 1058 |
-
<type><![CDATA[DATE]]></type>
|
| 1059 |
-
<uid><![CDATA[A6E71B4E-6B4A-40B9-B4AC-D1BCBD67A021]]></uid>
|
| 1060 |
-
</SQLField>
|
| 1061 |
-
<SQLField>
|
| 1062 |
-
<name><![CDATA[is_default]]></name>
|
| 1063 |
-
<type><![CDATA[BOOLEAN]]></type>
|
| 1064 |
-
<uid><![CDATA[1F05AEBD-D51A-4223-A02A-0F6140A92D4B]]></uid>
|
| 1065 |
-
</SQLField>
|
| 1066 |
-
<labelColor><![CDATA[{0.552896,0.12298,0.559,1}]]></labelColor>
|
| 1067 |
-
<labelWindowIndex><![CDATA[18]]></labelWindowIndex>
|
| 1068 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 1069 |
-
<uid><![CDATA[E88A698C-AE0A-43D1-A1CD-3EF38745CDBD]]></uid>
|
| 1070 |
-
</SQLTable>
|
| 1071 |
-
<SQLTable>
|
| 1072 |
-
<name><![CDATA[invoices]]></name>
|
| 1073 |
-
<schema><![CDATA[]]></schema>
|
| 1074 |
-
<location>
|
| 1075 |
-
<x>765.00</x>
|
| 1076 |
-
<y>1036.00</y>
|
| 1077 |
-
</location>
|
| 1078 |
-
<size>
|
| 1079 |
-
<width>231.00</width>
|
| 1080 |
-
<height>160.00</height>
|
| 1081 |
-
</size>
|
| 1082 |
-
<zorder>7</zorder>
|
| 1083 |
-
<SQLField>
|
| 1084 |
-
<name><![CDATA[invoice_id]]></name>
|
| 1085 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 1086 |
-
<primaryKey>1</primaryKey>
|
| 1087 |
-
<uid><![CDATA[9955F57B-896A-41E6-8445-B36A36B44F16]]></uid>
|
| 1088 |
-
</SQLField>
|
| 1089 |
-
<SQLField>
|
| 1090 |
-
<name><![CDATA[merchant_id]]></name>
|
| 1091 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 1092 |
-
<referencesField>merchant_id</referencesField>
|
| 1093 |
-
<referencesTable>merchants</referencesTable>
|
| 1094 |
-
<deleteAction>1</deleteAction>
|
| 1095 |
-
<updateAction>12983400752</updateAction>
|
| 1096 |
-
<referencesField><![CDATA[merchant_id]]></referencesField>
|
| 1097 |
-
<referencesTable><![CDATA[merchants]]></referencesTable>
|
| 1098 |
-
<sourceCardinality>5</sourceCardinality>
|
| 1099 |
-
<destinationCardinality>1</destinationCardinality>
|
| 1100 |
-
<referencesFieldUID><![CDATA[471DBA24-3923-42DA-945C-C58E8643D871]]></referencesFieldUID>
|
| 1101 |
-
<referencesTableUID><![CDATA[9BAE2600-3273-4010-B46C-4A004EAE8D47]]></referencesTableUID>
|
| 1102 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 1103 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 1104 |
-
<notNull><![CDATA[1]]></notNull>
|
| 1105 |
-
<uid><![CDATA[264EC01B-5B40-4AE5-9B76-372CF6F306EA]]></uid>
|
| 1106 |
-
</SQLField>
|
| 1107 |
-
<SQLField>
|
| 1108 |
-
<name><![CDATA[account_id]]></name>
|
| 1109 |
-
<type><![CDATA[VARCHAR(255)]]></type>
|
| 1110 |
-
<deferrable><![CDATA[0]]></deferrable>
|
| 1111 |
-
<initiallyDeferred><![CDATA[0]]></initiallyDeferred>
|
| 1112 |
-
<notNull><![CDATA[1]]></notNull>
|
| 1113 |
-
<uid><![CDATA[2DE5F17B-8468-4456-A0E5-B62F505F8EA5]]></uid>
|
| 1114 |
-
</SQLField>
|
| 1115 |
-
<SQLField>
|
| 1116 |
-
<name><![CDATA[amount]]></name>
|
| 1117 |
-
<type><![CDATA[DECIMAL(15 , 2)]]></type>
|
| 1118 |
-
<notNull><![CDATA[1]]></notNull>
|
| 1119 |
-
<uid><![CDATA[04A52512-A1BF-4164-8BF8-BF7368A7C773]]></uid>
|
| 1120 |
-
</SQLField>
|
| 1121 |
-
<SQLField>
|
| 1122 |
-
<name><![CDATA[currency]]></name>
|
| 1123 |
-
<type><![CDATA[VARCHAR(3)]]></type>
|
| 1124 |
-
<uid><![CDATA[4FB45CB9-ECA5-4B07-8F72-0C7801779957]]></uid>
|
| 1125 |
-
</SQLField>
|
| 1126 |
-
<SQLField>
|
| 1127 |
-
<name><![CDATA[status]]></name>
|
| 1128 |
-
<type><![CDATA[VARCHAR(50)]]></type>
|
| 1129 |
-
<uid><![CDATA[45D5C7E0-41E5-4144-9C08-50F9ED68B50C]]></uid>
|
| 1130 |
-
</SQLField>
|
| 1131 |
-
<SQLField>
|
| 1132 |
-
<name><![CDATA[due_date]]></name>
|
| 1133 |
-
<type><![CDATA[TIMESTAMP]]></type>
|
| 1134 |
-
<uid><![CDATA[927A64F5-5301-4556-A54E-5D9B187AF6F9]]></uid>
|
| 1135 |
-
</SQLField>
|
| 1136 |
-
<labelColor><![CDATA[{0.953876,0.393018,0.30782,1}]]></labelColor>
|
| 1137 |
-
<labelWindowIndex><![CDATA[15]]></labelWindowIndex>
|
| 1138 |
-
<ui.treeExpanded><![CDATA[1]]></ui.treeExpanded>
|
| 1139 |
-
<uid><![CDATA[EC76BC22-945B-4A92-8E47-22821DB0798A]]></uid>
|
| 1140 |
-
</SQLTable>
|
| 1141 |
-
<SQLDocumentInfo>
|
| 1142 |
-
<encodedPrintInfo><![CDATA[BAtzdHJlYW10eXBlZIHoA4QBQISEhAtOU1ByaW50SW5mbwGEhAhOU09iamVjdACFkoSEhBNOU011dGFibGVEaWN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2l6ZT1kZH2fgVMCgUoDhpKEmZkWTlNIb3Jpem9udGFsbHlDZW50ZXJlZIaShISECE5TTnVtYmVyAJ+ehIQBY6EBhpKEmZkUTlNWZXJ0aWNhbGx5Q2VudGVyZWSGkqKShJmZDE5TTGVmdE1hcmdpboaShKOehIQBZKIShpKEmZkNTlNSaWdodE1hcmdpboaSp5KEmZkLTlNUb3BNYXJnaW6GkoSjnqiiHoaShJmZDU5TT3JpZW50YXRpb26GkoSjnoSEAXGjAIaShJmZFU5TSG9yaXpvbmFsUGFnaW5hdGlvboaSrZKEmZkUTlNWZXJ0aWNhbFBhZ2luYXRpb26Gkq2ShJmZDk5TQm90dG9tTWFyZ2luhpKEo56oojWGkoSZmQtOU1BhcGVyTmFtZYaShJmZBmlzby1hNIaShJmZD05TU2NhbGluZ0ZhY3RvcoaShKOeqKIBhoaG]]></encodedPrintInfo>
|
| 1143 |
-
<autoSizeTablesOption><![CDATA[0]]></autoSizeTablesOption>
|
| 1144 |
-
<cardinalityNotationStyle><![CDATA[0]]></cardinalityNotationStyle>
|
| 1145 |
-
<documentScaleFactor><![CDATA[1]]></documentScaleFactor>
|
| 1146 |
-
<dropTableOption><![CDATA[0]]></dropTableOption>
|
| 1147 |
-
<exportDialect><![CDATA[mysql]]></exportDialect>
|
| 1148 |
-
<fileversion><![CDATA[4]]></fileversion>
|
| 1149 |
-
<footer><![CDATA[Jedha - 12/25]]></footer>
|
| 1150 |
-
<generator><![CDATA[com.malcolmhardie.sqleditor]]></generator>
|
| 1151 |
-
<generatorVersion><![CDATA[3.6.2]]></generatorVersion>
|
| 1152 |
-
<header><![CDATA[Bloc 2 - Stripe - OLTP]]></header>
|
| 1153 |
-
<hideFieldIcons><![CDATA[0]]></hideFieldIcons>
|
| 1154 |
-
<hideFieldTypes><![CDATA[0]]></hideFieldTypes>
|
| 1155 |
-
<overviewPanelHidden><![CDATA[0]]></overviewPanelHidden>
|
| 1156 |
-
<pageBoundariesVisible><![CDATA[0]]></pageBoundariesVisible>
|
| 1157 |
-
<PageGridVisible><![CDATA[0]]></PageGridVisible>
|
| 1158 |
-
<RightSidebarWidth><![CDATA[2559.000000]]></RightSidebarWidth>
|
| 1159 |
-
<sidebarIndex><![CDATA[0]]></sidebarIndex>
|
| 1160 |
-
<snapToGrid><![CDATA[0]]></snapToGrid>
|
| 1161 |
-
<SourceSidebarWidth><![CDATA[312.000000]]></SourceSidebarWidth>
|
| 1162 |
-
<SQLEditorFileFormatVersion><![CDATA[4]]></SQLEditorFileFormatVersion>
|
| 1163 |
-
<uid><![CDATA[BD6D1D38-5559-4DF4-A21E-68C08E174511]]></uid>
|
| 1164 |
-
<windowHeight><![CDATA[1409.000000]]></windowHeight>
|
| 1165 |
-
<windowLocationX><![CDATA[-2560.000000]]></windowLocationX>
|
| 1166 |
-
<windowLocationY><![CDATA[72.000000]]></windowLocationY>
|
| 1167 |
-
<windowScrollOrigin><![CDATA[{168, 757}]]></windowScrollOrigin>
|
| 1168 |
-
<windowWidth><![CDATA[2560.000000]]></windowWidth>
|
| 1169 |
-
</SQLDocumentInfo>
|
| 1170 |
-
<AllowsIndexRenamingOnInsert><![CDATA[1]]></AllowsIndexRenamingOnInsert>
|
| 1171 |
-
<defaultLabelExpanded><![CDATA[1]]></defaultLabelExpanded>
|
| 1172 |
-
<ui.treeDisplayMode><![CDATA[0]]></ui.treeDisplayMode>
|
| 1173 |
-
<MHObjectStyle>
|
| 1174 |
-
<font key="boldObjectFont" name="AvenirNext-Bold" size="12.000000"></font>
|
| 1175 |
-
<font key="boldObjectTitleFont" name="AvenirNext-Bold" size="12.000000"></font>
|
| 1176 |
-
<font key="objectFont" name="AvenirNext-Regular" size="12.000000"></font>
|
| 1177 |
-
<font key="objectTitleFont" name="AvenirNext-Bold" size="12.000000"></font>
|
| 1178 |
-
</MHObjectStyle>
|
| 1179 |
-
</SQLContainer>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bloc2 - Data Architecture/README.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
| 1 |
-
# 🎓 Certification AIA - Architecte en Intelligence Artificielle
|
| 2 |
-
|
| 3 |
-
[](https://www.francecompetences.fr/recherche/rncp/38777/)
|
| 4 |
-
[-green>)](https://www.francecompetences.fr/recherche/rncp/38777/)
|
| 5 |
-
[]()
|
| 6 |
-
|
| 7 |
-
---
|
| 8 |
-
|
| 9 |
-
## 📋 Table des matières
|
| 10 |
-
|
| 11 |
-
- [Bloc 2 - Data Architecture](#bloc-2---data-architecture)
|
| 12 |
-
- [Objectifs](#objectifs)
|
| 13 |
-
- [Contenu](#contenu)
|
| 14 |
-
- [Ressources](#ressources)
|
| 15 |
-
|
| 16 |
-
## 🟢 Bloc 2 - Data Architecture
|
| 17 |
-
|
| 18 |
-
### Objectifs
|
| 19 |
-
|
| 20 |
-
Concevoir et implémenter des architectures de données scalables et performantes pour supporter les solutions d'intelligence artificielle.
|
| 21 |
-
|
| 22 |
-
### Contenu
|
| 23 |
-
|
| 24 |
-
- Architecture des données et design patterns
|
| 25 |
-
- Stockage de données (Data Lake, Data Warehouse)
|
| 26 |
-
- Pipelines ETL/ELT et orchestration
|
| 27 |
-
- Scalabilité et performance
|
| 28 |
-
- Sécurité et gouvernance des architectures
|
| 29 |
-
|
| 30 |
-
### Ressources
|
| 31 |
-
|
| 32 |
-
Les ressources et exercices pratiques sont organisés dans les dossiers de ce bloc.
|
| 33 |
-
|
| 34 |
-
---
|
| 35 |
-
|
| 36 |
-
## 📝 Licence
|
| 37 |
-
|
| 38 |
-
Ce projet est sous licence MIT - voir le fichier [LICENSE](LICENSE) pour plus de détails.
|
| 39 |
-
|
| 40 |
-
---
|
| 41 |
-
|
| 42 |
-
## 📧 Contact
|
| 43 |
-
|
| 44 |
-
- **Candidat** : David RAMBEAU
|
| 45 |
-
- **Formation** : Lead Data Science & Engineering
|
| 46 |
-
- **Certification** : AIA - RNCP38777
|
| 47 |
-
- **Email** : david.rambeau@gmail.com
|
| 48 |
-
- **LinkedIn** : https://www.linkedin.com/in/davidrambeau/
|
| 49 |
-
- **GitHub** : https://github.com/AByGCreation
|
| 50 |
-
|
| 51 |
-
---
|
| 52 |
-
|
| 53 |
-
**Dernière mise à jour** : Décembre 2025
|
| 54 |
-
|
| 55 |
-
**Version** : 1.0.0
|
| 56 |
-
|
| 57 |
-
**Statut du projet** : 🟡 En cours de développement
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|