Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DecisionLens — Explainable Decision Intelligence Platform

Make decisions transparent, explainable, and auditable.

DecisionLens goes beyond showing outcomes — it explains why decisions were made, why alternatives were rejected, provides confidence scores, risk assessments, and full audit trails.


🚀 Quick Start (Local Development)

Prerequisites

  • Node.js v18+
  • PostgreSQL 16+ (or Docker)
  • npm or yarn

1. Start Database

Option A: Docker (recommended)

docker compose up postgres -d

Option B: Local PostgreSQL

Create a database called decisionlens_db and update backend/.env with your connection string.

2. Setup Backend

cd backend
npm install
npx prisma migrate dev --name init
npx prisma db seed
npm run dev

The API will be running at http://localhost:5000

3. Setup Frontend

cd frontend
npm install
npm run dev

The UI will be running at http://localhost:5173

4. Login

Open http://localhost:5173 and sign in with:

Role Email Password
Admin admin@decisionlens.com Admin123!
Analyst analyst@decisionlens.com Analyst123!
Manager manager@decisionlens.com Manager123!

🐳 Docker (Full Stack)

docker compose up --build

This starts PostgreSQL, Backend API, and Frontend in one command.


📂 Project Structure

DecisionLens/
├── backend/
│   ├── prisma/
│   │   ├── schema.prisma          # Database schema
│   │   └── seed.ts                # Seed data
│   ├── src/
│   │   ├── middleware/
│   │   │   ├── authMiddleware.ts   # JWT authentication
│   │   │   ├── roleMiddleware.ts   # RBAC authorization
│   │   │   └── errorHandler.ts     # Global error handling
│   │   ├── routes/
│   │   │   ├── auth.ts             # Auth endpoints
│   │   │   ├── decisions.ts        # Decision CRUD
│   │   │   ├── uploads.ts          # File upload
│   │   │   ├── analytics.ts        # Dashboard analytics
│   │   │   ├── audit.ts            # Audit logs
│   │   │   └── settings.ts         # User/admin settings
│   │   ├── utils/
│   │   │   ├── explainabilityEngine.ts  # Core AI engine
│   │   │   └── logger.ts           # Winston logger
│   │   ├── server.ts               # Express app
│   │   └── index.ts                # Entry point
│   ├── package.json
│   ├── tsconfig.json
│   ├── Dockerfile
│   └── .env
├── frontend/
│   ├── src/
│   │   ├── components/layout/      # Sidebar, Topbar, Layout
│   │   ├── context/                # Auth, Theme providers
│   │   ├── pages/                  # All page components
│   │   ├── utils/api.ts            # API client
│   │   ├── App.tsx                 # Router
│   │   ├── main.tsx                # Entry
│   │   └── index.css               # Global styles
│   ├── package.json
│   ├── tailwind.config.js
│   ├── vite.config.ts
│   ├── Dockerfile
│   └── index.html
├── docker-compose.yml
└── README.md

🔑 Features

Dashboard

  • Total, approved, rejected, high-risk decision counts
  • Average confidence score
  • Decision trend charts (area, bar, pie)
  • Recent activity feed

Decision Explorer

  • Search, filter, sort, paginate
  • Outcome and risk badges
  • Confidence progress bars

Decision Details

  • Outcome summary with scores
  • Explanation report
  • Factor analysis (bar + radar charts)
  • Rejected alternatives with reasoning
  • Historical case comparisons
  • Audit timeline

Explainability Engine

  • Configurable decision type presets
  • Adjustable factor sliders
  • Real-time evaluation
  • Save results to database

Analytics

  • 6 interactive charts
  • Volume, approval, risk, and confidence trends
  • Distribution breakdowns

File Upload

  • Drag-and-drop (CSV, Excel, PDF, DOCX)
  • Progress tracking
  • Upload history with delete

Admin Panel

  • User management (role updates, delete)
  • File management
  • Searchable audit logs

Settings

  • Profile management
  • Password update
  • Dark/light theme toggle
  • Notification preferences

🔒 Authentication & Authorization

  • JWT token-based authentication
  • RBAC with three roles: Admin, Manager, Analyst
  • Admin-only routes protected on both client and server
  • Passwords hashed with bcrypt (12 rounds)

📡 API Endpoints

Method Endpoint Auth Description
POST /api/auth/register Register new user
POST /api/auth/login Login
GET /api/auth/me Get current user
POST /api/auth/forgot-password Request password reset
POST /api/auth/reset-password Reset password with token
GET /api/decisions List decisions (paginated)
GET /api/decisions/:id Get decision with full details
POST /api/decisions Create decision
PUT /api/decisions/:id Update decision
DELETE /api/decisions/:id Delete decision
POST /api/decisions/evaluate Run explainability engine
POST /api/uploads Upload file
GET /api/uploads List uploads
DELETE /api/uploads/:id Delete upload
GET /api/analytics/summary Dashboard summary stats
GET /api/analytics/trends Trend data for charts
GET /api/analytics/recent Recent activity
GET /api/audit List audit logs
GET /api/settings/profile Get profile
PUT /api/settings/profile Update profile
PUT /api/settings/password Change password
GET /api/settings/users 🔒 List users (Admin only)
PUT /api/settings/users/:id/role 🔒 Update user role (Admin only)
DELETE /api/settings/users/:id 🔒 Delete user (Admin only)

🛠 Tech Stack

Layer Technology
Frontend React, TypeScript, Tailwind CSS
Routing React Router v6
Charts Recharts
Icons Lucide React
Backend Node.js, Express, TypeScript
ORM Prisma
Database PostgreSQL
Auth JWT + bcrypt
File Upload Multer
Logging Winston
Build Vite
Deployment Docker + Docker Compose

📜 License

MIT

About

DecisionLens: An Explainable Decision Intelligence SaaS platform that provides transparent, auditable reasoning behind automated outcomes.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages