How abhishek-mallick/decision-hub works
Project Type and Purpose
• Decision-Hub is a full-stack, web-based rule-building application.
• Purpose: Enable business analysts to author, manage, debug, and execute decision strategies via no-code, English-like rules underpinned by an LLM (Code Llama 2) and vector‐based storage (FAISS).
File Structure
• Top-level Python Backend
• app.py, model.py, ingest.py – Flask application entrypoints and data ingestion
• requirements.txt – Python dependencies (Flask, SQLAlchemy, FAISS, OpenAI/Code Llama client, etc.)
• instance/database.db & database.db – SQLite databases for persistence
• vectorstore/db_faiss – FAISS index files for storing embeddings
• templates/ – Jinja2 HTML templates for server-rendered pages (login, dashboard, rule tester, etc.)
• static/ – Compiled CSS/JS and images served to clients
• Frontend Components
• query-builder/ – React/Redux single-page app for rule creation, management, and debugging
• Advanced-Logic-Builder/ – Reusable logic-builder widget (vanilla JS/React mix) bundled by Vite
• Configuration & Build
• package.json & lock files in each frontend – NPM dependencies
• webpack.config.js, vite.config.ts – Build pipelines for bundling frontend assets
• Auxiliary Files
• vectorstore/ – FAISS index artifacts
• data/ – Reference documents (not part of runtime)
• Hackathon Details/ – Documentation and presentation files
README for Additional Insights
• Architectural goals:
• No-code, English-like rule input converted to SQL/JSON/XML via LLM
• Real-time debugging with breakpoints, error messages, execution trace
• Dynamic rule modification via drag-n-drop
• System uses:
• Flask REST and server-rendered routes
• React frontends served either as static SPAs or injected into templates
• SQLite for relational storage, FAISS for vector search
a. Components
• User Browser
• React SPA (query-builder)
• Advanced Logic Builder widget
• Server-rendered pages (Jinja2 templates)
• Web Server / API Layer
• Flask application with REST endpoints and template routes
• Business Logic & Rule Engine
• model.py, ingest.py, LLM interface module
• Code Llama 2 (local or remote inference)
• Datastores
• SQLite relational database
• FAISS-based vectorstore for embeddings
• External Services (optional)
• LLM provider endpoint (if not local)
• Analytics or logging systems
b. Relationships / Data Flow
1. User interacts with front-end UI → triggers HTTP request (REST API or form POST)
2. Flask API receives request → calls rule-engine services in model.py
3. For NLP to Query: invokes LLM interface → returns SQL/JSON rules
4. Query execution: backend runs generated query against SQLite or JSON stores
5. For similarity search or contextual schemas: backend queries FAISS index
6. Results & execution trace sent back → UI displays debug info or visualizations
c. Architectural Patterns & Principles
• Modular separation of frontends (React SPAs) and backend (Flask monolith)
• RESTful API design for rule CRUD, execution, debugging
• Adapter pattern for LLM service (easily swap models)
• Repository pattern for database and vectorstore abstractions
d. Key Technologies
• Python, Flask, SQLAlchemy, FAISS
• React, Redux, Webpack, Vite
• Code Llama 2 (LLM)
• SQLite