Prescreening Data and Integrations
MongoDB
The backend selects three collections from the configured database. Production data is in Atlas project DMIND Production, cluster dmind-prescreen-backend-prod. Open the current environment mapping → for variant-to-database names.
interview
One document represents a participant case. Important groups are:
- Identity and routing:
_id,case_id,corp_id,data_source,tracking_data. - Participant details: recipient name, age, academic year, gender, phone, province, zone, and user agent.
- AI lifecycle: prediction ID, question configuration, AI status/result, depression level, and result source.
- Self-rating: partner-supplied Agnos HAMD-7/8Q fields, deprecated compatibility AIMET 9Q fields, suicidal response, and low-depression survey.
- Staff workflow: case status, staff assessment, contact/result logs, last-contact date.
- Partner workflow: AllTime 1323 progress/related ID, last selected terminal service, available services, and SROI survey.
Key embedded structures are:
| Structure | Important fields |
|---|---|
question_config | Interview type and avatar ID. |
result_ai | processing/finish status, depression level, two-question flags, suicidal score/level/detail, and chief complaints. |
self_rating_score_agnos | Partner-supplied HAMD-7 total/level/section scores, 8Q score/level, and choice-key answer details; external runtime use is unverified. |
self_rating_score_aimet | Deprecated AIMET 9Q total/severity and question/choice pairs retained for compatibility. |
result_staff_agnos | staff 8Q/9Q scores/levels, unreachable count, invalid-phone flag, staff ID, and first assessment time. |
result_log_agnos[] | staff ID, text, creation time, edit count, and soft-delete flag. |
tracking_data | UTM source/platform/medium/campaign and GA user ID. |
available_low_depression_terminal_service | last fetch time and service names. |
low_depression_survey | chatbot experience, interest, trust, and help-seeking situations. |
sroi_survey | submission time, mental-health behavior, and willingness-to-pay fields. |
Top-level enum families include:
status:NEW,FOLLOW_UP,DONEdepression_level:LOW,MODERATE,SEVEREdepression_level_source: partnerAGNOS_SELF_RATING, participantFALLBACKandAI_SERVICE, deprecated compatibility sourceAIMET_SELF_RATING- interview type: current
TEXT,AUDIO,VIDEO; deprecated compatibility typeCHOICE, which is excluded from configured method selection - terminal service:
ASA,1323_ALLTIME,1323_DASHBOARD,DMIND_CHATBOT,SATI,HERE_TO_HEAL,EMMIND
staff
Stores dashboard username/password hash, identity/contact information, role, province/affiliation, active status, and last login.
incrementor
Contains the atomic case_id counter used when creating interviews.
Redis key catalog
Keys are namespaced by application name.
| Pattern | Value | Lifetime/purpose |
|---|---|---|
<APP>:session:<token> | Serialized interview session | Start/default/end TTLs control an in-progress participant journey. |
<APP>:refresh_token:<staff_id>:<token_uuid> | Refresh counter | JWT refresh lifetime; supports rotation/invalidation checks. |
<APP>:otp_session:<token> | OTP answer payload | Three minutes. |
<APP>:content:<content_id> | S3 content URL | Persistent cache until refreshed. |
<APP>:question_path:<APP> | Serialized question paths | Persistent cached interview ordering. |
The serialized participant session contains workflow state, including phone and national ID used during 1323 verification.
AWS-backed data
| Service | Current use |
|---|---|
| S3 | Interview content and corp frontend artifacts. Live buckets exist for main/dev and TU, MDCU, CPIRD, THPF, KKU, Thangrath, TSU, and TU UAT frontends. |
| SSM Parameter Store | Corp feature configurations and some backend runtime configuration names. |
| Secrets Manager / ECS task environment | JWT, system, and partner secret references; active production tasks provide the MongoDB connection setting through the task environment. |
| SNS | Transactional SMS/OTP delivery from the backend. |
| CloudWatch | Backend logs, response metrics, alarms, and corp-specific log groups. |
External integrations
| Integration | Direction | Purpose |
|---|---|---|
| AI controller | Backend → AI platform | Create predictions, submit answers, fetch results and question paths. |
| Mental Med/Agnos | Partner → POST /interview/submit-self-rating | Accepts HAMD-7/8Q self-rating submissions. The current participant frontend does not call this registered endpoint; external runtime use is unverified. |
| Corp systems | Backend ↔ corp | Corp-specific start and redirect flows. |
| AllTime 1323 | Backend ↔ 1323 | Progress, related ID, verification, OTP, and service routing. |
| ASA | Backend → service | Follow-up service option. |
| DMIND chatbot | Browser/backend → chatbot | Terminal-service redirect and optional survey. |
| Sati / Emmind / Here to Heal | Browser/backend → service | Weighted or configured follow-up options. |
| Cloudflare Turnstile | Browser/backend → Cloudflare | Participant-start bot validation where enabled. |