How bg12345/ocr works
OCR API accepts Indian identity-document uploads through its browser demo or REST endpoints, processes PAN, driving licence, and Aadhaar documents, and returns extracted records or existing-record matches as JSON with temporary download links. The documented processing includes image preprocessing, PDF image conversion, OCR, and Aadhaar/QR decoding; routes also check MongoDB and use S3 for private file storage. The principal source excerpt is partial, so the graph omits uncertain internal wiring and represents documented but unsampled PDF handling at the routes module.
Main entry points: routes.py Flask API routes · app.js Upload demo · preprocessing.py Image preprocessing · PDFTextExtract.py PDF image extraction
Components 17
Client experience
- Upload demo
app/static/js/app.js
API workflows
- Flask API routes
app/routes/routes.py - PAN extraction
app/routes/routes.py - Licence extraction
app/routes/routes.py - Aadhaar extraction
app/routes/routes.py - JSON responses
app/routes/routes.py
Document processing
- Image preprocessing
preprocessing.py - PDF image conversion
app/routes/routes.py - PDF image extraction
PDFTextExtract.py - Tesseract OCR
- QR decoding
preprocessing.py - Aadhaar QR parsing
app/routes/routes.py
Storage and records
- MongoDB records
- S3 upload and links
app/routes/routes.py
Other components
- Browser user
- API caller
- Amazon S3
Connections 24
- Browser user → Upload demo: uploads files
- Upload demo → Flask API routes: submits forms
- API caller → Flask API routes: posts documents
- Flask API routes → PAN extraction: dispatches PAN
- Flask API routes → Licence extraction: dispatches licence
- Flask API routes → Aadhaar extraction: dispatches Aadhaar
- PAN extraction → Image preprocessing: preprocesses image
- Licence extraction → Image preprocessing: preprocesses image
- Aadhaar extraction → Image preprocessing: preprocesses image
- Flask API routes → PDF image conversion: converts PDFs
- Flask API routes → PDF image extraction: extracts PDF images
- PAN extraction → Tesseract OCR: recognizes text
- Licence extraction → Tesseract OCR: recognizes text
- Aadhaar extraction → Tesseract OCR: recognizes text
- Aadhaar extraction → QR decoding: detects QR
- Aadhaar extraction → Aadhaar QR parsing: decodes Aadhaar QR
- PAN extraction → MongoDB records: checks and stores
- Licence extraction → MongoDB records: checks and stores
- Aadhaar extraction → MongoDB records: checks and stores
- Flask API routes → S3 upload and links: uploads files
- S3 upload and links → Amazon S3: stores privately
- S3 upload and links → Flask API routes: returns signed links
- Flask API routes → JSON responses: formats response
- JSON responses → Upload demo: displays JSON