# fayas2007/naren-exam-stress-analyzer architecture

> Architecture diagram of the GitHub repository fayas2007/naren-exam-stress-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fayas2007/naren-exam-stress-analyzer
- Repository: https://github.com/fayas2007/naren-exam-stress-analyzer

## Overview

Exam Stress Analyzer is a mobile research workflow for importing survey data, checking its quality, running statistical analyses, and exploring or exporting results. Users authenticate, upload and map a dataset, validate it, then request analysis and view dashboards; separate branches support prediction, profile management, and statistics-grounded assistant chats. The README documents an R Plumber backend, PostgreSQL, and Gemini integration, but backend source files are not in the supplied tree. The mobile-to-backend connection is therefore shown only at the documented REST boundary.

Main entry points: [`mobile/src/api/analysisApi.ts`](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/analysisApi.ts) (Analysis API), [`mobile/src/api/client.ts`](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/client.ts) (HTTP API client), [`mobile/app/upload/index.tsx`](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/upload/index.tsx) (Dataset upload), [`mobile/app/upload/validate.tsx`](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/upload/validate.tsx) (Mapping and validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and app shell"]
  node_authscreens["Sign in and onboarding<br/>[login.tsx]"]
  node_authstate["Authentication state<br/>[AuthContext.tsx]"]
  node_securestorage[("Session storage<br/>[storage.ts]")]
  node_home["Home dashboard<br/>[index.tsx]"]
  node_profile["Profile screen<br/>[profile.tsx]"]
end

subgraph group_data["Dataset workflow"]
  node_upload["Dataset upload<br/>[index.tsx]"]
  node_session["Dataset session<br/>[datasetSession.ts]"]
  node_validation["Mapping and validation<br/>[validate.tsx]"]
  node_filehelper["File handling<br/>[fileHelper.ts]"]
end

subgraph group_insights["Analysis and reporting"]
  node_analysisapi["Analysis API<br/>[analysisApi.ts]"]
  node_analysisview["Analysis dashboard<br/>[&#91;id&#93;.tsx]"]
  node_visuals["Statistical visualizations"]
  node_reports["Report generation<br/>[reportGenerator.ts]"]
  node_analyseslist["Analysis history<br/>[analyses.tsx]"]
  node_assistant["Assistant chat<br/>[assistant.tsx]"]
  node_prediction["Prediction screen<br/>[predict.tsx]"]
end

subgraph group_services["Mobile services"]
  node_api["HTTP API client<br/>[client.ts]"]
  node_datasetapi["Dataset API<br/>[datasetApi.ts]"]
  node_chatapi["Chat API<br/>[chatApi.ts]"]
  node_profileapi["Profile API<br/>[profileApi.ts]"]
end

node_user(("Researcher or student"))
node_backend["R Plumber REST backend"]
node_postgres[("Neon PostgreSQL")]
node_gemini["Gemini API"]

node_user -->|"signs in"| node_authscreens
node_authscreens -->|"requests auth"| node_authstate
node_authstate -->|"stores session"| node_securestorage
node_authstate -->|"authenticates via REST"| node_backend
node_user -->|"selects dataset"| node_upload
node_upload -->|"reads file"| node_filehelper
node_upload -->|"uploads dataset"| node_datasetapi
node_upload -->|"keeps upload state"| node_session
node_validation -->|"checks mapping"| node_datasetapi
node_validation -->|"starts analysis"| node_analysisapi
node_validation -->|"uses dataset state"| node_session
node_datasetapi -->|"sends requests"| node_api
node_analysisapi -->|"sends requests"| node_api
node_api -->|"calls REST endpoints"| node_backend
node_backend -->|"persists data"| node_postgres
node_backend -.->|"requests chat assistance"| node_gemini
node_home -->|"loads analyses"| node_analysisapi
node_analyseslist -.->|"lists analyses"| node_analysisapi
node_analysisview -->|"loads results"| node_analysisapi
node_analysisview -->|"renders charts"| node_visuals
node_analysisview -->|"generates report"| node_reports
node_assistant -->|"sends chat"| node_chatapi
node_assistant -->|"gets analysis context"| node_analysisapi
node_chatapi -->|"sends requests"| node_api
node_prediction -.->|"requests prediction"| node_api
node_profile -->|"loads profile"| node_profileapi
node_profileapi -->|"sends requests"| node_api

click node_authscreens "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/(auth)/login.tsx"
click node_authstate "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/context/AuthContext.tsx"
click node_securestorage "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/utils/storage.ts"
click node_home "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/(tabs)/index.tsx"
click node_upload "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/upload/index.tsx"
click node_session "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/utils/datasetSession.ts"
click node_validation "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/upload/validate.tsx"
click node_filehelper "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/utils/fileHelper.ts"
click node_analysisapi "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/analysisApi.ts"
click node_analysisview "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/analysis/%5Bid%5D.tsx"
click node_visuals "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/components/DistributionChart.tsx"
click node_reports "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/utils/reportGenerator.ts"
click node_analyseslist "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/(tabs)/analyses.tsx"
click node_assistant "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/(tabs)/assistant.tsx"
click node_prediction "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/predict.tsx"
click node_api "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/client.ts"
click node_datasetapi "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/datasetApi.ts"
click node_chatapi "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/chatApi.ts"
click node_profile "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/(tabs)/profile.tsx"
click node_profileapi "https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/profileApi.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_authscreens,node_authstate,node_securestorage,node_home,node_profile toneBlue
class node_upload,node_session,node_validation,node_filehelper,node_postgres toneAmber
class node_analysisapi,node_analysisview,node_visuals,node_reports,node_analyseslist,node_assistant,node_prediction,node_gemini toneMint
class node_api,node_datasetapi,node_chatapi,node_profileapi toneRose
class node_user,node_backend toneIndigo
```

## Components

### Access and app shell

- [Sign in and onboarding](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/(auth)/login.tsx): `mobile/app/(auth)/login.tsx`
- [Authentication state](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/context/AuthContext.tsx): `mobile/src/context/AuthContext.tsx`
- [Session storage](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/utils/storage.ts): `mobile/src/utils/storage.ts`
- [Home dashboard](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/(tabs)/index.tsx): `mobile/app/(tabs)/index.tsx`
- [Profile screen](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/(tabs)/profile.tsx): `mobile/app/(tabs)/profile.tsx`

### Dataset workflow

- [Dataset upload](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/upload/index.tsx): `mobile/app/upload/index.tsx`
- [Dataset session](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/utils/datasetSession.ts): `mobile/src/utils/datasetSession.ts`
- [Mapping and validation](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/upload/validate.tsx): `mobile/app/upload/validate.tsx`
- [File handling](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/utils/fileHelper.ts): `mobile/src/utils/fileHelper.ts`

### Analysis and reporting

- [Analysis API](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/analysisApi.ts): `mobile/src/api/analysisApi.ts`
- [Analysis dashboard](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/analysis/%5Bid%5D.tsx): `mobile/app/analysis/[id].tsx`
- [Statistical visualizations](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/components/DistributionChart.tsx): `mobile/src/components/DistributionChart.tsx`
- [Report generation](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/utils/reportGenerator.ts): `mobile/src/utils/reportGenerator.ts`
- [Analysis history](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/(tabs)/analyses.tsx): `mobile/app/(tabs)/analyses.tsx`
- [Assistant chat](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/(tabs)/assistant.tsx): `mobile/app/(tabs)/assistant.tsx`
- [Prediction screen](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/app/predict.tsx): `mobile/app/predict.tsx`

### Mobile services

- [HTTP API client](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/client.ts): `mobile/src/api/client.ts`
- [Dataset API](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/datasetApi.ts): `mobile/src/api/datasetApi.ts`
- [Chat API](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/chatApi.ts): `mobile/src/api/chatApi.ts`
- [Profile API](https://github.com/fayas2007/naren-exam-stress-analyzer/blob/main/mobile/src/api/profileApi.ts): `mobile/src/api/profileApi.ts`

### Other components

- **Researcher or student**
- **R Plumber REST backend**
- **Neon PostgreSQL**
- **Gemini API**

## Connections

- Researcher or student → Sign in and onboarding: signs in (evidence: `mobile/app/(auth)/login.tsx`)
- Sign in and onboarding → Authentication state: requests auth (evidence: `mobile/app/(auth)/login.tsx`)
- Authentication state → Session storage: stores session (evidence: `mobile/src/context/AuthContext.tsx`)
- Authentication state → R Plumber REST backend: authenticates via REST (evidence: `README.md`)
- Researcher or student → Dataset upload: selects dataset (evidence: `mobile/app/upload/index.tsx`)
- Dataset upload → File handling: reads file (evidence: `mobile/app/upload/index.tsx`)
- Dataset upload → Dataset API: uploads dataset (evidence: `mobile/app/upload/index.tsx`)
- Dataset upload → Dataset session: keeps upload state (evidence: `mobile/app/upload/index.tsx`)
- Mapping and validation → Dataset API: checks mapping (evidence: `mobile/app/upload/validate.tsx`)
- Mapping and validation → Analysis API: starts analysis (evidence: `mobile/app/upload/validate.tsx`)
- Mapping and validation → Dataset session: uses dataset state (evidence: `mobile/app/upload/validate.tsx`)
- Dataset API → HTTP API client: sends requests (evidence: `mobile/src/api/datasetApi.ts`)
- Analysis API → HTTP API client: sends requests (evidence: `mobile/src/api/analysisApi.ts`)
- HTTP API client → R Plumber REST backend: calls REST endpoints (evidence: `README.md`)
- R Plumber REST backend → Neon PostgreSQL: persists data (evidence: `README.md`)
- R Plumber REST backend → Gemini API: requests chat assistance (evidence: `README.md`)
- Home dashboard → Analysis API: loads analyses (evidence: `mobile/app/(tabs)/index.tsx`)
- Analysis history → Analysis API: lists analyses (evidence: `mobile/src/api/analysisApi.ts`)
- Analysis dashboard → Analysis API: loads results (evidence: `mobile/app/analysis/[id].tsx`)
- Analysis dashboard → Statistical visualizations: renders charts (evidence: `mobile/app/analysis/[id].tsx`)
- Analysis dashboard → Report generation: generates report (evidence: `mobile/app/analysis/[id].tsx`)
- Assistant chat → Chat API: sends chat (evidence: `mobile/app/(tabs)/assistant.tsx`)
- Assistant chat → Analysis API: gets analysis context (evidence: `mobile/app/(tabs)/assistant.tsx`)
- Chat API → HTTP API client: sends requests (evidence: `mobile/src/api/chatApi.ts`)
- Prediction screen → HTTP API client: requests prediction (evidence: `mobile/app/predict.tsx`)
- Profile screen → Profile API: loads profile (evidence: `mobile/app/(tabs)/profile.tsx`)
- Profile API → HTTP API client: sends requests (evidence: `mobile/src/api/profileApi.ts`)
