Skip to content

Repository files navigation

📄 Resume Parser Engine: Unstructured PDF to Structured JSON

Python Pydantic PyMuPDF

A lightweight, high-performance rule-based parsing engine designed to extract unstructured text from PDF resumes and convert it into schema-validated, ATS-friendly JSON.

Unlike rigid ML models that can hallucinate or overfit to specific resume templates, this engine utilizes deterministic heuristics—such as anchor-collision detection—to robustly handle multi-column layouts, varied regional formatting, and complex narrative structures.


🎯 Engineering & ATS Strategy

Applicant Tracking Systems (ATS) rely on strict, predictable data models to index candidates for search. This project is built with downstream database integration and API consumption in mind:

  • Pydantic Data Contracts: Guarantees strict schema validation. Output JSON is deeply nested and strictly typed, making it plug-and-play for FastAPI microservices or Document/Vector databases.
  • Canonical Skill Normalization: Extracts varied technical phrases (e.g., "NodeJS", "node.js") and maps them to a canonical taxonomy for standardized database querying.
  • Context-Aware Chunking: Employs a 2-pass algorithmic slicing strategy to prevent "section bleeding" (e.g., keeping Education metadata out of the Work Experience blocks).
  • International PII Validation: Uses RFC-compliant regex for emails and ITU E.164 length verification to accurately extract international phone numbers without capturing false positives like date ranges.

🏗️ System Architecture

The pipeline is decoupled into three primary stages to ensure maintainability and fault isolation:

  1. Ingestion (pdf_extractor.py): Safely streams document binaries, preserving spatial layout and reading order using PyMuPDF.
  2. Heuristic Parsers (parse_*.py): A Facade pattern orchestrates isolated sub-parsers. If the Experience parser fails on a bizarre template, the Pipeline gracefully degrades rather than crashing, ensuring Email and Skills are still captured.
  3. Serialization (models.py): Domain entities are serialized into a heavily typed Pydantic model.

🚀 Quick Start

Prerequisites

  • Python 3.9+
  • pip package manager

Installation

Clone the repository and install the required dependencies:

git clone https://github.com/YOUR_USERNAME/resume_parser.git
cd resume_parser

# It is recommended to use a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows use: venv\Scripts\activate

pip install pymupdf pydantic

🚀 Usage

Run the orchestration script to process a sample resume:

python main.py

Note: To test your own resume, place the .pdf file in the root directory and update the input_resume path variable inside main.py.

🗂️ Example JSON Output

The engine outputs deterministic, strictly typed JSON ready for indexing:

{
  "name": "Utkarsh Vaibhav",
  "email": "utkarshvaibhav888@gmail.com",
  "phone": "+91 9876543210",
  "skills": [
    "Docker",
    "Git",
    "Java",
    "Machine Learning",
    "Python",
    "SQL"
  ],
  "education": [
    [
      "Bachelor of Technology in Computer Science",
      "2020 - 2024",
      "# Vel Tech Rangarajan Dr. Sagunthala R&D Institute of Science and Technology"
    ]
  ],
  "experience": [
    [
      "Software Engineer",
      "Tech Corp | 2025 - Present",
      "Developed automated resume parsing microservice using Pydantic and PyMuPDF.",
      "Optimized heuristic algorithms reducing false positive extraction by 40%."
    ]
  ]
}

🧠 Core Algorithms Highlight: Anchor Collision

Extracting multi-line work experience without explicit XML/HTML tags is notoriously difficult. This engine solves this using Anchor Collision Detection:

  1. It scans a section line-by-line, looking for structural anchors (Dates, Job Titles, Company Names).

  2. It filters out descriptive narrative lines (bullets or lines >10 words).

  3. If an incoming line contains an anchor type that already exists in the current working block, it triggers a "collision," safely finalizing the previous job entry and beginning a new one.

🛣️ Roadmap & Future Scope

  • FastAPI Wrapper: Expose the process_resume() pipeline as a RESTful API endpoint.

  • LLM Fallback Sub-parser: Integrate a lightweight local LLM to serve as a fallback parser for heavily obfuscated PDF layouts that fail the heuristic passes.

👨‍💻 Author

Utkarsh Vaibhav

Built with a focus on clean code, software architecture, and practical AI/ML data engineering.

About

Lightweight Python engine converting unstructured resumes into schema-validated JSON.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages