Reusable Document Ingestion Package for IIL Platform (ADR-170)
Project description
iil-ingest
Reusable Document Ingestion Package for the IIL Platform — ADR-170
Pattern: iil-enrichment (ADR-169) — Pure Python Core, Protocol-based, optional Django integration
Installation
pip install iil-ingest[pdf] # PDF only
pip install iil-ingest[all] # PDF + Excel + DOCX
pip install iil-ingest[all,django] # + Django mixins
Quick Start
from ingest import IngestPipeline, ProfileClassifier
from ingest.extractors.pdf import PDFExtractor
from ingest.profiles.german_hr import GERMAN_HR_PROFILES
pipeline = IngestPipeline(
extractors=[PDFExtractor()],
classifier=ProfileClassifier(GERMAN_HR_PROFILES),
)
with open("rechnung.pdf", "rb") as f:
doc = pipeline.run(f.read(), filename="rechnung.pdf")
print(doc.doc_type) # "RECHNUNG"
print(doc.confidence) # "HIGH"
print(doc.score) # 42.0
Custom Profile
from dataclasses import dataclass
from ingest import IngestPipeline, ProfileClassifier
from ingest.extractors.pdf import PDFExtractor
@dataclass
class SdsProfile:
name = "SDS"
patterns = [
(r"sicherheitsdatenblatt", 10),
(r"gefahrenhinweis|h\d{3}", 8),
(r"reach", 6),
]
min_score = 10
pipeline = IngestPipeline(
extractors=[PDFExtractor()],
classifier=ProfileClassifier([SdsProfile()]),
)
Architecture
Upload -> iil-ingest (detect + extract + classify)
-> iil-enrichment (optional enrichment)
-> Django DB / Paperless (archive)
Supported Formats
| Format | Extra | Extractor |
|---|---|---|
[pdf] |
PDFExtractor (pdfplumber) |
|
| Excel (.xlsx) | [excel] |
ExcelExtractor (openpyxl) |
| CSV | -- | CSVExtractor (stdlib) |
| DOCX | [docx] |
DOCXExtractor (python-docx) |
Pipeline Flow
bytes + filename
-> detect_mime() # magic bytes + extension
-> extractor.extract() # text, tables, metadata
-> classifier.classify() # doc_type, confidence, score
-> IngestedDocument
References
- ADR-170:
platform/docs/adr/ADR-170-iil-ingest-document-ingestion-package.md - Pattern: iil-enrichment (ADR-169)
- Migrated from:
dms-hub/apps/benefits/classifier.py,dms-hub/apps/accounting/extractor.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
iil_ingest-0.1.0.tar.gz
(16.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iil_ingest-0.1.0.tar.gz.
File metadata
- Download URL: iil_ingest-0.1.0.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
643860ced8c12e7be52edfffb368998dc1f62f50bef15dc8f6f63defb63beecf
|
|
| MD5 |
664338cd1db39571ad80a22ccfc10090
|
|
| BLAKE2b-256 |
6733ff5a162560d4f87cc7654ea6cfd5b989c1f5f3cd113b3e07f43e63647ec0
|
File details
Details for the file iil_ingest-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iil_ingest-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
288eedf08650c0d289b7250e567ec4956457d802f66bd3cdbae0d9c9f7b3395d
|
|
| MD5 |
235ae94200a10e5517afba505b51da7b
|
|
| BLAKE2b-256 |
050326abce79e2840ce5cf27569627ff59fcbd9307a2ddb95d4c9b5f0c038a47
|