Skip to content

feat: implement algorithmic risk assessment engine with ML scoring and real-time monitoring#93

Merged
gabito1451 merged 4 commits intoGalactiGuild:mainfrom
yusuftomilola:main
Feb 25, 2026
Merged

feat: implement algorithmic risk assessment engine with ML scoring and real-time monitoring#93
gabito1451 merged 4 commits intoGalactiGuild:mainfrom
yusuftomilola:main

Conversation

@yusuftomilola
Copy link
Contributor

Summary

  • Implements a TypeScript ML ensemble model (Logistic Regression + Gradient
    Boosting + Random Forest) to predict project success probability and generate
    a 0–100 risk score across six domains: Funding, Team, Technical, Community,
    Market, and Legal
  • Adds SHAP-inspired explainability that attributes signed impact scores to each
    risk factor with human-readable descriptions and actionable investor recommendations
  • Builds an on-chain + off-chain data pipeline with LRU caching, retry logic,
    and a privacy-preserving mode that anonymizes individual contribution data
  • Introduces a real-time risk monitor using Server-Sent Events (SSE) that emits
    scored snapshots, trend analysis, and typed alerts (whale concentration,
    sentiment drops, score changes, etc.)

Changes

Core Engine (src/lib/risk-engine/)

  • types.ts — Full type system: feature vectors, risk scores, alerts, monitoring
    sessions, pipeline config
  • features.ts — 22-dimensional feature extraction with log-normalisation,
    sigmoid scaling, and Herfindahl concentration index
  • model.ts — Pre-calibrated ensemble with 6-tree GBDT, 5-tree Random Forest,
    and logistic regression; computes 95% confidence intervals from model disagreement
  • explainability.ts — SHAP marginal attribution, top risk factors, top strengths,
    explanation summary, and investor insight generation
  • data-pipeline.ts — Parallel on-chain/off-chain fetching, retry-with-backoff,
    500-entry LRU cache with per-project invalidation
  • monitor.ts — SSE-based polling engine with alert threshold detection, trend
    direction analysis, and pub/sub callbacks
  • index.tsRiskEngine class with assess(), assessFromRawData(), and
    assessBatch() methods

API Routes (src/app/api/risk/)

  • assess/route.tsGET + POST risk assessment with optional privacy mode
  • monitor/route.ts — SSE stream for live updates + POST start/stop control
  • history/[projectId]/route.ts — Paginated snapshot history

UI Components (src/components/risk/)

  • RiskScoreCard — Circular overall score, success probability, confidence badge,
    and animated sub-domain progress bars

  • RiskFactorChart — SHAP factor bars with current vs. benchmark comparison;
    hover reveals recommendations

  • RealTimeMonitor — SSE-connected live feed with sparkline chart, trend arrow,
    and categorised alert feed

  • RiskDashboard — Full composable dashboard with loading skeleton, error/retry
    state, and refresh control

    closes Algorithmic Risk Assessment Engine #76

@gabito1451 gabito1451 merged commit 7222170 into GalactiGuild:main Feb 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Algorithmic Risk Assessment Engine

2 participants