How sarveshms7/recoveryops works
RecoveryOps ingests and deduplicates revenue-at-risk events, scores recovery opportunity, assigns a randomized control group, allocates treatment capacity, then recommends and policy-checks actions before idempotent payment execution. PostgreSQL persists events, scores, decisions, executions, outbox work, and audit history. The API and dashboard expose funnel and incrementality views; offline ML training is a documented capability. Edges are based on excerpts, SOURCE INDEX references, or README statements; dashboard/API wiring and some integrations are documented but not visible in sampled implementation.
Main entry points: pg_event_repository.ts Event repository · execute_decision.ts Decision execution · App.tsx Recovery dashboard · run_scoring_pass.ts Scoring pass
Components 23
Recovery workflow
- Event ingestion
application/ingest_event.ts - Scoring pass
application/run_scoring_pass.ts - Allocation pass
application/run_allocation_pass.ts - Decision execution
application/execute_decision.ts
Decision domain
- Uplift scoring
domain/scoring.ts - Budget allocator
domain/allocator.ts - Policy checks
domain/policy.ts - State transitions
domain/state_machine.ts
Persistence and adapters
- Outbox poller
adapters/outbox/poller.ts - Event repository
adapters/postgres/pg_event_repository.ts - PostgreSQL
- Gemini client
adapters/llm/gemini_llm_client.ts - Razorpay gateway
adapters/razorpay/razorpay_payment_gateway.ts
Insights and modeling
- Funnel API
api/server.ts - Recovery dashboard
dashboard/src/App.tsx - Event list
dashboard/src/EventList.tsx - Funnel chart
dashboard/src/FunnelChart.tsx - Incrementality panel
dashboard/src/IncrementalityPanel.tsx - Offline model training
ml/train.py - Model coefficients
ml/coefficients.json
Other components
- Risk event source
- Gemini API
- Razorpay API
Connections 24
- Risk event source → Event ingestion: submits events
README.md - Event ingestion → Event repository: writes event and outbox
application/ingest_event.ts - Outbox poller → Event repository: polls outbox
adapters/outbox/poller.ts - Scoring pass → Event repository: loads and persists scores
application/run_scoring_pass.ts - Scoring pass → Uplift scoring: computes scores
application/run_scoring_pass.ts - Scoring pass → State transitions: transitions events
application/run_scoring_pass.ts - Allocation pass → Event repository: loads eligible events
application/run_allocation_pass.ts - Allocation pass → Budget allocator: ranks recovery options
application/run_allocation_pass.ts - Allocation pass → State transitions: transitions events
application/run_allocation_pass.ts - Decision execution → Event repository: records execution
application/execute_decision.ts - Decision execution → Gemini client: requests recommendation
application/execute_decision.ts - Decision execution → Policy checks: checks action policy
application/execute_decision.ts - Decision execution → Razorpay gateway: executes action
README.md - Decision execution → State transitions: transitions events
application/execute_decision.ts - Event repository → PostgreSQL: persists records
README.md - Event repository → State transitions: validates transitions
adapters/postgres/pg_event_repository.ts - Gemini client → Gemini API: requests analysis
adapters/llm/gemini_llm_client.ts - Razorpay gateway → Razorpay API: sends payment action
README.md - Funnel API → Recovery dashboard: serves dashboard data
README.md - Recovery dashboard → Event list: renders
dashboard/src/App.tsx - Recovery dashboard → Funnel chart: renders
dashboard/src/App.tsx - Recovery dashboard → Incrementality panel: renders
dashboard/src/App.tsx - Offline model training → Model coefficients: trains model
README.md - Model coefficients → Scoring pass: supplies model weights
README.md