# saivijayragav/neuroscreen architecture

> Architecture diagram of the GitHub repository saivijayragav/neuroscreen, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saivijayragav/neuroscreen
- Repository: https://github.com/saivijayragav/neuroscreen

## Overview

NeuroScreen is a web platform for AQ-10 autism screening and ongoing support, not a diagnostic service. The primary flow is a user completing the screening, receiving a risk estimate and recommendations, and reviewing screening history; the app also supports therapy tasks and games, analytics, AI clinical chat, and reports. The sampled routes show screening fallback behavior, authenticated history and task storage, and AI report/chat generation. Several UI-to-route connections and unsampled capabilities are represented from the README and file tree; their internal wiring was not verified.

Main entry points: [`autism-screening-app/lib/auth.ts`](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/lib/auth.ts) (Authentication), [`autism-screening-app/lib/db.ts`](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/lib/db.ts) (PostgreSQL), [`autism-screening-app/app/api/generate-report/route.ts`](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/generate-report/route.ts) (Report Generator), [`autism-screening-app/app/api/chat/route.ts`](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/chat/route.ts) (Contextual Chat API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_screening["Screening"]
  node_screening_ui["Screening Experience<br/>[page.tsx]"]
  node_screening_form["AQ-10 Form<br/>[screening-form.tsx]"]
  node_screening_api["Screening API<br/>[route.ts]"]
  node_ml_service["ML Prediction<br/>[api.py]"]
  node_results["Results View"]
  node_history_ui["Screening History<br/>[page.tsx]"]
  node_history_api["History API<br/>[route.ts]"]
end

subgraph group_support["Support and Therapy"]
  node_clinical_ui["Clinical Support<br/>[page.tsx]"]
  node_clinical_api["Clinical Chat API<br/>[route.ts]"]
  node_chat_api["Contextual Chat API<br/>[route.ts]"]
  node_therapy_games["Therapy Games<br/>[page.tsx]"]
  node_scenario_api["Scenario Generator<br/>[route.ts]"]
  node_achievement_api["Achievement Generator<br/>[route.ts]"]
  node_tasks_ui["Task Tracker<br/>[page.tsx]"]
  node_tasks_api["Task APIs<br/>[route.ts]"]
  node_task_item_api["Task Updates<br/>[route.ts]"]
end

subgraph group_insights["Progress and Reports"]
  node_analytics_ui["Analytics Dashboard<br/>[page.tsx]"]
  node_report_api["Report Generator<br/>[route.ts]"]
  node_reports_ui["Reports and Export<br/>[page.tsx]"]
  node_notifications_api["Task Notifications<br/>[route.ts]"]
end

subgraph group_platform["Platform Services"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_database[("PostgreSQL<br/>[db.ts]")]
end

node_person(("User"))
node_groq{{"Groq LLM"}}

node_person -->|"completes"| node_screening_ui
node_screening_ui -->|"presents"| node_screening_form
node_screening_form -->|"submits answers"| node_screening_api
node_screening_api -.->|"requests prediction"| node_ml_service
node_screening_api -->|"returns result"| node_results
node_person -->|"reviews"| node_history_ui
node_history_api -->|"checks session"| node_auth
node_history_api -->|"reads and writes"| node_database
node_person -->|"seeks guidance"| node_clinical_ui
node_clinical_api -->|"streams response"| node_groq
node_chat_api -->|"checks session"| node_auth
node_chat_api -->|"reads user context"| node_database
node_chat_api -->|"streams response"| node_groq
node_clinical_ui -->|"sends messages"| node_clinical_api
node_person -->|"plays activities"| node_therapy_games
node_therapy_games -->|"requests scenarios"| node_scenario_api
node_therapy_games -->|"requests achievements"| node_achievement_api
node_achievement_api -->|"generates milestones"| node_groq
node_scenario_api -->|"generates scenarios"| node_groq
node_person -->|"tracks progress"| node_tasks_ui
node_tasks_api -->|"checks session"| node_auth
node_tasks_api -->|"reads and writes"| node_database
node_task_item_api -->|"checks session"| node_auth
node_task_item_api -->|"updates tasks"| node_database
node_report_api -->|"checks session"| node_auth
node_report_api -->|"reads history and tasks"| node_database
node_report_api -->|"generates summary"| node_groq
node_person -->|"requests report"| node_reports_ui
node_reports_ui -->|"requests generation"| node_report_api
node_person -->|"reviews progress"| node_analytics_ui
node_notifications_api -->|"checks session"| node_auth
node_notifications_api -->|"reads pending tasks"| node_database

click node_screening_ui "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/screening/page.tsx"
click node_screening_form "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/components/screening-form.tsx"
click node_screening_api "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/screening/route.ts"
click node_ml_service "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/ml-backend/api.py"
click node_results "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/components/results-dashboard.tsx"
click node_history_ui "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/history/page.tsx"
click node_history_api "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/screening-history/route.ts"
click node_clinical_ui "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/clinical-support/page.tsx"
click node_clinical_api "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/clinical-chat/route.ts"
click node_chat_api "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/chat/route.ts"
click node_therapy_games "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/therapy-games/page.tsx"
click node_scenario_api "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/generate-scenarios/route.ts"
click node_achievement_api "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/generate-achievements/route.ts"
click node_tasks_ui "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/progress/page.tsx"
click node_tasks_api "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/tasks/route.ts"
click node_task_item_api "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/tasks/%5Bid%5D/route.ts"
click node_analytics_ui "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/analytics/page.tsx"
click node_report_api "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/generate-report/route.ts"
click node_reports_ui "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/reports/page.tsx"
click node_notifications_api "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/notifications/route.ts"
click node_auth "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/lib/auth.ts"
click node_database "https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/lib/db.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_screening_ui,node_screening_form,node_screening_api,node_ml_service,node_results,node_history_ui,node_history_api,node_person toneBlue
class node_clinical_ui,node_clinical_api,node_chat_api,node_therapy_games,node_scenario_api,node_achievement_api,node_tasks_ui,node_tasks_api,node_task_item_api toneAmber
class node_analytics_ui,node_report_api,node_reports_ui,node_notifications_api toneMint
class node_auth,node_database toneRose
class node_groq toneIndigo
```

## Components

### Screening

- [Screening Experience](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/screening/page.tsx): `autism-screening-app/app/dashboard/screening/page.tsx`
- [AQ-10 Form](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/components/screening-form.tsx): `autism-screening-app/components/screening-form.tsx`
- [Screening API](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/screening/route.ts): `autism-screening-app/app/api/screening/route.ts`
- [ML Prediction](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/ml-backend/api.py): `autism-screening-app/ml-backend/api.py`
- [Results View](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/components/results-dashboard.tsx): `autism-screening-app/components/results-dashboard.tsx`
- [Screening History](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/history/page.tsx): `autism-screening-app/app/dashboard/history/page.tsx`
- [History API](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/screening-history/route.ts): `autism-screening-app/app/api/screening-history/route.ts`

### Support and Therapy

- [Clinical Support](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/clinical-support/page.tsx): `autism-screening-app/app/dashboard/clinical-support/page.tsx`
- [Clinical Chat API](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/clinical-chat/route.ts): `autism-screening-app/app/api/clinical-chat/route.ts`
- [Contextual Chat API](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/chat/route.ts): `autism-screening-app/app/api/chat/route.ts`
- [Therapy Games](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/therapy-games/page.tsx): `autism-screening-app/app/dashboard/therapy-games/page.tsx`
- [Scenario Generator](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/generate-scenarios/route.ts): `autism-screening-app/app/api/generate-scenarios/route.ts`
- [Achievement Generator](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/generate-achievements/route.ts): `autism-screening-app/app/api/generate-achievements/route.ts`
- [Task Tracker](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/progress/page.tsx): `autism-screening-app/app/dashboard/progress/page.tsx`
- [Task APIs](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/tasks/route.ts): `autism-screening-app/app/api/tasks/route.ts`
- [Task Updates](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/tasks/%5Bid%5D/route.ts): `autism-screening-app/app/api/tasks/[id]/route.ts`

### Progress and Reports

- [Analytics Dashboard](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/analytics/page.tsx): `autism-screening-app/app/dashboard/analytics/page.tsx`
- [Report Generator](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/generate-report/route.ts): `autism-screening-app/app/api/generate-report/route.ts`
- [Reports and Export](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/dashboard/reports/page.tsx): `autism-screening-app/app/dashboard/reports/page.tsx`
- [Task Notifications](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/app/api/notifications/route.ts): `autism-screening-app/app/api/notifications/route.ts`

### Platform Services

- [Authentication](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/lib/auth.ts): `autism-screening-app/lib/auth.ts`
- [PostgreSQL](https://github.com/saivijayragav/neuroscreen/blob/main/autism-screening-app/lib/db.ts): `autism-screening-app/lib/db.ts`

### Other components

- **User**
- **Groq LLM**

## Connections

- User → Screening Experience: completes
- Screening Experience → AQ-10 Form: presents
- AQ-10 Form → Screening API: submits answers
- Screening API → ML Prediction: requests prediction
- Screening API → Results View: returns result
- User → Screening History: reviews
- History API → Authentication: checks session
- History API → PostgreSQL: reads and writes
- User → Clinical Support: seeks guidance
- Clinical Chat API → Groq LLM: streams response
- Contextual Chat API → Authentication: checks session
- Contextual Chat API → PostgreSQL: reads user context
- Contextual Chat API → Groq LLM: streams response
- Clinical Support → Clinical Chat API: sends messages
- User → Therapy Games: plays activities
- Therapy Games → Scenario Generator: requests scenarios
- Therapy Games → Achievement Generator: requests achievements
- Achievement Generator → Groq LLM: generates milestones
- Scenario Generator → Groq LLM: generates scenarios
- User → Task Tracker: tracks progress
- Task APIs → Authentication: checks session
- Task APIs → PostgreSQL: reads and writes
- Task Updates → Authentication: checks session
- Task Updates → PostgreSQL: updates tasks
- Report Generator → Authentication: checks session
- Report Generator → PostgreSQL: reads history and tasks
- Report Generator → Groq LLM: generates summary
- User → Reports and Export: requests report
- Reports and Export → Report Generator: requests generation
- User → Analytics Dashboard: reviews progress
- Task Notifications → Authentication: checks session
- Task Notifications → PostgreSQL: reads pending tasks
