# Aumentum Browser Access - Quick Start

## ✅ Server is Running!

The Aumentum Browser API is now running at: **http://localhost:8001**

## Quick Test

```bash
# View API documentation
open http://localhost:8001/docs

# Test the API
python3 PLAGIS_AUMENTUM/test_api.py
```

## What You Can Do

### 1. View API Documentation
Open http://localhost:8001/docs in your browser for interactive API documentation.

### 2. Lookup Documents
```bash
# Lookup a specific document
curl "http://localhost:8001/documents/lookup?content_path=2014/11/03/file.bin&convert_to_pdf=true"
```

### 3. Get PDF for Browser Viewing
```bash
# Convert and view as PDF
open "http://localhost:8001/documents/pdf?content_path=2014/11/03/file.bin"
```

### 4. Discover Database Schema
```bash
# See what tables are available
curl http://localhost:8001/schema | python3 -m json.tool
```

## API Endpoints

- **GET /** - API information
- **GET /health** - Health check
- **GET /schema** - Discover database schema
- **GET /documents/lookup?content_path=...&convert_to_pdf=true** - Lookup document
- **GET /documents/pdf?content_path=...** - Stream PDF to browser
- **GET /documents/by-property?apn=...** - Get documents by property

## Browser Extension

The browser extension in `browser_extension/` allows you to:
1. Enter an APN or document path
2. Look up documents
3. View PDFs directly in your browser

To load the extension:
1. Open Chrome/Edge
2. Go to `chrome://extensions/`
3. Enable "Developer mode"
4. Click "Load unpacked"
5. Select the `browser_extension/` directory

## Files Created

- `aumentum_browser_service.py` - Core service for DB access and PDF conversion
- `aumentum_api.py` - FastAPI REST API server
- `browser_extension/` - Chrome/Edge extension
- `test_api.py` - API testing script
- `README_BROWSER_ACCESS.md` - Full documentation
- `AUMENTUM_DATA_STRUCTURES.md` - Database schema notes

## Configuration

Edit these variables in `aumentum_browser_service.py`:

```python
DEFAULT_DB_CONFIG = {
    "host": "10.10.10.3",
    "user": "sa",
    "password": "",
    "database": "aumentum",
    "port": 3306,
}

DEFAULT_CONTENTSTORE_BASE = r"/mnt/contentstore"
```

## How It Works

1. **Database Lookup**: Queries Aumentum MSSQL database for document paths
2. **File Conversion**: Converts `.bin` files (LEADTOOLS JPEG) to PDF using PIL
3. **Browser Delivery**: Serves PDFs as HTTP responses for browser viewing

The system handles the conversion on-demand, so documents are converted to PDF when requested.

