File size: 3,006 Bytes
410242f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# πŸš€ Quick Start - Run in 3 Steps

## Step 1: Install Requirements
```bash
pip install -r requirements.txt
```

**For Windows users (OCR support):**
1. Download Tesseract from: https://github.com/UB-Mannheim/tesseract/wiki
2. Run the installer
3. Add to PATH or set in code

## Step 2: Start the Server
```bash
python main.py
```

You should see:
```
INFO:     Uvicorn running on http://0.0.0.0:8000
```

## Step 3: Open Dashboard
Visit in your browser:
```
http://localhost:8000/dashboard
```

---

## 🎯 What You Can Do

### Upload Documents
- Click "πŸ“€ Upload Document"
- Select an image or text file
- Results appear automatically

### Extract Data
- Click "βœ‚οΈ Extract from Text"
- Paste your document text
- Click "Extract Data"

### View Results
- See extracted fields with confidence scores
- Check data quality metrics
- View document classification

### Monitor Jobs
- Track processing status
- View system statistics
- Check success rates

---

## πŸ“Š API Quick Reference

### Extract from Text
```bash
curl -X POST "http://localhost:8000/extract" \
  -H "Content-Type: application/json" \
  -d '{"text": "Invoice #123 for $500"}'
```

### Upload File
```bash
curl -X POST "http://localhost:8000/upload" \
  -F "file=@document.pdf"
```

### Batch Process
```bash
curl -X POST "http://localhost:8000/batch" \
  -H "Content-Type: application/json" \
  -d '{"documents": [{"text": "Doc 1"}, {"text": "Doc 2"}]}'
```

### Get Job Status
```bash
curl http://localhost:8000/jobs/{job_id}
```

---

## 🐍 Python Usage

```python
import asyncio
from app.pipeline import DocumentProcessingPipeline

async def main():
    pipeline = DocumentProcessingPipeline()
    
    result = await pipeline.process_document(
        document_id="doc_001",
        text="Invoice #123 Amount: $500.00"
    )
    
    print(f"Type: {result.classification.document_type}")
    print(f"Confidence: {result.classification.confidence:.2%}")
    print(f"Fields: {len(result.extraction.extracted_fields)}")
    print(f"Quality: {result.validation.data_quality_score:.2%}")

asyncio.run(main())
```

---

## πŸ§ͺ Run Examples

```bash
python examples.py
```

This will show you:
- Single document processing
- Batch processing
- Custom field extraction
- Data validation

---

## 🐳 Docker Alternative

```bash
# Build image
docker build -t doc-intelligence .

# Run container
docker run -p 8000:8000 -v ./uploads:/app/uploads doc-intelligence

# Visit http://localhost:8000/dashboard
```

---

## βš™οΈ Configuration

Create `.env` file if needed:
```env
API_PORT=8000
DATABASE_URL=sqlite:///./documents.db
OCR_LANG=eng
LOG_LEVEL=INFO
```

---

## βœ… Verify Installation

```bash
# Check health
curl http://localhost:8000/health

# Should return: {"status":"healthy",...}
```

---

## πŸ“š Full Documentation

See [QUICKSTART.md](QUICKSTART.md) for detailed guide or [app/README.md](app/README.md) for complete documentation.

---

**πŸŽ‰ You're all set! Open http://localhost:8000/dashboard to get started!**