Commit 0f7f3b

2025-10-07 10:42:15 Vinay Deokar: Module 1,2 added
Projects/HireGenius/LLD.md ..
@@ 37,11 37,81 @@
| **Embeddings** | OpenAI `text-embedding-3-small` |
| **Email Integration** | Gmail API with OAuth 2.0 |
| **Scheduler** | node-cron |
- ### 🧠 Additional Components
-
- | Component | Technology |
- |------------|-------------|
- | **AI/ML** | OpenAI **GPT-4o-mini** |
- | **Vector Embeddings** | OpenAI **text-embedding-3-small** |
- | **Email Integration** | Gmail API with **OAuth 2.0** |
- | **Scheduler** | **node-cron** |
+
+ ## 2. Module Breakdown
+
+ ### Module 1: Gmail Module
+ **Responsibility:** Email integration and resume fetching
+
+ **Functions:**
+ - Authenticate with Gmail API using OAuth 2.0
+ - Fetch emails with attachments based on filters (date, keywords, labels)
+ - Download resume attachments (PDF, DOCX)
+ - Track last fetch timestamp for incremental processing
+
+ **Key Operations:**
+ - `fetchNewEmails(afterDate, filters)` → Returns array of email objects with attachments
+ - `downloadAttachment(messageId, attachmentId)` → Returns file buffer
+ - `getLastFetchTime(jobId)` → Returns timestamp of last successful fetch
+
+ **External Dependencies:** Gmail API, Google OAuth 2.0
+
+ ---
+
+ ### Module 2: Resume Parser Module
+ **Responsibility:** Extract structured data from resume text
+
+ **Parsing Strategy:** Rule-based NLP with regex patterns
+
+ **Name Extraction:** First line heuristics, capitalization patterns
+ **Email Extraction:** Regex pattern `[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}`
+ **Phone Extraction:** Regex for various formats (+1-XXX-XXX-XXXX, (XXX) XXX-XXXX)
+ **Skills Extraction:** Keyword matching against predefined skill database
+ **Experience Parsing:** Section detection (keywords: "experience", "work history") + date parsing
+ **Education Parsing:** Section detection + degree/institution extraction
+
+ **Functions:**
+ - `extractText(fileBuffer, format)` → Returns plain text from PDF/DOCX
+ - `parseResume(resumeText)` → Returns structured JSON object
+ - `validateParsedData(data)` → Returns boolean + error messages
+ - `normalizeSkills(skillArray)` → Returns deduplicated, lowercase skills
+
+ **Output Format (JSON):**
+ ```json
+ {
+ "name": "John Doe",
+ "email": "john@example.com",
+ "phone": "+1-555-0123",
+ "skills": ["javascript", "python", "sql"],
+ "experience": [
+ {
+ "title": "Software Engineer",
+ "company": "Tech Corp",
+ "duration": "2020-2023",
+ "description": "Built REST APIs..."
+ }
+ ],
+ "education": [
+ {
+ "degree": "B.S. Computer Science",
+ "institution": "MIT",
+ "year": 2018
+ }
+ ],
+ "total_experience_years": 5
+ }
+ ```
+ ---
+
+ ### Alternative AI Approach (Optional Enhancement)
+ Instead of rule-based parsing, use GPT-4o-mini with structured JSON output. The flow would be: extract plain text -> send it to GPT-4o-mini with a schema-enforced prompt -> receive structured JSON (name, email, phone, skills, experience, education, total years).
+
+ **Pros:**
+ - Much higher accuracy across different resume formats and layouts
+ - Handles inconsistent structures, missing sections, and varied wording
+ - Reduces need for complex regex/heuristics
+
+ **Cons:**
+ - Incur API usage costs
+ - Slightly higher latency (~2–5 seconds per resume, depending on length)
+ - Requires API reliability and internet access
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9