Skip to main content
This is Part 2 of 3. If you haven’t completed Part 1, start there: Part 1: Getting Started
Just want to use the dashboard? See the Medical Intake Agent Guide for quick start instructions.
  • Time to complete: 20-25 minutes
  • What you’ll build: A React dashboard with real-time SSE updates
  • What you’ll learn: FastAPI integration, SSE streaming, React state management
  • Platform: Runs locally on AI PCs with Ryzen AI (NPU/iGPU acceleration)

Why Build a Dashboard?

The CLI is great for developers, but healthcare staff need a visual interface. The dashboard provides:
  • Real-time monitoring - Watch forms process as they arrive
  • Patient management - Search, filter, and view patient records
  • Alert handling - Acknowledge critical allergies and missing fields
  • Efficiency metrics - Track time savings and ROI

Dashboard Architecture

Data flow:
  1. New file arrives → Agent processes it
  2. Agent emits event → FastAPI broadcasts via SSE
  3. React receives event → Updates UI in real-time
  4. No polling required!

Quick Start

Developer Installation Required: The dashboard feature requires the Developer (Editable Install) path from Part 1, as it uses source files from the cloned repository. If you used the PyPI installation, clone the repository to access the dashboard.

Launch the Dashboard

The dashboard opens automatically in a native Electron window. If Node.js/Electron is not available, it falls back to your default web browser.

Launch Options


Dashboard Views

The dashboard has four main views accessible via navigation tabs.

Dashboard View (Home)

The main monitoring view with live updates. Watch Folder Panel Features:
  • Status indicators with color-coded dots:
    • 🟢 Green - Processed files
    • 🔴 Red (flashing) - Currently processing
    • 🟠 Orange - Queued for processing
  • Drag-and-drop upload - Drop files directly onto the panel to upload
  • File type icons - Visual indicators for PDFs vs images
  • Click to navigate - Click processed files to view patient details
Efficiency Metrics Panel:
  • Forms Processed - Total count of successfully extracted forms
  • Manual Would Take - Cumulative estimated time for manual data entry
  • AI Processing Time - Cumulative actual VLM processing time
  • Time Saved - Running total of time saved (resets with database)
The Live Feed shows detailed processing progress including:
  • File detection events
  • Step-by-step progress (Reading file → Checking duplicates → Extracting data → Saving)
  • Processing times and success/error states

Patient Database View

Searchable patient list with filtering.

Patient Detail View

Complete patient information and workflow history.
When deleting a patient, you can choose to also delete the source intake form file. This keeps the watched directory in sync with the database.

Chat View

Natural language interface for querying patients. Example queries:
  • “How many patients were processed today?”
  • “Find patients with penicillin allergies”
  • “Show me patients missing insurance information”

Settings View

Configuration and file upload.
You can upload intake forms in two ways: drag-and-drop onto the Watch Folder panel on the Dashboard, or use the file browser in Settings.

REST API Reference

The dashboard exposes a REST API for integration with other systems. Full API docs are available at http://localhost:8080/docs when running.

Patient Endpoints

Query Parameters for GET /api/patients: Query Parameters for DELETE /api/patients/:id: Query Parameters for GET /api/patients/:id/file: Examples:

Alert Endpoints

Query Parameters for GET /api/alerts: Examples:

Session Endpoints

Query Parameters:

Chat Endpoint

Request Body:
Response:

Configuration Endpoints

Upload Example:
Clear Database Example:

Watch Folder Endpoint

Response Example:

Stats & Health

Stats Response Example:

Server-Sent Events (SSE)

The /api/events endpoint streams real-time updates to the frontend. The server sends heartbeats every 30 seconds to keep connections alive.

Event Types

JavaScript Example

Event Payload Examples

Processing Steps

The agent emits 7 processing steps via SSE:

Development Mode

For frontend development with hot reload:

Terminal 1: Backend API

Terminal 2: Vite Dev Server

Access http://localhost:3000 for the Vite dev server (proxies API to port 8080).

Project Structure

Electron Wrapper

The dashboard includes a minimal Electron wrapper for a native desktop experience:
electron/main.js
The Electron wrapper:
  • Loads automatically when running gaia-emr dashboard
  • Shows a connection error page with retry if server is unavailable
  • Opens external links in the default browser
  • Falls back to browser mode if Electron/Node.js is not available

Building the FastAPI Server

Let’s understand how the backend is built.

Basic Server Setup

server.py

Implementing SSE

server.py (continued)

Hooking Into Agent Events

server.py (continued)

Building the React Frontend

Main App Component

App.jsx

Live Feed Component

components/LiveFeed.jsx

Time Savings Calculation

The dashboard calculates time savings per-form based on extracted data (not fixed estimates). See Part 3: Architecture for the formula details. Summary: A typical 15-field form takes ~4-5 minutes to enter manually. VLM extracts it in ~30 seconds. That’s ~89% time savings.

What’s Next?

Part 3: Architecture & Internals

Deep dive into database schema, processing pipeline, and system design decisions