CoolFace
Apppublic

SameerInfinity/AI_DD

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
App README

ABYSS — AI-Powered M&A Due Diligence Virtual Data Room

A multi-party Virtual Data Room (VDR) platform for mergers & acquisitions due diligence. Upload documents, get perspective-specific AI analysis with structured findings, risk scores, and source citations. Supports Buy Side, Sell Side, and Admin workflows with role-based access, request lists, audit trails, and Human-in-the-Loop review.

Live: Frontend (Vercel) | Backend (HF Spaces)

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                FRONTEND (React 18 + TypeScript + Vite 8)        │
│  Auth → Perspective → Projects → Data Room / Q&A / Audit       │
│  UI: shadcn/ui + Tailwind  |  State: Zustand + React Query     │
│  Theme: Ocean dark + Sunny light  |  Code-split (React.lazy)   │
└─────────────────────────┬───────────────────────────────────────┘
                          │ REST API (JWT Auth)
┌─────────────────────────▼───────────────────────────────────────┐
│                   BACKEND (FastAPI + async)                      │
│                                                                  │
│  Auth ─ Projects ─ Teams ─ Documents ─ Requests ─ Queries       │
│  Folders ─ DD Tests ─ Routines ─ Planning ─ Finance ─ Export    │
│  Knowledge ─ Self-Improvement ─ VDR Security                    │
│                                                                  │
│  ┌────────────────────────────────────────────────────────────┐  │
│  │         OCR → Chunker → Embeddings → Vector Store          │  │
│  │    (PyMuPDF / Tesseract → Semantic Split → Pinecone EU)    │  │
│  └────────────────────────────────────────────────────────────┘  │
│                                                                  │
│  ┌────────────────────────────────────────────────────────────┐  │
│  │              AI PIPELINE (8-Step State Machine)             │  │
│  │  Rewrite → Classify → Retrieve → Completeness              │  │
│  │  → Think (Groq) → Audit → Structure → Done                 │  │
│  │  + Review feedback injected into system prompt              │  │
│  └────────────────────────────────────────────────────────────┘  │
└──────────────────────────────────────────────────────────────────┘
         │                │                 │
   ┌─────▼──────┐  ┌──────▼───────┐  ┌─────▼──────────┐
   │ Supabase   │  │   Pinecone   │  │ Supabase       │
   │ PostgreSQL │  │  (vectors)   │  │ Storage (files) │
   │  (EU)      │  │  (EU)        │  │  (EU)          │
   └────────────┘  └──────────────┘  └────────────────┘

Tech Stack

LayerTechnology
FrontendReact 18.3 + TypeScript + Vite 8 (SWC), code-split via React.lazy
UIshadcn/ui + Tailwind CSS + Radix UI + Framer Motion
StateZustand 5 + TanStack React Query 5 (5-min staleTime cache)
FormsReact Hook Form 7 + Zod validation
ThemeDark (ocean abyss) + Light (sunny ocean) with smooth 400ms transition
ExportjsPDF + html2canvas (PDF), python-docx (DOCX), openpyxl (XLSX)
BackendFastAPI 0.115 + Uvicorn (fully async)
DatabaseSupabase PostgreSQL EU (SQLAlchemy AsyncSession + asyncpg)
File StorageSupabase Storage EU (with local fallback)
LLMGroq — Llama 3.3 70B Versatile
Embeddingssentence-transformers (all-MiniLM-L6-v2), 384-dim, local
Vector DBPinecone serverless EU (local in-memory fallback)
OCRPyMuPDF + Tesseract (digital + scanned PDFs, images)
AuthJWT (python-jose) + bcrypt + Google OAuth + email verification
EmailBrevo (verification, password reset, project invitations)

All 11 Modules

1. Auth Module

  • Register, login, Google OAuth, email verification (Brevo), password reset
  • 8 analyst perspectives (set once, changeable from sidebar)
  • 5 project roles: Admin, Buy Side (Legal/Tax/Commercial), Sell Side
  • Email-based project invitations (admin sends, user accepts/declines)
  • Session management with global 401 redirect

2. Project Module

  • Create, rename, delete projects with extended fields (legal form, deal type, country, employees, revenue, deal value)
  • Email invitation system (replaced invite codes)
  • Team management with role badges and activity feed
  • VDR security settings (watermarks, download restrictions per role)

3. DMS Module (Data Room)

  • Upload PDFs, DOCX, XLSX, CSV, images, plain text
  • Nested folder structure with directory upload
  • Document versioning, AI auto-tagging, full-text search
  • Professional list-view file manager
  • Language detection (AI responds in document language)
  • Document watermarks (username + date overlay, configurable)

4. OCR Module

  • PyMuPDF for digital PDFs, Tesseract for scanned documents
  • python-docx for Word, pandas + openpyxl for Excel/CSV
  • Semantic chunking (1200 chars, 150 overlap) → Pinecone indexing
  • Reprocess-all endpoint for failed documents

5. Agent Module (AI Pipeline)

  • 8-step pipeline: Rewrite → Classify → Retrieve → Completeness → Think → Audit → Structure → Complete
  • 8 perspective-specific system prompts
  • Citation enforcement, confidence scoring, red flag detection
  • Human-in-the-Loop review (Approve/Edit/Reject) on all AI outputs
  • Review feedback injected into system prompt (AI learns from corrections)

6. Planning Module

  • Interactive AI-guided audit planning dialog
  • AI analyzes project profile, asks 4-6 targeted risk questions
  • Auto-generates DD request list by workstream
  • Sessions persisted — visible to all team members
  • Past sessions viewable in read-only mode

7. Finance Module

  • Upload accounting data (Excel/CSV), auto-detect SKR 03/SKR 04
  • Range-based account mapping (100+ German standard account ranges)
  • Journal entry format support (debit/credit per row)
  • Balance sheet items excluded from P&L automatically
  • Variance analysis: Month-over-Month, Year-over-Year, anomaly detection (>30%)
  • Key metrics: EBITDA margin, gross margin, net margin, personnel ratio, equity ratio, ROA

8. Report Module

  • PDF export: Q&A analysis with structured findings, TOC, confidence bars
  • DOCX export: Full DD report with request list, test results, Q&A summary
  • XLSX export: Workstream sheets with status, scores, findings
  • Editable executive summary (write or AI-generate before export)
  • Download restrictions enforceable per role

9. Knowledge Module

  • 20 built-in IDW/M&A standards (Legal, Tax, Commercial, General)
  • Auto-seeded on first access, filterable by category
  • AI-generated cross-project insights ("Generate Insights" button)
  • User-level, accessible from Projects page

10. Audit Module

  • Completeness audit: AI cross-checks documents against request list
  • Per-field DD tests with pass/fail/warning scoring
  • Custom test routines with user-defined prompts
  • Results persisted — load on revisit, shows "Last run by [name]"
  • Activity log: human-readable action labels, user/IP tracking
  • Cookie consent + GDPR privacy policy

11. Self-Improvement Module

  • Usage analytics: projects, queries, uploads, tests, reviews
  • 30-day activity heatmap
  • AI review patterns: approve/edit/reject rates with contextual messages
  • Actionable recommendations: missing docs, open requests, unrun audits
  • User-level, accessible from Projects page

Performance

OptimizationEffect
Route-based code splittingMain bundle 970KB → 361KB (63% smaller). Each page loads on-demand.
Hover preloadingPage chunks preload on sidebar hover — zero blink on first visit.
React Query cache5-min staleTime, no refetch on tab switch. Data survives page navigation.
Splash skipRepeat visits within session skip 4s splash animation.
Smart pollingExponential backoff (2s → 30s), stops when idle. Zero requests when nothing processing.
Theme transitionTemporary 400ms CSS transition class — only color/bg/border, no layout cost.

Pages (21 total)

PageRouteDescription
Sign In/signinEmail/password + Google OAuth
Sign Up/signupRegistration with password strength checklist
Verify Pending/verify-pendingEmail verification waiting page with resend
Verify Email/verify-emailToken verification from email link
Forgot Password/forgot-passwordRequest password reset email
Reset Password/reset-passwordSet new password with strength checklist
Perspective/role8 analyst perspectives (shown once after signup)
Projects/projectsCreate projects, accept/decline invitations
Knowledge/knowledgeDD standards + AI cross-project insights
Insights/insightsUsage analytics + AI review patterns
Q&A/dashboardAI query interface with branching conversations
Planning/planningInteractive audit planning with session history
Requests/requestsRequest list with workstream tabs + per-item upload
Data Room/dataroomFile manager with folders, search, versions, watermarks
Finance/financeAccounting import, variance analysis, key metrics
Audit/auditCompleteness audit, field tests, custom routines
Upload/uploadDrag & drop upload with progress tracking
Activity/activityFull audit trail with human-readable actions
Team/teamMembers, invitations, VDR security settings, activity feed
Privacy/privacyGDPR privacy policy
404*Not found page

Database Schema (19 Tables)

TablePurpose
usersAccounts with perspective (8 types), email verification
projectsDeal containers with extended fields, VDR security settings
project_membersPer-project role assignments (admin/buy/sell)
project_invitesEmail invitations with accept/decline status
documentsFiles with versioning, tags, language, OCR status
chunksIndexed text segments with Pinecone IDs + page numbers
foldersNested folder structure for data room
conversationsChat thread branches per project/user
queriesQuestions + pipeline state + Human-in-the-Loop review
pipeline_stepsStep-by-step tracking with I/O + duration
request_itemsDD request list items with workstream + status
dd_test_resultsDue diligence test results with findings
test_routinesUser-defined custom test prompts
audit_logsFull activity trail: who, what, when, IP
audit_resultsSaved completeness audit results with history
planning_sessionsPersisted planning conversations
financial_datasetsUploaded accounting files metadata
financial_entriesParsed accounting line items
knowledge_entriesDD standards + AI-generated insights

Enums: UserRole (5), Perspective (8), Workstream (4), InviteStatus (4), DocStatus (4), QueryStatus (9), RequestStatus (5), Severity (5)

Environment Variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection (async: postgresql+asyncpg://...)
JWT_SECRETYesSecret key for JWT tokens
GROQ_API_KEYYesGroq API key for Llama 3.3 70B
SUPABASE_URLYesSupabase project URL
SUPABASE_SERVICE_KEYYesSupabase service role key
BREVO_API_KEYYesBrevo API key for transactional emails
BREVO_FROM_EMAILYesVerified sender email address
FRONTEND_URLYesFrontend URL for email links
PINECONE_API_KEYNoPinecone API key (falls back to local)
PINECONE_REGIONNoPinecone region (default: eu-west-1)
GOOGLE_CLIENT_IDNoGoogle OAuth client ID
EMBEDDING_MODELNoEmbedding model (default: all-MiniLM-L6-v2)

Quick Start

bash
# 1. Clone
git clone https://github.com/SameerInfinity/AI-Due-Diligence.git
cd AI-Due-Diligence

# 2. Backend
python -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install -r requirements.txt

# 3. Frontend
cd frontend && npm install && cd ..

# 4. Configure
cp .env.example .env
# Edit .env with your keys

# 5. Run backend
uvicorn backend.main:app --reload --port 8000

# 6. Run frontend (new terminal)
cd frontend && npm run dev

Deployment

ServicePlatformRegion
BackendHuggingFace Spaces (Docker)EU
FrontendVercel (Edge CDN)Global
DatabaseSupabase PostgreSQLEU West (Paris)
File StorageSupabase StorageEU
Vector DBPineconeEU West (Ireland)
EmailBrevoGlobal
RedisUpstashEU

License

Private — All rights reserved.