⚡ acatrack-pdf-parser-rs
A high-performance, native Rust PDF parsing engine designed specifically to extract structured academic student records and provisional exam marks. Bridged seamlessly to Python via PyO3 and Maturin, it leverages multi-threaded CPU parallel processing via Rayon to slash batch ingestion processing times.
Developed as the core ingestion engine of AcaTrack, this parser solves complex visual layout alignment issues mathematically and runs 38.4x faster than traditional sequential Python parsers.
🚀 Key Features
- 🏎️ Rayon Parallelization: GIL-free multi-threaded PDF table extraction using CPU core saturation.
- 🛡️ Spacing-Robust Digit Concatenation: Reconstructs fragmented, narrow visual columns (e.g., visual layout splits like
"4"and"5"for a score of45) automatically. - 📐 Virtual Row Splitting: Automatically splits stacked cell values separated by newlines (
\n) into neat, index-aligned rows. - 📐 Mathematical Verification: Automatically executes algebraic checksum checks ($\text{IA} + \text{SEE} == \text{Total}$) to guarantee $100%$ parsing accuracy.
- ⚡ PyO3 FFI Bridge: Compiled into a native
.so/.pydmodule that can be imported directly in Python with zero performance loss. - 📊 FFI Telemetry: Streams granular Rust execution logs back into Python for instant diagnostic debugging.
📊 Performance Benchmarks (1,308 PDFs)
Tested over 1,308 PDFs (across 4 ZIP upload requests) containing freshman provisional university results:
| Metric | Sequential Python Core | Parallel Rust Engine (This Library) 🚀 | Net Improvement |
|---|---|---|---|
| Total Parsing Duration | 21.78 minutes |
34.06 seconds (~0.57 min) |
38.4x Faster 🚀 |
| Speed per PDF | 0.9992 seconds |
0.0260 seconds |
38.4x Faster 🚀 |
| Memory Net Impact | +268.48 MB |
+76.43 MB |
71.5% Lower RAM 📉 |
🛠️ Architecture
The parser integrates a dual-tier parsing fallback mechanism to remain robust across layout changes:
graph TD
A[Raw PDF Page] --> B{Tier 1: Clean Column Scan}
B -- Found Code & Split Cells --> C[Unified Token Concatenation & Math Verification]
B -- Layout Grid Failure --> D{Tier 2: Fallback Flat Text Scan}
D --> E[Tokenize flat whitespace stream]
E --> F[Match codes & parse trailing numeric pairs]
C --> G[StudentRecord PyDict Object]
F --> G
📦 Getting Started
Prerequisites
- Rust Toolchain:
rustup,rustc,cargo(Latest stable edition) - Python:
3.8+ - Maturin:
pip install maturin
Local Development & Setup
-
Clone the repository:
git clone https://github.com/chetanuchiha16/acatrack-pdf-parser-rs.git cd acatrack-pdf-parser-rs
-
Compile and install locally into your active Python environment:
# Builds in release mode and sets up an editable package link maturin develop --release
-
Verify compilation:
python -c "import acatrack_rust; print(acatrack_rust.__doc__)"
🐍 Python Usage Example
import acatrack_rust
# Target subjects to scan for
target_subjects = ["BMATS101", "BCHES102", "BCEDK103", "BENGK106"]
# Parse a single PDF file
record = acatrack_rust.parse_single_pdf(
pdf_path="path/to/student_result.pdf",
subject_codes=target_subjects
)
if record:
print(f"USN: {record['usn']}")
print(f"Name: {record['name']}")
print(f"Marks Extracted: {record['marks']}")
print("\n--- Telemetry Logs ---")
for log in record['logs']:
print(log)
📄 License
Licensed under the MIT License.
Metadata
Release files for acatrack-pdf-parser-rs 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| acatrack_pdf_parser_rs-0.1.1-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details for acatrack_pdf_parser_rs-0.1.1-cp310-cp310-win_amd64.whl |
| acatrack_pdf_parser_rs-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.34+ x86-64 | Details for acatrack_pdf_parser_rs-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl |
| acatrack_pdf_parser_rs-0.1.1-cp310-cp310-macosx_11_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 11.0+ ARM64 | Details for acatrack_pdf_parser_rs-0.1.1-cp310-cp310-macosx_11_0_arm64.whl |
Total release size: 5.0 MB
Release files / acatrack_pdf_parser_rs-0.1.1-cp310-cp310-win_amd64.whl
| Download URL | acatrack_pdf_parser_rs-0.1.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
832238dfc656625ea6fbc5fe9d92516d62ec10ef41aeb395522a9ab90c87e9e4
|
|
BLAKE2b-256 checksum How to use checksums |
304671c08483059055e2ae0204bcaacb0c98bf315d2aba39d67e36d22281ca87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.13.3
|
Release files / acatrack_pdf_parser_rs-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl
| Download URL | acatrack_pdf_parser_rs-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.10 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
98a6fb4b3aaad35798dc33cbcd5b14257bed33362994603d551e3424e57b67d8
|
|
BLAKE2b-256 checksum How to use checksums |
b9afcd7fdcc078c3fe86cf1d2900468a69d9e0e1825717b9dcfdd05532ac116e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.13.3
|
Release files / acatrack_pdf_parser_rs-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | acatrack_pdf_parser_rs-0.1.1-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5807ce39b76873bae2c35b0d9b842b6bf3e555c89f81dd9d00cfe64b2c43b28b
|
|
BLAKE2b-256 checksum How to use checksums |
55f05d4cb79a72a02ca4f3037d56a518a97c43792032c97fdfe6029e223e085b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.13.3
|
Security for acatrack-pdf-parser-rs 0.1.1
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.