AI Platform Data and Contracts
MongoDB prediction collection
The controller stores one document per prediction in collection prediction.
Mongo stores these statuses as integers:
- answer:
0 NO_ANSWER,1 TRANSCRIBING,2 TRANSCRIBE_SUCCESS,3 CONVERT_FILE_FAILED - result item:
0 WAITING_FOR_ANSWER,1 PREDICTING,2 PREDICT_SUCCESS,3 PREDICT_FAILED
The Go GPT worker can store the submitted answer map, provider response, endpoint, version, and task metadata in openai-gpt-response. Release v1.0.3 enables this option by default, and the production-v2 task definition has no disabling override.
S3 object layout
The controller uploads source media beneath:
<prediction_id>/<question_id>/<original_filename>The converter output path uses the same prefix with converted_<text-before-first-period>.mp3. Production-v2 uses bucket dmind-aiservice-asrfilestorage-prod-v2.
FIFO queue contracts
ASR request
Queue: dmind_ai-service_asr_queue_prod-v2.fifo.
{
"filepath": "<sanitized-s3-key>",
"prediction_id": "<uuid>",
"question_id": "qs-01-02"
}The on-cloud, on-prem caller, and OpenAI ASR workers are competing consumers of this queue. The controller does not route a message to a specific implementation; every worker publishes transcripts to the controller result queue. Tier-1 and tier-2 ASR dead-letter queues handle failed processing.
DSC request
Queue: dmind_ai-service_dsc_queue_prod-v2.fifo.
{
"prediction_id": "<uuid>",
"text": {
"qs-01-02": "<sanitized-text>"
}
}The enabled event-source mapping targets alias distributer of dmind_ai-service_dsc_invoker-function_prod-v2; that alias points to function version 7. The Lambda calls the DSC model API and emits depression.rank to the controller result queue.
OpenAI request
Queue: dmind_ai-service_openai_queue_prod-v2.fifo.
{
"prediction_id": "<uuid>",
"version": "1_0_0",
"answer": {
"qs-07-03": "<sanitized-text>"
},
"task_id": "openai_suicidal_severity"
}The Go worker formats the versioned prompt, calls Azure OpenAI, parses function-call or content JSON into task-specific structures, and sends normalized result fragments.
Controller result
Queue: dmind_ai-controller_result-queue_prod-v2.fifo.
The SQS message attribute type selects one of two body contracts:
store_text:prediction_id,question_id, and transcripttext.save_result:prediction_idand an array of{result_id, value}.
Successful persistence removes the message. Malformed JSON and unrecognized non-empty type values are also deleted; persistence errors and messages without type remain for another receive.
Result contract
The internal Mongo result tree is versioned and can aggregate:
- two-question-plus flags: sadness, boredom, suicidal thought
- depression: numeric/model rank, choice rank where applicable, and
LOW/MODERATE/SEVERElevel - suicidal assessment: severity, rank, and detail
- chief complaint: sad complaint terms
The public GET /result envelope contains prediction id, status (PROCESSING or FINISH), optional result, and answer_count. A finished result exposes:
| Field | Public type |
|---|---|
two_q_plus | {sad: boolean, boredom: boolean, suicidal_thought: boolean} |
suicidal_score | integer in 1_0_0; integer or null in 1_1_0 and 1_2_0 |
chief_complaint | {sad: string[]} |
depression_level | LOW, MODERATE, or SEVERE |
Versions 1_1_0 and 1_2_0 finish against method-specific required results; 1_0_0 requires the complete legacy result set. Version 1_2_0 derives two_q_plus.suicidal_thought from suicidal rank. No public version exposes the full internal depression or suicidal tree. Clients depend on the requested result-format version, not the Mongo representation.