|
Download FILE_STRUCTURE.md from Neworg001/README: direct link, hf CLI and curl.
- Browser
- Download file 13 kB
-
https://huggingface.co/spaces/Neworg001/README/resolve/main/FILE_STRUCTURE.md
- Command line
-
hf download hf://spaces/Neworg001/README/FILE_STRUCTURE.md
-
curl -L -o FILE_STRUCTURE.md https://huggingface.co/spaces/Neworg001/README/resolve/main/FILE_STRUCTURE.md
13 kB
Resume Analyzer Backend - Visual Structure & File Guide
π¦ Complete File Tree
backend/
β
βββ π Documentation (Read These First!)
β βββ README.md β START HERE (overview)
β βββ SETUP_GUIDE.md β Installation & setup
β βββ ARCHITECTURE.md β Technical details
β βββ QUICK_REFERENCE.md β Quick commands
β βββ DEPLOYMENT.md β Production deployment
β βββ DELIVERY_SUMMARY.md β What was built
β βββ FILE_STRUCTURE.md β This file
β
βββ π Application Code
β βββ main.py β FastAPI app (250+ lines)
β βββ requirements.txt β Python dependencies
β βββ .env.example β Environment template
β βββ skills.json β Skill database (250+ skills)
β βββ test_api.py β Testing & demo script (300+ lines)
β
βββ π models/
β βββ response_models.py β Pydantic schemas (2 models)
β βββ ResumeAnalysisResponse β Main response model
β βββ ErrorResponse β Error response model
β
βββ π services/
βββ resume_parser.py β File parsing service (150+ lines)
β βββ ResumeParser class
β βββ parse_pdf() β PDF extraction
β βββ parse_docx() β DOCX extraction
β
βββ skill_extractor.py β Skill extraction (200+ lines)
β βββ SkillExtractor class
β βββ extract_skills() β Main extraction
β βββ _fuzzy_match() β Typo tolerance
β
βββ matcher.py β Semantic matching (200+ lines)
β βββ ResumeMatcher class
β βββ compute_match_score() β Main matching
β βββ batch_match() β Batch processing
β
βββ utils.py β Utilities (100+ lines)
βββ setup_logging()
βββ clean_text()
βββ normalize_skill()
βββ validate_file_path()
π Line Count Summary
main.py 250 lines β Core application
services/resume_parser.py 150 lines β File parsing
services/skill_extractor.py 200 lines β Skill extraction
services/matcher.py 200 lines β Semantic matching
services/utils.py 100 lines β Utilities
models/response_models.py 80 lines β Validation
test_api.py 300 lines β Testing
Total Code 1280 lines
βββ Documentation 600 lines
βββ Comments & Docstrings 400 lines
Combined Total 2280 lines
π― File-by-File Guide
1. main.py (The Heart)
What it does:
- Sets up FastAPI application
- Initializes ML models on startup
- Defines API endpoints
- Handles errors
Key sections:
# Configuration (lines 1-20)
app = FastAPI(...)
app.add_middleware(CORSMiddleware, ...)
# Startup event (lines 30-50)
@app.on_event("startup")
async def startup_event():
# Initialize resume_parser, skill_extractor, resume_matcher
# Health endpoint (lines 60-75)
@app.get("/health")
# Main endpoint (lines 85-200)
@app.post("/analyze")
async def analyze_resume(file: UploadFile, job_description: str)
# Error handlers (lines 210-240)
@app.exception_handler(HTTPException)
Dependencies:
- FastAPI, Uvicorn
- All service classes
- Pydantic models
2. services/resume_parser.py (File Handler)
What it does:
- Extracts text from PDF files
- Extracts text from DOCX files
- Validates files
- Handles errors gracefully
Key class:
class ResumeParser:
@staticmethod
def parse_pdf(file_path: str) -> str
@staticmethod
def parse_docx(file_path: str) -> str
@staticmethod
def parse_resume(file_path: str, file_type: str) -> str
Dependencies:
- pdfplumber (PDF parsing)
- python-docx (Word parsing)
- Logging utilities
3. services/skill_extractor.py (NLP Engine)
What it does:
- Loads spaCy NLP model
- Loads skill database from JSON
- Extracts skills with fuzzy matching
- Handles typos with 85% threshold
Key class:
class SkillExtractor:
def __init__(self, skills_json_path: str = None)
def extract_skills(self, text: str) -> List[str]
def _fuzzy_match(self, text: str, skill: str) -> bool
Dependencies:
- spacy (NLP)
- difflib (fuzzy matching)
- skills.json (skill database)
4. services/matcher.py (AI Matching)
What it does:
- Loads sentence-transformers model
- Generates embeddings for text
- Computes cosine similarity
- Returns match scores (0-100%)
Key class:
class ResumeMatcher:
def __init__(self, model_name: str = "all-MiniLM-L6-v2")
def compute_match_score(self, resume: str, jd: str) -> float
def batch_match(self, resume: str, jds: List[str]) -> list
Dependencies:
- sentence-transformers (embeddings)
- scikit-learn (cosine similarity)
- torch (deep learning)
5. services/utils.py (Helpers)
What it does:
- Sets up logging
- Cleans text
- Normalizes skills
- Validates files
Key functions:
def setup_logging(log_level: str) -> logging.Logger
def clean_text(text: str) -> str
def normalize_skill(skill: str) -> str
def validate_file_path(file_path: str, ...) -> bool
No external dependencies (uses stdlib)
6. models/response_models.py (Data Schemas)
What it does:
- Defines response data structures
- Validates data with Pydantic
- Generates OpenAPI docs
Key classes:
class ResumeAnalysisResponse(BaseModel):
match_score: float
resume_skills: List[str]
jd_skills: List[str]
missing_skills: List[str]
class ErrorResponse(BaseModel):
error: str
detail: str
status_code: int
Dependencies:
- Pydantic (validation)
7. skills.json (Data)
What it contains:
- 250+ predefined skills
- Organized by category:
- Programming languages (Python, Java, etc.)
- Web frameworks (FastAPI, Django, React, etc.)
- Databases (PostgreSQL, MongoDB, etc.)
- Cloud platforms (AWS, Azure, GCP)
- Tools (Docker, Kubernetes, etc.)
- Soft skills (Leadership, Communication, etc.)
Format:
{
"skills": [
"Python",
"FastAPI",
"PostgreSQL",
...
]
}
8. test_api.py (Testing)
What it does:
- Tests API endpoints
- Provides interactive testing
- Batch testing capability
- Sample job descriptions
Key functions:
def check_api_health() -> bool
def analyze_resume(file_path: str, job_description: str) -> dict
def interactive_test()
def batch_test(resume_dir: str)
Usage:
python test_api.py # Interactive
python test_api.py --file resume.pdf # File mode
python test_api.py --batch ./dir/ # Batch mode
9. requirements.txt (Dependencies)
What it contains:
fastapi==0.104.1 # Web framework
uvicorn[standard]==0.24.0 # ASGI server
pdfplumber==0.10.3 # PDF extraction
python-docx==0.8.11 # DOCX parsing
spacy==3.7.2 # NLP
sentence-transformers==2.2.2 # Embeddings
torch==2.1.1 # Deep learning
scikit-learn==1.3.2 # ML utilities
pydantic==2.5.0 # Validation
...
10. Documentation Files
| File | Purpose | Length |
|---|---|---|
| README.md | Main overview & features | 400 lines |
| SETUP_GUIDE.md | Installation & deployment | 500 lines |
| ARCHITECTURE.md | Technical design | 600 lines |
| QUICK_REFERENCE.md | Commands & API reference | 250 lines |
| DEPLOYMENT.md | Production deployment | 400 lines |
| DELIVERY_SUMMARY.md | What was delivered | 350 lines |
| FILE_STRUCTURE.md | This file (guide) | 300 lines |
π Data Flow
User Request
β
FastAPI (main.py)
ββ Validate inputs
β ββ Check file type, size, content length
β
ββ Parse Resume
β ββ services/resume_parser.py
β ββ If PDF: pdfplumber
β ββ If DOCX: python-docx
β ββ Return: Clean text
β
ββ Extract Skills (Resume)
β ββ services/skill_extractor.py
β ββ Load spaCy model
β ββ Load skills.json
β ββ Fuzzy match skills
β ββ Return: [Skill1, Skill2, ...]
β
ββ Extract Skills (Job Description)
β ββ services/skill_extractor.py
β ββ Return: [Skill1, Skill2, ...]
β
ββ Skill Gap Analysis
β ββ Find: JD skills - Resume skills
β
ββ Semantic Matching
β ββ services/matcher.py
β ββ Load sentence-transformers
β ββ Generate embeddings
β ββ Compute cosine similarity
β ββ Return: Match score (0-100)
β
ββ Build Response
β ββ models/response_models.py
β ββ Validate with Pydantic
β ββ Return: JSON response
β
ββ Return JSON
{
"match_score": 85.5,
"resume_skills": [...],
"jd_skills": [...],
"missing_skills": [...]
}
π οΈ Technology Stack
Backend Framework
- FastAPI - Modern, async, automatic API docs
File Processing
- pdfplumber - PDF text extraction
- python-docx - Word document parsing
Natural Language Processing
- spaCy - Entity recognition, text processing
- sentence-transformers - Semantic embeddings
Machine Learning
- torch - Deep learning backend
- scikit-learn - Cosine similarity
Data Validation
- Pydantic - Type checking, validation
Server
- Uvicorn - ASGI server
- Gunicorn - Production server (optional)
π Complexity Breakdown
Simple (read-only)
βββ utils.py β Text cleaning, helpers
βββ response_models.py β Data schemas
βββ skills.json β Skill database
Medium (processing)
βββ resume_parser.py β File extraction
βββ test_api.py β Testing script
Complex (ML/AI)
βββ skill_extractor.py β spaCy + fuzzy matching
βββ matcher.py β Embeddings + cosine similarity
Orchestration
βββ main.py β Coordinates all services
π Getting Started by File
1. First time?
- Read: README.md
- Run:
python main.py - Test: Open http://localhost:8000/docs
2. Installation issues?
- Read: SETUP_GUIDE.md
- Check: requirements.txt
3. Want to understand how it works?
- Read: ARCHITECTURE.md
- Review: main.py, then services/
4. Need quick commands?
- Read: QUICK_REFERENCE.md
- Check: test_api.py examples
5. Ready for production?
- Read: DEPLOYMENT.md
- Check: DELIVERY_SUMMARY.md
β Verification Checklist
Before using, verify all files exist:
cd backend
# Core code files
[ -f main.py ] β
[ -f requirements.txt ] β
[ -f skills.json ] β
[ -f test_api.py ] β
[ -f .env.example ] β
# Service files
[ -f services/resume_parser.py ] β
[ -f services/skill_extractor.py ] β
[ -f services/matcher.py ] β
[ -f services/utils.py ] β
# Model files
[ -f models/response_models.py ] β
# Documentation
[ -f README.md ] β
[ -f SETUP_GUIDE.md ] β
[ -f ARCHITECTURE.md ] β
[ -f QUICK_REFERENCE.md ] β
[ -f DEPLOYMENT.md ] β
[ -f DELIVERY_SUMMARY.md ] β
π Notes
- All files include comprehensive docstrings
- All code is type-hinted for clarity
- All documentation is thorough and organized
- All dependencies are in requirements.txt
- All skills are in skills.json
- Code is production-ready with proper error handling
For detailed explanation of each file, see ARCHITECTURE.md For quick commands, see QUICK_REFERENCE.md For setup, see SETUP_GUIDE.md