DISE AI Agent is an intelligent assistant designed for Drug-Induced Sleep Endoscopy (DISE). It integrates computer vision and Large Language Models (LLM) to assist physicians in identifying critical airway obstruction moments and providing quantitative analysis data.
- Multi-Mode Input: Supports local video file uploads and public video links for remote analysis.
- Precise Interval Selection: Includes a time-parsing engine that allows users to analyze specific segments (e.g., "0:10-0:50") or the entire video duration.
- Site-Specific Analysis: Provides independent AI analysis for the V-Site (Velum/Soft Palate) and O-Site (Oropharynx).
- Automated Status Tracking: Utilizes a polling mechanism to provide real-time updates on AI processing progress via task IDs.
- Interactive Data Correction: An Annotation Modal allows physicians to view polygon overlays and manually correct analysis results, including obstruction percentages.
- Medical Knowledge Chat: Features a text-based chat mode for consulting medical knowledge or discussing specific analysis results.
- Report Generation: Includes a dedicated action to trigger the automated generation of professional medical analysis reports.
- Frontend Framework: React 18 (TypeScript).
- Styling: Tailwind CSS for responsive medical-grade UI.
- Icons: Lucide React and Heroicons.
- State Management: React Hooks including useState, useRef, and useEffect.
- Communication: Fetch API with support for ngrok header bypass for local development.
The application manages complex analysis flows through a structured state machine to ensure a clear user path:
- WAITING: Initial state awaiting video upload or link input.
- AWAITING_TIME: Metadata loaded; the system requests a specific analysis timeframe.
- AWAITING_SITE: Timeframe confirmed; the user selects the anatomical site (V or O).
- ANALYZING: Backend task initiated with 3-second polling to update progress.
- DONE: Results displayed, comparing the "Worst" (maximum obstruction) and "Best" (maximum opening) moments.
- Payload: Supports FormData for local files or JSON for video URLs.
- Parameters: Includes start/end times and the target anatomical site (V-Site or O-Site).
- Response: Returns current task status (pending, analyzing, completed, or failed) and the numerical progress percentage.