Skip to content

About

Serverless Architecture & Telemetry for a Zero-PII Mental Health Check-In System (AWS Amplify, Lambda, DynamoDB, API Gateway, Tone.js PWA).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Serverless Architecture and Telemetry for a Zero-PII Mental Health Check-In System

AWS Architecture AWS Lambda Amazon DynamoDB Amazon API Gateway AWS Amplify PWA Ready Zero-PII License: MIT

Academic Project
Course: Advanced Cloud Computing (BECE355L)
Institution: School of Electronics Engineering, Vellore Institute of Technology (VIT), Vellore
Authors: Aakash Nair (24BEC0080) & Ayush Swain (24BML0094)
Faculty Guide: Prof. Sumathi G
Paper & Report: Available under docs/


📌 Executive Summary

Traditional digital mental health platforms frequently suffer from three critical bottlenecks:

  1. Monolithic Cost Overhead: Continuously provisioned virtual machines (e.g., Amazon EC2) accumulate substantial idle infrastructure costs during sporadic public-welfare usage.
  2. The "Stigma Barrier": Mandatory user registration, email authentication, and persistent logging of Personally Identifiable Information (PII) deter vulnerable users who fear data breaches, employment consequences, or social exposure.
  3. Linguistic & Crisis Fragility: Over 88% of digital interventions in developing regions are English-only, and video-based coping tools fail catastrophically during post-disaster network disruptions.

This project delivers a fully serverless, offline-resilient Progressive Web Application (PWA) deployed on Amazon Web Services (AWS) for anonymous, bilingual (English & Hindi) psychometric triage and community health monitoring.

The architecture pairs an AWS Amplify CDN edge with Amazon API Gateway, AWS Lambda (Node.js 20.x), and Amazon DynamoDB (On-Demand capacity mode). It enforces a Zero-PII ingestion model where check-in records are stamped with server-generated RFC 4122 UUID v4 partition keys, eliminating user accounts, IP logging, and client fingerprinting. For immediate crisis intervention, an offline-resilient Tone.js 4-2-4 breathing synthesizer provides sensory biofeedback natively in the browser without network dependency.


🏛️ System Architecture

The architecture enforces a strict decoupling between static asset delivery at the edge and stateless, event-driven backend compute:

System Architecture

                                 ┌─────────────────────────────────────────────────────────────┐
                                 │                Client: Progressive Web App                 │
                                 │   Bilingual UI (EN/HI) • Service Worker Cache • Tone.js     │
                                 └──────────────┬──────────────────────────────┬───────────────┘
                                                │                              │
                                  Static Assets │                              │ HTTPS / JSON
                                         (42 ms)│                              │
                                                ▼                              ▼
                                 ┌─────────────────────────────┐┌──────────────────────────────┐
                                 │         AWS Amplify         ││      Amazon API Gateway      │
                                 │      CDN Edge Delivery      ││  /checkin • /stats • CORS    │
                                 └─────────────────────────────┘└──────────────┬───────────────┘
                                                                               │
                                                ┌──────────────────────────────┴───────────────┐
                                                │                                              │
                                                ▼ (128 ms warm)                                ▼ (210 ms warm)
                                 ┌─────────────────────────────┐┌──────────────────────────────┐
                                 │        Lambda: Ingest       ││       Lambda: Aggregate      │
                                 │      POST, UUID v4 Key      ││       GET, Risk Totals       │
                                 └──────────────┬──────────────┘└──────────────┬───────────────┘
                                                │                              │
                                                ▼                              ▼
                                 ┌─────────────────────────────────────────────────────────────┐
                                 │                       Amazon DynamoDB                       │
                                 │        Table: MHCheckInResults (Partition Key: id)          │
                                 │        Zero-PII: No IP, No User-Agent, No Credentials       │
                                 └─────────────────────────────────────────────────────────────┘

Architectural Tiers

Layer AWS Service Implementation Details
Client / Edge AWS Amplify + Global CDN Global edge distribution of PWA shell, manifest, audio assets, and Service Worker. Sub-50ms static cache delivery.
Ingress & Security Amazon API Gateway Managed RESTful ingress exposing /checkin (POST) and /stats (GET). Natively handles CORS preflight (OPTIONS) with approved origin whitelisting.
Stateless Compute AWS Lambda (Node.js 20.x) Isolated FaaS functions for write ingestion and community aggregation. Automatically scales per incoming request with zero idle compute.
Persistence (NoSQL) Amazon DynamoDB Fully managed on-demand capacity table (MHCheckInResults). Keyed on server-generated UUID v4 with zero PII attributes stored.

📊 Empirical Benchmarks & Results

Empirical latency benchmarking and privacy audits conducted across the deployed AWS pipeline demonstrated high-efficiency performance with zero idle expenditure.

1. Network Latency Profile

Pipeline Component Operation Literature Benchmark Measured Latency (ms) Status
Amplify Edge CDN Static PWA Shell & Asset Fetch < 100 ms 42 ms Instantaneous
Lambda Compute Warm Write Ingestion (POST /checkin) < 200 ms (Zhang & Liu [1]) 128 ms Target Exceeded
Lambda Compute Dashboard Aggregation (GET /stats) < 500 ms 210 ms Fast $O(N)$ Scan
Lambda Compute Cold Start Ingestion (First Invocation) < 1000 ms 385 ms Sub-second

2. Operational Cost Analysis

Metric Monolithic Virtual Machine (EC2) Serverless Architecture (This Project)
Baseline Idle Cost $15.00 – $40.00 / month $0.00 / month
Capacity Model Provisioned continuous instances Pure pay-per-request execution
AWS Always Free Tier Exhausts after 12 months 1M Lambda executions + 25GB DynamoDB free forever
Maintenance Burden OS updates, AMI patches, security hardening Managed cloud services (Zero host maintenance)

3. Zero-PII Compliance & Privacy Audit

A database-level inspection across the production DynamoDB table verified absolute anonymity:

Audited Field Ingestion Telemetry Behavior Verification Status
Partition Key (id) Server-side crypto.randomUUID() (RFC 4122 v4) Passed (No client entropy)
IP Addresses Discarded at compute tier; never committed to DB Passed (Absent)
User-Agent / Device Fingerprint Completely stripped from incoming headers Passed (Absent)
Geographic / GPS Coordinates No location tracking requested or recorded Passed (Absent)
User Authentication / Credentials No accounts, passwords, or emails collected Passed (Zero PII)

Full audit details available in docs/zero-pii-audit.md.


🧠 Psychometric Triage & Biofeedback

1. 10-Question Bilingual Screening Framework

The check-in incorporates a validated assessment spanning four clinical domains:

  • Emotional Wellbeing (Stress, Sadness, Anxiety)
  • Physical Health (Sleep disruption, Appetite alterations, Chronic fatigue)
  • Daily Functioning (Cognitive concentration, Anhedonia / loss of interest)
  • Coping & Resilience (Isolation, Trauma hypervigilance)

State management is structured in a dual English-Hindi nested JSON architecture, enabling instantaneous client-side localization without server round-trips.

       Cumulative Score: 0 - 10
                  │
        ┌─────────┼─────────┐
        ▼         ▼         ▼
    Low (0-3)  Mod (4-6)  High (7-10)
        │         │         │
    Self-Care  Peer &     Immediate Emergency
    Guidance   Counseling Escalation (Tele-MANAS,
               Resources  SAMHSA Helpline)

2. Deterministic 4-2-4 Audio-Visual Biofeedback

To mitigate acute panic and somatic anxiety without network buffering:

  • Audio Synthesis: Uses Tone.js over the HTML5 Web Audio API. MembraneSynth and Synth nodes generate harmonic guidance tones in real time.
  • Cadence: Deterministic 4-2-4 pacing (4 seconds Inhale, 2 seconds Hold, 4 seconds Exhale).
  • Offline Resilient: Fully functional in Airplane Mode or post-disaster network blackouts once cached by the Service Worker.

📁 Repository Structure

.
├── .github/
│   └── workflows/              # GitHub Actions CI/CD workflows
├── backend/
│   ├── lambdas/
│   │   ├── ingest/
│   │   │   ├── index.mjs       # Zero-PII POST /checkin handler (UUID v4 + DynamoDB PutItem)
│   │   │   └── package.json
│   │   └── aggregate/
│   │       ├── index.mjs       # Community GET /stats handler (DynamoDB Scan & Tier Tally)
│   │       └── package.json
│   ├── sam/
│   │   └── template.yaml       # AWS SAM / CloudFormation Infrastructure-as-Code
│   └── terraform/              # Terraform Infrastructure-as-Code
│       ├── main.tf
│       ├── variables.tf
│       └── outputs.tf
├── docs/
│   ├── assets/
│   │   ├── architecture-diagram.png  # High-resolution AWS system architecture
│   │   ├── app-preview.png           # Production UI screenshot
│   │   └── vit-logo.png              # Institution crest
│   ├── benchmarks.md                 # Detailed latency, throughput & cost profiling
│   ├── zero-pii-audit.md             # Privacy audit & HIPAA/GDPR analysis
│   ├── IEEE_Mental_Health_CheckIn_Paper.md    # Full IEEE conference paper format
│   ├── Project_Report.md                     # Comprehensive academic course report
│   ├── IEEE_Mental_Health_CheckIn_Paper.docx  # Original Word submission
│   └── Project_Report.docx                   # Original project report docx
├── images/                           # Web application assets & background themes
├── index.html                        # PWA entrypoint & accessible UI screens
├── styles.css                        # Responsive styles, glassmorphism & CSS animations
├── script.js                         # Application logic, audio synthesis & AWS API integration
├── manifest.json                     # PWA Web App Manifest
├── sw.js                             # Service Worker cache management
├── .gitignore
├── LICENSE                           # MIT License
└── README.md

🚀 Deployment & Setup Guide

Option A: Deploying Backend Infrastructure

Using AWS SAM (Recommended)

  1. Ensure the AWS SAM CLI is installed.
  2. Build and deploy the serverless stack:
    cd backend/sam
    sam build
    sam deploy --guided
  3. Copy the output ApiBaseUrl and update API_BASE_URL in script.js (or pass it at runtime via window.API_BASE_URL).

Using Terraform

  1. Ensure Terraform is installed.
  2. Initialize and apply:
    cd backend/terraform
    terraform init
    terraform apply

Option B: Deploying Frontend PWA to AWS Amplify

  1. Connect your GitHub repository to the AWS Amplify Console.
  2. Select Hosting environments > Deploy without Git provider OR connect your repository branch (main).
  3. Set build settings (static frontend):
    version: 1
    frontend:
      phases:
        build:
          commands: []
      artifacts:
        baseDirectory: /
        files:
          - '**/*'
      cache:
        paths: []
  4. Save and deploy. AWS Amplify will distribute the application across its global CloudFront CDN.

Option C: Running Locally

The application shell requires no complex build tools or bundlers. Simply serve the root directory:

# Using Python 3
python -m http.server 8000

# Using Node.js
npx serve .

Open your browser to http://localhost:8000. Test offline behavior by opening Chrome DevTools > Network > select Offline and refresh.


🎯 Sustainable Development Goals (SDG) Alignment

  • SDG 3 (Good Health and Well-Being): Lowers stigma barriers to encourage early intervention for acute depressive and trauma symptoms.
  • SDG 9 (Industry, Innovation & Infrastructure): Pioneers resilient, zero-maintenance serverless public-health pipelines.
  • SDG 10 (Reduced Inequalities): Native Hindi vernacular localization democratizes mental healthcare access for historically underserved populations.
  • SDG 11 & SDG 12 (Sustainable Cities & Responsible Consumption): Event-driven execution eliminates continuous VM power and carbon consumption during idle periods.

👥 Authors & Academic Credits

  • Aakash Nair — Registration No: 24BEC0080 — Vellore Institute of Technology, Vellore
    GitHub: @Sky-Code06 | Email: aakash.nair2024@vitstudent.ac.in
  • Ayush Swain — Registration No: 24BML0094 — Vellore Institute of Technology, Vellore
    Email: ayush.swain2024@vitstudent.ac.in
  • Course: Advanced Cloud Computing (BECE355L)
  • Faculty Guide: Prof. Sumathi G, School of Electronics Engineering (SENSE), VIT Vellore

⚖️ License & Ethical Disclaimer

This project is licensed under the MIT License.

Medical & Regulatory Disclaimer: This platform is an educational research prototype designed for self-assessment, epidemiological tracking, and psychoeducation. It does not provide clinical diagnoses, psychotherapy, or medical prescription. Individuals experiencing severe acute crises should contact emergency services or national crisis helplines (India: 14416 / Tele-MANAS; USA: 988 / SAMHSA).

About

Serverless Architecture & Telemetry for a Zero-PII Mental Health Check-In System (AWS Amplify, Lambda, DynamoDB, API Gateway, Tone.js PWA).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages