# Project export: Ictus

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: UC Berkeley AI Hackathon 2025
- Tagline: Ictus is an AI-powered stroke detection and emergency response app designed to save lives in real time. Using your webcam, microphone, and device sensors, Ictus detects early signs of stroke- in secs.
- Devpost: https://devpost.com/software/ictus-r3vw6g
- GitHub: https://github.com/parsafarajia/UCBHackathon2025
- Demo: https://ictus-ai-stroke-detection.vercel.app/
- Team: 3 GitHub contributor(s) — Sewon Myung (6 commits), parsafarajia (3 commits), cjaeey (2 commits)

## Devpost submission (written by the team)

### Inspiration

We've learned about the BE FAST protocol—Balance, Eyes, Face, Arms, Speech, Time— critical for the early detection of strokes. Thus, with the help of advanced ai tools like google adk, we've programmed to streamline the procedures, making it more accessible to at-risk patients.

### What it does

Designed to detect strokes within seconds for patients who are already at risk of strokes.

### How we built it

Integrating multimodal AI agents and Kaggle datasets to

### Challenges we ran into

We had trouble getting the accuracy because we weren’t able to use the actual ai agents, as well as being unfamiliar with data training with Kaggle

### Accomplishments we're proud of

Trained the datasets with 91% accuracy using the AI agents algorithm.

### What we learned

We get to familiarize ourselves with advanced AI tools such as Claude, model training from Kaggle, detect facial asymmetry in real time with yolo. superbase

### What's next

Improve the agentic workflow, and implement Ictus on various hardware like apple watches, meta glasses to make it widely accessible.

## README (from the GitHub repository)

### UCBHackathon2025 — Stroke Detection Tool

A multimodal stroke detection tool that guides users through FAST assessment, performs real-time facial droop detection, and coordinates alerts and triage via an agent-based backend with a React frontend.

### Features
- **FAST Assessment**: Structured flow for Face, Arm, Speech, Time checks.
- **Real-time Vision**: Face/landmark detection for facial droop analysis.
- **Conversational Agents**: Symptom intake, triage, care guidance, and alert coordination.
- **Web Frontend**: React-based UI with modular components.
- **Extensible Backends**: Pluggable stroke detection pipelines and agents.

### Project Structure
- `frontend/`: React app (TypeScript) with components like `FASTAssessment.tsx`, `VideoRecognition.tsx`, `StrokeDetectionChatbot.tsx`.
- `facial_droop_model/`: Python scripts for dataset prep, training, and real-time droop detection (`real_time_face_detection.py`, `train_stroke_model.py`).
- `multi_tool_agent/`: Agent orchestration (Python).
- `newfiles/multi_tool_agent/stroke_detection/`: New agentized stroke detection demo with coordinator and agents.

### Architecture
- **Frontend (React)**: UI for FAST, video/voice capture, and chat.
- **CV/ML (Python)**: Facial droop detection and model training scripts.
- **Agent Layer (Python)**: Coordinator orchestrates specialized agents: symptom, triage, care, follow-up, alert.

### Prerequisites
- Node.js 18+ and npm
- Python 3.10+ (recommend venv)
- macOS (tested), camera + microphone permissions enabled
- Optional: GPU/accelerators for training

### Quick Start

#### 1) Frontend
```bash
cd /Users/sewonmyung/programming/UCBHackathon2025/frontend
npm install
npm start
```
- App runs at `http://localhost:3000`.

#### 2) Facial Droop Model (Real-time Demo)
```bash
cd /Users/sewonmyung/programming/UCBHackathon2025/facial_droop_model
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python real_time_face_detection.py
```

#### 3) Agent Demo (Coordinator + Agents)
```bash
cd /Users/sewonmyung/programming/UCBHackathon2025/newfiles/multi_tool_agent
python -m venv venv && source venv/bin/activate
pip install -e .
python stroke_detection_demo.py
```

### Key Frontend Components
- `components/FASTAssessment.tsx`: Core FAST workflow.
- `components/EnhancedFASTAssessment.tsx`: Extended evaluation.
- `components/VideoRecognition.tsx` and `components/EnhancedVideoRecognition.tsx`: Camera capture + CV integration.
- `components/StrokeDetectionChatbot.tsx` and `components/FASTChatbot.tsx`: Guided chat for assessment.
- `hooks/useStrokeAnalysis.ts`: Client logic for analysis/API calls.
- `lib/strokeAgentAPI.ts`: Client wrapper for backend interactions.

### CV/ML Pipeline
- `setup_dataset.py`, `analyze_stroke_dataset.py`: Dataset prep and EDA.
- `train_stroke_model.py` / `train_model.py`: Model training.
- `real_time_face_detection.py`: Webcam-based inference and droop estimation.
- `deploy_model.py`: Packaging/deployment utilities.
- You can swap models by updating loaders/inference in `facial_droop_model/`.

### Agent Orchestration
- `newfiles/multi_tool_agent/stroke_detection/coordinator.py`: Orchestrates multi-agent flow.
- Agents in `stroke_detection/agents/`: 
  - `symptom_agent.py`, `triage_agent.py`, `care_agent.py`, `followup_agent.py`, `alert_agent.py`.
- `utils/data_structures.py`: Core types for messages, tasks, and results.

### Environment Variables
Create `.env` files as needed:
- Frontend (`frontend/.env`):
  - `REACT_APP_BACKEND_URL` (if integrating with a running API)
  - `REACT_APP_SUPABASE_URL`, `REACT_APP_SUPABASE_ANON_KEY` (if using Supabase)
- Python backends:
  - `OPENAI_API_KEY` or provider keys (if LLM-backed)
  - Any alerting integrations (e.g., `TWILIO_*`, `SENDGRID_*`) if used.

### Development Scripts
- Frontend:
  - `npm start`: Dev server
  - `npm test`: Unit tests
  - `npm run build`: Production build
- CV/ML:
  - `python setup_dataset.py`
  - `python train_stroke_model.py`
  - `python real_time_face_detection.py`
- Agents:
  - `python stroke_detection_demo.py`

### API Notes
- Client-side wrapper is in `frontend/src/lib/strokeAgentAPI.ts`.
- If you expose local APIs (e.g., Flask/FastAPI), set `REACT_APP_BACKEND_URL` accordingly and implement endpoints for:
  - `POST /analyze/face` (image/stream analysis)
  - `POST /fast/assess` (FAST questionnaire/session)
  - `POST /agent/route` (coordinator entrypoint)

### Data, Privacy, and Safety
- For demo use only; not a medical device.
- Do not use for diagnosis or emergency response.
- Handle all audio/video data locally where possible; obtain consent before capture.
- Review logging in `facial_droop_model/api.log` and disable PII logging for production.

### Troubleshooting
- Camera/mic blocked: Allow permissions in the browser and macOS System Settings.
- GPU issues: Force CPU inference or update drivers.
- CORS: Configure your backend to allow `http://localhost:3000`.
- Build errors: Clear cache `rm -rf node_modules && npm install`.

### Contributing
- Use feature branches and submit PRs.
- Keep edits focused and well-described.
- Add tests for new logic where possible.

### License
- Specify your license (e.g., MIT) in a `LICENSE` file.

- Implemented a complete, concise `README.md` covering setup, architecture, components, scripts, and safety guidance.


## Detected evidence (automated analysis)

Indexed codebase: 42 recognized source files, 240 KB.
- CSS (language) — detected in the code
- HTML (language) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code
- Supabase (technology) — detected in the code
- TypeScript (language) — detected in the code
- Google Gemini (technology) — claimed on Devpost, not found in the code
- AI coding agent: Claude Code — evidence: config files committed to the repository

## Codebase structure (from repository index)

### Files (49 of 49)

```
CLAUDE.md
frontend/.gitignore
frontend/BACKEND_INTEGRATION.md
frontend/package.json
frontend/public/index.html
frontend/public/manifest.json
frontend/public/robots.txt
frontend/README.md
frontend/src/App.css
frontend/src/App.test.tsx
frontend/src/App.tsx
frontend/src/AppDebug.tsx
frontend/src/AppSimple.tsx
frontend/src/components/AgentStatus.tsx
frontend/src/components/EmergencyAlert.tsx
frontend/src/components/EnhancedFASTAssessment.tsx
frontend/src/components/EnhancedVideoRecognition.tsx
frontend/src/components/FASTAssessment.tsx
frontend/src/components/VideoRecognition.tsx
frontend/src/components/VoiceRecognition.tsx
frontend/src/ErrorBoundary.tsx
frontend/src/hooks/useStrokeAnalysis.ts
frontend/src/index.css
frontend/src/index.tsx
frontend/src/lib/strokeAgentAPI.ts
frontend/src/lib/supabase.ts
frontend/src/react-app-env.d.ts
frontend/src/reportWebVitals.ts
frontend/src/setupTests.ts
frontend/src/theme/theme.ts
frontend/tsconfig.json
multi_tool_agent/__init__.py
multi_tool_agent/.env
multi_tool_agent/agent.py
newfiles/multi_tool_agent/__init__.py
newfiles/multi_tool_agent/.env
newfiles/multi_tool_agent/agent.py
newfiles/multi_tool_agent/stroke_detection_demo.py
newfiles/multi_tool_agent/stroke_detection/__init__.py
newfiles/multi_tool_agent/stroke_detection/agents/__init__.py
newfiles/multi_tool_agent/stroke_detection/agents/alert_agent.py
newfiles/multi_tool_agent/stroke_detection/agents/care_agent.py
newfiles/multi_tool_agent/stroke_detection/agents/followup_agent.py
newfiles/multi_tool_agent/stroke_detection/agents/symptom_agent.py
newfiles/multi_tool_agent/stroke_detection/agents/triage_agent.py
newfiles/multi_tool_agent/stroke_detection/coordinator.py
newfiles/multi_tool_agent/stroke_detection/utils/__init__.py
newfiles/multi_tool_agent/stroke_detection/utils/data_structures.py
README.md
```

### Dependencies

- frontend/package.json: @emotion/react@^11.14.0, @emotion/styled@^11.14.0, @mui/icons-material@^7.1.2, @mui/material@^7.1.2, @mui/system@^7.1.1, @supabase/supabase-js@^2.50.0, @testing-library/dom@^10.4.0, @testing-library/jest-dom@^6.6.3, @testing-library/react@^16.3.0, @testing-library/user-event@^13.5.0, @types/jest@^27.5.2, @types/node@^16.18.126, @types/react@^19.1.8, @types/react-dom@^19.1.6, react@^19.1.0, react-dom@^19.1.0, react-scripts@5.0.1, typescript@^4.9.5, web-vitals@^2.1.4

### Recent commits (newest first)

- Update README.md
- Merge pull request #4 from parsafarajia/reset-Carlos
- vibe
- update
- Merge pull request #3 from parsafarajia/ADK-sewon
- deleted
- Merge pull request #2 from parsafarajia/ADK-Sewon
- everything???
- health agent
- Merge pull request #1 from parsafarajia/ADK-Sewon
- project structure adk
- Initial commit

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

### CLAUDE.md

```markdown
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

This is a UCB Hackathon 2025 AI project featuring a Google ADK-based health monitoring agent that detects medical anomalies and automatically calls emergency services.

## Development Environment Setup

### Virtual Environment and Dependencies
```bash
# Create and activate virtual environment
cd multi_tool_agent
python3 -m venv venv
source venv/bin/activate

# Install Google ADK
pip install google-adk
```

### Running the Agent
```bash
# Activate virtual environment and run
source venv/bin/activate
python agent.py
```

## Architecture

### Core Agent Structure
The project uses Google ADK's Agent framework with the following pattern:
- **Tool Functions**: Health monitoring functions that return structured dictionaries
- **Agent Configuration**: Centralized agent with model, description, instructions, and tool array
- **Emergency Response System**: Automatic 911 calling when critical thresholds are exceeded

### Health Monitoring System
The agent implements a three-tier monitoring system:

**Vital Sign Functions:**
- `monitor_heart_rate(patient_id)` - Heart rate monitoring with BPM thresholds
- `monitor_blood_pressure(patient_id)` - Blood pressure monitoring with systolic/diastolic thresholds  
- `monitor_temperature(patient_id)` - Body temperature monitoring in Fahrenheit/Celsius

**Emergency Response:**
- `call_emergency_services(patient_id, condition)` - 911 simulation with dispatch details
- `get_patient_status(patient_id)` - Comprehensive health overview aggregating all vitals

### Critical Thresholds
Health monitoring uses medically-based severity levels:

**Heart Rate:**
- Critical: <50 or >150 BPM
- Warning: <60 or >120 BPM

**Blood Pressure:**
- Critical: Systolic >180 or <90, Diastolic >110
- Warning: Systolic >140, Diastolic >90

**Temperature:**
- Critical: <95�F or >104�F
- Warning: <96�F or >100.4�F

### Data Flow
1. Individual monitoring functions generate simulated vital signs
2. Threshold detection triggers severity classification (normal/warning/critical)
3. Critical conditions automatically invoke emergency services
4. `get_patient_status()` aggregates all vitals and emergency responses
5. Agent returns structured JSON with timestamps, alerts, and emergency details

## Configuration

### Environment Variables
The `.env` file contains:
- `GOOGLE_GENAI_USE_VERTEXAI=FALSE` - Uses Google GenAI API directly
- `GOOGLE_API_KEY` - Authentication for Google's Gemini model

### Agent Configuration
- **Model**: `gemini-2.0-flash`
- **Name**: `health_monitoring_agent`
- **Tools**: All health monitoring and emergency response functions
- **Instructions**: Embedded medical thresholds and safety protocols

## Key Implementation Details

### Emergency Response Simulation
- Generates unique emergency IDs with timestamp format `EMR-YYYYMMDDHHMMSS`
- Returns realistic dispatch information (units, response times)

[truncated — 3328 more characters]
```

### frontend/BACKEND_INTEGRATION.md

```markdown
# Backend Integration Guide

This guide explains how to integrate the Google ADK multi-agent stroke detection system with the React frontend.

## Architecture Overview

```
Frontend (React) ←→ Backend API (Python/Flask) ←→ Google ADK Agents
     ↓                        ↓                         ↓
  Supabase           Environment Vars            Multi-Agent System
(API Keys)         (Google API Key)           (5 Specialized Agents)
```

## Integration Components

### 1. Frontend Integration Layer

- **`strokeAgentAPI.ts`**: Main API client for communicating with the backend
- **`useStrokeAnalysis.ts`**: React hook for managing stroke analysis state
- **Enhanced Components**: AI-powered versions of FAST assessment and video analysis
- **Agent Status**: Real-time monitoring of the multi-agent system

### 2. Multi-Agent System (from newfiles/)

The backend consists of 5 specialized agents:

1. **Symptom Agent**: NLP analysis of patient symptoms
2. **Triage Agent**: FAST assessment and risk scoring  
3. **Alert Agent**: Emergency response coordination
4. **Care Agent**: Immediate care instructions
5. **Follow-up Agent**: Event logging and reporting

### 3. Coordinator System

- **`coordinator.py`**: Orchestrates workflow across all agents
- **Workflow Management**: Handles agent sequencing and data flow
- **Batch Processing**: Supports multiple patient assessments
- **Performance Monitoring**: System health and metrics

## Deployment Steps

### Step 1: Backend API Server

Create a Flask API server to expose the agent functionality:

```python
# backend/app.py
from flask import Flask, request, jsonify
from flask_cors import CORS
import sys
import os

# Add the stroke detection system to path
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'newfiles', 'multi_tool_agent'))

from stroke_detection.coordinator import orchestrate_stroke_detection, get_system_status

app = Flask(__name__)
CORS(app)

@app.route('/api/analyze', methods=['POST'])
def analyze_stroke():
    data = request.json
    patient_id = data.get('patient_id')
    input_data = {
        'text': data.get('text'),
        'voice_text': data.get('voice_text'), 
        'input_type': data.get('input_type', 'text'),
        'location': data.get('location', {})
    }
    
    try:
        result = orchestrate_stroke_detection(patient_id, input_data)
        return jsonify(result)
    except Exception as e:
        return jsonify({'error': str(e)}), 500

@app.route('/api/status', methods=['GET'])
def system_status():
    try:
        status = get_system_status()
        return jsonify(status)
    except Exception as e:
        return jsonify({'error': str(e)}), 500

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080, debug=True)
```

### Step 2: Environment Configuration

Update your environment variables:

```bash
# Backend Environment
GOOGLE_API_KEY=your_google_api_key_here
GOOGLE_GENAI_USE_VERTEXAI=FALSE
FLASK_ENV=production
PORT=8080

# Frontend Environment  
REACT_
[truncated — 6419 more characters]
```

### frontend/package.json

```
{
  "name": "frontend",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.14.0",
    "@emotion/styled": "^11.14.0",
    "@mui/icons-material": "^7.1.2",
    "@mui/material": "^7.1.2",
    "@mui/system": "^7.1.1",
    "@supabase/supabase-js": "^2.50.0",
    "@testing-library/dom": "^10.4.0",
    "@testing-library/jest-dom": "^6.6.3",
    "@testing-library/react": "^16.3.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.5.2",
    "@types/node": "^16.18.126",
    "@types/react": "^19.1.8",
    "@types/react-dom": "^19.1.6",
    "react": "^19.1.0",
    "react-dom": "^19.1.0",
    "react-scripts": "5.0.1",
    "typescript": "^4.9.5",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

```

### frontend/src/index.tsx

```typescript
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './AppDebug';
import ErrorBoundary from './ErrorBoundary';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
  <React.StrictMode>
    <ErrorBoundary>
      <App />
    </ErrorBoundary>
  </React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

```

### frontend/src/App.tsx

```typescript
import React, { useState } from 'react'
import {
  ThemeProvider,
  CssBaseline,
  AppBar,
  Toolbar,
  Typography,
  Container,
  Tabs,
  Tab,
  Box,
} from '@mui/material'
import { ictusTheme } from './theme/theme'
import FASTAssessment from './components/FASTAssessment'
import EnhancedFASTAssessment from './components/EnhancedFASTAssessment'
import VideoRecognition from './components/VideoRecognition'
import EnhancedVideoRecognition from './components/EnhancedVideoRecognition'
import VoiceRecognition from './components/VoiceRecognition'
import EmergencyAlert from './components/EmergencyAlert'
import AgentStatus from './components/AgentStatus'

interface TabPanelProps {
  children?: React.ReactNode
  index: number
  value: number
}

function TabPanel(props: TabPanelProps) {
  const { children, value, index, ...other } = props

  return (
    <div
      role="tabpanel"
      hidden={value !== index}
      id={`simple-tabpanel-${index}`}
      aria-labelledby={`simple-tab-${index}`}
      {...other}
    >
      {value === index && <Box sx={{ p: 3 }}>{children}</Box>}
    </div>
  )
}

function App() {
  const [tabValue, setTabValue] = useState(0)

  const handleTabChange = (_: React.SyntheticEvent, newValue: number) => {
    setTabValue(newValue)
  }

  return (
    <ThemeProvider theme={ictusTheme}>
      <CssBaseline />
      <Box sx={{ flexGrow: 1 }}>
        <AppBar position="static">
          <Toolbar>
            <Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
              ICTUS - AI Stroke Detection System
            </Typography>
          </Toolbar>
        </AppBar>
        
        <Container maxWidth="lg" sx={{ mt: 2 }}>
          <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
            <Tabs value={tabValue} onChange={handleTabChange} aria-label="Ictus navigation tabs">
              <Tab label="FAST Assessment" />
              <Tab label="AI-Enhanced FAST" />
              <Tab label="Video Analysis" />
              <Tab label="AI-Enhanced Video" />
              <Tab label="Voice Analysis" />
              <Tab label="Emergency" />
              <Tab label="Agent Status" />
            </Tabs>
          </Box>
          
          <TabPanel value={tabValue} index={0}>
            <FASTAssessment />
          </TabPanel>
          
          <TabPanel value={tabValue} index={1}>
            <EnhancedFASTAssessment />
          </TabPanel>
          
          <TabPanel value={tabValue} index={2}>
            <VideoRecognition />
          </TabPanel>
          
          <TabPanel value={tabValue} index={3}>
            <EnhancedVideoRecognition />
          </TabPanel>
          
          <TabPanel value={tabValue} index={4}>
            <VoiceRecognition />
          </TabPanel>
          
          <TabPanel value={tabValue} index={5}>
            <EmergencyAlert 
              patientData={{
                name: "John Doe",
                age: 65,
                conditions: ["Hypertension", "Diabetes"]
              }}
            />
          </TabPanel>
          
          <TabPanel value={tabValue} index={6}>
            <AgentStatus />
          </TabPanel>
        </Container>
      </Box>
    </ThemeProvider>
  )
}

export default App

```

### multi_tool_agent/__init__.py

```python
from . import agent 
```

### multi_tool_agent/agent.py

```python
import datetime
from google.adk.agents import Agent
import random

def monitor_heart_rate(patient_id: str) -> dict:
    """Monitors a patient's heart rate and detects anomalies.

    Args:
        patient_id (str): The ID of the patient to monitor.

    Returns:
        dict: status, heart rate reading, and emergency alert if needed.
    """
    heart_rate = random.randint(45, 180)
    
    is_critical = heart_rate < 50 or heart_rate > 150
    is_warning = (heart_rate < 60 or heart_rate > 120) and not is_critical
    
    result = {
        "status": "success",
        "patient_id": patient_id,
        "heart_rate": heart_rate,
        "timestamp": datetime.datetime.now().isoformat(),
        "severity": "normal"
    }
    
    if is_critical:
        result["severity"] = "critical"
        result["alert"] = f"CRITICAL: Heart rate {heart_rate} BPM detected for patient {patient_id}"
        result["emergency_response"] = call_emergency_services(patient_id, f"Critical heart rate: {heart_rate} BPM")
    elif is_warning:
        result["severity"] = "warning"
        result["alert"] = f"WARNING: Abnormal heart rate {heart_rate} BPM for patient {patient_id}"
    
    return result

def monitor_blood_pressure(patient_id: str) -> dict:
    """Monitors a patient's blood pressure and detects anomalies.

    Args:
        patient_id (str): The ID of the patient to monitor.

    Returns:
        dict: status, blood pressure reading, and emergency alert if needed.
    """
    systolic = random.randint(80, 200)
    diastolic = random.randint(50, 120)
    
    is_critical = systolic > 180 or diastolic > 110 or systolic < 90
    is_warning = (systolic > 140 or diastolic > 90) and not is_critical
    
    result = {
        "status": "success",
        "patient_id": patient_id,
        "blood_pressure": f"{systolic}/{diastolic}",
        "systolic": systolic,
        "diastolic": diastolic,
        "timestamp": datetime.datetime.now().isoformat(),
        "severity": "normal"
    }
    
    if is_critical:
        result["severity"] = "critical"
        result["alert"] = f"CRITICAL: Blood pressure {systolic}/{diastolic} mmHg detected for patient {patient_id}"
        result["emergency_response"] = call_emergency_services(patient_id, f"Critical blood pressure: {systolic}/{diastolic} mmHg")
    elif is_warning:
        result["severity"] = "warning"
        result["alert"] = f"WARNING: Elevated blood pressure {systolic}/{diastolic} mmHg for patient {patient_id}"
    
    return result

def monitor_temperature(patient_id: str) -> dict:
    """Monitors a patient's body temperature and detects anomalies.

    Args:
        patient_id (str): The ID of the patient to monitor.

    Returns:
        dict: status, temperature reading, and emergency alert if needed.
    """
    temperature_f = round(random.uniform(95.0, 108.0), 1)
    temperature_c = round((temperature_f - 32) * 5/9, 1)
    
    is_critical = temperature_f < 95.0 or temperature_f > 104.0
    is_warning = (temperature_f < 96.0 or temperature_f > 100.4) and not is_critical
    
    result = {
        "status": "success",
        "patient_id": patient_id,
        "temperature_f": temperature_f,
        "temperature_c": temperature_c,
        "timestamp": datetime.datetime.now().isoformat(),
        "severity": "normal"
    }
    
    if is_critical:
        result["severity"] = "critical"
        result["alert"] = f"CRITICAL: Body temperature {temperature_f}°F ({temperature_c}°C) detected for patient {patient_id}"
        result["emergency_response"] = call_emergency_services(patient_id, f"Critical temperature: {temperature_f}°F")
    elif is_warning:
        result["severity"] = "warning"
        result["alert"] = f"WARNING: Abnormal temperature {temperature_f}°F ({temperature_c}°C) for patient {patient_id}"
    
    return result

def call_emergency_services(patient_id: str, condition: str) -> dict:
    """Simulates calling 911 for emergency medical response.

    Args:
        patient_id (str): The ID of the patient requiring emergency response.
        condition (str): Description of the medical emergency.

    Returns:
        dict: Emergency response details.
    """
    emergency_id = f"EMR-{datetime.datetime.now().strftime('%Y%m%d%H%M%S')}"
    
    return {
        "emergency_id": emergency_id,
        "patient_id": patient_id,
        "condition": condition,
        "response_time": "5-8 minutes",
        "dispatched_units": ["Ambulance Unit 12", "Paramedic Team Alpha"],
        "status": "911 CALLED - Emergency services dispatched",
        "timestamp": datetime.datetime.now().isoformat(),
        "operator_message": f"Emergency services have been notified for patient {patient_id}. Medical emergency: {condition}"
    }

def get_patient_status(patient_id: str) -> dict:
    """Gets comprehensive health status for a patient.

    Args:
        patient_id (str): The ID of the patient to check.

    Returns:
        dict: Complete health monitoring report.
    """
    heart_rate_data = monitor_heart_rate(patient_id)
    bp_data = monitor_blood_pressure(patient_id)
    temp_data = monitor_temperature(patient_id)
    
    overall_severity = "normal"
    alerts = []
    emergency_responses = []
    
    for data in [heart_rate_data, bp_data, temp_data]:
        if data["severity"] == "critical":
            overall_severity = "critical"
        elif data["severity"] == "warning" and overall_severity == "normal":
            overall_severity = "warning"
        
        if "alert" in data:
            alerts.append(data["alert"])
        
        if "emergency_response" in data:
            emergency_responses.append(data["emergency_response"])
    
    return {
        "status": "success",
        "patient_id": patient_id,
        "overall_severity": overall_severity,
        "heart_rate": heart_rate_data,
        "blood_pressure": bp_data,
        "temperature": temp_data,
        "alerts": alerts,
        "emergency_responses": emergency_respons
[truncated — 1160 more characters]
```

### newfiles/multi_tool_agent/__init__.py

```python
from . import agent 
```

### frontend/src/react-app-env.d.ts

```typescript
/// <reference types="react-scripts" />

```

### frontend/src/setupTests.ts

```typescript
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

```

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