How hliran207/distress-detector works
Distress-Detector collects and labels Reddit posts, stores them in MongoDB, serves browsing, search, statistics and prediction through a FastAPI API, and presents these capabilities in a React dashboard. The principal workflow runs from Reddit collection through post parsing and persistence to API-backed browsing or distress classification. The repository also includes PullPush collection, Telegram scanning, analytics and Kafka/WebSocket result broadcasting. Some subsystem links are based on README or SOURCE INDEX references; unsampled implementations are not assumed to have specific call paths.
Main entry points: api.ts API client · main.tsx Dashboard routes · reddit_scraper_controller.py Reddit scraper · main.py FastAPI app
Components 33
Post collection
- Reddit scraper
app/controllers/reddit_scraper_controller.py - Chrome driver
app/services/chrome_driver.py - Post parser
app/services/shreddit_parser.py - PullPush collector
app/controllers/pullpush_final_stretch_controller.py
Persistence
- Post model
app/models/post.py - Mongo repository
app/repositories/mongo_posts.py - MongoDB posts
app/mongo_config.py
API and inference
- FastAPI app
services/api/main.py - API dependencies
services/api/deps.py - Posts API
services/api/routers/posts.py - Stats API
services/api/routers/stats.py - Prediction API
services/api/routers/predict.py - Distress ensemble
packages/distress_ml/distress_ml/ensemble.py - Text preprocessing
packages/distress_ml/distress_ml/preprocess.py - Model service
services/model/main.py - Preprocessing service
services/preprocessing/main.py
Dashboard
- Dashboard routes
frontend/src/main.tsx - Post browsing
frontend/src/pages/PostsPage.tsx - Post search
frontend/src/pages/SearchPage.tsx - Distress detection
frontend/src/pages/DetectPage.tsx - Telegram scanning
frontend/src/pages/TelegramPage.tsx - Analytics dashboard
frontend/src/pages/DashboardPage.tsx - EDA charts
frontend/src/components/EdaCharts.tsx - API client
frontend/src/lib/api.ts
External integrations
- PullPush client
app/services/pullpush_client.py - Telegram bot
services/telegram-bot/main.py - Telegram service
services/telegram-bot/telegram_service.py - PullPush service
- Telegram
- Kafka results
Other components
- Operator
- Dashboard user
Connections 39
- Operator → Reddit scraper: starts scrape
- Reddit scraper → Chrome driver: creates driver
app/controllers/reddit_scraper_controller.py - Reddit scraper → Post parser: parses elements
app/controllers/reddit_scraper_controller.py - Reddit scraper → Mongo repository: inserts posts
app/controllers/reddit_scraper_controller.py - Post parser → Post model: creates posts
app/services/shreddit_parser.py - PullPush collector → PullPush client: fetches submissions
app/controllers/pullpush_final_stretch_controller.py - PullPush client → PullPush service: requests submissions
app/services/pullpush_client.py - PullPush collector → Mongo repository: bulk inserts
app/controllers/pullpush_final_stretch_controller.py - Mongo repository → Post model: serializes posts
app/repositories/mongo_posts.py - Mongo repository → MongoDB posts: reads and writes
- FastAPI app → Posts API: registers router
services/api/main.py - FastAPI app → Stats API: registers router
services/api/main.py - FastAPI app → Prediction API: registers router
services/api/main.py - Posts API → API dependencies: uses dependencies
services/api/routers/posts.py - Stats API → API dependencies: uses dependencies
services/api/routers/stats.py - Prediction API → API dependencies: uses dependencies
services/api/routers/predict.py - API dependencies → MongoDB posts: provides collections
services/api/deps.py - Prediction API → Distress ensemble: runs prediction
services/api/routers/predict.py - Distress ensemble → Text preprocessing: preprocesses text
packages/distress_ml/distress_ml/ensemble.py - Model service → Distress ensemble: uses model
services/model/main.py - Preprocessing service → Text preprocessing: uses preprocessing
services/preprocessing/main.py - Telegram bot → Telegram service: delegates service
services/telegram-bot/main.py - Telegram service → Telegram: connects to
- Dashboard user → Dashboard routes: opens dashboard
frontend/src/main.tsx - Dashboard routes → Post browsing: routes to
frontend/src/main.tsx - Dashboard routes → Post search: routes to
frontend/src/main.tsx - Dashboard routes → Distress detection: routes to
frontend/src/main.tsx - Dashboard routes → Telegram scanning: routes to
frontend/src/main.tsx - Dashboard routes → Analytics dashboard: routes to
frontend/src/main.tsx - Post browsing → API client: requests post data
frontend/src/pages/PostsPage.tsx - Post search → API client: requests search
frontend/src/pages/SearchPage.tsx - Distress detection → API client: requests prediction
frontend/src/pages/DetectPage.tsx - Telegram scanning → API client: requests Telegram scan
frontend/src/pages/TelegramPage.tsx - Analytics dashboard → EDA charts: renders charts
frontend/src/pages/DashboardPage.tsx - API client → Posts API: calls posts routes
frontend/src/lib/api.ts - API client → Stats API: calls stats routes
frontend/src/lib/api.ts - API client → Prediction API: calls prediction route
frontend/src/lib/api.ts - Reddit scraper → Reddit: scrapes posts
- FastAPI app → Kafka results: consumes results
services/api/main.py