diff --git a/README.md b/README.md
index 7f4231f..588e22c 100644
--- a/README.md
+++ b/README.md
@@ -164,6 +164,7 @@ Explore the diverse range of projects available in this repository. Each link ta
* [`recap/`](./recap/) - **Workshop Recap:** A summary of key learnings and advancements made since the inception of the Gemini workshops, presented as a slide deck. ([📊 slides](https://google-gemini.github.io/workshops/recap))
* [`roast/`](./roast/) - **AI Roast Battle Arena: Uncensored Wit with LLMs:** Showcases a dynamic, multi-agent AI system designed to host uncensored roast battles between different LLMs, with an independent third LLM acting as an impartial judge.
* [`scripts/`](./scripts/) - **LLM-Powered Content Generation & Developer Experience:** A robust framework for generating various content types, including presentation slides and factual summaries, powered by LLMs, emphasizing efficient developer workflows.
+* [`seizure/`](./seizure/) - **SeizureScoreAI: Seizure outcome scoring with Gemini:** A multi-agent clinical reasoning system for ILAE seizure outcome scoring after epilepsy surgery (Streamlit + Google ADK + Gemini).
* [`startupcon/`](./startupcon/) - **StartupCon Talk:** Workshop presentation on building with Gemini and AI agents. ([📊 slides](https://google-gemini.github.io/workshops/startupcon))
* [`smash/`](./smash/) - **Smash Bot: An LLM-Powered Fighting Game Agent:** A cutting-edge AI agent capable of playing a fighting game (like Super Smash Bros.) by observing the game state and controlling a virtual gamepad, powered by a multimodal LLM. ([📊 slides](https://google-gemini.github.io/workshops/smash))
* [`tv/`](./tv/) - **TV Companion: Your AI Film Critic and Controller:** An advanced LLM-powered assistant that "watches" movies and shows in real-time, offering insightful commentary, deep-diving into film trivia, and controlling your TV through natural voice commands.
@@ -201,6 +202,7 @@ Projects focusing on practical applications of LLMs, multi-agent systems, and re
* [`factuality/`](./factuality/) - Factuality: News Summarization & Redaction
* [`kundali/`](./kundali/) - Kundali Milan: AI Jyotish Guru
* [`roast/`](./roast/) - AI Roast Battle Arena: Uncensored Wit with LLMs
+* [`seizure/`](./seizure/) - SeizureScoreAI: ILAE seizure outcome scoring with Gemini
* [`tv/`](./tv/) - TV Companion: Your AI Film Critic and Controller
* [`utils/`](./utils/) - LLM Demonstration Workshop Project
diff --git a/seizure/.dockerignore b/seizure/.dockerignore
new file mode 100644
index 0000000..b4240ea
--- /dev/null
+++ b/seizure/.dockerignore
@@ -0,0 +1,5 @@
+__pycache__
+*.pyc
+.env
+.git
+
diff --git a/seizure/.env.example b/seizure/.env.example
new file mode 100644
index 0000000..9bfe100
--- /dev/null
+++ b/seizure/.env.example
@@ -0,0 +1,2 @@
+# Google Gemini API Configuration
+GEMINI_API_KEY=your_gemini_api_key_here
diff --git a/seizure/.gitignore b/seizure/.gitignore
new file mode 100644
index 0000000..ddc2b5b
--- /dev/null
+++ b/seizure/.gitignore
@@ -0,0 +1,30 @@
+# Environment variables
+.env
+.env.*
+!.env.example
+
+# Python
+__pycache__/
+*.py[cod]
+*$py.class
+
+# Jupyter Notebook
+.ipynb_checkpoints
+*.ipynb_checkpoints
+
+# VS Code settings
+.vscode/
+
+# macOS system files
+.DS_Store
+
+# Distribution / packaging
+dist/
+build/
+*.egg-info/
+
+# Generated notes
+generated_notes/
+
+# Deprecated code
+deprecated_code/
diff --git a/seizure/CONTRIBUTING.md b/seizure/CONTRIBUTING.md
new file mode 100644
index 0000000..19b9437
--- /dev/null
+++ b/seizure/CONTRIBUTING.md
@@ -0,0 +1,26 @@
+# Contributing to SeizureScoreAI
+
+## Setup
+
+1. Clone the repo
+2. Install dependencies: `pip install -r requirements.txt`
+3. Add your `GEMINI_API_KEY` to a `.env` file
+4. Run: `streamlit run app/streamlit_app.py`
+
+## Contributors
+
+### AI ATL Hackathon Team
+
+- **[Vineet Reddy](https://github.com/vineet-reddy):** Conceived the idea to analyze epilepsy clinic notes and output ILAE scores. Developed the original Named Entity Recognition (NER) system with Viresh Pati. (NER system now deprecated)
+- **[Viresh Pati](https://github.com/vireshpati):** Co-designed the initial NER and designed the initial knowledge graph retrieval-augmented generation (KG RAG) system. (NER & KG RAG system now deprecated)
+- **[Mukesh Paranthaman](https://github.com/MukProgram):** Co-built the backend for the original NER and KG RAG system. (NER & KG RAG system now deprecated)
+- **[Sachi Goel](https://github.com/computer-s-2):** Designed the initial Streamlit frontend
+- **[Ananda Badari](https://github.com/abadari3):** Developed logic for predicting ILAE and Engel scores using knowledge graphs. (KG logic now deprecated)
+
+### Post-Hackathon Development
+
+- **[Vineet Reddy](https://github.com/vineet-reddy):** Complete rewrite using Google Agent Development Kit (ADK) with multi-agent architecture
+
+---
+
+**Citation:** The ILAE Outcome Scale is sourced from [MGH Epilepsy Service](https://seizure.mgh.harvard.edu/engel-surgical-outcome-scale/).
diff --git a/seizure/Dockerfile b/seizure/Dockerfile
new file mode 100644
index 0000000..87c2330
--- /dev/null
+++ b/seizure/Dockerfile
@@ -0,0 +1,18 @@
+# Use a lightweight base image
+FROM python:3.12-slim
+
+WORKDIR /app
+
+# Copy all code first (needed for setup.py)
+COPY . .
+
+# Install requirements and local package
+RUN pip install --no-cache-dir -r requirements.txt && pip install --no-cache-dir .
+
+# Set port for Cloud Run
+ENV PORT=8080
+EXPOSE 8080
+
+# Start Streamlit
+CMD ["bash", "-lc", "streamlit run app/streamlit_app.py --server.port $PORT --server.address 0.0.0.0"]
+
diff --git a/seizure/README.md b/seizure/README.md
new file mode 100644
index 0000000..a2f28d4
--- /dev/null
+++ b/seizure/README.md
@@ -0,0 +1,178 @@
+# SeizureScoreAI: Multi-Agent Clinical Reasoning System
+
+A multi-agent system designed to emulate epileptologist decision-making for ILAE outcome scoring after epilepsy surgery. Built with **Google's Agent Development Kit (ADK)**, the system uses Gemini 3 Flash models in a sequential agent pipeline to process clinical notes and evaluate post-surgical outcomes. The goal is to teach an LLM to reason like an epileptologist.
+
+## Overview
+
+SeizureScoreAI employs a three-agent pipeline to process clinical notes and determine ILAE (International League Against Epilepsy) outcome scores:
+
+1. **Clinical Information Extractor**: Analyzes clinical notes to extract key metrics including:
+ - Presence of seizure freedom
+ - Presence of auras
+ - Baseline seizure frequency (pre-treatment)
+ - Post-treatment seizure frequency
+
+2. **ILAE Score Calculator**: Applies expertise to:
+ - Process extracted clinical information
+ - Calculate ILAE outcome scores based on standard criteria
+ - Provide detailed reasoning for score determination
+
+3. **Concise Reporter**: Generates clear, concise summaries of:
+ - Final ILAE score
+ - Key factors influencing the score
+ - Clinical reasoning behind the determination
+
+## Technical Architecture
+
+### Components
+
+- **Frontend**: Streamlit interface for clinical note input and result display
+- **Backend**: Multi-agent system built with **Google Agent Development Kit (ADK)**
+- **Agent Framework**: Sequential pipeline using ADK's `LlmAgent` class
+- **Model**: Gemini 3 Flash Preview (`gemini-3-flash-preview`)
+- **Session Management**: In-memory session service for agent state
+- **Structured Output**: JSON-formatted data for consistent processing between agents
+
+### Data Flow
+
+```
+Clinical Note → [Agent 1: Extract] → Structured Data → [Agent 2: Calculate] → ILAE Score + Reasoning → [Agent 3: Summarize] → Final Output
+```
+
+1. Clinical note input → Information Extraction (JSON)
+2. Structured entities → ILAE Score Calculation
+3. Detailed analysis → Concise Reporting
+4. Final output → User presentation with highlighted supporting text
+
+## Quick Start
+
+### Prerequisites
+
+- Python 3.8+
+- Google Gemini API key
+
+### Installation
+
+```bash
+# Clone the repository
+git clone https://github.com/vineet-reddy/SeizureScoreAI.git
+cd SeizureScoreAI
+
+# Install dependencies
+pip install -r requirements.txt
+
+# Set up environment variables
+echo "GEMINI_API_KEY=your_api_key_here" > .env
+```
+
+### Usage
+
+Run the Streamlit application:
+
+```bash
+streamlit run app/streamlit_app.py
+```
+
+The application will:
+1. Accept clinical notes as input (via file upload)
+2. Process them through the three-agent pipeline
+3. Return ILAE scores with explanations
+4. Display the clinical note with highlighted supporting text
+
+## ILAE Outcome Scale
+
+The system evaluates surgical outcomes based on the following scale[^1]:
+
+| Class | Outcome |
+|-------|---------|
+| **1** | Completely seizure free; no auras |
+| **2** | Only auras; no other seizures |
+| **3** | 1-3 seizure days per year; ± auras |
+| **4** | 4 seizure days per year to 50% reduction of baseline seizure days; ± auras |
+| **5** | Less than 50% reduction of baseline seizure days; ± auras |
+| **6** | More than 100% increase of baseline seizure days; ± auras |
+
+[^1]: Source: [MGH Epilepsy Service - Epilepsy Surgery Outcome Scales](https://seizure.mgh.harvard.edu/engel-surgical-outcome-scale/)
+
+## Project Structure
+
+```
+SeizureScoreAI/
+├── src/
+│ └── seizure_score_ai/
+│ ├── __init__.py # Package initialization
+│ └── agents.py # Multi-agent pipeline using Google ADK
+├── app/
+│ ├── streamlit_app.py # Streamlit frontend
+│ ├── config.toml # Streamlit configuration
+│ └── example_notes/ # Example clinical notes for demo
+│ ├── ilaeclass1.txt
+│ ├── ilaeclass2.txt
+│ └── ilaeclass3.txt
+├── scripts/
+│ └── generate_clinic_notes.py # Synthetic clinic note generator
+├── tests/
+│ ├── test_adk_agents.py # ADK agent tests
+│ └── test_gemini.py # API verification test
+├── data/
+│ └── test_notes/ # Sample clinical notes (synthetic)
+├── generated_notes/ # Generated synthetic notes
+├── docs/ # Documentation
+├── .env # Environment variables (not in repo)
+├── requirements.txt # Python dependencies
+├── setup.py # Package setup
+├── Dockerfile # Docker configuration
+└── README.md # This file
+```
+
+## Technology Stack
+
+| Component | Technology |
+|-----------|------------|
+| **AI Framework** | [Google Agent Development Kit (ADK)](https://google.github.io/adk-docs/) `>=0.3.0` |
+| **LLM Model** | Gemini 3 Flash Preview |
+| **Frontend** | Streamlit `>=1.40.0` |
+| **Language** | Python 3.8+ |
+| **Environment** | python-dotenv for secure API key handling |
+
+### Key Dependencies
+
+```
+google-adk>=0.3.0
+streamlit>=1.40.0
+python-dotenv>=1.0.0
+```
+
+## Testing
+
+The system includes **synthetically generated test clinical notes** in the `data/test_notes/` directory, representing various post-surgical outcomes and clinical scenarios. These notes are designed to simulate real-world inputs but **do not contain any Protected Health Information (PHI)**.
+
+Example notes demonstrating different ILAE classes are available in `app/example_notes/` for demo purposes.
+
+## Security Considerations
+
+> **Important**: This system is **not HIPAA compliant**. Do not upload documents containing Protected Health Information (PHI).
+
+- API keys are managed through environment variables (`.env` file)
+- Never commit `.env` files to version control
+- Streamlit Cloud secrets provide secure deployment options
+
+## Limitations
+
+- Requires high-quality clinical notes for accurate scoring
+- LLM responses may vary slightly between runs
+- System should be used as a support tool, not a replacement for clinical judgment
+- Performance depends on the quality and completeness of input clinical notes
+- May return "indeterminate" if key clinical information is missing from the note
+
+## Contributing
+
+Interested in contributing? Check out [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to get started!
+
+## Project History
+
+This project originated as a proof-of-concept at the 2024 AI ATL Hackathon and has since undergone a complete architectural rewrite. The current implementation uses Google's Agent Development Kit with a multi-agent system, representing a fundamental redesign from the original NER/Knowledge Graph approach. See [CONTRIBUTING.md](CONTRIBUTING.md#project-history-and-contributors) for detailed project evolution and contributor information.
+
+## Citation
+
+The ILAE Outcome Scale used in this system is sourced from the Massachusetts General Hospital Epilepsy Service. For more information, visit their [Epilepsy Surgery Outcome Scales page](https://seizure.mgh.harvard.edu/engel-surgical-outcome-scale/).
diff --git a/seizure/app/config.toml b/seizure/app/config.toml
new file mode 100644
index 0000000..6e12f7f
--- /dev/null
+++ b/seizure/app/config.toml
@@ -0,0 +1,22 @@
+[theme]
+primaryColor = "#FF4B4B"
+backgroundColor = "#FFFFFF"
+secondaryBackgroundColor = "#F0F2F6"
+textColor = "#262730"
+font = "sans serif"
+
+[server]
+maxUploadSize = 5
+enableXsrfProtection = true
+enableCORS = false
+port = 8501
+address = "0.0.0.0"
+
+[browser]
+gatherUsageStats = false
+serverAddress = "localhost"
+serverPort = 8501
+
+[logger]
+level = "info"
+messageFormat = "%(asctime)s %(message)s"
\ No newline at end of file
diff --git a/seizure/app/example_notes/ilaeclass1.txt b/seizure/app/example_notes/ilaeclass1.txt
new file mode 100644
index 0000000..8d06299
--- /dev/null
+++ b/seizure/app/example_notes/ilaeclass1.txt
@@ -0,0 +1,65 @@
+**_This is a fictional clinical note for illustrative purposes only. It does not contain real patient information or PHI._**
+
+EPILEPSY CLINIC FOLLOW-UP NOTE
+
+Date: November 18, 2024
+Time: 10:30 AM
+
+PATIENT IDENTIFICATION
+Name: Sarah Johnson
+DOB: 03/15/1990
+MRN: 123456789
+
+CHIEF COMPLAINT
+Routine follow-up for epilepsy management
+
+HISTORY OF PRESENT ILLNESS
+34-year-old female with history of focal epilepsy s/p left temporal lobectomy in 2022 presents for routine follow-up. Patient reports complete seizure freedom since surgery. No auras. No episodes of loss of consciousness, automatisms, or focal aware sensory phenomena. Maintains regular sleep schedule. Medication compliance is excellent with no missed doses.
+
+CURRENT MEDICATIONS
+- Levetiracetam 1000mg BID
+- Lamotrigine 200mg BID
+
+REVIEW OF SYSTEMS
+- Constitutional: Denies fatigue, sleep problems
+- Neurological: No headaches, no dizziness, no focal deficits
+- Psychiatric: Good mood, no depression or anxiety
+- All other systems reviewed and negative
+
+PHYSICAL EXAMINATION
+Vital Signs: BP 118/76, HR 72, RR 16, T 98.6°F
+General: Well-appearing, alert and oriented x3
+Neurological:
+- Mental Status: Clear, fluent speech
+- Cranial Nerves: II-XII intact
+- Motor: 5/5 strength throughout
+- Sensory: Intact to light touch
+- Cerebellar: Normal finger-to-nose
+- Gait: Normal, steady
+
+LABORATORY/DIAGNOSTIC STUDIES
+- Recent AED levels within therapeutic range
+- Last EEG (3 months ago): No epileptiform abnormalities
+
+ASSESSMENT
+1. Focal Epilepsy (ICD-10: G40.209)
+ - Post-left temporal lobectomy
+ - ILAE Outcome Class 1 (completely seizure free, no auras)
+ - Excellent medication compliance
+ - Stable on current AED regimen
+
+PLAN
+1. Continue current AED regimen unchanged
+2. Continue driving (meets local regulations for seizure-free duration)
+3. Maintain regular sleep schedule and lifestyle modifications
+4. Return to clinic in 6 months
+5. Obtain repeat AED levels prior to next visit
+6. Call if any seizure activity or concerning symptoms develop
+
+Patient understands and agrees with plan.
+
+___________________________
+Dr. Michael Chen, MD
+Epileptologist
+Board Certified in Neurology
+Time spent: 30 minutes
\ No newline at end of file
diff --git a/seizure/app/example_notes/ilaeclass2.txt b/seizure/app/example_notes/ilaeclass2.txt
new file mode 100644
index 0000000..613684d
--- /dev/null
+++ b/seizure/app/example_notes/ilaeclass2.txt
@@ -0,0 +1,67 @@
+**_This is a fictional clinical note for illustrative purposes only. It does not contain real patient information or PHI._**
+
+EPILEPSY CLINIC FOLLOW-UP NOTE
+
+Date: November 18, 2024
+Time: 2:15 PM
+
+PATIENT IDENTIFICATION
+Name: Robert Martinez
+DOB: 08/22/1985
+MRN: 987654321
+
+CHIEF COMPLAINT
+Routine follow-up for epilepsy management
+
+HISTORY OF PRESENT ILLNESS
+38-year-old male with history of temporal lobe epilepsy presents for scheduled follow-up. Since last visit 3 months ago, patient reports no overt seizures but continues to experience brief episodes of déjà vu and rising epigastric sensation lasting 10-15 seconds, occurring approximately once monthly. These episodes are similar to his previous seizure auras but never progress to loss of awareness or motor symptoms. Last overt seizure was 18 months ago. Patient maintains medication compliance and regular sleep schedule. Triggers include sleep deprivation and excessive stress. Currently working full-time as an accountant without limitations.
+
+CURRENT MEDICATIONS
+- Carbamazepine XR 400mg BID
+- Zonisamide 200mg QD
+
+REVIEW OF SYSTEMS
+- Constitutional: No fatigue, normal sleep pattern
+- Neurological: Occasional mild headaches, no dizziness
+- Psychiatric: Stable mood, mild anxiety about aura symptoms
+- All other systems reviewed and negative
+
+PHYSICAL EXAMINATION
+Vital Signs: BP 122/78, HR 68, RR 16, T 98.4°F
+General: Well-developed, well-nourished male in no acute distress
+Neurological:
+- Mental Status: Alert, oriented x3
+- Cranial Nerves: Intact
+- Motor: Full strength throughout
+- Sensory: Intact to all modalities
+- Reflexes: 2+ symmetric
+- Coordination: Normal
+- Gait: Normal base and stride
+
+LABORATORY/DIAGNOSTIC STUDIES
+- Carbamazepine level: 9.2 mcg/mL (therapeutic)
+- Recent EEG: Rare right temporal sharp waves during sleep
+
+ASSESSMENT
+1. Temporal Lobe Epilepsy (ICD-10: G40.209)
+ - Well-controlled with only occasional auras
+ - No convulsive seizures in 18 months
+ - Medication compliance good
+ - Stable on current regimen
+
+PLAN
+1. Continue current medication regimen
+2. OK to continue driving as per state guidelines
+3. Advised to maintain sleep hygiene and stress management
+4. Patient to keep diary of aura episodes
+5. Return to clinic in 4 months
+6. Will obtain repeat AED levels at next visit
+7. Call if auras increase in frequency or new seizure types develop
+
+Patient verbalizes understanding of treatment plan and agrees to follow-up.
+
+___________________________
+Dr. Sarah Williams, MD
+Epileptologist
+Board Certified in Neurology
+Time spent: 25 minutes
\ No newline at end of file
diff --git a/seizure/app/example_notes/ilaeclass3.txt b/seizure/app/example_notes/ilaeclass3.txt
new file mode 100644
index 0000000..53fa6a4
--- /dev/null
+++ b/seizure/app/example_notes/ilaeclass3.txt
@@ -0,0 +1,72 @@
+**_This is a fictional clinical note for illustrative purposes only. It does not contain real patient information or PHI._**
+
+EPILEPSY CLINIC FOLLOW-UP NOTE
+
+Date: November 18, 2024
+Time: 3:45 PM
+
+PATIENT IDENTIFICATION
+Name: Emily Thompson
+DOB: 11/30/1995
+MRN: 456789123
+
+CHIEF COMPLAINT
+Follow-up for epilepsy management
+
+HISTORY OF PRESENT ILLNESS
+28-year-old female with history of focal epilepsy presents for routine follow-up. Since last visit 3 months ago, patient reports two breakthrough seizures: one in September during her menstrual period, and another in early November during a period of medication non-compliance due to insurance issues (now resolved). Seizures typically begin with metallic taste and right hand tingling, progressing to altered awareness and oral automatisms lasting 1-2 minutes. Post-ictal confusion lasts approximately 30 minutes. Prior to these events, patient had been seizure-free since February (total of 3 seizure days this year). Reports occasional auras without progression to full seizures approximately twice monthly.
+
+CURRENT MEDICATIONS
+- Oxcarbazepine 600mg BID
+- Lacosamide 200mg BID
+- Oral contraceptive (Continuous cycle for seizure control)
+
+REVIEW OF SYSTEMS
+- Constitutional: Mild fatigue
+- Neurological: Occasional headaches post-seizure
+- Psychiatric: Mild anxiety about recent breakthrough seizures
+- All other systems reviewed and negative
+
+PHYSICAL EXAMINATION
+Vital Signs: BP 115/70, HR 76, RR 16, T 98.7°F
+General: Well-appearing female in no acute distress
+Neurological:
+- Mental Status: Alert, oriented, normal language
+- Cranial Nerves: Intact II-XII
+- Motor: 5/5 throughout, no drift
+- Sensory: Intact to light touch and pinprick
+- Reflexes: 2+ symmetric
+- Coordination: Normal finger-to-nose and heel-to-shin
+- Gait: Normal
+
+LABORATORY/DIAGNOSTIC STUDIES
+- Recent AED levels:
+ * Oxcarbazepine: 22 mcg/mL (therapeutic)
+ * Lacosamide: 8.5 mcg/mL (therapeutic)
+- EEG (1 month ago): Left temporal epileptiform discharges
+
+ASSESSMENT
+1. Focal Epilepsy (ICD-10: G40.209)
+ - Breakthrough seizures likely related to hormonal changes and temporary medication non-compliance
+ - Otherwise relatively stable with 3 total seizure days this year
+ - Good therapeutic drug levels
+ - Insurance issues now resolved
+
+PLAN
+1. Continue current AED regimen
+2. Provided 90-day prescription with 3 refills to prevent gaps in treatment
+3. Connected with hospital pharmacy assistance program
+4. Emphasized importance of medication compliance
+5. Continue oral contraceptive for hormonal regulation
+6. Maintain seizure diary
+7. Return to clinic in 3 months
+8. Advised to hold driving until seizure-free for state-mandated duration
+9. Call if seizure frequency increases
+
+Patient demonstrates understanding of treatment plan and risks.
+
+___________________________
+Dr. James Anderson, MD
+Epileptologist
+Board Certified in Neurology
+Time spent: 30 minutes
\ No newline at end of file
diff --git a/seizure/app/streamlit_app.py b/seizure/app/streamlit_app.py
new file mode 100644
index 0000000..0ecba30
--- /dev/null
+++ b/seizure/app/streamlit_app.py
@@ -0,0 +1,290 @@
+import streamlit as st
+from seizure_score_ai.agents import process_clinical_note
+import re
+import base64
+import os
+
+st.set_page_config(layout="wide")
+
+# Add this near the top of the file, after imports
+def reset_session_state():
+ st.session_state['score_generated'] = False
+ if 'final_output' in st.session_state:
+ del st.session_state['final_output']
+ if 'detailed_output' in st.session_state:
+ del st.session_state['detailed_output']
+
+# Function to display text
+def display_text_animated(text):
+ st.write(text)
+
+# Function to clean up the ILAE score
+def clean_ilae_score(score):
+ if isinstance(score, str):
+ score_lower = score.lower()
+ if 'indeterminate' in score_lower:
+ return 'indeterminate'
+ else:
+ # Try to extract number from the string
+ match = re.search(r'\d+', score)
+ if match:
+ return match.group()
+ else:
+ return 'Not available'
+ elif isinstance(score, int) or isinstance(score, float):
+ return str(score)
+ else:
+ return 'Not available'
+
+def get_file_download_link(filename):
+ try:
+ # Added code to handle the file path
+ script_dir = os.path.dirname(os.path.abspath(__file__)) # Get the directory of the current script
+ file_path = os.path.join(script_dir, "example_notes", filename) # Build the path to the file
+ with open(file_path, 'r', encoding='utf-8') as f:
+ file_content = f.read()
+ b64 = base64.b64encode(file_content.encode()).decode()
+ return f'''
+
+
+ '''
+ except Exception as e:
+ return ""
+
+# Main app
+
+st.sidebar.title("Upload Clinical Note")
+
+st.sidebar.write("Example Notes (Click to Download):")
+
+example_files_html = '
'
+for filename in ["ilaeclass1.txt", "ilaeclass2.txt", "ilaeclass3.txt"]:
+ example_files_html += get_file_download_link(filename)
+example_files_html += '
'
+st.sidebar.markdown(example_files_html, unsafe_allow_html=True)
+
+uploaded_file = st.sidebar.file_uploader("Drag and drop your clinical note", type="txt",
+ on_change=reset_session_state)
+
+if uploaded_file is not None:
+ uploaded_file_string = uploaded_file.read().decode("utf-8")
+else:
+ uploaded_file_string = ""
+
+# Add HIPAA warning
+st.sidebar.markdown("""
+
+
+ ⚠️
+ HIPAA Warning
+
+
+ This service is not HIPAA compliant. Do not upload documents containing Protected Health Information (PHI).
+
+
+""", unsafe_allow_html=True)
+
+# Adjusted columns
+col1, col2, col3 = st.columns([4.5, 0.1, 5.4])
+
+with col1:
+ st.title("ILAE Score Calculator")
+
+ if 'score_generated' not in st.session_state:
+ st.session_state['score_generated'] = False
+
+ if uploaded_file_string:
+ if not st.session_state['score_generated']:
+ with st.spinner('Processing...'):
+ # Call the backend processing function
+ final_output, detailed_output = process_clinical_note(uploaded_file_string)
+ st.session_state['final_output'] = final_output
+ st.session_state['detailed_output'] = detailed_output
+ st.session_state['score_generated'] = True # Set flag to avoid re-processing
+
+ # Extract the ILAE score and explanations from the result
+ ilae_score_raw = st.session_state['final_output'].get('ilae_score', "Not available")
+ ilae_score = clean_ilae_score(ilae_score_raw) # Clean up the ILAE score
+ concise_explanation = st.session_state['final_output'].get('concise_explanation', "")
+ detailed_explanation = st.session_state['detailed_output'].get('detailed_explanation', "")
+
+ # Replace the styled version with a more compact one
+ st.markdown(f"""
+
+
ILAE Score
+
{ilae_score}
+
+ """, unsafe_allow_html=True)
+
+ st.write("---")
+ st.subheader("Explanation of the Prediction")
+
+ # Display the concise explanation automatically
+ st.write(concise_explanation)
+
+ # Button to show/hide detailed explanation
+ if st.button("Show Detailed Explanation"):
+ display_text_animated(detailed_explanation)
+
+ else:
+ st.write("Please upload a clinical note to calculate the ILAE score.")
+
+# Replace the col2 section with this updated version
+with col2:
+ if uploaded_file_string and st.session_state.get('score_generated', False):
+ st.markdown(
+ '''
+
+
+ ''',
+ unsafe_allow_html=True
+ )
+
+# Move the clinical note display to the third column
+with col3:
+ if uploaded_file_string:
+ st.subheader("Clinical Note")
+
+ # Get the extracted entities from the session state
+ extracted_entities = st.session_state['final_output'].get('extracted_entities', {})
+ clinical_note = uploaded_file_string
+ highlighted_text = clinical_note
+
+ # Function to safely highlight text
+ def highlight_text(full_text, text_to_highlight):
+ if not text_to_highlight or text_to_highlight.lower() == "not found in the clinical note":
+ return full_text
+
+ # Escape special regex characters in the text to highlight
+ escaped_text = re.escape(text_to_highlight)
+
+ # Create pattern that matches the text while preserving case
+ pattern = re.compile(f'({escaped_text})', re.IGNORECASE)
+
+ # Replace with highlighted version
+ return pattern.sub(r'\1', full_text)
+
+ # Highlight all supporting texts from extracted entities
+ try:
+ for entity, data in extracted_entities.items():
+ supporting_text = data.get('supporting_text', '')
+ if supporting_text:
+ highlighted_text = highlight_text(highlighted_text, supporting_text)
+
+ except Exception as e:
+ st.error(f"Error processing highlights: {str(e)}")
+
+ # Display the highlighted text
+ st.markdown(highlighted_text, unsafe_allow_html=True)
+
+# Hide Streamlit style elements
+hide_streamlit_style = """
+
+ """
+st.markdown(hide_streamlit_style, unsafe_allow_html=True)
+
+# Custom styling for the Streamlit app
+st.markdown(
+ """
+
+ """,
+ unsafe_allow_html=True
+)
+
diff --git a/seizure/data/test_notes/clinic_note_1.txt b/seizure/data/test_notes/clinic_note_1.txt
new file mode 100644
index 0000000..35176ab
--- /dev/null
+++ b/seizure/data/test_notes/clinic_note_1.txt
@@ -0,0 +1,73 @@
+Epilepsy Surgery Clinic Note
+Date: November 17, 2024
+Patient: Ms. Emily Richards
+Age: 32 years
+Hospital Number: 87654321
+Referring Physician: Dr. Michael Johnson, Neurology
+
+Reason for Review:
+Post-operative follow-up after right anterior temporal lobectomy for drug-resistant epilepsy.
+
+Diagnosis:
+- Pre-surgical: Drug-resistant focal epilepsy with confirmed right temporal lobe seizure onset.
+- Post-surgical: Focal epilepsy, post-resection, with reduced seizure frequency since March 2023 surgery.
+
+History:
+Current Antiepileptic Medication:
+Lamotrigine 200 mg twice daily, well-tolerated without side effects.
+
+Previous Antiepileptic Medications:
+- Levetiracetam: Discontinued in 2017 due to irritability and inadequate seizure control.
+- Valproic acid: Discontinued in 2019 due to weight gain and tremors.
+
+Pre-Surgical Seizure History:
+- Auras: Experienced olfactory auras (burning smell) lasting 30-60 seconds before some seizures.
+- Seizure Frequency (2014-2023): Approximately 80-100 days per year with complex partial seizures involving altered awareness, staring, and automatisms.
+- Childhood Seizures: No history of seizures or neurological conditions in childhood.
+- Family History: Paternal aunt with a history of febrile seizures in childhood, no other family history of epilepsy.
+
+Surgical History:
+- Surgery Date: March 12, 2023.
+- Procedure: Right anterior temporal lobectomy.
+- Intraoperative Findings: Resected area included the right hippocampus and anterior temporal cortex, with pathology revealing focal cortical dysplasia.
+- Post-operative Course: Uncomplicated recovery, with no neurological deficits or infections.
+
+Post-Surgical Seizure Status:
+- Seizure Frequency (2023-2024): Approximately 20-25 days per year with brief staring spells and rare complex partial seizures.
+- Functional Outcomes: Resumed part-time work as a graphic designer in July 2024 but unable to drive due to ongoing seizures.
+
+Investigations:
+Pre-surgical Workup:
+- MRI (2022): Demonstrated right mesial temporal sclerosis with hippocampal atrophy and subtle cortical dysplasia in the right temporal lobe.
+- Video EEG Monitoring (2022): Recorded eight clinical seizures, all with onset in the right temporal lobe. No secondary generalization observed.
+- Neuropsychological Assessment: Mild impairment in visuospatial memory consistent with right temporal dysfunction.
+- PET Scan (2022): Hypometabolism localized to the right temporal lobe, supporting focal epilepsy diagnosis.
+
+Post-surgical Investigations:
+- MRI (2023): Post-resection changes in the right anterior temporal lobe without evidence of residual or new pathology.
+- EEG (2023): Occasional right temporal slowing without epileptiform discharges.
+
+Clinical Assessment:
+Ms. Richards was seen in the epilepsy clinic today for her routine post-surgical follow-up. She reports a significant reduction in seizure frequency since her surgery, with only brief staring spells and occasional complex partial seizures. Her last generalized tonic-clonic seizure was in January 2024. She has experienced no medication side effects and feels well overall. She has been able to resume part-time work but has not yet met the seizure-free guidelines for driving.
+
+Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed mild impairments in visuospatial memory and attention, consistent with her pre-surgical neuropsychological assessment. Physical examination, including gait and coordination, was normal.
+
+Discussion and Plan:
+I discussed Ms. Richards' positive response to surgery, with a substantial reduction in seizure frequency and severity. However, I emphasized the importance of maintaining her current treatment regimen and lifestyle modifications to optimize seizure control. The following key points were addressed:
+1. Long-term continuation of lamotrigine to maintain seizure control.
+2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+3. The ongoing risk of seizure recurrence and the potential need for additional treatment options if seizures persist or worsen.
+
+We discussed her prognosis, including the possibility of further seizure reduction or complete freedom with time. I advised against any medication changes at this time but emphasized the need for close monitoring and potential adjustments in the future based on her response.
+
+Follow-up Plan:
+- Routine follow-up in 6 months to assess seizure control and consider treatment adjustments.
+- Referral to neuropsychology for repeat cognitive testing in 2025 to assess long-term memory outcomes post-surgery.
+- Driving assessment to be reconsidered if she achieves a sustained seizure-free period as per local guidelines.
+
+Ms. Richards expressed her gratitude for the improvement in her seizure control and quality of life since her surgery. She understands the importance of ongoing treatment and monitoring and will contact the clinic if needed.
+
+Signed:
+[Your Name, MD]
+Consultant Epileptologist
+[Hospital Name]
\ No newline at end of file
diff --git a/seizure/data/test_notes/clinic_note_10.txt b/seizure/data/test_notes/clinic_note_10.txt
new file mode 100644
index 0000000..de19bae
--- /dev/null
+++ b/seizure/data/test_notes/clinic_note_10.txt
@@ -0,0 +1,72 @@
+Epilepsy Surgery Clinic Note
+Date: November 17, 2024
+Patient: Ms. Emily Richards
+Age: 32 years
+Hospital Number: 87654321
+Referring Physician: Dr. Michael Johnson, Neurology
+
+Reason for Review:
+Post-operative follow-up after right anterior temporal lobectomy for drug-resistant epilepsy.
+
+Diagnosis:
+- Pre-surgical: Drug-resistant focal epilepsy with confirmed right temporal lobe seizure onset.
+- Post-surgical: Focal epilepsy, post-resection, seizure-free since March 2024 surgery.
+
+History:
+Current Antiepileptic Medication:
+Lacosamide 200 mg twice daily, well-tolerated without side effects.
+
+Previous Antiepileptic Medications:
+- Valproic acid: Discontinued in 2018 due to weight gain and tremor.
+- Levetiracetam: Discontinued in 2020 due to irritability and inadequate seizure control.
+
+Pre-Surgical Seizure History:
+- First Seizures (2016): Experienced recurrent focal aware seizures with an aura of déjà vu and rising epigastric sensation, followed by impaired awareness and oral automatisms. No generalized convulsions.
+- Seizure Frequency: Approximately 180 days per year with seizures despite medication trials.
+- Childhood History: No history of febrile seizures or other neurological conditions.
+- Family History: No family history of epilepsy or neurological disorders.
+
+Surgical History:
+- Surgery Date: March 10, 2024.
+- Procedure: Right anterior temporal lobectomy.
+- Intraoperative Findings: Resected area included the right hippocampus and anterior temporal cortex, with pathology confirming focal cortical dysplasia.
+- Post-operative Course: Uncomplicated recovery, with mild word-finding difficulties resolving within 2 weeks.
+
+Post-Surgical Seizure Status:
+- Seizure-Free Period: 8 months since surgery.
+- Functional Outcomes: Resumed part-time work as a graphic designer in June 2024. Driving privileges reinstated in September 2024 after meeting seizure-free guidelines.
+
+Investigations:
+Pre-surgical Workup:
+- MRI (2023): Demonstrated right temporal lobe cortical dysplasia, no other structural abnormalities.
+- Video EEG Monitoring (2023): Recorded seven clinical seizures, all with onset in the right temporal lobe. No secondary generalization observed.
+- Neuropsychological Assessment: Mild impairment in visual memory consistent with right temporal dysfunction.
+- PET Scan (2023): Hypometabolism localized to the right temporal lobe, supporting focal epilepsy diagnosis.
+
+Post-surgical Investigations:
+- MRI (2024): Post-resection changes in the right anterior temporal lobe without evidence of residual or new pathology.
+- EEG (2024): Normal background activity without epileptiform discharges.
+
+Clinical Assessment:
+Ms. Richards was seen in the epilepsy clinic today for her routine post-surgical follow-up. She reports no seizures, auras, or other episodes suggestive of epilepsy since her surgery. She has experienced no medication side effects and feels well overall. She has returned to driving and part-time work. Her sleep quality and mood are good, and she denies symptoms of anxiety or depression.
+
+Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed mild improvement in visual memory compared to the pre-surgical neuropsychological assessment. Physical examination, including gait and coordination, was normal.
+
+Discussion and Plan:
+I congratulated Ms. Richards on her excellent post-surgical outcome and discussed the importance of maintaining her current treatment regimen. She was counseled on the ongoing, albeit reduced, risk of seizure recurrence even after successful surgery. The following key points were emphasized:
+1. Long-term continuation of lacosamide to minimize the risk of recurrence.
+2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+3. The rare but serious risk of sudden unexpected death in epilepsy (SUDEP), which is significantly lower given her seizure freedom.
+
+We discussed her prognosis, including the likelihood of sustained seizure freedom and potential medication tapering in the distant future if seizure freedom persists. I emphasized the need for close monitoring before any changes are made to her treatment.
+
+Follow-up Plan:
+- Routine follow-up in 12 months, or sooner if symptoms recur or if she has questions.
+- Referral to neuropsychology for repeat cognitive testing in 2025 to assess long-term memory outcomes post-surgery.
+
+Ms. Richards expressed her satisfaction with her care and stated she feels optimistic about her quality of life moving forward. She understands she can contact the clinic if needed.
+
+Signed:
+[Your Name, MD]
+Consultant Epileptologist
+[Hospital Name]
\ No newline at end of file
diff --git a/seizure/data/test_notes/clinic_note_2.txt b/seizure/data/test_notes/clinic_note_2.txt
new file mode 100644
index 0000000..ea55507
--- /dev/null
+++ b/seizure/data/test_notes/clinic_note_2.txt
@@ -0,0 +1,76 @@
+Epilepsy Surgery Clinic Note
+Date: November 17, 2024
+Patient: Ms. Emily Callahan
+Age: 32 years
+Hospital Number: 87654321
+Referring Physician: Dr. Robert Johnson, Neurology
+
+Reason for Review:
+Post-operative follow-up after right anterior temporal lobectomy for drug-resistant epilepsy.
+
+Diagnosis:
+- Pre-surgical: Drug-resistant focal epilepsy with confirmed right temporal lobe seizure onset.
+- Post-surgical: Focal epilepsy, post-resection, with ongoing seizures but reduced frequency.
+
+History:
+Current Antiepileptic Medication:
+Lacosamide 200 mg twice daily, well-tolerated.
+
+Previous Antiepileptic Medications:
+- Levetiracetam: Discontinued in 2019 due to behavioral side effects and suboptimal seizure control.
+- Valproic acid: Discontinued in 2020 due to weight gain and tremor.
+
+Pre-Surgical Seizure History:
+- Auras: Reported an intense déjà vu feeling lasting 30-60 seconds before some seizures.
+- Seizure Frequency: Approximately 120 days per year with seizures prior to surgery.
+- Seizure Types: Focal impaired awareness seizures with staring and automatisms, occasionally evolving to bilateral tonic-clonic seizures.
+- Childhood History: No seizures or neurological issues in childhood.
+- Family History: Paternal aunt with a history of febrile seizures in childhood.
+
+Surgical History:
+- Surgery Date: March 22, 2024.
+- Procedure: Right anterior temporal lobectomy.
+- Intraoperative Findings: Resected area included the right hippocampus and anterior temporal cortex, with pathology showing focal cortical dysplasia.
+- Post-operative Course: Uncomplicated recovery, with no neurological deficits or infections.
+
+Post-Surgical Seizure Status:
+- Seizure Frequency: Approximately 30 days per year with seizures after surgery, a significant reduction from pre-operative levels.
+- Current Seizure Freedom: No seizures in the past 4 months.
+- Functional Outcomes: Resumed part-time work as an accountant in July 2024, still restricted from driving due to ongoing seizures.
+
+Investigations:
+Pre-surgical Workup:
+- MRI (2023): Demonstrated right temporal lobe abnormality consistent with focal cortical dysplasia.
+- Video EEG Monitoring (2023): Recorded eight clinical seizures, all with onset in the right temporal lobe. Secondary generalization observed in three seizures.
+- Neuropsychological Assessment: Mild impairment in visual memory consistent with right temporal dysfunction.
+- PET Scan (2023): Hypometabolism localized to the right temporal lobe, supporting focal epilepsy diagnosis.
+
+Post-surgical Investigations:
+- MRI (2024): Post-resection changes in the right anterior temporal lobe without evidence of residual or new pathology.
+- EEG (2024): Intermittent epileptiform discharges over the right temporal region, consistent with residual epileptogenic tissue.
+
+Clinical Assessment:
+Ms. Callahan was seen in the epilepsy clinic today for her routine post-surgical follow-up. She reports a significant reduction in seizure frequency since her surgery, with no seizures in the past 4 months. Her auras of déjà vu have also decreased in frequency. She denies any side effects from her current medication, lacosamide.
+
+Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed mild impairments in visual memory, consistent with her pre-surgical neuropsychological assessment. Physical examination, including gait and coordination, was normal.
+
+Discussion and Plan:
+I discussed Ms. Callahan's post-surgical course, noting the substantial improvement in seizure control but the persistence of occasional seizures. The following key points were emphasized:
+1. Continuation of lacosamide to maintain seizure control.
+2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+3. The ongoing risk of seizure-related injuries and the importance of adhering to driving restrictions until seizure freedom is achieved.
+4. The potential need for additional surgical intervention or alternative treatments if seizures persist or increase in frequency.
+
+We discussed her prognosis, including the possibility of achieving complete seizure freedom with time or additional treatment adjustments. I emphasized the need for close monitoring and open communication regarding any changes in her seizure pattern or side effects.
+
+Follow-up Plan:
+- Routine follow-up in 6 months, or sooner if her seizure frequency increases or she experiences side effects.
+- Referral for repeat neuropsychological testing in 12 months to assess any cognitive changes.
+- Consideration of additional treatment options, including potential for further surgery or neurostimulation, if seizures persist or increase in frequency.
+
+Ms. Callahan expressed her understanding of the plan and her commitment to adhering to her treatment regimen. She feels optimistic about the potential for further seizure control and improved quality of life.
+
+Signed:
+[Your Name, MD]
+Consultant Epileptologist
+[Hospital Name]
\ No newline at end of file
diff --git a/seizure/data/test_notes/clinic_note_3.txt b/seizure/data/test_notes/clinic_note_3.txt
new file mode 100644
index 0000000..ba529af
--- /dev/null
+++ b/seizure/data/test_notes/clinic_note_3.txt
@@ -0,0 +1,76 @@
+Epilepsy Surgery Clinic Note
+Date: November 17, 2024
+Patient: Ms. Emily Watson
+Age: 32 years
+Hospital Number: 87654321
+Referring Physician: Dr. Robert Johnson, Neurology
+
+Reason for Review:
+Post-operative follow-up after right anterior temporal lobectomy for drug-resistant epilepsy.
+
+Diagnosis:
+- Pre-surgical: Drug-resistant focal epilepsy with confirmed right temporal lobe seizure onset.
+- Post-surgical: Focal epilepsy, post-resection, with ongoing seizures but significantly reduced frequency.
+
+History:
+Current Antiepileptic Medication:
+Lacosamide 200 mg twice daily, well-tolerated without significant side effects.
+
+Previous Antiepileptic Medications:
+- Levetiracetam: Discontinued in 2019 due to mood changes and inadequate seizure control.
+- Valproic acid: Discontinued in 2020 due to weight gain and tremors.
+- Oxcarbazepine: Discontinued in 2021 due to hyponatremia and suboptimal seizure control.
+
+Pre-Surgical Seizure History:
+- Auras: Experienced an aura of a rising epigastric sensation preceding her seizures.
+- Seizure Frequency Pre-Surgery: Approximately 120 days per year with seizures.
+- Seizure Type: Focal impaired awareness seizures with occasional secondary generalization.
+- Childhood History: No history of febrile or other childhood seizures.
+- Family History: No known family history of epilepsy or neurological disorders.
+
+Surgical History:
+- Surgery Date: May 5, 2023.
+- Procedure: Right anterior temporal lobectomy.
+- Intraoperative Findings: Resected area included the right hippocampus and anterior temporal cortex, with pathology confirming focal cortical dysplasia.
+- Post-operative Course: Complicated by a small subdural hematoma, managed conservatively without surgical intervention. No other complications.
+
+Post-Surgical Seizure Status:
+- Seizure Frequency Post-Surgery: Approximately 30 days per year with seizures, a significant reduction from pre-surgical frequency.
+- Functional Outcomes: Able to resume part-time work as a graphic designer, but unable to drive due to ongoing seizures.
+
+Investigations:
+Pre-surgical Workup:
+- MRI (2022): Demonstrated right mesial temporal sclerosis with cortical dysplasia in the right anterior temporal lobe.
+- Video EEG Monitoring (2022): Recorded eight clinical seizures, all with onset in the right temporal lobe. Two events showed secondary generalization.
+- Neuropsychological Assessment: Mild impairment in visuospatial abilities consistent with right temporal dysfunction.
+- PET Scan (2022): Hypometabolism localized to the right temporal lobe, supporting focal epilepsy diagnosis.
+
+Post-surgical Investigations:
+- MRI (2023): Post-resection changes in the right anterior temporal lobe, with a small subdural hematoma that resolved on subsequent imaging.
+- EEG (2023): Persistent epileptiform discharges arising from the right temporal region.
+
+Clinical Assessment:
+Ms. Watson was seen in the epilepsy clinic today for her routine post-surgical follow-up. She reports ongoing seizures, although significantly less frequent than before her surgery. Her seizures are preceded by her typical aura of a rising epigastric sensation, followed by impaired awareness and occasional generalization. She reports no significant side effects from her current medication, lacosamide.
+
+Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed no significant changes in memory or attention compared to her pre-surgical neuropsychological assessment. Physical examination, including gait and coordination, was normal.
+
+Discussion and Plan:
+I discussed with Ms. Watson the positive outcome of her surgery, with a substantial reduction in seizure frequency, although not complete seizure freedom. We reviewed her current treatment regimen and the importance of strict medication adherence. The following key points were emphasized:
+1. Continuation of lacosamide to maintain seizure control.
+2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+3. The ongoing risk of seizures and the potential need for further treatment adjustments or alternative therapies if seizures persist.
+4. The risk of sudden unexpected death in epilepsy (SUDEP), which remains elevated due to her ongoing seizures.
+
+We discussed the possibility of adding or switching to a different antiepileptic medication if her seizures continue at the current frequency. I emphasized the need for close monitoring and follow-up to assess her response to any treatment changes.
+
+Follow-up Plan:
+- Follow-up in 6 months to re-evaluate seizure control and consider treatment adjustments if needed.
+- Referral to neuropsychology for repeat cognitive testing in 2025 to assess long-term memory outcomes post-surgery.
+- Counseling on driving restrictions due to ongoing seizures and the need to meet seizure-free guidelines before resuming driving.
+
+Ms. Watson expressed her understanding of the current situation and her willingness to continue working closely with the epilepsy team to optimize her treatment. She understands she can contact the clinic if her seizures worsen or if she has any other concerns.
+
+Signed:
+[Your Name, MD]
+Consultant Epileptologist
+[Hospital Name]
\ No newline at end of file
diff --git a/seizure/data/test_notes/clinic_note_4.txt b/seizure/data/test_notes/clinic_note_4.txt
new file mode 100644
index 0000000..7785f8e
--- /dev/null
+++ b/seizure/data/test_notes/clinic_note_4.txt
@@ -0,0 +1,72 @@
+Epilepsy Surgery Clinic Note
+Date: November 17, 2024
+Patient: Ms. Emily Watkins
+Age: 32 years
+Hospital Number: 87654321
+Referring Physician: Dr. Robert Jones, Neurology
+
+Reason for Review:
+Post-operative follow-up after right anterior temporal lobectomy for drug-resistant epilepsy.
+
+Diagnosis:
+- Pre-surgical: Drug-resistant focal epilepsy with confirmed right temporal lobe seizure onset.
+- Post-surgical: Focal epilepsy, post-resection, seizure-free since March 2024 surgery.
+
+History:
+Current Antiepileptic Medication:
+Lamotrigine 200 mg twice daily, well-tolerated without side effects.
+
+Previous Antiepileptic Medications:
+- Levetiracetam: Discontinued in 2019 due to mood disturbances and inadequate seizure control.
+- Valproic acid: Discontinued in 2021 due to weight gain and tremor.
+
+Pre-Surgical Seizure History:
+- First Seizures (2016): Experienced several focal impaired awareness seizures with auras of rising epigastric sensation and déjà vu. Seizures would progress to impaired awareness and automatisms like lip-smacking and hand fumbling.
+- "Absence-like" Episodes (2016–2024): Multiple daily episodes of staring and unresponsiveness lasting 10–30 seconds, often preceded by aura of déjà vu.
+- Childhood History: No seizures or neurological disorders in childhood.
+- Family History: No family history of epilepsy or neurological conditions.
+
+Surgical History:
+- Surgery Date: March 10, 2024.
+- Procedure: Right anterior temporal lobectomy.
+- Intraoperative Findings: Resected area included the right hippocampus and anterior temporal cortex, with pathology confirming focal cortical dysplasia.
+- Post-operative Course: Uncomplicated recovery, with no neurological deficits or infections.
+
+Post-Surgical Seizure Status:
+- Seizure-Free Period: 8 months since surgery.
+- Functional Outcomes: Resumed part-time work as a teacher in July 2024 and hopes to return to full-time in the near future.
+
+Investigations:
+Pre-surgical Workup:
+- MRI (2023): Demonstrated right mesial temporal focal cortical dysplasia, no other structural abnormalities.
+- Video EEG Monitoring (2023): Recorded eight clinical seizures, all with onset in the right temporal lobe. No secondary generalization observed.
+- Neuropsychological Assessment: Mild impairment in visual-spatial memory consistent with right temporal dysfunction.
+- PET Scan (2023): Hypometabolism localized to the right temporal lobe, supporting focal epilepsy diagnosis.
+
+Post-surgical Investigations:
+- MRI (2024): Post-resection changes in the right anterior temporal lobe without evidence of residual or new pathology.
+- EEG (2024): Normal background activity without epileptiform discharges.
+
+Clinical Assessment:
+Ms. Watkins was seen in the epilepsy clinic today for her routine post-surgical follow-up. She reports no seizures, auras, or staring spells since her surgery. She has experienced no medication side effects and feels well overall. She has returned to part-time work as a teacher and hopes to increase her hours soon. Her sleep quality and mood are good, and she denies symptoms of anxiety or depression.
+
+Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed no changes in memory or attention since the pre-surgical neuropsychological assessment. Physical examination, including gait and coordination, was normal.
+
+Discussion and Plan:
+I congratulated Ms. Watkins on her excellent post-surgical outcome and discussed the importance of maintaining her current treatment regimen. She was counseled on the ongoing, albeit reduced, risk of seizure recurrence even after successful surgery. The following key points were emphasized:
+1. Long-term continuation of lamotrigine to minimize the risk of recurrence.
+2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+3. The rare but serious risk of sudden unexpected death in epilepsy (SUDEP), which is significantly lower given her seizure freedom.
+
+We discussed her prognosis, including the likelihood of sustained seizure freedom and potential medication tapering in the distant future if seizure freedom persists. I emphasized the need for close monitoring before any changes are made to her treatment.
+
+Follow-up Plan:
+- Routine follow-up in 6 months, or sooner if symptoms recur or if she has questions.
+- Referral to neuropsychology for repeat cognitive testing in 2025 to assess long-term memory outcomes post-surgery.
+
+Ms. Watkins expressed her satisfaction with her care and stated she feels optimistic about her quality of life moving forward. She understands she can contact the clinic if needed.
+
+Signed:
+[Your Name, MD]
+Consultant Epileptologist
+[Hospital Name]
\ No newline at end of file
diff --git a/seizure/data/test_notes/clinic_note_5.txt b/seizure/data/test_notes/clinic_note_5.txt
new file mode 100644
index 0000000..1c1b1dc
--- /dev/null
+++ b/seizure/data/test_notes/clinic_note_5.txt
@@ -0,0 +1,74 @@
+Epilepsy Surgery Clinic Note
+Date: November 17, 2024
+Patient: Ms. Emily Watson
+Age: 32 years
+Hospital Number: 87654321
+Referring Physician: Dr. Robert Johnson, Neurology
+
+Reason for Review:
+Post-operative follow-up after right anterior temporal lobectomy for drug-resistant epilepsy.
+
+Diagnosis:
+- Pre-surgical: Drug-resistant focal epilepsy with confirmed right temporal lobe seizure onset.
+- Post-surgical: Focal epilepsy, post-resection, seizure-free since March 2024 surgery.
+
+History:
+Current Antiepileptic Medication:
+Lacosamide 200 mg twice daily, well-tolerated without side effects.
+
+Previous Antiepileptic Medications:
+- Valproic acid: Discontinued in 2018 due to weight gain and tremor.
+- Levetiracetam: Discontinued in 2020 due to irritability and inadequate seizure control.
+
+Pre-Surgical Seizure History:
+- First Seizures (2016): Experienced recurrent focal aware seizures (auras) characterized by an intense déjà vu sensation and nausea, followed by impaired awareness and automatisms (lip-smacking, repetitive hand movements). Seizures lasted 1-2 minutes with postictal confusion for 10-15 minutes.
+- Auras: Experienced daily déjà vu auras lasting 30-60 seconds without progressing to seizures.
+- Seizure Frequency: Approximately 120 days per year with seizures despite medication trials.
+- Childhood History: No history of febrile seizures or other neurological conditions.
+- Family History: No family history of epilepsy or seizure disorders.
+
+Surgical History:
+- Surgery Date: March 15, 2024.
+- Procedure: Right anterior temporal lobectomy.
+- Intraoperative Findings: Resected area included the right hippocampus and anterior temporal cortex, with pathology confirming hippocampal sclerosis.
+- Post-operative Course: Uncomplicated recovery, with no neurological deficits or infections.
+
+Post-Surgical Seizure Status:
+- Seizure-Free Period: 8 months since surgery.
+- Functional Outcomes: Resumed part-time work as a graphic designer in July 2024. Driving reinstatement pending in January 2025 after meeting the seizure-free guidelines.
+
+Investigations:
+Pre-surgical Workup:
+- MRI (2023): Demonstrated right mesial temporal sclerosis with hippocampal atrophy, no other structural abnormalities.
+- Video EEG Monitoring (2023): Recorded three clinical seizures, all with onset in the right temporal lobe. No secondary generalization observed.
+- Neuropsychological Assessment: Mild impairment in visual memory consistent with right temporal dysfunction.
+- PET Scan (2023): Hypometabolism localized to the right temporal lobe, further supporting focal epilepsy diagnosis.
+
+Post-surgical Investigations:
+- MRI (2024): Post-resection changes in the right anterior temporal lobe without evidence of residual or new pathology.
+- EEG (2024): Normal background activity without epileptiform discharges.
+
+Clinical Assessment:
+Ms. Watson was seen in the epilepsy clinic today for her routine post-surgical follow-up. She reports no seizures or auras since her surgery. She has experienced no medication side effects and feels well overall. She has returned to part-time work, and her sleep quality and mood are good. She denies symptoms of anxiety or depression.
+
+Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed no changes in memory or attention since the pre-surgical neuropsychological assessment. Physical examination, including gait and coordination, was normal.
+
+Discussion and Plan:
+I congratulated Ms. Watson on her excellent post-surgical outcome and discussed the importance of maintaining her current treatment regimen. She was counseled on the ongoing, albeit reduced, risk of seizure recurrence even after successful surgery. The following key points were emphasized:
+1. Long-term continuation of lacosamide to minimize the risk of recurrence.
+2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+3. The rare but serious risk of sudden unexpected death in epilepsy (SUDEP), which is significantly lower given her seizure freedom.
+
+We discussed her prognosis, including the likelihood of sustained seizure freedom and potential medication tapering in the distant future if seizure freedom persists. I emphasized the need for close monitoring before any changes are made to her treatment.
+
+Follow-up Plan:
+- Routine follow-up in 6 months, or sooner if symptoms recur or if she has questions.
+- Referral to neuropsychology for repeat cognitive testing in 2025 to assess long-term memory outcomes post-surgery.
+- Driving reinstatement assessment in January 2025 after meeting the seizure-free guidelines.
+
+Ms. Watson expressed her satisfaction with her care and stated she feels optimistic about her quality of life moving forward. She understands she can contact the clinic if needed.
+
+Signed:
+[Your Name, MD]
+Consultant Epileptologist
+[Hospital Name]
\ No newline at end of file
diff --git a/seizure/data/test_notes/clinic_note_6.txt b/seizure/data/test_notes/clinic_note_6.txt
new file mode 100644
index 0000000..77d8c87
--- /dev/null
+++ b/seizure/data/test_notes/clinic_note_6.txt
@@ -0,0 +1,75 @@
+Epilepsy Surgery Clinic Note
+Date: November 17, 2024
+Patient: Ms. Emily Richards
+Age: 32 years
+Hospital Number: 87654321
+Referring Physician: Dr. Robert Johnson, Neurology
+
+Reason for Review:
+Post-operative follow-up after right anterior temporal lobectomy for drug-resistant epilepsy.
+
+Diagnosis:
+- Pre-surgical: Drug-resistant focal epilepsy with confirmed right temporal lobe seizure onset.
+- Post-surgical: Focal epilepsy, post-resection, with significant reduction in seizure frequency.
+
+History:
+Current Antiepileptic Medication:
+Lamotrigine 300 mg daily, Levetiracetam 1000 mg twice daily, both well-tolerated.
+
+Previous Antiepileptic Medications:
+- Carbamazepine: Discontinued in 2018 due to adverse effects (dizziness, nausea).
+- Valproic acid: Discontinued in 2020 due to weight gain and suboptimal seizure control.
+
+Pre-Surgical Seizure History:
+- Auras: Experienced an intense déjà vu sensation, lasting 30-60 seconds, preceding many of her seizures.
+- Seizure Frequency Pre-Surgery: Approximately 120 days per year with seizures, often occurring in clusters.
+- Seizure Types: Complex partial seizures with impaired awareness, occasional secondary generalization.
+- Childhood History: No significant medical history until seizure onset at age 14.
+- Family History: No known family history of epilepsy or neurological disorders.
+
+Surgical History:
+- Surgery Date: May 20, 2024.
+- Procedure: Right anterior temporal lobectomy.
+- Intraoperative Findings: Resected area included the right hippocampus and anterior temporal cortex, with pathology confirming hippocampal sclerosis.
+- Post-operative Course: Uncomplicated recovery, with no neurological deficits or infections.
+
+Post-Surgical Seizure Status:
+- Seizure Frequency Post-Surgery: Approximately 20 days per year with seizures, a significant improvement.
+- Current Seizure Freedom: Seizure-free for the past 3 months.
+- Functional Outcomes: Resumed part-time work as a graphic designer in September 2024.
+
+Investigations:
+Pre-surgical Workup:
+- MRI (2023): Demonstrated right mesial temporal sclerosis with hippocampal atrophy, no other structural abnormalities.
+- Video EEG Monitoring (2023): Recorded multiple clinical seizures, all with onset in the right temporal lobe. No secondary generalization observed.
+- Neuropsychological Assessment: Mild impairment in visuospatial abilities consistent with right temporal dysfunction.
+- PET Scan (2023): Hypometabolism localized to the right temporal lobe, supporting focal epilepsy diagnosis.
+
+Post-surgical Investigations:
+- MRI (2024): Post-resection changes in the right anterior temporal lobe without evidence of residual or new pathology.
+- EEG (2024): Mild background slowing over the right temporal region, without epileptiform discharges.
+
+Clinical Assessment:
+Ms. Richards was seen in the epilepsy clinic today for her routine post-surgical follow-up. She reports a significant reduction in seizure frequency since her surgery, with only a few brief episodes of impaired awareness over the past 6 months. She has been seizure-free for the past 3 months. She denies any medication side effects and feels her overall quality of life has improved.
+
+Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed mild impairments in visuospatial abilities consistent with her pre-surgical assessment. Physical examination, including gait and coordination, was normal.
+
+Discussion and Plan:
+I commended Ms. Richards on her positive post-surgical outcome and discussed the importance of maintaining her current treatment regimen. We reviewed the following key points:
+1. Continuation of lamotrigine and levetiracetam to maintain seizure control.
+2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+3. The ongoing, albeit reduced, risk of seizure recurrence even after successful surgery.
+4. The rare but serious risk of sudden unexpected death in epilepsy (SUDEP), which is lower given her improved seizure control.
+
+We discussed her prognosis, including the potential for further seizure reduction or complete freedom with time. I emphasized the need for close monitoring before considering any medication adjustments.
+
+Follow-up Plan:
+- Routine follow-up in 6 months, or sooner if symptoms recur or if she has questions.
+- Referral to neuropsychology for repeat cognitive testing in 2025 to assess long-term memory and visuospatial outcomes post-surgery.
+
+Ms. Richards expressed her satisfaction with her care and stated she feels optimistic about her quality of life moving forward. She understands she can contact the clinic if needed.
+
+Signed:
+[Your Name, MD]
+Consultant Epileptologist
+[Hospital Name]
\ No newline at end of file
diff --git a/seizure/data/test_notes/clinic_note_7.txt b/seizure/data/test_notes/clinic_note_7.txt
new file mode 100644
index 0000000..998a9ad
--- /dev/null
+++ b/seizure/data/test_notes/clinic_note_7.txt
@@ -0,0 +1,73 @@
+Epilepsy Surgery Clinic Note
+Date: November 17, 2024
+Patient: Ms. Emily Richards
+Age: 32 years
+Hospital Number: 87654321
+Referring Physician: Dr. Robert Johnson, Neurology
+
+Reason for Review:
+Post-operative follow-up after right anterior temporal lobectomy for drug-resistant epilepsy.
+
+Diagnosis:
+- Pre-surgical: Drug-resistant focal epilepsy with confirmed right temporal lobe seizure onset.
+- Post-surgical: Focal epilepsy, post-resection, seizure-free since March 2024 surgery.
+
+History:
+Current Antiepileptic Medication:
+Lamotrigine 200 mg twice daily, well-tolerated without side effects.
+
+Previous Antiepileptic Medications:
+- Levetiracetam: Discontinued in 2019 due to irritability and inadequate seizure control.
+- Valproic acid: Discontinued in 2021 due to weight gain and tremor.
+
+Pre-Surgical Seizure History:
+- First Seizures (2017): Experienced several focal impaired awareness seizures characterized by staring, lip-smacking, and unresponsiveness lasting 1-2 minutes. Aura consisted of an indescribable rising epigastric sensation preceding the seizures.
+- Generalized Tonic-Clonic Seizures (2018–2023): Experienced 4-5 generalized tonic-clonic seizures per year, often following the focal onset seizures. Postictal confusion and fatigue lasting several hours.
+- Childhood History: No history of febrile seizures or other neurological conditions.
+- Family History: No known family history of epilepsy or seizure disorders.
+
+Surgical History:
+- Surgery Date: March 18, 2024.
+- Procedure: Right anterior temporal lobectomy.
+- Intraoperative Findings: Resected area included the right hippocampus and anterior temporal cortex, with pathology confirming focal cortical dysplasia.
+- Post-operative Course: Uncomplicated recovery, with no neurological deficits or infections.
+
+Post-Surgical Seizure Status:
+- Seizure-Free Period: 8 months since surgery.
+- Functional Outcomes: Resumed part-time work as a graphic designer in July 2024. Driving privileges pending further seizure freedom.
+
+Investigations:
+Pre-surgical Workup:
+- MRI (2023): Demonstrated subtle right temporal cortical dysplasia, no other structural abnormalities.
+- Video EEG Monitoring (2023): Recorded three clinical seizures, all with onset in the right temporal lobe. Two seizures progressed to bilateral tonic-clonic activity.
+- Neuropsychological Assessment: Mild impairment in visual-spatial memory consistent with right temporal dysfunction.
+- PET Scan (2023): Hypometabolism localized to the right temporal lobe, supporting focal epilepsy diagnosis.
+
+Post-surgical Investigations:
+- MRI (2024): Post-resection changes in the right anterior temporal lobe without evidence of residual or new pathology.
+- EEG (2024): Normal background activity without epileptiform discharges.
+
+Clinical Assessment:
+Ms. Richards was seen in the epilepsy clinic today for her routine post-surgical follow-up. She reports no seizures, auras, or other episodes suggestive of epilepsy since her surgery. She has experienced no medication side effects and feels well overall. Her sleep quality and mood are good, and she denies symptoms of anxiety or depression.
+
+Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed no changes in memory or attention since the pre-surgical neuropsychological assessment. Physical examination, including gait and coordination, was normal.
+
+Discussion and Plan:
+I congratulated Ms. Richards on her excellent post-surgical outcome and discussed the importance of maintaining her current treatment regimen. She was counseled on the ongoing, albeit reduced, risk of seizure recurrence even after successful surgery. The following key points were emphasized:
+1. Long-term continuation of lamotrigine to minimize the risk of recurrence.
+2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+3. The rare but serious risk of sudden unexpected death in epilepsy (SUDEP), which is significantly lower given her seizure freedom.
+
+We discussed her prognosis, including the likelihood of sustained seizure freedom and potential medication tapering in the distant future if seizure freedom persists. I emphasized the need for close monitoring before any changes are made to her treatment.
+
+Follow-up Plan:
+- Routine follow-up in 6 months, or sooner if symptoms recur or if she has questions.
+- Referral to neuropsychology for repeat cognitive testing in 2025 to assess long-term memory outcomes post-surgery.
+- Consideration of resuming driving privileges after 12 months of sustained seizure freedom, pending further evaluation.
+
+Ms. Richards expressed her satisfaction with her care and stated she feels optimistic about her quality of life moving forward. She understands she can contact the clinic if needed.
+
+Signed:
+[Your Name, MD]
+Consultant Epileptologist
+[Hospital Name]
\ No newline at end of file
diff --git a/seizure/data/test_notes/clinic_note_8.txt b/seizure/data/test_notes/clinic_note_8.txt
new file mode 100644
index 0000000..61e89f0
--- /dev/null
+++ b/seizure/data/test_notes/clinic_note_8.txt
@@ -0,0 +1,77 @@
+Epilepsy Surgery Clinic Note
+Date: November 17, 2024
+Patient: Ms. Emily Richards
+Age: 32 years
+Hospital Number: 87654321
+Referring Physician: Dr. Robert Anderson, Neurology
+
+Reason for Review:
+Post-operative follow-up after right anterior temporal lobectomy for drug-resistant epilepsy.
+
+Diagnosis:
+- Pre-surgical: Drug-resistant focal epilepsy with confirmed right temporal lobe seizure onset.
+- Post-surgical: Focal epilepsy, post-resection, with rare seizures since March 2024 surgery.
+
+History:
+Current Antiepileptic Medication:
+Lacosamide 200 mg twice daily, well-tolerated with mild dizziness.
+
+Previous Antiepileptic Medications:
+- Levetiracetam: Discontinued in 2018 due to irritability and inadequate seizure control.
+- Valproic acid: Discontinued in 2020 due to weight gain and tremor.
+
+Pre-Surgical Seizure History:
+- Auras (2016–2024): Experienced recurrent auras of an intense déjà vu sensation and nausea lasting 30–60 seconds, often preceding seizures.
+- Focal Impaired Awareness Seizures (2016–2024): Weekly episodes of staring, lip-smacking, and unresponsiveness lasting 1–2 minutes. Ms. Richards was sometimes aware of these events.
+- Generalized Tonic-Clonic Seizures (2016–2024): Occurred approximately 120 days per year, often following auras or focal seizures. Postictal confusion lasting up to 2 hours.
+- Childhood History: No febrile seizures or other neurological issues.
+- Family History: Paternal uncle with epilepsy of unknown etiology.
+
+Surgical History:
+- Surgery Date: March 18, 2024.
+- Procedure: Right anterior temporal lobectomy.
+- Intraoperative Findings: Resected area included the right hippocampus and anterior temporal cortex, with pathology confirming focal cortical dysplasia.
+- Post-operative Course: Uncomplicated recovery, with mild word-finding difficulties that resolved within 2 months.
+
+Post-Surgical Seizure Status:
+- Seizure Frequency: Rare focal impaired awareness seizures, approximately 10 days per year since surgery.
+- Auras: Persistent déjà vu auras occurring 1–2 times per month, occasionally preceding seizures.
+- Functional Outcomes: Resumed part-time work as a graphic designer in July 2024. Driving privileges reinstated in September 2024.
+
+Investigations:
+Pre-surgical Workup:
+- MRI (2023): Demonstrated right mesial temporal cortical dysplasia, no other structural abnormalities.
+- Video EEG Monitoring (2023): Recorded eight clinical seizures, all with onset in the right temporal lobe. Three seizures generalized.
+- Neuropsychological Assessment: Mild impairment in visual memory consistent with right temporal dysfunction.
+- PET Scan (2023): Hypometabolism localized to the right temporal lobe, supporting focal epilepsy diagnosis.
+
+Post-surgical Investigations:
+- MRI (2024): Post-resection changes in the right anterior temporal lobe without evidence of residual or new pathology.
+- EEG (2024): Rare epileptiform discharges over the right temporal region, consistent with residual epilepsy.
+
+Clinical Assessment:
+Ms. Richards was seen in the epilepsy clinic today for her routine post-surgical follow-up. She reports a significant reduction in seizure frequency since her surgery, with rare focal impaired awareness seizures occurring approximately 10 days per year. She continues to experience déjà vu auras 1–2 times per month, occasionally preceding seizures. She denies any generalized tonic-clonic seizures since surgery.
+
+She reports mild persistent word-finding difficulties but denies other cognitive issues. Her sleep quality and mood are good, and she denies symptoms of anxiety or depression. She has experienced mild dizziness attributed to her lacosamide medication.
+
+Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed mild word-finding difficulties consistent with her self-report. Physical examination, including gait and coordination, was normal.
+
+Discussion and Plan:
+I discussed Ms. Richards' overall positive post-surgical outcome, with a significant reduction in seizure frequency and no generalized tonic-clonic seizures since her surgery. However, I emphasized the importance of maintaining her current treatment regimen given the persistence of focal seizures and auras. The following key points were discussed:
+
+1. Long-term continuation of lacosamide to minimize the risk of seizure recurrence.
+2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+3. The ongoing risk of sudden unexpected death in epilepsy (SUDEP), although lower than her pre-surgical risk.
+
+We discussed her prognosis, including the possibility of further seizure freedom with time and the potential for medication tapering in the future if seizure freedom persists for an extended period. I emphasized the need for close monitoring before any changes are made to her treatment.
+
+Follow-up Plan:
+- Routine follow-up in 6 months, or sooner if symptoms worsen or if she has questions.
+- Referral to neuropsychology for repeat cognitive testing in 2025 to assess long-term memory outcomes post-surgery.
+
+Ms. Richards expressed her satisfaction with her care and stated she feels optimistic about her quality of life moving forward. She understands she can contact the clinic if needed.
+
+Signed:
+[Your Name, MD]
+Consultant Epileptologist
+[Hospital Name]
\ No newline at end of file
diff --git a/seizure/data/test_notes/clinic_note_9.txt b/seizure/data/test_notes/clinic_note_9.txt
new file mode 100644
index 0000000..45cfe42
--- /dev/null
+++ b/seizure/data/test_notes/clinic_note_9.txt
@@ -0,0 +1,73 @@
+Epilepsy Surgery Clinic Note
+Date: November 17, 2024
+Patient: Ms. Emily Roberts
+Age: 32 years
+Hospital Number: 87654321
+Referring Physician: Dr. Michael Johnson, Neurology
+
+Reason for Review:
+Post-operative follow-up after right anterior temporal lobectomy for drug-resistant epilepsy.
+
+Diagnosis:
+- Pre-surgical: Drug-resistant focal epilepsy with confirmed right temporal lobe seizure onset.
+- Post-surgical: Focal epilepsy, post-resection, seizure-free since March 2024 surgery.
+
+History:
+Current Antiepileptic Medication:
+Lamotrigine 200 mg twice daily, well-tolerated with no side effects.
+
+Previous Antiepileptic Medications:
+- Levetiracetam: Discontinued in 2018 due to irritability and mood disturbances.
+- Valproic acid: Discontinued in 2020 due to weight gain and tremors.
+
+Pre-Surgical Seizure History:
+- First Seizures (2016): Experienced recurrent focal impaired awareness seizures with aura of rising epigastric sensation and occasional progression to bilateral tonic-clonic seizures. Postictal confusion lasted 30-60 minutes.
+- Aura: Rising epigastric sensation lasting 30-60 seconds, followed by impaired awareness and automatisms (lip-smacking, hand fumbling).
+- Seizure Frequency: Approximately 120 days per year with seizures despite medication trials.
+- Childhood History: No history of febrile seizures or other neurological issues.
+- Family History: Paternal uncle with a history of childhood epilepsy, well-controlled on medication.
+
+Surgical History:
+- Surgery Date: March 12, 2024.
+- Procedure: Right anterior temporal lobectomy.
+- Intraoperative Findings: Resected area included the right hippocampus and anterior temporal cortex, with pathology confirming focal cortical dysplasia.
+- Post-operative Course: Uncomplicated recovery, with transient word-finding difficulties resolving within 2 weeks.
+
+Post-Surgical Seizure Status:
+- Seizure-Free Period: 8 months since surgery.
+- Functional Outcomes: Returned to work as an accountant in June 2024 after meeting seizure-free guidelines.
+
+Investigations:
+Pre-surgical Workup:
+- MRI (2023): Demonstrated subtle right hippocampal abnormality suggestive of focal cortical dysplasia, no other structural abnormalities.
+- Video EEG Monitoring (2023): Recorded seven clinical seizures, all with onset in the right temporal lobe. No secondary generalization observed.
+- Neuropsychological Assessment: Mild impairment in verbal memory consistent with right temporal dysfunction.
+- PET Scan (2023): Hypometabolism localized to the right temporal lobe, further supporting focal epilepsy diagnosis.
+
+Post-surgical Investigations:
+- MRI (2024): Post-resection changes in the right anterior temporal lobe without evidence of residual or new pathology.
+- EEG (2024): Normal background activity without epileptiform discharges.
+
+Clinical Assessment:
+Ms. Roberts was seen in the epilepsy clinic today for her routine post-surgical follow-up. She reports no seizures, auras, or other episodes suggestive of epilepsy since her surgery. She has experienced no medication side effects and feels well overall. She has returned to driving, as well as to full-time work. Her sleep quality and mood are good, and she denies symptoms of anxiety or depression.
+
+Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed mild improvement in verbal memory compared to pre-surgical testing, likely due to the resection of the dysfunctional right temporal lobe. Physical examination, including gait and coordination, was normal.
+
+Discussion and Plan:
+I congratulated Ms. Roberts on her excellent post-surgical outcome and discussed the importance of maintaining her current treatment regimen. She was counseled on the ongoing, albeit reduced, risk of seizure recurrence even after successful surgery. The following key points were emphasized:
+1. Long-term continuation of lamotrigine to minimize the risk of recurrence.
+2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+3. The rare but serious risk of sudden unexpected death in epilepsy (SUDEP), which is significantly lower given her seizure freedom.
+
+We discussed her prognosis, including the likelihood of sustained seizure freedom and potential medication tapering in the distant future if seizure freedom persists. I emphasized the need for close monitoring before any changes are made to her treatment.
+
+Follow-up Plan:
+- Routine follow-up in 6 months, or sooner if symptoms recur or if she has questions.
+- Referral to neuropsychology for repeat cognitive testing in 2025 to assess long-term memory outcomes post-surgery.
+
+Ms. Roberts expressed her satisfaction with her care and stated she feels optimistic about her quality of life moving forward. She understands she can contact the clinic if needed.
+
+Signed:
+[Your Name, MD]
+Consultant Epileptologist
+[Hospital Name]
\ No newline at end of file
diff --git a/seizure/docs/deploy.md b/seizure/docs/deploy.md
new file mode 100644
index 0000000..7494991
--- /dev/null
+++ b/seizure/docs/deploy.md
@@ -0,0 +1,75 @@
+# Deploy to Google Cloud Run
+
+## Prerequisites
+
+1. [Google Cloud SDK](https://cloud.google.com/sdk/docs/install) installed
+2. A Google Cloud project with billing enabled
+3. Your `GEMINI_API_KEY` set in your local environment
+
+## Quick Deploy
+
+### 1. Set your API key locally (if not already set)
+
+```bash
+export GEMINI_API_KEY="your-api-key-here"
+```
+
+### 2. Authenticate with Google Cloud
+
+```bash
+gcloud auth login
+```
+
+View your projects:
+```bash
+gcloud projects list
+```
+
+Set your project:
+```bash
+gcloud config set project YOUR_PROJECT_ID
+```
+
+### 3. Enable required APIs
+
+```bash
+gcloud services enable run.googleapis.com cloudbuild.googleapis.com
+```
+
+### 4. Deploy to Cloud Run
+
+From the project root directory:
+
+```bash
+gcloud run deploy seizure-score-ai \
+ --source . \
+ --region us-central1 \
+ --allow-unauthenticated \
+ --set-env-vars "GEMINI_API_KEY=$GEMINI_API_KEY"
+```
+
+This command:
+- Builds the Docker image using Cloud Build
+- Deploys to Cloud Run
+- Automatically pulls `GEMINI_API_KEY` from your local environment
+
+### 5. Access your app
+
+After deployment, you'll see a URL like:
+```
+https://seizure-score-ai-xxxxx-uc.a.run.app
+```
+
+## Updating the Deployment
+
+Just re-run the deploy command:
+
+```bash
+gcloud run deploy seizure-score-ai \
+ --source . \
+ --region us-central1 \
+ --allow-unauthenticated \
+ --set-env-vars "GEMINI_API_KEY=$GEMINI_API_KEY"
+```
+
+
diff --git a/seizure/requirements.txt b/seizure/requirements.txt
new file mode 100644
index 0000000..879adff
--- /dev/null
+++ b/seizure/requirements.txt
@@ -0,0 +1,7 @@
+# Core dependencies
+streamlit>=1.40.0
+python-dotenv>=1.0.0
+pillow>=10.0.0
+
+# Google Agent Development Kit (ADK)
+google-adk>=0.3.0
diff --git a/seizure/scripts/generate_clinic_notes.py b/seizure/scripts/generate_clinic_notes.py
new file mode 100644
index 0000000..ba9331d
--- /dev/null
+++ b/seizure/scripts/generate_clinic_notes.py
@@ -0,0 +1,169 @@
+from google import genai
+import os
+from typing import Optional
+
+from dotenv import load_dotenv
+load_dotenv()
+
+def setup_client() -> genai.Client:
+ """Setup and verify the Gemini client with API key"""
+ # Try to get API key from environment variable
+ api_key = os.getenv("GEMINI_API_KEY")
+
+ if not api_key:
+ raise ValueError(
+ "GEMINI_API_KEY environment variable not found. "
+ "Please set it using: export GEMINI_API_KEY='your-key-here' "
+ "or add it to your environment variables."
+ )
+
+ os.environ["GEMINI_API_KEY"] = api_key
+
+ return genai.Client()
+
+def generate_clinic_note() -> Optional[str]:
+ try:
+ client = setup_client()
+
+ # Example clinic note string here...
+ example_clinic_note = """
+ Epilepsy Surgery Clinic Note
+ Date: November 17, 2024
+ Patient: Mr. John Turko
+ Age: 26 years
+ Hospital Number: 12345678
+ Referring Physician: Dr. Jane Smith, Neurology
+
+ Reason for Review:
+ Post-operative follow-up after left anterior temporal lobectomy for drug-resistant epilepsy.
+
+ Diagnosis:
+ - Pre-surgical: Drug-resistant focal epilepsy with confirmed left temporal lobe seizure onset.
+ - Post-surgical: Focal epilepsy, post-resection, seizure-free since January 2023 surgery.
+
+ History:
+ Current Antiepileptic Medication:
+ Levetiracetam 500 mg twice daily, well-tolerated without side effects.
+
+ Previous Antiepileptic Medications:
+ - Lamotrigine: Discontinued in 2015 due to rash and inadequate seizure control.
+ - Carbamazepine: Discontinued in 2016 due to drowsiness and suboptimal control of seizures.
+
+ Pre-Surgical Seizure History:
+ - First Seizures (2014): Experienced two generalized tonic-clonic seizures without aura or prodrome. Witnesses noted possible preceding right leg jerking lasting a few seconds. Postictal confusion lasted approximately 20 minutes.
+ - "Absence-like" Episodes (2014–2022): Weekly episodes of staring and unresponsiveness lasting 5–10 seconds. Mr. Turko was unaware of these events and relied on observations by family and colleagues.
+ - Childhood Seizures: Febrile seizures between the ages of 2–4 years, resolved without long-term effects.
+ - Family History: No family history of epilepsy, neurological conditions, or febrile seizures. His two children are healthy without seizure activity.
+
+ Surgical History:
+ - Surgery Date: January 15, 2023.
+ - Procedure: Left anterior temporal lobectomy.
+ - Intraoperative Findings: Resected area included the left hippocampus and anterior temporal cortex, with pathology confirming hippocampal sclerosis.
+ - Post-operative Course: Uncomplicated recovery, with no neurological deficits or infections.
+
+ Post-Surgical Seizure Status:
+ - Seizure-Free Period: 22 months since surgery.
+ - Functional Outcomes: Resumed full-time work as a graphic designer and driving in February 2024 after meeting the seizure-free guidelines.
+
+ Investigations:
+ Pre-surgical Workup:
+ - MRI (2022): Demonstrated left mesial temporal sclerosis with hippocampal atrophy, no other structural abnormalities.
+ - Video EEG Monitoring (2022): Recorded five clinical seizures, all with onset in the left temporal lobe. No secondary generalization observed.
+ - Neuropsychological Assessment: Mild impairment in verbal memory consistent with left temporal dysfunction.
+ - PET Scan (2022): Hypometabolism localized to the left temporal lobe, further supporting focal epilepsy diagnosis.
+
+ Post-surgical Investigations:
+ - MRI (2023): Post-resection changes in the left anterior temporal lobe without evidence of residual or new pathology.
+ - EEG (2023): Normal background activity without epileptiform discharges.
+
+ Clinical Assessment:
+ Mr. Turko was seen in the epilepsy clinic today for his routine post-surgical follow-up. He reports no seizures, staring spells, or other episodes suggestive of epilepsy since his surgery. He has experienced no medication side effects and feels well overall. He has returned to driving, as well as to full-time work. His sleep quality and mood are good, and he denies symptoms of anxiety or depression.
+
+ Neurological examination was unremarkable, with no focal deficits. Cognitive testing in clinic revealed no changes in memory or attention since the pre-surgical neuropsychological assessment. Physical examination, including gait and coordination, was normal.
+
+ Discussion and Plan:
+ I congratulated Mr. Turko on his excellent post-surgical outcome and discussed the importance of maintaining his current treatment regimen. He was counseled on the ongoing, albeit reduced, risk of seizure recurrence even after successful surgery. The following key points were emphasized:
+ 1. Long-term continuation of levetiracetam to minimize the risk of recurrence.
+ 2. Lifestyle modifications, including adequate sleep, regular meals, stress management, and avoiding known triggers such as excessive alcohol.
+ 3. The rare but serious risk of sudden unexpected death in epilepsy (SUDEP), which is significantly lower given his seizure freedom.
+
+ We discussed his prognosis, including the likelihood of sustained seizure freedom and potential medication tapering in the distant future if seizure freedom persists. I emphasized the need for close monitoring before any changes are made to his treatment.
+
+ Follow-up Plan:
+ - Routine follow-up in 12 months, or sooner if symptoms recur or if he has questions.
+ - Referral to neuropsychology for repeat cognitive testing in 2025 to assess long-term memory outcomes post-surgery.
+
+ Mr. Turko expressed his satisfaction with his care and stated he feels optimistic about his quality of life moving forward. He understands he can contact the clinic if needed.
+
+ Signed:
+ [Your Name, MD]
+ Consultant Epileptologist
+ [Hospital Name]
+ """
+
+ # Create the prompt with system instructions and user request
+ prompt = f"""You are an experienced epileptologist creating detailed clinical notes. Generate realistic,
+ professional clinic notes that maintain patient confidentiality while including comprehensive medical details.
+ Follow standard medical documentation practices and ensure all relevant clinical information is included.
+
+ Using the following example clinic note as a template, generate a detailed clinic note
+ for a different patient who has undergone epilepsy surgery. Include similar sections and formatting,
+ and ensure to include information about the patient's:
+ - Auras
+ - Seizure frequency before surgery (days per year)
+ - Seizure frequency after surgery (days per year)
+ - Current seizure freedom status
+ - All relevant clinical details
+
+ The note should maintain the same level of detail and professional medical terminology as the example.
+ All dates should be current relative to today's date of November 17, 2024.
+ Make the note realistic and comparable to real clinic notes, with different patient details and medical history.
+
+ Example Clinic Note:
+ {example_clinic_note}
+ """
+
+ # Generate content using Gemini 2.5 Flash API
+ response = client.models.generate_content(
+ model="gemini-2.5-flash",
+ contents=prompt
+ )
+
+ return response.text
+
+ except ValueError as ve:
+ print(f"Authentication Error: {str(ve)}")
+ return None
+ except Exception as e:
+ print(f"Unexpected error: {str(e)}")
+ return None
+
+def save_clinic_note(note: str, index: int, output_dir: str = "generated_notes"):
+ """Save the generated clinic note to a file"""
+ os.makedirs(output_dir, exist_ok=True)
+ filename = os.path.join(output_dir, f"clinic_note_{index}.txt")
+ with open(filename, "w", encoding="utf-8") as f:
+ f.write(note)
+ print(f"Saved clinic note {index} to {filename}")
+
+def main():
+ num_notes = 10 # Number of clinic notes to generate
+
+ try:
+ setup_client()
+ except ValueError as e:
+ print(f"Setup Error: {str(e)}")
+ return
+
+ for i in range(num_notes):
+ print(f"\nGenerating clinic note {i+1}...")
+ note = generate_clinic_note()
+
+ if note:
+ save_clinic_note(note, i+1)
+ print(f"Successfully generated clinic note {i+1}")
+ else:
+ print(f"Failed to generate clinic note {i+1}")
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file
diff --git a/seizure/setup.py b/seizure/setup.py
new file mode 100644
index 0000000..52246e1
--- /dev/null
+++ b/seizure/setup.py
@@ -0,0 +1,18 @@
+from setuptools import setup, find_packages
+
+setup(
+ name="seizure_score_ai",
+ version="0.1.0",
+ description="AI-powered ILAE seizure score calculator",
+ author="Vineet Reddy",
+ package_dir={"": "src"},
+ packages=find_packages(where="src"),
+ python_requires=">=3.8",
+ install_requires=[
+ "streamlit>=1.40.0",
+ "google-adk>=0.3.0",
+ "python-dotenv>=1.0.0",
+ "pillow>=10.0.0",
+ ],
+)
+
diff --git a/seizure/src/seizure_score_ai/__init__.py b/seizure/src/seizure_score_ai/__init__.py
new file mode 100644
index 0000000..3ada542
--- /dev/null
+++ b/seizure/src/seizure_score_ai/__init__.py
@@ -0,0 +1,7 @@
+"""SeizureScoreAI: Multi-Agent Clinical Reasoning System for ILAE Outcome Scoring"""
+
+from .agents import process_clinical_note
+
+__version__ = "0.1.0"
+__all__ = ["process_clinical_note"]
+
diff --git a/seizure/src/seizure_score_ai/agents.py b/seizure/src/seizure_score_ai/agents.py
new file mode 100644
index 0000000..68667a1
--- /dev/null
+++ b/seizure/src/seizure_score_ai/agents.py
@@ -0,0 +1,253 @@
+"""
+Multi-Agent Clinical Reasoning System using Google Agent Development Kit (ADK)
+
+This module implements a three-agent pipeline using Google's ADK framework for
+processing clinical notes and calculating ILAE outcome scores.
+
+Architecture:
+ Agent 1: Clinical Information Extractor → extracts structured data
+ Agent 2: ILAE Score Calculator → calculates outcome score
+ Agent 3: Concise Explanation Reporter → generates user-friendly summary
+"""
+
+from google.adk import Runner
+from google.adk.agents import LlmAgent
+from google.adk.sessions import InMemorySessionService
+from google.genai import types
+import os
+from dotenv import load_dotenv
+import json
+import uuid
+import asyncio
+import re
+from typing import Dict, Tuple
+
+# Load environment variables
+load_dotenv(verbose=True)
+api_key = os.getenv("GEMINI_API_KEY")
+if api_key:
+ os.environ["GEMINI_API_KEY"] = api_key
+
+GEMINI_MODEL = "gemini-3-flash-preview"
+
+
+def run_agent(agent: LlmAgent, prompt: str, app_name: str) -> str:
+ """
+ Run an ADK agent with a prompt and return the response.
+
+ Args:
+ agent: The LlmAgent to run
+ prompt: The text prompt
+ app_name: Application name for session
+
+ Returns:
+ The agent's response as a string
+ """
+ session_service = InMemorySessionService()
+ session_id = str(uuid.uuid4())
+ user_id = "default_user"
+
+ # Create session and runner
+ asyncio.run(session_service.create_session(app_name=app_name, user_id=user_id, session_id=session_id))
+ runner = Runner(app_name=app_name, agent=agent, session_service=session_service)
+
+ # Create message and run agent
+ message = types.Content(parts=[types.Part(text=prompt)], role="user")
+
+ # Collect response from event stream
+ response_text = ""
+ for event in runner.run(user_id=user_id, session_id=session_id, new_message=message):
+ if hasattr(event, 'content') and event.content:
+ if hasattr(event.content, 'parts'):
+ for part in event.content.parts:
+ if hasattr(part, 'text') and part.text:
+ response_text += part.text
+
+ return response_text
+
+
+def create_clinical_extractor_agent() -> LlmAgent:
+ """Creates the Clinical Information Extractor agent."""
+
+ instruction = """You are a clinical information extractor. Extract these entities from the clinical note:
+
+1. **Presence of seizure freedom** (Yes/No/I don't know)
+2. **Presence of auras** (Yes/No/I don't know)
+3. **Baseline seizure days (pre-treatment)** (Numeric value or "I don't know")
+4. **Seizure days per year (post-treatment)** (Numeric value or "I don't know")
+
+For each entity, provide the value and exact supporting text from the note.
+
+**Output only valid JSON in this format:**
+
+{
+ "presence_of_seizure_freedom": {
+ "value": "...",
+ "supporting_text": "..."
+ },
+ "presence_of_auras": {
+ "value": "...",
+ "supporting_text": "..."
+ },
+ "baseline_seizure_days": {
+ "value": "...",
+ "supporting_text": "..."
+ },
+ "seizure_days_per_year": {
+ "value": "...",
+ "supporting_text": "..."
+ }
+}"""
+
+ return LlmAgent(
+ name="ClinicalInformationExtractor",
+ model=GEMINI_MODEL,
+ instruction=instruction,
+ description="Extracts structured clinical information from patient notes"
+ )
+
+
+def create_ilae_calculator_agent() -> LlmAgent:
+ """Creates the ILAE Score Calculator agent."""
+
+ instruction = """You are a medical expert specializing in epilepsy. Calculate the ILAE score using these criteria:
+
+**ILAE Outcome Scale:**
+- **Class 1**: Completely seizure free; no auras
+- **Class 2**: Only auras; no other seizures
+- **Class 3**: 1 to 3 seizure days per year; ± auras
+- **Class 4**: 4 seizure days per year to 50% reduction of baseline seizure days; ± auras
+- **Class 5**: Less than 50% reduction of baseline seizure days; ± auras
+- **Class 6**: More than 100% increase of baseline seizure days; ± auras
+
+Provide detailed reasoning citing the supporting texts. If you cannot determine the score, set "ilae_score" to "indeterminate".
+
+**Output only valid JSON in this format:**
+
+{
+ "ilae_score": "...",
+ "detailed_explanation": "..."
+}"""
+
+ return LlmAgent(
+ name="ILAEScoreCalculator",
+ model=GEMINI_MODEL,
+ instruction=instruction,
+ description="Calculates ILAE outcome scores based on clinical data"
+ )
+
+
+def create_concise_reporter_agent() -> LlmAgent:
+ """Creates the Concise Explanation Reporter agent."""
+
+ instruction = """Summarize the detailed ILAE explanation into a clear, concise summary for the frontend.
+
+**Output only valid JSON in this format:**
+
+{
+ "concise_explanation": "..."
+}"""
+
+ return LlmAgent(
+ name="ConciseExplanationReporter",
+ model=GEMINI_MODEL,
+ instruction=instruction,
+ description="Generates concise explanations of ILAE scores"
+ )
+
+
+def parse_json_response(response_text: str) -> Dict:
+ """Parse JSON from agent response, handling potential formatting issues."""
+ try:
+ return json.loads(response_text)
+ except json.JSONDecodeError:
+ # Try to extract JSON from response
+ json_match = re.search(r'\{.*\}', response_text, re.DOTALL)
+ if json_match:
+ return json.loads(json_match.group())
+ raise ValueError("Could not parse response as JSON")
+
+
+def process_clinical_note(clinical_note: str) -> Tuple[Dict, Dict]:
+ """
+ Process a clinical note through the ADK multi-agent pipeline.
+
+ Args:
+ clinical_note: Raw clinical note text
+
+ Returns:
+ Tuple of (final_output, detailed_output) where:
+ - final_output contains: ilae_score, concise_explanation, extracted_entities
+ - detailed_output contains: detailed_explanation
+ """
+
+ print("Initializing ADK multi-agent system...")
+
+ # Step 1: Extract clinical information
+ print("Step 1: Clinical Information Extraction...")
+ extractor = create_clinical_extractor_agent()
+ extraction_response = run_agent(
+ extractor,
+ f"Extract clinical information from this note:\n\n{clinical_note}",
+ app_name="ClinicalExtractor"
+ )
+ extracted_entities = parse_json_response(extraction_response)
+
+ # Calculate percent reduction for context
+ baseline = extracted_entities['baseline_seizure_days']['value']
+ post = extracted_entities['seizure_days_per_year']['value']
+
+ try:
+ if str(baseline).lower() == "i don't know" or str(post).lower() == "i don't know":
+ percent_reduction = "I don't know"
+ else:
+ baseline_val = float(baseline)
+ post_val = float(post)
+ percent_reduction = ((baseline_val - post_val) / baseline_val) * 100 if baseline_val > 0 else 0
+ except (ValueError, TypeError):
+ percent_reduction = "I don't know"
+
+ # Step 2: Calculate ILAE score
+ print("Step 2: ILAE Score Calculation...")
+ calculator = create_ilae_calculator_agent()
+ calculation_prompt = f"""Calculate the ILAE score using this information:
+
+**Extracted Entities and Supporting Texts:**
+1. Presence of seizure freedom: {extracted_entities['presence_of_seizure_freedom']['value']}
+ - Supporting text: {extracted_entities['presence_of_seizure_freedom']['supporting_text']}
+2. Presence of auras: {extracted_entities['presence_of_auras']['value']}
+ - Supporting text: {extracted_entities['presence_of_auras']['supporting_text']}
+3. Baseline seizure days: {baseline}
+ - Supporting text: {extracted_entities['baseline_seizure_days']['supporting_text']}
+4. Seizure days per year: {post}
+ - Supporting text: {extracted_entities['seizure_days_per_year']['supporting_text']}
+5. Percent reduction: {percent_reduction}
+
+Calculate the ILAE score."""
+
+ calculation_response = run_agent(calculator, calculation_prompt, app_name="ILAECalculator")
+ ilae_result = parse_json_response(calculation_response)
+
+ # Step 3: Generate concise explanation
+ print("Step 3: Generating Concise Explanation...")
+ reporter = create_concise_reporter_agent()
+ concise_response = run_agent(
+ reporter,
+ f"Summarize this detailed explanation:\n\n{ilae_result['detailed_explanation']}",
+ app_name="ConciseReporter"
+ )
+ concise_result = parse_json_response(concise_response)
+
+ # Prepare final outputs
+ final_output = {
+ "ilae_score": ilae_result['ilae_score'],
+ "concise_explanation": concise_result['concise_explanation'],
+ "extracted_entities": extracted_entities
+ }
+
+ detailed_output = {
+ "detailed_explanation": ilae_result['detailed_explanation']
+ }
+
+ print("ADK multi-agent processing complete!")
+ return final_output, detailed_output
diff --git a/seizure/tests/test_adk_agents.py b/seizure/tests/test_adk_agents.py
new file mode 100644
index 0000000..458d994
--- /dev/null
+++ b/seizure/tests/test_adk_agents.py
@@ -0,0 +1,44 @@
+"""
+Test for ADK multi-agent system.
+
+Usage: python tests/test_adk_agents.py
+"""
+
+import sys
+import os
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src'))
+
+from seizure_score_ai.agents import process_clinical_note
+
+
+def test_basic_functionality():
+ """Test that the ADK multi-agent pipeline works end-to-end."""
+
+ # Simple test case: seizure-free patient
+ clinical_note = """
+ Patient post-surgery 12 months ago.
+ Pre-surgery: 96 seizure days per year.
+ Current: Completely seizure-free, no auras.
+ """
+
+ print("Testing ADK multi-agent system...")
+
+ final, detailed = process_clinical_note(clinical_note)
+
+ # Verify we got results
+ assert 'ilae_score' in final, "Missing ILAE score"
+ assert 'extracted_entities' in final, "Missing extracted entities"
+ assert 'concise_explanation' in final, "Missing explanation"
+ assert 'detailed_explanation' in detailed, "Missing detailed explanation"
+
+ print(f"\nILAE Score: {final['ilae_score']}")
+ print(f"Extracted {len(final['extracted_entities'])} entities")
+ print("All tests passed!")
+
+
+if __name__ == "__main__":
+ try:
+ test_basic_functionality()
+ except Exception as e:
+ print(f"Test failed: {e}")
+ sys.exit(1)
diff --git a/seizure/tests/test_gemini.py b/seizure/tests/test_gemini.py
new file mode 100644
index 0000000..81924e1
--- /dev/null
+++ b/seizure/tests/test_gemini.py
@@ -0,0 +1,31 @@
+"""Test script to verify Gemini API is working"""
+from google import genai
+import os
+from dotenv import load_dotenv
+
+load_dotenv()
+
+# Get API key
+api_key = os.getenv("GEMINI_API_KEY")
+if not api_key:
+ print("ERROR: GEMINI_API_KEY not found in environment")
+ exit(1)
+
+print(f"API Key found!")
+
+# Set up client
+os.environ["GEMINI_API_KEY"] = api_key
+client = genai.Client()
+
+# Simple test
+print("\nTesting Gemini 2.5 Flash API...")
+try:
+ response = client.models.generate_content(
+ model="gemini-2.5-flash",
+ contents="Write a one-sentence summary of what epilepsy is."
+ )
+ print("\nSUCCESS! API is working.")
+ print(f"\nResponse: {response.text}")
+except Exception as e:
+ print(f"\nERROR: {e}")
+