How salahadin-hassen/lead-intelligence-automation works
Lead Intelligence Automation accepts and validates B2B leads, stores them in PostgreSQL, scores them with a configurable LLM or local heuristic, and exposes retrieval, status updates, CSV export, deletion, and database-backed health checks. Its documented n8n workflow routes qualification outcomes and records operational events; a demo form submits through that workflow. The graph follows the API-to-database/scoring ownership shown in sampled source. The n8n workflow, demo, and migration details are included from the README and tree; their source was not sampled.
Main entry points: leads.py Lead endpoints · db.py Database access · main.py App and health · scoring.py Score dispatcher
Components 16
API
- App and health
app/main.py - Lead endpoints
app/routes/leads.py - Lead models
app/models.py - Settings
app/config.py - Duplicate error
app/errors.py
Scoring
- Score dispatcher
app/scoring.py - LLM scoring
app/scoring.py - Local heuristic
app/scoring.py
Persistence
- Database access
app/db.py - Lead database
- Schema migrations
sql
Automation
- Demo lead form
demo/lead-form.html - Intake workflow
n8n/lead-intake.json - Decision events
n8n/lead-intake.json
Other components
- API client
- LLM provider
Connections 18
- API client → App and health: calls API
README.md - App and health → Lead endpoints: registers routes
app/main.py - App and health → Settings: loads settings
app/main.py - App and health → Database access: starts pool; probes
app/main.py - Lead endpoints → Lead models: uses schemas
app/routes/leads.py - Lead endpoints → Database access: reads and writes
app/routes/leads.py - Lead endpoints → Duplicate error: maps duplicate
app/routes/leads.py - Lead endpoints → Score dispatcher: requests score
app/routes/leads.py - Lead endpoints → Database access: saves score
app/routes/leads.py - Database access → Lead database: queries
app/db.py - Database access → Schema migrations: applies migrations
app/db.py - Score dispatcher → Settings: reads provider config
app/scoring.py - Score dispatcher → LLM scoring: tries LLM
app/scoring.py - Score dispatcher → Local heuristic: falls back
app/scoring.py - LLM scoring → LLM provider: requests completion
app/scoring.py - Demo lead form → Intake workflow: submits lead
README.md - Intake workflow → Lead endpoints: posts lead
README.md - Intake workflow → Decision events: records decisions
README.md