Mortgage document classifier using OCR, rules, AI validation, and human review.
338
AI-assisted mortgage document classification with OCR, rule-based evidence, LLM validation, and human-review routing.
A mortgage document classification and human-review console built for the MK Lending coding assignment.
The pipeline combines native PDF text extraction, selective OCR, explainable rule-based classification, and optional LLM validation to classify mortgage-document pages and group contiguous pages into document units.
URLA_1003INCOME_DOCCREDIT_REPORTTITLE_REPORTOTHERopenai/gpt-oss-120b) support.env, or API key included in the imageMulti-architecture image support:
linux/amd64linux/arm64Available tags:
latest1.0.0Pull the image:
docker pull seungchan1122/mk-document-classifier:latest
No external AI API is required.
docker run --rm \
-p 8501:8501 \
-e AI_PROVIDER=none \
seungchan1122/mk-document-classifier:latest
Open:
http://localhost:8501
Create a local .env file and provide it only at container runtime.
Example for NVIDIA NIM:
AI_PROVIDER=nvidia
NVIDIA_API_KEY=your_api_key
NVIDIA_BASE_URL=https://integrate.api.nvidia.com/v1
NVIDIA_MODEL=openai/gpt-oss-120b
ALLOW_PRIVATE_AI_UPLOAD=true
Run:
docker run --rm \
-p 8501:8501 \
--env-file .env \
seungchan1122/mk-document-classifier:latest
API keys are supplied only at runtime and are not embedded in the Docker image.
PDF
↓
Native Text Extraction
↓
Selective OCR
↓
Weighted Rule Evidence
↓
Optional AI Validation
↓
Page Classification
↓
Human Review Routing
↓
Contiguous Document Groups
On the provided package_01 Ground Truth:
| Stage | Accuracy |
|---|---|
| Native Rule | 82.05% (32/39) |
| Rule + OCR | 82.05% (32/39) |
| Rule + OCR + NVIDIA AI | 94.87% (37/39) |
The hybrid run improved 5 pages without introducing newly incorrect pages in this evaluation.
INCOME_DOC had only one Ground Truth sample and remained misclassified, so this project does not claim reliable generalized performance for that class.
package_02 has no official Ground Truth, so no accuracy claim is made for it.
Review routing is intentionally conservative.
A page may be flagged when:
OTHERThe Streamlit Review Console groups review pages by package and provides sanitized review reasons and in-memory page previews.
The Docker image does not contain the coding-test PDFs or ZIP archives.
Uploaded files are processed in temporary storage and are not persisted to the repository or Docker image.
External AI usage requires explicit opt-in:
ALLOW_PRIVATE_AI_UPLOAD=true
The original PDF or page image is not sent to the configured LLM provider. Only the extracted text required for classification is sent.
Persisted reports use sanitized output and do not store raw page text or free-form source evidence.
Verified with:
/_stcore/healthlinux/amd64linux/arm64http://localhost:8501/_stcore/health
seungchan1122/mk-document-classifier
Built as a reproducible Docker delivery layer around the same classification engine used by the CLI and Streamlit application.
Content type
Image
Digest
sha256:be8eee6cd…
Size
312.1 MB
Last updated
about 2 months ago
docker pull seungchan1122/mk-document-classifier