# Project export: CareLink+

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 12.0
- Tagline: Voice-first AI transforming post-surgery recovery into proactive, data-driven care.
- Devpost: https://devpost.com/software/carelink-c5pqnx
- GitHub: https://github.com/adithyagundlapalli/CareLinkv2
- Demo: https://carelnk.lovable.app/
- Team: 3 GitHub contributor(s) — adithya (8 commits), gpt-engineer-app[bot] (5 commits), neelb1 (2 commits)

## Devpost submission (written by the team)

No Devpost description available.

## README (from the GitHub repository)

# CareLink - Post-Discharge Patient Monitoring System

An AI-powered patient monitoring and triage system for post-discharge care, featuring automated voice check-ins, intelligent risk assessment, and real-time alerts.

## Features

- **Automated Voice Check-ins**: Daily phone calls to patients via Vapi
- **AI-Powered Triage**: Claude AI analyzes check-ins and assesses patient risk levels
- **Smart Alerts**: Multi-channel notifications (Slack, SMS, Email, Calendar) via Composio
- **Video Escalation**: LiveKit video rooms for urgent cases requiring immediate attention
- **Patient Memory**: Letta integration for contextual, long-term patient memory
- **RAG System**: Chroma vector database for discharge instructions and medical context
- **Analytics Dashboard**: Elastic Cloud + Kibana for insights and monitoring

## Tech Stack

### Frontend

- **Next.js 15** - React framework with App Router
- **TypeScript** - Type-safe development
- **Tailwind CSS** - Utility-first styling

### Backend

- **Supabase** - PostgreSQL database with real-time subscriptions
- **Anthropic Claude** - AI triage and analysis
- **Vapi** - Voice AI for patient calls
- **Chroma** - Vector database for RAG
- **Letta** - Patient memory management
- **Composio** - Workflow automation (Slack, SMS, Calendar, Gmail)
- **LiveKit** - Video call infrastructure
- **Elastic Cloud** - Logging and analytics

## Getting Started

### Prerequisites

- Node.js 18+ and npm
- Supabase account and project
- API keys for all services (see .env.example)

### Installation

1. **Clone and install dependencies:**

```bash
cd CareLink
npm install
```

2. **Set up environment variables:**

```bash
cp .env.example .env
```

3. **Fill in all required API keys in .env:**

   - Supabase credentials
   - Anthropic API key
   - Vapi API key
   - Letta API key
   - Composio API key
   - LiveKit credentials
   - Elastic Cloud credentials

4. **Set up Supabase database:**

   Run the migration to create all tables:

   ```bash
   # In your Supabase dashboard SQL editor, run:
   supabase/migrations/00001_initial_schema.sql
   ```

   Or use Supabase CLI:

   ```bash
   supabase db push
   ```

5. **Start Chroma (optional for local development):**

```bash
docker run -p 8000:8000 chromadb/chroma
```

6. **Run the development server:**

```bash
npm run dev
```

Open http://localhost:3000 to view the dashboard.

## Project Structure

```
CareLink/
├── src/
│   ├── app/                    # Next.js App Router pages
│   │   ├── api/               # API routes
│   │   │   ├── ingest/        # Vapi webhook handler
│   │   │   └── triage/        # AI triage endpoint
│   │   ├── dashboard/         # Main dashboard
│   │   ├── patients/          # Patient management
│   │   └── alerts/            # Alert management
│   ├── components/            # React components
│   ├── lib/                   # Utilities and integrations
│   │   ├── supabase.ts       # Supabase client
│   │   ├── chroma/           # RAG system
│   │   ├── letta/            # Patient memory
│   │   ├── composio/         # Workflow automation
│   │   └── livekit/          # Video calls
│   └── types/                # TypeScript types
├── supabase/
│   └── migrations/           # Database schema
└── .env.example             # Environment variables template
```

## How It Works

### 1. Patient Enrollment

- Hospital staff adds patient to system with discharge details
- Discharge instructions are embedded into Chroma vector database
- Letta creates a memory profile for the patient

### 2. Daily Check-ins

- Vapi calls patient at preferred time
- Conversation is transcribed and analyzed
- Data sent to `/api/ingest` webhook

### 3. AI Triage

Claude analyzes check-in data with context from:

- Discharge instructions (RAG via Chroma)
- Patient history (Letta memory)
- Previous check-ins

Assigns risk score (0-100) and level (low/medium/high/critical)
Identifies red flags and recommends actions

### 4. Alert Generation

- **High/Critical Risk**: Slack alert to care team
- **Critical + Immediate Attention**:
  - SMS to caregivers
  - Calendar event for care team
  - LiveKit video room creation
  - Email notification

### 5. Care Team Response

- Dashboard shows real-time alerts
- Can view patient details, check-in history
- Initiate video calls for urgent cases
- Track outcomes in Elastic/Kibana

## API Endpoints

### POST /api/ingest

Webhook receiver for Vapi call completions.

**Request:**

```json
{
  "call": {
    "id": "call_123",
    "startedAt": "2025-01-25T14:30:00Z",
    "endedAt": "2025-01-25T14:35:00Z",
    "transcript": "...",
    "summary": "..."
  },
  "phoneNumber": "+15551234567"
}
```

### POST /api/triage

AI triage assessment endpoint.

**Request:**

```json
{
  "checkin_id": "uuid",
  "patient_id": "uuid"
}
```

**Response:**

```json
{
  "success": true,
  "assessment_id": "uuid",
  "risk_level": "high",
  "requires_immediate_attention": true
}
```

## Database Schema

See `supabase/migrations/00001_initial_schema.sql` for complete schema.

**Main Tables:**

- `patients` - Patient demographics and discharge info
- `caregivers` - Emergency contacts
- `medications` - Current prescriptions
- `checkins` - Voice call data and transcripts
- `triage_assessments` - AI risk assessments
- `alerts` - Notifications sent to care team
- `discharge_instructions` - Care instructions (with RAG)
- `livekit_rooms` - Video call sessions

## Development

### Running Tests

```bash
npm test
```

### Building for Production

```bash
npm run build
npm start
```

### Linting

```bash
npm run lint
```

## Deployment

### Vercel (Recommended)

```bash
vercel deploy
```

**Note:** Make sure to set all environment variables in your deployment platform.

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request

## License

MIT License - see LICENSE file for details

## Support

For issues or questions, please open a GitHub issue or contact the development team.


## Detected evidence (automated analysis)

Indexed codebase: 81 recognized source files, 217 KB.
- Anthropic (technology) — detected in the code
- CSS (language) — detected in the code
- HTML (language) — detected in the code
- JavaScript (language) — detected in the code
- React (technology) — detected in the code
- Supabase (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code

## Codebase structure (from repository index)

### Files (90 of 90)

```
.env.example
.gitignore
bun.lockb
components.json
eslint.config.js
index.html
package.json
postcss.config.js
public/robots.txt
README.md
RISK_DETAILS_README.md
scripts/init-services.js
SETUP.md
src/App.css
src/App.tsx
src/components/AppSidebar.tsx
src/components/dashboard/ChatCard.tsx
src/components/dashboard/MedicationCard.tsx
src/components/dashboard/RiskAssessmentCard.tsx
src/components/dashboard/VitalsCard.tsx
src/components/FeatureCards.tsx
src/components/Hero.tsx
src/components/ui/accordion.tsx
src/components/ui/alert-dialog.tsx
src/components/ui/alert.tsx
src/components/ui/aspect-ratio.tsx
src/components/ui/avatar.tsx
src/components/ui/badge.tsx
src/components/ui/breadcrumb.tsx
src/components/ui/button.tsx
src/components/ui/calendar.tsx
src/components/ui/card.tsx
src/components/ui/carousel.tsx
src/components/ui/chart.tsx
src/components/ui/checkbox.tsx
src/components/ui/collapsible.tsx
src/components/ui/command.tsx
src/components/ui/context-menu.tsx
src/components/ui/dialog.tsx
src/components/ui/drawer.tsx
src/components/ui/dropdown-menu.tsx
src/components/ui/form.tsx
src/components/ui/hover-card.tsx
src/components/ui/input-otp.tsx
src/components/ui/input.tsx
src/components/ui/label.tsx
src/components/ui/menubar.tsx
src/components/ui/navigation-menu.tsx
src/components/ui/pagination.tsx
src/components/ui/popover.tsx
src/components/ui/progress.tsx
src/components/ui/radio-group.tsx
src/components/ui/resizable.tsx
src/components/ui/scroll-area.tsx
src/components/ui/select.tsx
src/components/ui/separator.tsx
src/components/ui/sheet.tsx
src/components/ui/sidebar.tsx
src/components/ui/skeleton.tsx
src/components/ui/slider.tsx
src/components/ui/sonner.tsx
src/components/ui/switch.tsx
src/components/ui/table.tsx
src/components/ui/tabs.tsx
src/components/ui/textarea.tsx
src/components/ui/toast.tsx
src/components/ui/toaster.tsx
src/components/ui/toggle-group.tsx
src/components/ui/toggle.tsx
src/components/ui/tooltip.tsx
src/components/ui/use-toast.ts
src/hooks/use-mobile.tsx
src/hooks/use-toast.ts
src/index.css
src/lib/claude-risk-api.ts
src/lib/supabase.ts
src/lib/utils.ts
src/main.tsx
src/pages/Dashboard.tsx
src/pages/Index.tsx
src/pages/NotFound.tsx
src/pages/Patients.tsx
src/pages/RiskDetailsPage.tsx
src/pages/Settings.tsx
src/vite-env.d.ts
tailwind.config.ts
tsconfig.app.json
tsconfig.json
tsconfig.node.json
vite.config.ts
```

### Dependencies

- package.json: @anthropic-ai/sdk@^0.67.0, @composio/core@^0.2.0, @elastic/elasticsearch@^9.2.0, @eslint/js@^9.32.0, @hookform/resolvers@^3.10.0, @letta-ai/letta-client@^0.0.68665, @radix-ui/react-accordion@^1.2.11, @radix-ui/react-alert-dialog@^1.1.14, @radix-ui/react-aspect-ratio@^1.1.7, @radix-ui/react-avatar@^1.1.10, @radix-ui/react-checkbox@^1.3.2, @radix-ui/react-collapsible@^1.1.11, @radix-ui/react-context-menu@^2.2.15, @radix-ui/react-dialog@^1.1.14, @radix-ui/react-dropdown-menu@^2.1.15, @radix-ui/react-hover-card@^1.1.14, @radix-ui/react-label@^2.1.7, @radix-ui/react-menubar@^1.1.15, @radix-ui/react-navigation-menu@^1.2.13, @radix-ui/react-popover@^1.1.14, @radix-ui/react-progress@^1.1.7, @radix-ui/react-radio-group@^1.3.7, @radix-ui/react-scroll-area@^1.2.9, @radix-ui/react-select@^2.2.5, @radix-ui/react-separator@^1.1.7, @radix-ui/react-slider@^1.3.5, @radix-ui/react-slot@^1.2.3, @radix-ui/react-switch@^1.2.5, @radix-ui/react-tabs@^1.1.12, @radix-ui/react-toast@^1.2.14, @radix-ui/react-toggle@^1.1.9, @radix-ui/react-toggle-group@^1.1.10, @radix-ui/react-tooltip@^1.2.7, @supabase/supabase-js@^2.76.1, @tailwindcss/typography@^0.5.16, @tanstack/react-query@^5.83.0, @types/node@^22.16.5, @types/react@^18.3.23, @types/react-dom@^18.3.7, @vapi-ai/server-sdk@^0.10.2, @vitejs/plugin-react-swc@^3.11.0, autoprefixer@^10.4.21, chromadb@^3.0.17, class-variance-authority@^0.7.1, clsx@^2.1.1, cmdk@^1.1.1, date-fns@^3.6.0, embla-carousel-react@^8.6.0, eslint@^9.32.0, eslint-plugin-react-hooks@^5.2.0, eslint-plugin-react-refresh@^0.4.20, framer-motion@^12.23.24, globals@^15.15.0, input-otp@^1.4.2, livekit-server-sdk@^2.14.0, lovable-tagger@^1.1.11, lucide-react@^0.462.0, next-themes@^0.3.0, postcss@^8.5.6, react@^18.3.1, react-day-picker@^8.10.1, react-dom@^18.3.1, react-hook-form@^7.61.1, react-resizable-panels@^2.1.9, react-router-dom@^6.30.1, recharts@^2.15.4, sonner@^1.7.4, tailwind-merge@^2.6.0, tailwindcss@^3.4.17, tailwindcss-animate@^1.0.7, typescript@^5.8.3, typescript-eslint@^8.38.0, vaul@^0.9.9, vite@^5.4.19, zod@^3.25.76

### Recent commits (newest first)

- Update site info
- Merge branch 'main' of https://github.com/adithyagundlapalli/CareLinkv2
- added the risk analysis/summary page
- Integrate LLM capabilities
- added backend tools
- added README
- Reverted to commit bc6283f3ac641a1879558b347410c0a86a224168
- idk
- Merge branch 'merge-lovable'
- random
- Merge Lovable frontend into /frontend
- Implement UI for CareLink+
- [skip lovable] Use tech stack vite_react_shadcn_ts_20250728_minor
- initial frontent kinda ahh
- plan

## Key source files (fetched from GitHub, selected and truncated for size)

### RISK_DETAILS_README.md

```markdown
# Risk Assessment Drilldown Feature

## ✅ Implementation Complete

The Risk Assessment Drilldown feature has been successfully implemented for CareLink v2.

### Features Implemented

#### 1. **Interactive Risk Assessment Card**

- ✅ Added hover animations with scale effect (1.02x scale)
- ✅ Blue glow effect on hover with border and shadow
- ✅ Navigation arrow icon
- ✅ Click handler that navigates to `/risk-details/:id`
- ✅ Visual cue text: "Click to view detailed analysis →"

#### 2. **Risk Details Page (`/risk-details/:id`)**

- ✅ Full page layout with navigation
- ✅ Patient information display
- ✅ Risk score visualization (circular progress)
- ✅ Color-coded risk levels (green/yellow/red)
- ✅ Vitals trends visualization with Recharts
- ✅ Medication adherence progress bar
- ✅ AI Analysis card with Claude integration

#### 3. **Claude AI Integration**

- ✅ API function: `generateRiskAnalysis()`
- ✅ Structured prompts for clinical context
- ✅ Analysis includes:
  - Summary explanation
  - Key factors identification
  - Clinical recommendations
  - Confidence score (0-100%)
- ✅ Fallback mock data if API fails

#### 4. **Charts & Visualizations**

- ✅ Line charts for vitals trends
- ✅ Heart rate and temperature over time
- ✅ Responsive chart container
- ✅ Custom tooltips with dark theme

#### 5. **Animations & UX**

- ✅ Framer Motion page transitions
- ✅ Smooth fade-in animations
- ✅ Loading states with spinner
- ✅ Hover effects on interactive elements
- ✅ Consistent black + blue theme

### Files Created/Modified

#### New Files:

1. `src/pages/RiskDetailsPage.tsx` - Complete risk details page
2. `src/lib/claude-risk-api.ts` - Claude AI integration
3. `src/vite-env.d.ts` - TypeScript environment variables

#### Modified Files:

1. `src/components/dashboard/RiskAssessmentCard.tsx` - Added navigation
2. `src/App.tsx` - Added route for `/risk-details/:id`

### Technical Stack

- **Frontend**: React + Vite + TypeScript
- **Routing**: React Router v6
- **Animations**: Framer Motion
- **Charts**: Recharts
- **AI**: Anthropic Claude API
- **Styling**: Tailwind CSS
- **UI Components**: Radix UI / Shadcn

### How to Use

1. **From Dashboard**:

   - Click on the Risk Assessment Card
   - Automatically navigates to details page

2. **AI Analysis**:

   - Click "Analyze with Claude" button
   - Wait for AI to generate analysis (shows loading spinner)
   - Review summary, factors, and recommendations

3. **Navigate Back**:
   - Click "Back to Dashboard" button in top-left
   - Returns to main dashboard

### Environment Setup

Add to `.env`:

```bash
VITE_ANTHROPIC_API_KEY=your_anthropic_api_key_here
```

### Data Structure

```typescript
interface RiskDetails {
  id: string;
  patientName: string;
  riskScore: number; // 0-3 scale
  timestamp: string;
  vitals: {
    heartRate: number[];
    temperature: number[];
    bloodPressure: { systolic: number; diastolic: number }[];
  };
  medicationAdherence: number; // 0-100%
  notes: string;
  aiAnalysis?: {
    summ
[truncated — 1181 more characters]
```

### SETUP.md

```markdown
# CareLink Backend Services Setup Guide

This guide will help you set up all the backend services required for CareLink.

## Prerequisites

- Node.js 18+ installed
- All service accounts created (see below)
- API keys obtained from each service

## Service Setup Instructions

### 1. Supabase (Database)

1. Go to [Supabase](https://supabase.com/) and create an account
2. Create a new project
3. Go to Settings → API to get your credentials:
   - `SUPABASE_URL`
   - `SUPABASE_ANON_KEY`
   - `SUPABASE_SERVICE_ROLE_KEY`

### 2. Anthropic Claude (AI Triage)

1. Visit [Anthropic Console](https://console.anthropic.com/)
2. Create an account and generate an API key
3. Set `ANTHROPIC_API_KEY` in your environment

### 3. Vapi (Voice AI)

1. Sign up at [Vapi](https://vapi.ai/)
2. Get your API key from the dashboard
3. Set up webhook endpoint (will be configured automatically)
4. Set `VAPI_API_KEY` and `VAPI_WEBHOOK_SECRET`

### 4. Chroma (Vector Database)

1. Install Chroma locally: `docker run -p 8000:8000 chromadb/chroma`
2. Or use Chroma Cloud (get API key)
3. Set `CHROMA_HOST`, `CHROMA_PORT`, and `CHROMA_API_KEY`

### 5. Letta (Patient Memory)

1. Visit [Letta](https://letta.ai/) and create an account
2. Get your API key from the dashboard
3. Set `LETTA_API_KEY` and `LETTA_BASE_URL`

### 6. Composio (Workflow Automation)

1. Sign up at [Composio](https://composio.dev/)
2. Connect integrations (Slack, SMS, Email, Calendar)
3. Get your API key
4. Set `COMPOSIO_API_KEY`

### 7. LiveKit (Video Calls)

1. Create account at [LiveKit](https://livekit.io/)
2. Create a project and get credentials
3. Set `LIVEKIT_API_KEY`, `LIVEKIT_API_SECRET`, and `LIVEKIT_WS_URL`

### 8. Elastic Cloud (Logging & Analytics)

1. Sign up at [Elastic Cloud](https://cloud.elastic.co/)
2. Create a deployment
3. Get your Cloud ID and credentials
4. Set `ELASTIC_CLOUD_ID`, `ELASTIC_USERNAME`, and `ELASTIC_PASSWORD`

## Installation Steps

1. **Install Dependencies**

   ```bash
   npm install
   ```

2. **Set Up Environment Variables**

   ```bash
   cp .env.example .env
   # Edit .env with your actual API keys
   ```

3. **Initialize Services**

   ```bash
   npm run init-services
   ```

4. **Verify Installation**
   ```bash
   npm run health-check
   ```

## Service Integration Files

All services are integrated in the `src/lib/` directory:

- `supabase.ts` - Database client and types
- `anthropic.ts` - AI triage and analysis
- `vapi.ts` - Voice AI for patient calls
- `chroma.ts` - Vector database for RAG
- `letta.ts` - Patient memory management
- `composio.ts` - Workflow automation
- `livekit.ts` - Video call infrastructure
- `elastic.ts` - Logging and analytics
- `index.ts` - Main exports and initialization

## Usage Examples

### Initialize All Services

```typescript
import { initializeServices } from "./src/lib";

await initializeServices();
```

### Health Check

```typescript
import { healthCheck } from "./src/lib";

const health = await healthCheck();
console.log(health);
```
[truncated — 1611 more characters]
```

### package.json

```
{
  "name": "vite_react_shadcn_ts",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "build:dev": "vite build --mode development",
    "lint": "eslint .",
    "preview": "vite preview",
    "init-services": "node scripts/init-services.js",
    "health-check": "node -e \"import('./src/lib/index.js').then(m => m.healthCheck()).then(console.log)\""
  },
  "dependencies": {
    "@anthropic-ai/sdk": "^0.67.0",
    "@composio/core": "^0.2.0",
    "@elastic/elasticsearch": "^9.2.0",
    "@hookform/resolvers": "^3.10.0",
    "@letta-ai/letta-client": "^0.0.68665",
    "@radix-ui/react-accordion": "^1.2.11",
    "@radix-ui/react-alert-dialog": "^1.1.14",
    "@radix-ui/react-aspect-ratio": "^1.1.7",
    "@radix-ui/react-avatar": "^1.1.10",
    "@radix-ui/react-checkbox": "^1.3.2",
    "@radix-ui/react-collapsible": "^1.1.11",
    "@radix-ui/react-context-menu": "^2.2.15",
    "@radix-ui/react-dialog": "^1.1.14",
    "@radix-ui/react-dropdown-menu": "^2.1.15",
    "@radix-ui/react-hover-card": "^1.1.14",
    "@radix-ui/react-label": "^2.1.7",
    "@radix-ui/react-menubar": "^1.1.15",
    "@radix-ui/react-navigation-menu": "^1.2.13",
    "@radix-ui/react-popover": "^1.1.14",
    "@radix-ui/react-progress": "^1.1.7",
    "@radix-ui/react-radio-group": "^1.3.7",
    "@radix-ui/react-scroll-area": "^1.2.9",
    "@radix-ui/react-select": "^2.2.5",
    "@radix-ui/react-separator": "^1.1.7",
    "@radix-ui/react-slider": "^1.3.5",
    "@radix-ui/react-slot": "^1.2.3",
    "@radix-ui/react-switch": "^1.2.5",
    "@radix-ui/react-tabs": "^1.1.12",
    "@radix-ui/react-toast": "^1.2.14",
    "@radix-ui/react-toggle": "^1.1.9",
    "@radix-ui/react-toggle-group": "^1.1.10",
    "@radix-ui/react-tooltip": "^1.2.7",
    "@supabase/supabase-js": "^2.76.1",
    "@tanstack/react-query": "^5.83.0",
    "@vapi-ai/server-sdk": "^0.10.2",
    "chromadb": "^3.0.17",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "cmdk": "^1.1.1",
    "date-fns": "^3.6.0",
    "embla-carousel-react": "^8.6.0",
    "framer-motion": "^12.23.24",
    "input-otp": "^1.4.2",
    "livekit-server-sdk": "^2.14.0",
    "lucide-react": "^0.462.0",
    "next-themes": "^0.3.0",
    "react": "^18.3.1",
    "react-day-picker": "^8.10.1",
    "react-dom": "^18.3.1",
    "react-hook-form": "^7.61.1",
    "react-resizable-panels": "^2.1.9",
    "react-router-dom": "^6.30.1",
    "recharts": "^2.15.4",
    "sonner": "^1.7.4",
    "tailwind-merge": "^2.6.0",
    "tailwindcss-animate": "^1.0.7",
    "vaul": "^0.9.9",
    "zod": "^3.25.76"
  },
  "devDependencies": {
    "@eslint/js": "^9.32.0",
    "@tailwindcss/typography": "^0.5.16",
    "@types/node": "^22.16.5",
    "@types/react": "^18.3.23",
    "@types/react-dom": "^18.3.7",
    "@vitejs/plugin-react-swc": "^3.11.0",
    "autoprefixer": "^10.4.21",
    "eslint": "^9.32.0",
    "eslint-plugin-react-hooks": "^5.2.0",
    "eslint-plugin-react-refresh": "^0.4.20",
    "globals": "^15.15.0",
    "lovable-tagger": "^1.1.11",
    "postcss": "^8.5.6",
    "tailwindcss": "^3.4.17",
    "typescript": "^5.8.3",
    "typescript-eslint": "^8.38.0",
    "vite": "^5.4.19"
  }
}

```

### src/main.tsx

```typescript
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import "./index.css";

createRoot(document.getElementById("root")!).render(<App />);

```

### src/App.tsx

```typescript
import { Toaster } from "@/components/ui/toaster";
import { Toaster as Sonner } from "@/components/ui/sonner";
import { TooltipProvider } from "@/components/ui/tooltip";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import { SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar";
import { AppSidebar } from "@/components/AppSidebar";
import Index from "./pages/Index";
import Dashboard from "./pages/Dashboard";
import Patients from "./pages/Patients";
import Settings from "./pages/Settings";
import { RiskDetailsPage } from "./pages/RiskDetailsPage";
import NotFound from "./pages/NotFound";

const queryClient = new QueryClient();

const App = () => (
  <QueryClientProvider client={queryClient}>
    <TooltipProvider>
      <Toaster />
      <Sonner />
      <BrowserRouter>
        <SidebarProvider>
          <div className="flex min-h-screen w-full">
            <AppSidebar />
            <main className="flex-1">
              <header className="sticky top-0 z-10 flex h-14 items-center border-b border-border/50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 px-4">
                <SidebarTrigger />
              </header>
              <Routes>
                <Route path="/" element={<Index />} />
                <Route path="/dashboard" element={<Dashboard />} />
                <Route path="/patients" element={<Patients />} />
                <Route path="/settings" element={<Settings />} />
                <Route path="/risk-details/:id" element={<RiskDetailsPage />} />
                {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
                <Route path="*" element={<NotFound />} />
              </Routes>
            </main>
          </div>
        </SidebarProvider>
      </BrowserRouter>
    </TooltipProvider>
  </QueryClientProvider>
);

export default App;

```

### src/pages/Index.tsx

```typescript
import { Hero } from "@/components/Hero";
import { FeatureCards } from "@/components/FeatureCards";

const Index = () => {
  return (
    <div className="min-h-screen">
      <Hero />
      <FeatureCards />
    </div>
  );
};

export default Index;

```

### postcss.config.js

```javascript
export default {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
};

```

### vite.config.ts

```typescript
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
import { componentTagger } from "lovable-tagger";

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
  server: {
    host: "::",
    port: 8080,
  },
  plugins: [react(), mode === "development" && componentTagger()].filter(Boolean),
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
}));

```

### eslint.config.js

```javascript
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";

export default tseslint.config(
  { ignores: ["dist"] },
  {
    extends: [js.configs.recommended, ...tseslint.configs.recommended],
    files: ["**/*.{ts,tsx}"],
    languageOptions: {
      ecmaVersion: 2020,
      globals: globals.browser,
    },
    plugins: {
      "react-hooks": reactHooks,
      "react-refresh": reactRefresh,
    },
    rules: {
      ...reactHooks.configs.recommended.rules,
      "react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
      "@typescript-eslint/no-unused-vars": "off",
    },
  },
);

```

### index.html

```html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>CareLink+</title>
    <meta name="description" content="Voice-first AI-powered post-operative care management system with real-time monitoring and actionable insights">
    <meta name="author" content="CareLink+" />
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">

    
    
    <meta property="og:type" content="website" />
    <meta property="og:image" content="https://lovable.dev/opengraph-image-p98pqg.png" />

    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:site" content="@carelink_plus" />
    <meta name="twitter:image" content="https://lovable.dev/opengraph-image-p98pqg.png" />
    <meta property="og:title" content="CareLink+">
  <meta name="twitter:title" content="CareLink+">
  <meta property="og:description" content="Voice-first AI-powered post-operative care management system with real-time monitoring and actionable insights">
  <meta name="twitter:description" content="Voice-first AI-powered post-operative care management system with real-time monitoring and actionable insights">
</head>

  <body>
    <div id="root"></div>
    <script type="module" src="/src/main.tsx"></script>
  </body>
</html>

```

[71 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]