Skip to content

Repository files navigation

Nena Logo

Project Nena

The memory bridge for pediatric care

An AI-powered platform that helps parents of neurodivergent children log daily behavioral episodes effortlessly — and gives doctors the clinical data they actually need.

Next.js FastAPI Supabase Groq Tailwind Python


🦋 The Problem

Every day, millions of parents in India care for children with ADHD and Autism. When a meltdown happens — screaming, crying, throwing things — the parent manages it, calms things down, and by morning, the details are gone.

Weeks later at the doctor's office, when asked "How has he been?", the parent says:

"He had a few rough days... I think the medicine is helping a little, not sure."

The doctor, working with only that, adjusts treatment based on guesswork. This cycle repeats every 4-8 weeks.

No accurate data. No patterns. No real picture.

That gap is exactly what Nena is built to close.


💡 The Solution

Nena is a web application that makes daily behavior tracking effortless. Every day, the parent talks to Nena for 90 seconds — through a voice call, chat, or quick form — and the AI quietly turns that conversation into structured clinical notes using the ABC method:

Step What It Means Example
A — Antecedent What happened before the episode? "Someone touched his bag on the bus"
B — Behavior What did the child do? "Cried and threw things for 20 minutes"
C — Consequence What happened after? What helped? "Calmed down with a sensory ball"

The doctor sees the full picture. The parent doesn't have to remember a thing.


✨ Features

👨‍👩‍👦 For Parents

  • 🗣️ Voice Check-in — Talk to Nena via VAPI-powered voice calls. No typing needed
  • 💬 AI Chat — Chat naturally in English, Hindi, or Hinglish. Nena extracts the clinical data automatically
  • 📝 Quick Form — Fill a simple ABC form when you prefer structured input
  • 📊 Timeline — See your child's full behavioral history, severity trends, and patterns
  • 🎨 ABC Visualizations — AI-generated 3D clay renders that bring each episode to life
  • 📲 WhatsApp Reminders — Gentle nudges if you miss a day
  • 🧠 AI Thinking Mode — Ask Nena deep questions about your child's patterns

👨‍⚕️ For Doctors

  • 📋 Patient Dashboard — All assigned children at a glance with status indicators
  • 🔍 RAG-Powered AI Chat — Ask questions like "Show me sensory triggers in the last 30 days" and get data-backed answers
  • 📄 PDF Reports — Generate hospital-grade clinical reports with one click
  • 📈 Severity Trends — Visualize behavioral patterns over time

🔐 For Admins

  • 👤 User Management — Create parent and doctor accounts
  • 🔗 Relationship Linking — Connect parents ↔ children ↔ doctors
  • 📊 Platform Statistics — Overview of all users, children, and assignments

🏗️ Architecture

graph TD
    subgraph Frontend["🌐 Next.js 16 + Tailwind v4 + Shadcn/UI"]
        AdminUI["Admin Dashboard"]
        ParentUI["Parent Portal"]
        DoctorUI["Doctor Dashboard"]
    end

    subgraph Backend["⚡ FastAPI — Python 3.12+"]
        AuthAPI["Auth — JWT httpOnly Cookies"]
        BehaviorAPI["Behavior Logs + ABC Extraction"]
        ChatAPI["AI Chat — 4 Modes"]
        ReportsAPI["PDF Reports — ReportLab"]
        WebhooksAPI["Voice Webhooks"]
    end

    subgraph AI["🧠 AI Services"]
        Groq["Groq LLM — Llama 3.1/3.3"]
        Gemini["Gemini 2.5 Flash — Prompt Enhancement"]
        Flux["Cloudflare FLUX-1-schnell — ABC Images"]
        Sarvam["Sarvam AI — Hinglish STT"]
    end

    subgraph Data["🗄️ Supabase — Mumbai Region"]
        Postgres["PostgreSQL + pgvector"]
        Storage["File Storage"]
    end

    Frontend -->|"REST + httpOnly cookies"| Backend
    Backend --> AI
    Backend --> Data
    ParentUI -->|"@vapi-ai/web"| WebhooksAPI
Loading

🔧 Tech Stack

Layer Technology Purpose
Frontend Next.js 16.2, React 19, Tailwind v4, Shadcn/UI Responsive web app with role-based dashboards
Backend FastAPI, Python 3.12+, Uvicorn REST API, business logic, AI orchestration
Database Supabase PostgreSQL + pgvector (Mumbai) Data storage, vector embeddings, RLS
AI/LLM Groq (Llama 3.1 8B + 3.3 70B) ABC extraction, RAG chat, summaries
Image Gen Cloudflare FLUX-1-schnell + Gemini 2.5 Flash 3D clay-style ABC scene visualizations
Voice VAPI AI In-browser voice calls for daily check-ins
STT Sarvam AI Saaras V3 Hinglish-optimized speech-to-text
Notifications Twilio WhatsApp Business API Daily behavior logging reminders
PDF ReportLab Hospital-grade clinical PDF reports
Auth Custom JWT (PyJWT + bcrypt) httpOnly cookies, role-based access control
Package Mgmt uv (backend), npm (frontend) Fast, reliable dependency management

📁 Project Structure

Nena/
├── assets/                 # Logo and brand assets
├── backend/                # FastAPI backend
│   ├── app/
│   │   ├── main.py         # App entry + admin seed + scheduler
│   │   ├── config.py       # Environment configuration
│   │   ├── dependencies.py # FastAPI dependency injection
│   │   ├── api/v1/         # All REST endpoints (9 routers)
│   │   ├── core/           # Permissions and exception handling
│   │   ├── models/         # Pydantic schemas + enums
│   │   └── services/       # AI, auth, reports, notifications, STT
│   └── pyproject.toml      # Python dependencies (uv)
├── frontend/               # Next.js frontend
│   ├── src/
│   │   ├── app/
│   │   │   ├── (admin)/    # Admin dashboard pages
│   │   │   ├── (parent)/   # Parent portal pages
│   │   │   ├── (doctor)/   # Doctor dashboard pages
│   │   │   └── login/      # Authentication
│   │   ├── components/ui/  # Shadcn/UI components
│   │   └── lib/            # Auth context, API helpers, types
│   └── package.json
├── .env                    # Unified environment variables
├── ARCHITECTURE.md         # System design document
├── DATABASE_SCHEMA.md      # Full SQL schema + RLS policies
├── FEATURE_SPEC.md         # Feature requirements
├── TECH_STACK.md           # Technology decisions
├── ROADMAP.md              # Development roadmap
├── PROMPT_LIBRARY.md       # All AI system prompts
└── SETUP_FOR_TEAM.md       # Team onboarding guide

🚀 Quick Start

Prerequisites

1. Clone & Configure

git clone https://github.com/your-username/nena.git
cd nena

Create a .env file in the project root:

# ── Supabase ──
SUPABASE_URL=https://<YOUR_PROJECT>.supabase.co
SUPABASE_ANON_KEY=<YOUR_ANON_KEY>
SUPABASE_SERVICE_ROLE_KEY=<YOUR_SERVICE_ROLE_KEY>

# ── Auth ──
JWT_SECRET_KEY=your-secret-key-change-in-production

# ── AI ──
GROQ_API_KEY=<YOUR_GROQ_KEY>
GEMINI_API_KEY=<YOUR_GEMINI_KEY>

# ── Voice (VAPI) ──
VAPI_PUBLIC_KEY=<YOUR_VAPI_PUBLIC_KEY>
VAPI_PRIVATE_KEY=<YOUR_VAPI_PRIVATE_KEY>
VAPI_ASSISTANT_ID=<YOUR_VAPI_ASSISTANT_ID>

# ── WhatsApp (Twilio) ──
TWILIO_ACCOUNT_SID=<YOUR_SID>
TWILIO_AUTH_TOKEN=<YOUR_TOKEN>
TWILIO_WHATSAPP_NUMBER=<YOUR_NUMBER>

# ── Image Generation (Cloudflare) ──
CLOUDFLARE_ACCOUNT_ID=<YOUR_ACCOUNT_ID>
CLOUDFLARE_API_TOKEN=<YOUR_TOKEN>

# ── Frontend ──
FRONTEND_URL=http://localhost:3000
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_SUPABASE_URL=https://<YOUR_PROJECT>.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=<YOUR_ANON_KEY>

2. Start the Backend

cd backend
uv sync
uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

3. Start the Frontend

cd frontend
npm install
npm run dev

4. Login

Open http://localhost:3000/login and use the default admin credentials:

Field Value
Email admin@gmail.com
Password admin123

The admin account is automatically created on first backend startup.


🧠 How the AI Pipeline Works

Parent speaks naturally                    Structured clinical data
        │                                          │
        ▼                                          ▼
┌─────────────────┐    ┌──────────────┐    ┌─────────────────┐
│  "Aaj Arjun ka  │───▶│  Groq LLM    │───▶│  antecedent:    │
│  school se aate │    │  Llama 3.1   │    │    "Touched bag" │
│  hi meltdown    │    │  8B Instant   │    │  behavior:      │
│  hua..."        │    │              │    │    "Crying 20m"  │
└─────────────────┘    └──────────────┘    │  severity: 4    │
                                           │  ai_summary:    │
                                           │    "Arjun had a │
                                           │     meltdown..." │
                                           └─────────────────┘

Key design decisions:

  • Plain text enforcement — AI responses never include markdown, ensuring clean rendering across all UI surfaces
  • [LOG_SESSION_NOW] trigger — When the parent chat AI collects all three ABC pieces, it appends this hidden signal. The frontend detects it and auto-saves the behavior log
  • Hinglish-first — All prompts handle English, Hindi, and Hinglish seamlessly
  • No hallucination — Missing data uses clinical placeholders like "Not specifically identified" instead of null

📚 Documentation

Document What's Inside
ARCHITECTURE.md System design, data flows, module responsibilities
DATABASE_SCHEMA.md All 10 tables, RLS policies, indexes, SQL migrations
FEATURE_SPEC.md Detailed feature requirements for all 12 modules
TECH_STACK.md Technology choices and rationale
ROADMAP.md 6-phase development roadmap with progress tracking
PROMPT_LIBRARY.md Every AI system prompt used in the application
SETUP_FOR_TEAM.md Team onboarding and local setup guide

🗄️ Database Schema

10 tables powering the platform:

Table Purpose
profiles All users — admin, parent, doctor (with bcrypt passwords)
children Child profiles — diagnosis, medications, triggers
parent_child_links Parent ↔ Child relationships
doctor_child_assignments Doctor ↔ Child assignments
behavior_logs Core ABC data with severity, categories, AI analysis
consent_records DPDP Act compliance — consent tracking
call_logs Voice call metadata and recordings
ai_summaries Weekly/monthly AI-generated behavior summaries
generated_reports PDF report tracking and storage
notification_logs WhatsApp reminder delivery tracking

All tables are protected by Row-Level Security (RLS) — parents see only their children, doctors see only assigned patients, admins see everything.


🛣️ Roadmap

Phase Feature Status
0 Project Setup & Infrastructure ✅ Complete
1A Database + Auth ✅ Complete
1B Admin Dashboard (CRUD) ✅ Complete
2 Parent Quick Form + Timeline ✅ Complete
3A AI Pipeline (Groq ABC Extraction) ✅ Complete
3B Parent AI Chat ✅ Complete
4A Doctor Dashboard + Patient List ✅ Complete
4B Doctor RAG Chat ✅ Complete
5A PDF Reports (ReportLab) ✅ Complete
5B Voice Integration (VAPI AI) ✅ Complete
6A WhatsApp Nudges (Twilio) ✅ Complete
6B Polish & Testing 🟡 In Progress

🔒 Security

  • httpOnly cookies — Tokens are never exposed to JavaScript
  • bcrypt password hashing — Industry-standard password security
  • Role-based access controlrequire_admin, require_parent, require_doctor decorators
  • Row-Level Security — Database-level data isolation per user
  • DPDP Act compliance — Consent tracking tables, Mumbai-region data residency
  • Soft deletes — No data is permanently deleted; is_active flags used throughout

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please read SETUP_FOR_TEAM.md for development setup instructions.


📄 License

This project is part of an academic/hackathon initiative for pediatric behavioral care in India.


Built with 💜 for every parent who's doing their best

Nena

About

An AI-powered behavioral tracking platform connecting parents of ADHD and Autism children with doctors through VAPI voice agents, RAG-powered clinical insights, and structured ABC data.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages