Skip to content

Poolchaos/artemis-insight

Repository files navigation

Artemis Insight

AI-powered document intelligence platform for automated summarization and analysis

License Python React FastAPI

Artemis Insight transforms lengthy technical documents into structured, actionable summaries using AI. Upload PDFs, select a template, and receive comprehensive summaries organized by your specifications.

✨ Features

πŸ“„ Document Processing

  • PDF Upload & Analysis - Upload and process PDF documents up to 50MB
  • Intelligent Text Extraction - Extract text with metadata preservation
  • Vector Embeddings - Create searchable embeddings for semantic analysis
  • Multi-pass Processing - Configurable chunk sizes and overlap for optimal results

🎯 Template-Based Summarization

  • Custom Templates - Define section structures with guidance prompts
  • Section Ordering - Control the flow and organization of summaries
  • Required Fields - Mark critical sections for mandatory completion
  • Reusable Templates - Create once, use for multiple documents

πŸ“Š Summary Management

  • Status Tracking - Monitor processing, completed, and failed summaries
  • Section Breakdown - View detailed content by section with page references
  • Export Options - Download summaries as PDF or Word documents
  • Markdown Support - Rich text formatting with headers, bold, and lists

🎨 Modern UI/UX

  • Dark Mode - Comfortable viewing in any lighting condition
  • Responsive Design - Works seamlessly on desktop and tablet
  • Real-time Updates - Live status monitoring during processing
  • Modal Dialogs - Professional confirmations and error messages

πŸš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • OpenAI API Key
  • 8GB RAM minimum
  • 10GB free disk space

Installation

  1. Clone the repository

    git clone https://github.com/Poolchaos/artemis-insight.git
    cd artemis-insight
  2. Configure environment variables

    cp .env.example .env

    Edit .env and set your OpenAI API key:

    OPENAI_API_KEY=sk-your-api-key-here
  3. Start the services

    docker-compose up -d
  4. Access the application

First Steps

  1. Create a Template

    • Navigate to Templates β†’ Create New Template
    • Define sections with guidance prompts
    • Set section order and required fields
  2. Upload a Document

    • Go to Documents β†’ Upload
    • Select a PDF file
    • Wait for processing to complete
  3. Generate a Summary

    • Click "Process" on a document
    • Select your template
    • Monitor progress in Summaries
  4. Export Results

    • Open the completed summary
    • Click Export β†’ Choose PDF or DOCX
    • Download and share

πŸ—οΈ Architecture

Technology Stack

Frontend

  • React 18 with TypeScript
  • TailwindCSS for styling
  • Zustand for state management
  • React Router for navigation
  • Heroicons for icons

Backend

  • FastAPI (Python 3.11)
  • MongoDB for data storage
  • Redis for caching
  • Celery for async tasks
  • MinIO for file storage

AI/ML

  • OpenAI GPT-4o-mini for summarization
  • OpenAI text-embedding-3-small for embeddings
  • PDFPlumber for text extraction
  • ReportLab for PDF generation
  • python-docx for Word exports

System Components

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Browser   │────▢│   Nginx     │────▢│   FastAPI   β”‚
β”‚  (React)    β”‚     β”‚  (Frontend) β”‚     β”‚  (Backend)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                               β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚                          β”‚              β”‚
              β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”            β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β–Όβ”€β”€β”€β”€β”
              β”‚  MongoDB  β”‚            β”‚   Celery    β”‚  β”‚ MinIO  β”‚
              β”‚ (Database)β”‚            β”‚  (Workers)  β”‚  β”‚(Storage)β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                              β”‚
                                       β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                                       β”‚    Redis    β”‚
                                       β”‚   (Queue)   β”‚
                                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

artemis-insight/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ models/          # Pydantic models & MongoDB schemas
β”‚   β”‚   β”œβ”€β”€ routes/          # FastAPI route handlers
β”‚   β”‚   β”œβ”€β”€ services/        # Business logic
β”‚   β”‚   β”œβ”€β”€ middleware/      # Auth & CORS
β”‚   β”‚   β”œβ”€β”€ tasks.py         # Celery async tasks
β”‚   β”‚   └── main.py          # FastAPI app initialization
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── Dockerfile
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”œβ”€β”€ pages/           # Page components
β”‚   β”‚   β”œβ”€β”€ services/        # API clients
β”‚   β”‚   β”œβ”€β”€ stores/          # Zustand stores
β”‚   β”‚   └── types/           # TypeScript types
β”‚   β”œβ”€β”€ package.json
β”‚   └── Dockerfile
β”œβ”€β”€ docker-compose.yml
└── README.md

πŸ”§ Configuration

Environment Variables

Required:

OPENAI_API_KEY=sk-...          # Your OpenAI API key

Database:

MONGO_ROOT_USERNAME=admin
MONGO_ROOT_PASSWORD=secure_password
MONGO_DATABASE=artemis_insight

Storage:

MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=secure_password
MINIO_BUCKET=artemis-insight

Authentication:

JWT_SECRET_KEY=your-secret-key  # Generate with: openssl rand -hex 32
JWT_ALGORITHM=HS256
JWT_ACCESS_TOKEN_EXPIRE_MINUTES=15
JWT_REFRESH_TOKEN_EXPIRE_DAYS=7

Processing Configuration

Adjust template processing strategies in the template configuration:

{
  "processing_strategy": {
    "approach": "multi-pass",
    "chunk_size": 600,
    "overlap": 75,
    "embedding_model": "text-embedding-3-small",
    "summarization_model": "gpt-4o-mini"
  }
}

πŸ“– Usage Examples

Template Structure

Example template for a feasibility study:

{
  "name": "Feasibility Study Summary",
  "description": "Technical summary for engineering review",
  "sections": [
    {
      "title": "Executive Summary",
      "order": 1,
      "required": true,
      "guidance_prompt": "Synthesize key findings, proposed solution, and recommendations"
    },
    {
      "title": "Technical Aspects",
      "order": 2,
      "required": true,
      "guidance_prompt": "Describe components, sizing, operations, and implementation"
    },
    {
      "title": "Cost Analysis",
      "order": 3,
      "required": true,
      "guidance_prompt": "Extract capital costs, operating costs, and unit reference values"
    }
  ]
}

API Examples

Upload a document:

curl -X POST http://localhost:8001/api/documents/upload \
  -H "Authorization: Bearer $TOKEN" \
  -F "file=@document.pdf"

Create a summary:

curl -X POST "http://localhost:8001/api/summaries?document_id=xxx&template_id=yyy" \
  -H "Authorization: Bearer $TOKEN"

Export as PDF:

curl -X GET "http://localhost:8001/api/summaries/{summary_id}/export/pdf" \
  -H "Authorization: Bearer $TOKEN" \
  -o summary.pdf

πŸ§ͺ Development

Running Locally

Backend:

cd backend
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8001

Frontend:

cd frontend
npm install
npm run dev

Worker:

cd backend
celery -A app.celery_app worker --loglevel=info

Testing

# Backend tests
cd backend
pytest

# Frontend tests
cd frontend
npm test

# E2E tests
npm run test:e2e

Code Quality

# Backend linting
cd backend
flake8 app/
black app/
isort app/

# Frontend linting
cd frontend
npm run lint
npm run format

πŸ› Troubleshooting

Common Issues

"Failed to connect to MongoDB"

  • Ensure MongoDB container is running: docker ps
  • Check credentials in .env match docker-compose.yml
  • Verify port 27017 is not in use

"OpenAI API rate limit"

  • Check your OpenAI account has sufficient credits
  • Reduce concurrent processing in template strategy
  • Consider using GPT-3.5-turbo for faster processing

"PDF upload fails"

  • Check file size is under 50MB
  • Ensure MinIO container is healthy
  • Verify MINIO_BUCKET exists

"Summary shows 0 sections"

  • Confirm template has sections defined (not legacy fields)
  • Check template was saved correctly in MongoDB
  • Refresh browser cache

Logs

# View all logs
docker-compose logs -f

# Specific service logs
docker logs artemis-insight-backend --tail 100
docker logs artemis-insight-celery-worker --tail 100
docker logs artemis-insight-frontend --tail 100

# Database logs
docker logs artemis-insight-mongodb --tail 50

πŸ“ Changelog

[Unreleased]

[0.2.0] - 2025-11-17

Added:

  • Summary list page with status filtering
  • Detailed summary view with section breakdown
  • PDF and DOCX export functionality
  • ProcessPage for document summarization workflow
  • Markdown rendering in summaries
  • Modal dialogs for confirmations and errors
  • Local 24-hour time format
  • Human-readable processing time display

Changed:

  • Replaced browser alerts with modal components
  • Updated template types for backward compatibility
  • Improved error messages and validation
  • Enhanced dark mode support

Fixed:

  • ObjectId conversion bug in summary endpoints
  • PDF markdown parsing with proper regex
  • Template edit form not populating sections
  • CORS headers for file downloads
  • TypeScript compilation errors in templates

[0.1.0] - 2025-11-15

Added:

  • Initial release
  • Document upload and processing
  • Template management
  • Basic summarization
  • User authentication
  • Dark mode support

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Commit Convention

We follow Conventional Commits:

  • feat: - New feature
  • fix: - Bug fix
  • docs: - Documentation changes
  • style: - Code style changes (formatting, etc.)
  • refactor: - Code refactoring
  • test: - Adding or updating tests
  • chore: - Maintenance tasks

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support

πŸ—ΊοΈ Roadmap

  • Multi-document batch processing
  • Custom AI model selection per template
  • Collaborative editing and sharing
  • Advanced analytics dashboard
  • API webhooks for integrations
  • Multi-language support
  • Mobile app (iOS/Android)
  • On-premise deployment option

Built with ❀️ by Artemis Innovations