NEW ORGANIZATION

classroom
Activity Feed

AI & ML interests

None defined yet.

Organization Card

๐ŸŽฏ Resume Analyzer API - Production-Ready Backend

A complete, interview-grade FastAPI backend for AI-powered resume analysis using modern NLP techniques.

Python FastAPI License


โœจ Features

  • ๐Ÿ“„ Resume Parsing: Extract text from PDF and DOCX files
  • ๐Ÿง  NLP Skill Extraction: Use spaCy with 200+ predefined skills
  • ๐ŸŽฏ Semantic Matching: AI-powered resume vs job description matching using sentence-transformers
  • ๐Ÿ“Š Skill Gap Analysis: Identify missing skills with detailed breakdown
  • โšก Fast & Efficient: ~350ms end-to-end latency
  • ๐Ÿš€ Production Ready: Proper error handling, logging, CORS support
  • ๐Ÿ“– Well Documented: Code comments, docstrings, comprehensive guides
  • ๐ŸŽ“ Interview Grade: Clean architecture, best practices, scalable design

๐Ÿš€ Quick Start

1. Setup Virtual Environment (2 min)

Windows:

python -m venv venv
venv\Scripts\activate

macOS/Linux:

python -m venv venv
source venv/bin/activate

2. Install Dependencies (3 min)

pip install -r requirements.txt

3. Download spaCy Model (1 min)

python -m spacy download en_core_web_sm

4. Run the Server (immediate)

python main.py

You should see:

โœ“ Resume parser initialized
โœ“ Skill extractor initialized  
โœ“ Resume matcher initialized
Uvicorn running on http://0.0.0.0:8000

5. Test the API

Open in browser: http://localhost:8000/docs

Use the interactive Swagger UI to test /analyze endpoint!


๐Ÿ“– Documentation

Document Purpose
SETUP_GUIDE.md Installation, deployment, troubleshooting
ARCHITECTURE.md Technical deep dive, design decisions
QUICK_REFERENCE.md Quick commands and API reference

๐Ÿ”Œ API Endpoint

POST /analyze

Upload a resume and analyze against job description

Request:

curl -X POST "http://localhost:8000/analyze" \
  -F "file=@resume.pdf" \
  -F "job_description=Senior Python developer needed..."

Response:

{
  "match_score": 85.5,
  "resume_skills": ["Python", "FastAPI", "PostgreSQL", "Docker"],
  "jd_skills": ["Python", "FastAPI", "PostgreSQL", "Docker", "Kubernetes"],
  "missing_skills": ["Kubernetes"]
}

๐Ÿ“ Project Structure

backend/
โ”œโ”€โ”€ main.py                    # FastAPI application
โ”œโ”€โ”€ requirements.txt           # Python dependencies
โ”œโ”€โ”€ skills.json               # Skill database (200+ skills)
โ”œโ”€โ”€ test_api.py               # Testing script
โ”‚
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ response_models.py    # Pydantic schemas
โ”‚
โ”œโ”€โ”€ services/
โ”‚   โ”œโ”€โ”€ resume_parser.py      # PDF/DOCX parsing
โ”‚   โ”œโ”€โ”€ skill_extractor.py    # spaCy skill extraction
โ”‚   โ”œโ”€โ”€ matcher.py            # Semantic similarity
โ”‚   โ””โ”€โ”€ utils.py              # Helpers & logging
โ”‚
โ”œโ”€โ”€ SETUP_GUIDE.md            # Installation guide
โ”œโ”€โ”€ ARCHITECTURE.md           # Technical documentation
โ””โ”€โ”€ QUICK_REFERENCE.md        # Quick reference

๐Ÿง  How It Works

Step 1: Resume Parsing

  • Accepts PDF or DOCX files
  • Uses pdfplumber for PDFs (accurate, handles tables)
  • Uses python-docx for Word documents
  • Extracts clean text for processing

Step 2: Skill Extraction

  • Uses spaCy NLP for entity recognition
  • Matches against 200+ skills database (skills.json)
  • Fuzzy matching tolerates typos:
    • "Pyton" โ†’ matches "Python" (95% similarity)
    • "FastAPI" โ†’ exact match
  • Returns unique, sorted skills

Step 3: Semantic Matching

  • Uses sentence-transformers (all-MiniLM-L6-v2 model)
  • Converts resume and job description to 384-dim embeddings
  • Computes cosine similarity between embeddings
  • Returns match score: 0-100%

Why semantic matching?

Traditional (keyword matching):
"Python developer" vs "Software engineer with Java" โ†’ 0% match

Semantic (embeddings):
"Python developer" vs "Software engineer with Java" โ†’ 40% match
(Captures meaning: both are developers, different tech stacks)

Step 4: Skill Gap Analysis

  • Identifies skills in job description NOT in resume
  • Returns missing skills list
  • Helps identify training needs

๐Ÿ’ป Usage Examples

Python Script

import requests

# Analyze resume
with open('resume.pdf', 'rb') as f:
    response = requests.post(
        'http://localhost:8000/analyze',
        files={'file': f},
        data={
            'job_description': '''
            Senior Python FastAPI Developer
            Requirements:
            - 5+ years Python experience
            - FastAPI and PostgreSQL
            - Docker & Kubernetes
            - REST API design
            '''
        }
    )

result = response.json()
print(f"Match Score: {result['match_score']}%")
print(f"Missing Skills: {', '.join(result['missing_skills'])}")

React/JavaScript

const formData = new FormData();
formData.append('file', resumeFile);  // From file input
formData.append('job_description', jobDescription);

const response = await fetch('http://localhost:8000/analyze', {
    method: 'POST',
    body: formData
});

const result = await response.json();
console.log(`Match Score: ${result.match_score}%`);

Command Line Test

python test_api.py                    # Interactive mode
python test_api.py --file resume.pdf  # With default JD
python test_api.py --batch ./resumes/ # Multiple files

โš™๏ธ Configuration

Change AI Model (in matcher.py)

# Current: Fast (80MB, 100ms)
ResumeMatcher("all-MiniLM-L6-v2")

# Alternative: More Accurate (420MB, 300ms)
ResumeMatcher("all-mpnet-base-v2")

# Alternative: Highest Quality (700MB, 500ms)
ResumeMatcher("all-roberta-large-v1")

Add Custom Skills (in skills.json)

{
  "skills": [
    "Python",
    "FastAPI",
    "Your Custom Skill Here"
  ]
}

Change Server Port

python -m uvicorn main:app --port 9000

๐Ÿ“Š Performance

Operation Duration
Resume parsing (2-page PDF) ~100ms
Skill extraction ~50ms
Semantic matching ~100ms
Total response time ~350-500ms

Memory Usage:

  • spaCy model: 100MB
  • Sentence-transformers: 80MB
  • Runtime: 50MB
  • Total: ~230MB

๐Ÿš€ Production Deployment

With Gunicorn (4 workers)

pip install gunicorn

gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app \
  --bind 0.0.0.0:8000

Handles: ~12 requests/sec, 4-8 concurrent requests

With Docker

FROM python:3.10

WORKDIR /app

COPY requirements.txt .
RUN pip install -r requirements.txt && \
    python -m spacy download en_core_web_sm

COPY . .

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

Run:

docker build -t resume-analyzer .
docker run -p 8000:8000 resume-analyzer

Systemd Service

[Unit]
Description=Resume Analyzer API
After=network.target

[Service]
User=www-data
WorkingDirectory=/opt/resume-analyzer
Environment="PATH=/opt/resume-analyzer/venv/bin"
ExecStart=/opt/resume-analyzer/venv/bin/gunicorn -w 4 \
  -k uvicorn.workers.UvicornWorker main:app

[Install]
WantedBy=multi-user.target

๐Ÿงช Testing

Health Check

curl http://localhost:8000/health

Interactive Testing

python test_api.py
# Follow prompts to select sample JD and upload resume

Swagger UI

Open http://localhost:8000/docs and click "Try it out"


๐ŸŽ“ Learning & Interview Points

Architecture

โœ… Modular Design: Separated concerns (parsing, extraction, matching) โœ… Clean Code: Type hints, comprehensive docstrings, logging โœ… Error Handling: Validation at multiple layers, proper HTTP status codes

NLP Concepts

โœ… Skill Extraction: spaCy + fuzzy matching (typo tolerance) โœ… Embeddings: sentence-transformers for semantic understanding โœ… Similarity Metrics: Cosine similarity for comparing vectors

Performance

โœ… Caching: Models loaded once, reused for all requests โœ… Async: FastAPI's async/await for efficient I/O โœ… Optimization: ~350ms end-to-end, suitable for production

Scalability

โœ… Multi-worker: Gunicorn with 4+ workers โœ… Load Balancing: Ready for Nginx/ALB โœ… Caching: Can add Redis for repeated requests


๐Ÿ” Key Technologies

Component Library Why
Web Framework FastAPI Modern, async, auto-docs
PDF Extraction pdfplumber Accurate text extraction
DOCX Extraction python-docx Direct DOCX parsing
NLP spaCy Fast, efficient, production-ready
Embeddings sentence-transformers Pre-trained semantic similarity
Similarity scikit-learn Cosine similarity computation
Validation Pydantic Type safety, auto-validation

๐Ÿ› Troubleshooting

Issue: spaCy model not found

python -m spacy download en_core_web_sm

Issue: Port 8000 already in use

python -m uvicorn main:app --port 9000

Issue: Out of memory

  • Use smaller sentence-transformers model
  • Or increase available RAM
  • Check SETUP_GUIDE.md for details

Issue: Slow first request

  • Normal (3-5s for loading models)
  • Subsequent requests are fast (~100-200ms faster)

๐Ÿ“š Files Overview

main.py (200+ lines)

  • FastAPI application setup
  • CORS configuration
  • Health check endpoint
  • Main /analyze endpoint
  • Error handlers
  • Startup/shutdown events

services/resume_parser.py (150+ lines)

  • ResumeParser class
  • parse_pdf(): pdfplumber-based PDF extraction
  • parse_docx(): python-docx-based Word extraction
  • Error handling for corrupt files

services/skill_extractor.py (200+ lines)

  • SkillExtractor class
  • Load skills from JSON database
  • extract_skills(): Fuzzy matching algorithm
  • _fuzzy_match(): Typo-tolerant skill detection
  • Context-aware extraction using spaCy

services/matcher.py (200+ lines)

  • ResumeMatcher class
  • Load sentence-transformers model
  • compute_match_score(): Semantic similarity
  • _compute_cosine_similarity(): Vector similarity
  • batch_match(): Multiple JD matching

models/response_models.py (80+ lines)

  • ResumeAnalysisResponse: Main response schema
  • ErrorResponse: Error schema
  • Pydantic validation and auto-documentation

services/utils.py (100+ lines)

  • Logging setup
  • Text cleaning
  • Skill normalization
  • File validation helpers

skills.json (250+ skills)

  • Predefined skill database
  • Languages, frameworks, tools, soft skills
  • Easy to extend

๐ŸŽฏ Next Steps

To Extend the Backend:

  1. Add Database: Store analysis results in PostgreSQL
  2. Add Caching: Redis cache for embeddings
  3. Add Async Processing: Celery for batch analysis
  4. Add Authentication: JWT tokens for API security
  5. Add Monitoring: Prometheus metrics, error tracking
  6. Add Tests: Unit tests, integration tests
  7. Add Swagger Schemas: OpenAPI documentation

To Integrate with Frontend:

// React component example
const [matchScore, setMatchScore] = useState(null);

const analyzeResume = async (file, jobDescription) => {
    const formData = new FormData();
    formData.append('file', file);
    formData.append('job_description', jobDescription);
    
    const response = await fetch('http://localhost:8000/analyze', {
        method: 'POST',
        body: formData
    });
    
    const result = await response.json();
    setMatchScore(result.match_score);
};

๐Ÿ“œ License

MIT License - Feel free to use for projects, learning, and interviews!


๐Ÿค Support

For questions or issues:

  1. Check SETUP_GUIDE.md for installation help
  2. Check ARCHITECTURE.md for technical details
  3. Review code comments and docstrings
  4. Run python test_api.py for functional testing

โœ… Checklist for Interviews

When discussing this project:

  • Explain modular architecture and separation of concerns
  • Describe NLP approach: spaCy + fuzzy matching
  • Explain embeddings and cosine similarity
  • Discuss performance (350ms end-to-end)
  • Demonstrate error handling strategy
  • Show code organization and documentation
  • Discuss scalability (workers, caching, database)
  • Mention production readiness (logging, CORS, validation)
  • Explain why each library was chosen
  • Discuss trade-offs (accuracy vs speed, memory vs quality)

๐ŸŒŸ Highlights

โœจ Production-Ready Code: Well-commented, type-hinted, properly structured โœจ NLP Best Practices: Modern approaches to semantic understanding โœจ Clean Architecture: Modular design, easy to test and extend โœจ Complete Documentation: Setup, architecture, quick reference guides โœจ Interview-Grade: Demonstrates software engineering skills โœจ Fully Functional: Works end-to-end immediately after setup


Built with โค๏ธ for learning and interviews

Start with: python main.py โ†’ Open http://localhost:8000/docs

models 0

None public yet

datasets 0

None public yet