File size: 6,426 Bytes
60fbe12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
Perfect. Below is the **full, clean, editor-ready** version of **`docs/project_log.md`**.
You can **copy–paste as-is**. No filler, no inconsistencies, aligned with your actual backend state.

---

## πŸ“„ `docs/project_log.md`

```md
# PROJECT LOG β€” Multimodal AI Interview Simulator

## Project Title
Multimodal AI Interview Simulator  
(Backend-first system with scoring, analytics, decision engine, and future frontend)

---

## Project Summary

The Multimodal AI Interview Simulator is a full-stack interview evaluation system designed to:

- Parse ATS-friendly resumes
- Accept job role, job description, experience, and education
- Dynamically generate interview questions
- Conduct a **stateful, multi-stage interview**
- Score answers using **Sentence Transformers + TF-IDF explainability**
- Insert **follow-up questions automatically** when answers lack depth
- Aggregate scores into a final report
- Generate analytics and a readiness index
- Produce a final hiring decision (PASS / BORDERLINE / HOLD)
- Persist **all artifacts** for audit and review

The backend is deterministic, explainable, and LLM-free by design (LLMs planned later).

---

## Architecture Overview

### Backend Stack
- **Framework**: FastAPI
- **ML**: sentence-transformers, scikit-learn
- **ASR**: Whisper (via transformers)
- **Storage**: filesystem (`storage/<session_id>/`)
- **State management**: JSON-based interview state machine
- **Scoring**: cosine similarity + heuristics
- **Analytics**: post-interview signal analysis
- **Decision engine**: rule-based, conservative by default

---

## Key Directories & Files

```

backend/
└── app/
β”œβ”€β”€ main.py
β”œβ”€β”€ api/
β”‚   └── routes/
β”‚       β”œβ”€β”€ health.py
β”‚       β”œβ”€β”€ session.py
β”‚       β”œβ”€β”€ upload.py
β”‚       β”œβ”€β”€ parse_resume.py
β”‚       β”œβ”€β”€ interview_plan.py
β”‚       β”œβ”€β”€ generate_question.py
β”‚       β”œβ”€β”€ score_text.py
β”‚       β”œβ”€β”€ answer_audio.py
β”‚       β”œβ”€β”€ aggregate_scores.py      # Phase 6.1
β”‚       β”œβ”€β”€ analytics_report.py      # Phase 6.2
β”‚       └── decision.py              # Phase 6.3
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ interview_flow.py
β”‚   β”œβ”€β”€ interview_state.py
β”‚   β”œβ”€β”€ interview_reasoning.py
β”‚   β”œβ”€β”€ scoring_config.py
β”‚   └── ml_models.py
docs/
β”œβ”€β”€ api_contracts.md
β”œβ”€β”€ project_log.md
storage/
└── <session_id>/

```

---

## Interview Flow (Authoritative)

```

intro
β†’ project
β†’ technical (resume + JD driven)
β†’ follow-ups (conditional, dynamic)
β†’ HR / behavioral
β†’ critical thinking
β†’ warmup
β†’ wrapup
β†’ candidate questions (loop until none)
β†’ end

````

Rules:
- Intro and project are fixed stages
- Follow-ups can occur **anywhere except between intro β†’ project**
- Interview never ends abruptly after wrap-up
- Candidate questions are handled before final termination

---

## Chronological Development Log

### Phase 0 β€” Foundation
- Repository initialized
- FastAPI skeleton created
- Health check endpoint added
- Session creation with isolated storage implemented

---

### Phase 1 β€” Resume Handling
- Resume upload (`/api/upload/resume`)
- PDF/DOCX text extraction
- Resume parsing (`/api/parse/resume/{session_id}`)
- Extracted: name, email, skills
- Parsing hardened against encoding errors

---

### Phase 2 β€” Interview Planning
- Interview plan generation using:
  - Resume
  - Job role
  - Job description
  - Candidate profile
- Deterministic question generation (no LLM)
- Output stored as `interview_plan.json`

---

### Phase 3 β€” Interview State Machine
- Implemented persistent interview state
- Added:
  - `start_interview`
  - `next_question`
- State transitions tracked in `interview_state.json`
- Prevents repeated questions
- Supports dynamic follow-ups

---

### Phase 4 β€” Answer Scoring
- Text answer scoring (`/api/score/text`)
- SentenceTransformer embeddings
- Cosine similarity normalized to score [0–10]
- TF-IDF token extraction for explainability
- Human-review flags when:
  - Score below threshold
  - Answer too short
  - Depth insufficient

---

### Phase 5 β€” Audio Answers (ASR)
- Audio upload endpoint
- Whisper ASR integration
- Transcript auto-scored using same pipeline
- Audio persisted for audit

---

### Phase 6.1 β€” Score Aggregation
- Aggregates all question scores
- Weighted scoring by question type
- Coverage validation against interview plan
- Generates `final_report.json`
- Updates interview state with final metadata

---

### Phase 6.2 β€” Analytics
- Skill-wise performance analysis
- Follow-up pressure metrics
- Answer consistency signals
- Risk classification (LOW / MEDIUM / HIGH)
- Readiness index generation
- Output: `analytics_report.json`

Cleanup iteration performed:
- Removed stop-word noise
- Reduced token pollution
- Limited skills to meaningful technical signals

---

### Phase 6.3 β€” Decision Engine
- Final hiring decision endpoint
- Inputs:
  - Final score
  - Analytics signals
  - Human-review flags
- Conservative rules:
  - Human review β†’ BORDERLINE or HOLD
- Output: `decision.json`

---

## Known Issues & Resolutions

### Docs UI freezing
- Cause: heavy ML loads during startup
- Fix: lazy model loading

### Resume parsing crashes
- Cause: malformed PDFs
- Fix: error-tolerant text extraction

### Model reload issues (uvicorn)
- Cause: reload + model load race
- Fix: centralized model loader with fallback

---

## Current Status (Confirmed)

βœ… Backend complete  
βœ… Interview lifecycle stable  
βœ… Scoring, aggregation, analytics, decision working  
βœ… API contract finalized  
⏳ LLM enhancement deferred  
⏳ Security hardening pending  
⏳ Frontend not started

---

## Deferred / Future Enhancements

- LLM-based question generation
- LLM-assisted answer evaluation
- Skill taxonomy + ontology
- JWT authentication & RBAC
- Performance optimizations
- Vector DB for answer history
- Admin dashboard

---

## How to Run (Local)

```bash
python -m venv intrv-sim
source intrv-sim/bin/activate
pip install -r requirements.txt
uvicorn backend.app.main:app --reload --reload-exclude storage/*
````

---

## Recommended Next Steps

1. Freeze backend (tag release)
2. Finalize API contract (done)
3. Build frontend (React/Vite)
4. Add admin dashboard
5. Harden security

---

## Changelog

* **2026-02-02**

  * Phase 6.1, 6.2, 6.3 completed
  * Backend feature-complete (non-LLM)