Skip to content

ChartAI is an AI-powered tool designed to extract and visualize complex corporate structures from legal documents and text descriptions. It uses advanced LLMs to parse entity relationships and renders them as interactive, auto-arranged diagrams.

License

Notifications You must be signed in to change notification settings

jamietso/ChartAI

Repository files navigation

ChartAI - Corporate Structure Visualization AI

ChartAI is an AI-powered tool that extracts and visualizes complex corporate structures from legal documents and text. It uses Gemini AI to parse entity relationships (ownership, debt, control) and renders them as interactive, auto-arranged diagrams.

Features

  • AI-Powered Extraction: Automatically parses legal text to identify entities (Corporations, LLCs, Partnerships, etc.) and relationships.
  • Document Upload: Upload PDF, DOCX, PPTX, and image files for analysis using Docling.
  • Interactive Visualization: Renders corporate structures using React Flow with automatic layout (elkjs).
  • Smart Routing: Intelligent edge routing to minimize crossing and improve readability.
  • Chat Interface: Refine and modify charts using natural language commands.
  • Export: Export charts as images for reports and presentations.

Tech Stack

  • Frontend: React 19, TypeScript, Vite, Tailwind CSS, shadcn/ui, React Flow, elkjs
  • Document Extraction: Python Flask server with Docling
  • AI: Google Gemini 2.5 Flash

Prerequisites

  • Node.js (v18+)
  • npm or pnpm
  • Python 3.10+ (for document extraction)

Installation

1. Frontend Setup

```bash

Install dependencies

npm install

Create .env file with your Gemini API key

echo "VITE_GEMINI_API_KEY=your_api_key_here" > .env

Start the frontend dev server

npm run dev ```

The frontend will be available at http://localhost:5173

2. Document Extraction Server (Optional - for PDF/DOCX upload)

```bash

Create Python virtual environment

cd server python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate

Install dependencies

pip install -r requirements.txt

Start the extraction server

python extract_server.py ```

The extraction server will run on http://localhost:5001

Note: The first time you extract a document, Docling will download required ML models (~2GB). This only happens once.

Usage

Text Input

  1. Open the app at http://localhost:5173
  2. Paste legal text describing corporate structure in the chat
  3. The AI will extract entities and relationships and display them as a diagram

Document Upload

  1. Start the Python extraction server (see above)
  2. Click the 📎 button in the chat
  3. Upload a PDF, DOCX, PPTX, or image file
  4. The document text will be extracted and analyzed

Refining Charts

Once a chart is generated, you can refine it with natural language:

  • "Add a new entity called HoldCo"
  • "Change the ownership from 65% to 80%"
  • "Add a debt relationship between Bank X and Company Y"

Environment Variables

Variable Description Required
`VITE_GEMINI_API_KEY` Google Gemini API key Yes
`VITE_EXTRACT_SERVER_URL` Document extraction server URL (default: http://localhost:5001) No

Supported Document Formats

  • PDF (.pdf)
  • Microsoft Word (.docx, .doc)
  • Microsoft PowerPoint (.pptx, .ppt)
  • Images (.png, .jpg, .jpeg, .tiff, .bmp)

License

MIT

About

ChartAI is an AI-powered tool designed to extract and visualize complex corporate structures from legal documents and text descriptions. It uses advanced LLMs to parse entity relationships and renders them as interactive, auto-arranged diagrams.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published