Skip to content

eyesee11/AutoOps

Repository files navigation

πŸ€– AutoOps AI β€” Document to Dashboard Automation System

A Python-powered AI automation engine that transforms business documents (invoices, contracts, bank statements, reports) into structured data, insights, and interactive dashboards β€” automatically.


✨ Features

# Feature Description
1 Document Upload Upload PDF invoices, contracts, bank statements, reports
2 Automated Extraction Extract structured data using pdfplumber + regex patterns
3 LLM Summarization OpenAI-powered executive summaries, risk flags, action items
4 Structured JSON Output Clean, schema-consistent JSON for every document
5 Interactive Dashboard Streamlit dashboard with charts, risk alerts, spending trends
6 Automation Layer Auto-save to CSV/SQLite, PDF report generation, email notifications
7 Zapier Integration Webhook API to connect with 6000+ apps (Slack, Sheets, QuickBooks)

πŸ“ Project Structure

Automation_project/
β”œβ”€β”€ config.py               # Central configuration
β”œβ”€β”€ extractor.py             # PDF text & field extraction
β”œβ”€β”€ summarizer.py            # OpenAI LLM summarization
β”œβ”€β”€ pipeline.py              # End-to-end processing pipeline
β”œβ”€β”€ database.py              # SQLite storage layer
β”œβ”€β”€ automation.py            # CSV export, PDF reports, email
β”œβ”€β”€ dashboard.py             # Streamlit interactive dashboard
β”œβ”€β”€ main.py                  # CLI entry point
β”œβ”€β”€ generate_samples.py      # Sample PDF generator for testing
β”œβ”€β”€ requirements.txt         # Python dependencies
β”œβ”€β”€ .env.example             # Environment variables template
β”œβ”€β”€ .gitignore
β”œβ”€β”€ samples/                 # Generated sample PDFs
β”œβ”€β”€ uploads/                 # Uploaded documents
└── outputs/
    β”œβ”€β”€ json/                # Structured JSON outputs
    β”œβ”€β”€ csv/                 # CSV exports
    └── reports/             # Generated PDF reports

πŸš€ Quick Start

1. Install Dependencies

cd Automation_project
pip install -r requirements.txt

2. Configure Environment

# Copy the template
cp .env.example .env

# Edit .env and add your OpenAI API key
# OPENAI_API_KEY=sk-your-key-here

Note: The system works without an API key β€” it will skip LLM analysis and only use regex extraction.

3. Generate Sample PDFs

python generate_samples.py

This creates 4 sample PDFs in samples/:

  • sample_invoice.pdf
  • sample_contract.pdf
  • sample_bank_statement.pdf
  • sample_quarterly_report.pdf

4. Launch the Dashboard

streamlit run dashboard.py

Open http://localhost:8501 in your browser.


πŸ’» CLI Usage

# Process a single PDF
python main.py process samples/sample_invoice.pdf

# Process without LLM (regex-only)
python main.py process samples/sample_invoice.pdf --no-llm

# Batch process all PDFs in a folder
python main.py batch samples/

# Export all records to CSV
python main.py export-csv

# Generate summary PDF report
python main.py export-pdf

# View dashboard stats in terminal
python main.py stats

# Launch Streamlit dashboard
python main.py dashboard

πŸ”„ Processing Pipeline

 PDF Upload
     β”‚
     β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚  PDF Extraction  β”‚  pdfplumber β†’ raw text + tables
 β”‚  + Regex Fields  β”‚  regex patterns β†’ invoice #, date, amount, vendor...
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚
          β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚  Document Type   β”‚  Heuristic keyword scoring
 β”‚  Detection       β”‚  invoice / contract / bank_statement / report / email
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚
          β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚  LLM Analysis   β”‚  OpenAI API (gpt-4o-mini)
 β”‚  (if enabled)    β”‚  β†’ Summary, risk flags, action items, structured JSON
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚
          β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚  Merge & Store   β”‚  Regex + LLM fields β†’ canonical output
 β”‚                  β”‚  β†’ SQLite DB + JSON file
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚
          β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚  Automation      β”‚  β†’ CSV append
 β”‚  Layer           β”‚  β†’ PDF report generation
 β”‚                  β”‚  β†’ Email notification (optional)
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚
          β–Ό
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚  Dashboard       β”‚  Charts, risk alerts, spending trends
 β”‚  (Streamlit)     β”‚  Search, export, download reports
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“Š Dashboard Tabs

πŸ“€ Upload & Process

  • Drag & drop PDFs
  • Toggle AI analysis on/off
  • View extraction results, risk badges, summaries
  • Download individual PDF reports

πŸ“Š Analytics Dashboard

  • Total documents & total amount metrics
  • Document type distribution (pie chart)
  • Risk level distribution (bar chart)
  • Monthly spending trend (line chart)
  • Risk alerts & pending payments tables

πŸ“‹ Documents

  • Search across all processed documents
  • Sortable data table
  • Detail view with full JSON & action items

πŸ“₯ Export & Reports

  • One-click CSV export
  • Summary PDF report generation
  • Download previous exports

πŸ“„ Sample JSON Output

{
  "file": "sample_invoice.pdf",
  "document_type": "invoice",
  "invoice_number": "INV-2026-0042",
  "vendor": "Acme Solutions Ltd.",
  "date": "February 20, 2026",
  "due_date": "March 22, 2026",
  "total_amount": 11714.75,
  "currency": "USD",
  "tax_amount": "$917.75",
  "risk_flag": "low",
  "risk_reason": "Late payment fee clause present",
  "summary": "Invoice from Acme Solutions for cloud hosting, API development, and support services totaling $11,714.75 due March 22, 2026.",
  "action_items": [
    "Schedule payment before March 22 to avoid late fees",
    "Verify API integration hours against project tracker",
    "Confirm SSL certificate count matches deployed domains"
  ],
  "line_items": [
    {
      "description": "Cloud Hosting Services",
      "quantity": "1",
      "unit_price": "$2,500.00",
      "amount": "$2,500.00"
    },
    {
      "description": "API Integration Development",
      "quantity": "40 hrs",
      "unit_price": "$150.00",
      "amount": "$6,000.00"
    }
  ]
}

πŸ”— Zapier Integration

Connect AutoOps AI with 6000+ apps to automate your entire workflow.

Quick Setup

  1. Start the webhook server:

    python webhook_api.py
  2. Expose your local server for testing:

    # Install ngrok from https://ngrok.com/download
    ngrok http 8000
  3. Configure your Zapier Zap:

    • Trigger: Gmail, Dropbox, Slack, etc.
    • Action: Webhooks by Zapier β†’ POST
    • URL: https://your-ngrok-url.ngrok.io/process
    • Headers: X-API-Key: your-secret-api-key-here

Example Workflows

πŸ“§ Gmail β†’ AutoOps β†’ Slack
Automatically process invoice attachments and notify your team in Slack.

☁️ Dropbox β†’ AutoOps β†’ Google Sheets
Watch a Dropbox folder and add processed data to a tracking spreadsheet.

πŸ’° Email β†’ AutoOps β†’ QuickBooks
Extract invoice data and create entries in your accounting software.

🚨 High-Risk Alert
Send SMS and create Trello cards when contracts have risk flags.

πŸ“– Read the full Zapier Integration Guide β†’


βš™οΈ Configuration

Edit config.py or .env to customize:

Setting Default Description
OPENAI_MODEL gpt-4o-mini OpenAI model to use
TEMPERATURE 0.2 LLM creativity (lower = more deterministic)
MAX_TOKENS 2048 Max response tokens
SMTP_HOST smtp.gmail.com Email server for notifications

πŸ›  Tech Stack

  • Python 3.11+
  • pdfplumber β€” PDF text & table extraction
  • OpenAI API β€” LLM summarization & structuring
  • Streamlit β€” Interactive web dashboard
  • Plotly β€” Charts & visualizations
  • SQLite β€” Lightweight database
  • FPDF2 β€” PDF report generation
  • pandas β€” Data manipulation

πŸ“¬ Email Notifications (Optional)

To enable email alerts after processing:

  1. Set SMTP credentials in .env
  2. Enable "Auto-email notification" in the dashboard sidebar
  3. For Gmail, use an App Password

πŸ“œ License

MIT License β€” free for personal and commercial use.

About

A Python-powered AI automation engine that transforms business documents (invoices, contracts, bank statements, reports) into structured data, insights, and interactive dashboards, automatically.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages