Report Generation (SQS Consumer → AI Analysis → Report Storage)
Worker generates an interview report from snapshot and transcript, or marks insufficient evidence without LLM.
Sequence
sequenceDiagram
autonumber
participant Settle as settlement.service
participant SQS as SQS report-generate
participant Lambda as report-generate handler
participant Gen as report-generation.service
participant OpenAI as OpenAI API
participant Mongo as MongoDB
Settle->>SQS: publishReportGenerate
SQS->>Lambda: message
Lambda->>Gen: generateReport
Gen->>Mongo: claim report PROCESSING
alt too short or few answers
Gen->>Mongo: insufficient_evidence COMPLETED
else AI path
Gen->>OpenAI: chat completions json_schema
OpenAI-->>Gen: structured report
Gen->>Mongo: COMPLETED report fields
endSteps
- Settlement enqueues
{ interviewId, organizationId }after first successful credit settlement. - Lambda loads the interview and atomically claims the report document as processing.
- Very short interviews or too few answers get a completed insufficient-evidence report without LLM.
- Otherwise structured OpenAI output becomes scores, recommendation, and skill assessments.
- Recruiters poll or fetch report status and content when generation completes.