How oussemaharrabi/kanz-petitfour works
KANZ is a Tunisian investing assistant with separate investor and CMF-inspector experiences. Users enter through role selection, then explore market and portfolio information, predictions, sentiment, alerts, and investment guidance; inspectors monitor anomalies and investigate suspicious activity. The backend exposes these capabilities through FastAPI, backed by market/ML services and persistent data, with a separate multilingual news collection and analysis subsystem. Edges rely on excerpted imports, the startup excerpt, or README architecture statements; unsampled implementation details are not asserted.
Main entry points: main.py FastAPI application · App.jsx Role and route entry · stocks.py Stock endpoints · database.py Market and user store
Components 29
Web experience
- Role and route entry
frontend/src/App.jsx - Stock analysis
frontend/src/pages/investor/Analysis.jsx - Investor profile
frontend/src/pages/investor/Profile.jsx - Portfolio simulator
frontend/src/pages/investor/Simulator.jsx - Inspector dashboards
frontend/src/pages/inspector - Stock sample data
frontend/src/data/stocks.js - API client
frontend/src/services/api.js
API and identity
- FastAPI application
backend/app/main.py - Authentication routes
backend/app/api/routes/auth.py - Identity and roles
backend/app/core/auth.py - Stock endpoints
backend/app/api/routes/stocks.py - Market endpoints
backend/app/api/routes/market.py - News endpoints
backend/app/api/routes/news.py - Portfolio endpoints
backend/app/api/routes/portfolio.py - Alert endpoints
backend/app/api/routes/alerts.py - Agent endpoint
backend/app/api/routes/agent.py
Market intelligence
- Price prediction
backend/app/services/prediction.py - Anomaly detection
backend/app/services/anomaly.py - Decision service
backend/app/services/decision.py - Sentiment service
backend/app/services/sentiment.py - Forecast model
ml/src/prediction.py - Anomaly model
ml/src/anomaly.py
Data and news
- Market and user store
backend/app/db/database.py - News scrapers
nlp/scrapers/news_scrapers.py - News scheduler
nlp/scrapers/scheduler.py - French-Arabic analyzer
nlp/sentiment/analyzer.py
Other components
- Investor
- CMF inspector
- Supabase auth
Connections 38
- Investor → Role and route entry: opens
frontend/src/App.jsx - CMF inspector → Role and route entry: opens
frontend/src/App.jsx - Role and route entry → Stock analysis: routes to
frontend/src/App.jsx - Role and route entry → Investor profile: routes to
frontend/src/App.jsx - Role and route entry → Portfolio simulator: routes to
frontend/src/App.jsx - Role and route entry → Inspector dashboards: routes to
frontend/src/App.jsx - Stock analysis → API client: requests data
frontend/src/pages/investor/Analysis.jsx - Investor profile → API client: requests data
frontend/src/pages/investor/Profile.jsx - API client → Stock sample data: uses fallback
frontend/src/services/useApi.js - Role and route entry → FastAPI application: uses REST API
- FastAPI application → Stock endpoints: registers
backend/app/main.py - FastAPI application → Market endpoints: registers
backend/app/main.py - FastAPI application → Authentication routes: registers
backend/app/main.py - FastAPI application → News endpoints: registers
backend/app/main.py - FastAPI application → Portfolio endpoints: registers
backend/app/main.py - FastAPI application → Alert endpoints: registers
backend/app/main.py - FastAPI application → Agent endpoint: registers
backend/app/main.py - Authentication routes → Identity and roles: resolves user
backend/app/api/routes/auth.py - Identity and roles → Market and user store: reads users
backend/app/core/auth.py - Authentication routes → Supabase auth: authenticates
backend/app/api/routes/auth.py - Stock endpoints → Market and user store: reads market data
backend/app/api/routes/stocks.py - Market endpoints → Market and user store: reads market data
backend/app/api/routes/market.py - Portfolio endpoints → Market and user store: reads portfolio
backend/app/api/routes/portfolio.py - Alert endpoints → Market and user store: reads alerts
backend/app/api/routes/alerts.py - News endpoints → Market and user store: reads news
backend/app/api/routes/news.py - Stock endpoints → Price prediction: requests forecasts
backend/app/api/routes/stocks.py - Stock endpoints → Anomaly detection: requests detection
backend/app/api/routes/stocks.py - Stock endpoints → Sentiment service: requests sentiment
backend/app/api/routes/stocks.py - Stock endpoints → Decision service: requests guidance
backend/app/api/routes/stocks.py - Market endpoints → Sentiment service: requests sentiment
backend/app/api/routes/market.py - News endpoints → French-Arabic analyzer: analyzes articles
backend/app/api/routes/news.py - Price prediction → Forecast model: uses model
backend/app/services/prediction.py - Anomaly detection → Anomaly model: uses model
backend/app/services/anomaly.py - Sentiment service → French-Arabic analyzer: delegates analysis
backend/app/services/sentiment.py - News scheduler → News scrapers: schedules collection
nlp/scrapers/scheduler.py - News scheduler → French-Arabic analyzer: uses analysis
nlp/scrapers/scheduler.py - FastAPI application → News scheduler: starts optionally
backend/app/main.py - Agent endpoint → Decision service: uses guidance
backend/app/api/routes/agent.py