rakam-systems-documents
Generic document preparation: turn any source document into clean, structured, provenance-tagged content the rest of the stack can reason over.
from rakam_systems_documents import prepare, MistralOCRProvider
pc = prepare(raw_bytes, mime="application/pdf", filename="invoice.pdf",
ocr=MistralOCRProvider()) # ocr optional; native PDFs skip it
pc.markdown # what a model reads
pc.rows # structured rows (tabular sources), header-keyed + provenance
pc.provenance # page/sheet/row refs
pc.provider # pdf_text | mistral_ocr | docling_ocr | tabular | text | none
What it is (and isn't)
One job: bytes -> PreparedContent. Format dispatch, parse/decode, hybrid-OCR
routing, provenance normalization, truncation. A pure function — the only I/O is the
injected OCR provider.
Not its job: storage, chunking, embedding, indexing, async/status, or any business meaning (extraction, matching, classification). Those belong to the caller — the library gives every caller one document→content primitive so none reimplements parsing/OCR.
Formats
| Source | Handling |
|---|---|
| Native PDF | pymupdf4llm → markdown (text layer, exact, no egress) |
| Scanned PDF / image | hybrid gate → OCR provider (see below) |
| Excel / CSV | openpyxl / csv → markdown table + structured rows + (sheet,row) provenance |
| Word (.docx) | stdlib zip + WordprocessingML → paragraphs (headings kept) and markdown tables + header-keyed rows, in document order |
| Email (.eml) | rfc822 headers + body (html bodies stripped to text) + every attachment prepared in turn under ## Pièce jointe : <name> |
| Text | multi-encoding decode (binary rejected) |
| Legacy .xls / .doc / .msg | not parsed — provider="none" with a "save as .xlsx/.docx/.eml" hint |
OCR is pluggable
Native-text PDFs never hit OCR. Scanned pages / images route to an OCRProvider:
MistralOCRProvider(default) — the Mistral hosted OCR API (/v1/ocr). NeedsMISTRAL_API_KEY.DoclingOCRProvider— on-prem, no egress. Requires the optional extra:pip install rakam-systems-documents[docling].
A missing/unavailable engine degrades gracefully (native text still works; a scan yields
provider="none" + a help hint, never an exception).
Install
pip install rakam-systems-documents # Mistral OCR path
pip install rakam-systems-documents[docling] # + on-prem OCR
Metadata
Release files for rakam-systems-documents 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rakam_systems_documents-0.1.2.tar.gz | 17.7 kB | Without provenance | Details for rakam_systems_documents-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rakam_systems_documents-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for rakam_systems_documents-0.1.2-py3-none-any.whl |
Total release size: 39.4 kB
Release files / rakam_systems_documents-0.1.2.tar.gz
| Download URL | rakam_systems_documents-0.1.2.tar.gz |
|---|---|
| Size | 17.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1896da5be427e5737e2f63dbf2e605170952f6c9f55ea4bb0d8741912cf1950
|
|
BLAKE2b-256 checksum How to use checksums |
fa082226e2c1a51db6a641facac436f74d83d9738b748f5ab1d199ea7788dafd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / rakam_systems_documents-0.1.2-py3-none-any.whl
| Download URL | rakam_systems_documents-0.1.2-py3-none-any.whl |
|---|---|
| Size | 21.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
421ca7126552391aa2b99ad7953ab3d6e2475f5e0eb8a12360c1e39ef98ed162
|
|
BLAKE2b-256 checksum How to use checksums |
3cf288bda45a1a1c8b44f0025848288bb270307b7f120e5b834dffbffb55747d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for rakam-systems-documents 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.