Skip to content

Tathagat017/Echo-Notes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

43 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Echo Notes - AI-Powered SOAP Note Generation System

An intelligent healthcare documentation platform for hearing care professionals

License Docker AI Backend Frontend


🎯 Project Overview

Echo Notes revolutionizes healthcare documentation by using advanced AI to automatically generate SOAP (Subjective, Objective, Assessment, Plan) notes from patient visit transcripts. Built with a modern microservice architecture, it ensures scalability, security, and performance for healthcare professionals.

πŸ₯ Key Features

  • πŸ€– AI-Powered SOAP Generation - Automated medical note creation using LLaMA 3 and GPT-4
  • πŸ”’ PII Protection - Advanced privacy-preserving text processing with Microsoft Presidio
  • πŸ” RAG-based Queries - Intelligent patient data retrieval using vector embeddings
  • πŸ“„ Document Management - Secure file storage and processing with AWS S3
  • πŸ“Š Real-time Monitoring - Comprehensive service health and performance tracking
  • 🌐 Modern UI/UX - Responsive Next.js interface with Tailwind CSS

πŸ—οΈ System Architecture

Microservice Design Pattern

Echo Notes follows a microservice architecture with clear separation between business logic and AI operations:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Production Environment                    β”‚
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Main Backend   β”‚  β”‚   AI Service     β”‚  β”‚ PostgreSQL  β”‚ β”‚
β”‚  β”‚   (Port 8001)   β”‚  β”‚   (Port 8002)    β”‚  β”‚ + pgvector  β”‚ β”‚
β”‚  β”‚                 β”‚  β”‚                  β”‚  β”‚ (Port 5432) β”‚ β”‚
β”‚  β”‚ β€’ FastAPI       β”‚  β”‚ β€’ FastAPI        β”‚  β”‚             β”‚ β”‚
β”‚  β”‚ β€’ Business      β”‚  β”‚ β€’ AI Models      β”‚  β”‚ β€’ Shared DB β”‚ β”‚
β”‚  β”‚   Logic         β”‚  β”‚ β€’ Model Cache    β”‚  β”‚ β€’ Vector    β”‚ β”‚
β”‚  β”‚ β€’ HTTP Client   │◄── β€’ Transformers   β”‚  β”‚   Search    β”‚ β”‚
β”‚  β”‚ β€’ Database      β”‚  β”‚ β€’ OpenAI API     β”‚  β”‚             β”‚ β”‚
β”‚  β”‚   Operations    β”‚  β”‚ β€’ HuggingFace    β”‚  β”‚             β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚           β–²                      β–²                 β–²        β”‚
β”‚           β”‚                      β”‚                 β”‚        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Next.js     β”‚        β”‚   AWS S3     β”‚     β”‚  Model     β”‚ β”‚
β”‚  β”‚ Frontend    β”‚        β”‚  Document    β”‚     β”‚  Cache     β”‚ β”‚
β”‚  β”‚ (Port 3000) β”‚        β”‚   Storage    β”‚     β”‚  Volume    β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Layered Architecture Pattern

Main Backend Service (FastAPI - Port 8001)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              HTTP Layer                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   Controllers   β”‚ β”‚     Routes      β”‚ β”‚
β”‚  β”‚                 β”‚ β”‚                 β”‚ β”‚
β”‚  β”‚ β€’ AuthControllerβ”‚ β”‚ β€’ /auth/*       β”‚ β”‚
β”‚  β”‚ β€’ SOAPControllerβ”‚ β”‚ β€’ /soap/*       β”‚ β”‚
β”‚  β”‚ β€’ UserControllerβ”‚ β”‚ β€’ /users/*      β”‚ β”‚
β”‚  β”‚ β€’ RAGController β”‚ β”‚ β€’ /rag/*        β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Business Logic Layer          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚    Services     β”‚ β”‚     Clients     β”‚ β”‚
β”‚  β”‚                 β”‚ β”‚                 β”‚ β”‚
β”‚  β”‚ β€’ AuthService   β”‚ β”‚ β€’ AIServiceClientβ”‚ β”‚
β”‚  β”‚ β€’ AISoapService β”‚ β”‚ β€’ S3Client      β”‚ β”‚
β”‚  β”‚ β€’ UserService   β”‚ β”‚ β€’ EmailClient   β”‚ β”‚
β”‚  β”‚ β€’ PDFService    β”‚ β”‚                 β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Data Access Layer            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  Repositories   β”‚ β”‚     Models      β”‚ β”‚
β”‚  β”‚                 β”‚ β”‚                 β”‚ β”‚
β”‚  β”‚ β€’ PatientRepo   β”‚ β”‚ β€’ Professional  β”‚ β”‚
β”‚  β”‚ β€’ SOAPNotesRepo β”‚ β”‚ β€’ Patients      β”‚ β”‚
β”‚  β”‚ β€’ SessionRepo   β”‚ β”‚ β€’ SOAPNotes     β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Database Layer               β”‚
β”‚         PostgreSQL + pgvector           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

AI Microservice (FastAPI - Port 8002)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              API Layer                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ API Routes  β”‚ β”‚    Endpoints        β”‚ β”‚
β”‚  β”‚             β”‚ β”‚                     β”‚ β”‚
β”‚  β”‚ soap_api.py β”‚ β”‚ POST /soap/generate β”‚ β”‚
β”‚  β”‚ ner_api.py  β”‚ β”‚ POST /ner/extract   β”‚ β”‚
β”‚  β”‚ pii_api.py  β”‚ β”‚ POST /pii/anonymize β”‚ β”‚
β”‚  β”‚ rag_api.py  β”‚ β”‚ POST /embeddings/*  β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           AI Services Layer             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ AI Services β”‚ β”‚   Model Management  β”‚ β”‚
β”‚  β”‚             β”‚ β”‚                     β”‚ β”‚
β”‚  β”‚ SOAPService β”‚ β”‚ β€’ Model Loading     β”‚ β”‚
β”‚  β”‚ NERService  β”‚ β”‚ β€’ Caching Strategy  β”‚ β”‚
β”‚  β”‚ PIIService  β”‚ β”‚ β€’ Performance Opt   β”‚ β”‚
β”‚  β”‚ RAGService  β”‚ β”‚ β€’ Memory Management β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          External APIs Layer            β”‚
β”‚    OpenAI β€’ HuggingFace β€’ Presidio      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Tech Stack

Backend Technologies

Component Technology Purpose
Framework FastAPI 0.104+ High-performance async web framework
Language Python 3.11+ Modern Python with type hints
Database PostgreSQL 17 + pgvector Relational DB with vector operations
ORM SQLAlchemy 2.0 + Alembic Database modeling and migrations
Validation Pydantic V2 Data validation and serialization
Authentication JWT + Bcrypt Secure token-based auth
HTTP Client httpx Async HTTP client for microservice communication
Dependency Management uv Modern Python package manager

AI/ML Technologies

Component Technology Purpose
SOAP Generation LLaMA 3 (70B) via HuggingFace Advanced biomedical text generation
Judge LLM GPT-4o-mini Quality validation and scoring
Embeddings OpenAI text-embedding-3-small Vector embeddings for RAG
NER d4data/biomedical-ner-all Biomedical named entity recognition
PII Detection Microsoft Presidio Privacy-preserving text processing
Vector Search pgvector Cosine similarity search
ML Framework Transformers + LangChain Model orchestration

Frontend Technologies

Component Technology Purpose
Framework Next.js 15 React-based full-stack framework
UI Library React 19 Modern component-based UI
Styling Tailwind CSS 4 Utility-first CSS framework
Components Radix UI Accessible component library
Forms React Hook Form Performant forms with validation
State Management React Context + Hooks Client state management
API Client Fetch API RESTful API communication
Icons Lucide React Beautiful SVG icons

DevOps & Infrastructure

Component Technology Purpose
Containerization Docker + Docker Compose Container orchestration
Deployment Ubuntu EC2 + Nginx Cloud deployment with load balancing
Storage AWS S3 Document and file storage
Monitoring Structured Logging Application observability
CI/CD Git-based deployment Automated deployment pipeline

πŸ“± Frontend Architecture & User Flows

Application Structure

frontend/
β”œβ”€β”€ app/                    # Next.js 13+ App Router
β”‚   β”œβ”€β”€ (auth)/            # Authentication pages
β”‚   β”‚   β”œβ”€β”€ login/         # User login
β”‚   β”‚   └── register/      # User registration
β”‚   β”œβ”€β”€ dashboard/         # Main dashboard
β”‚   β”œβ”€β”€ patients/          # Patient management
β”‚   β”‚   β”œβ”€β”€ [id]/         # Patient details
β”‚   β”‚   └── new/          # Add new patient
β”‚   β”œβ”€β”€ sessions/          # Visit sessions
β”‚   β”‚   β”œβ”€β”€ [id]/         # Session details
β”‚   β”‚   └── new/          # New session
β”‚   β”œβ”€β”€ documents/         # Document management
β”‚   β”‚   β”œβ”€β”€ upload/       # File upload
β”‚   β”‚   └── [id]/view/    # Document viewer
β”‚   β”œβ”€β”€ soap/             # SOAP note management
β”‚   β”‚   β”œβ”€β”€ generate/     # SOAP generation
β”‚   β”‚   └── notes/[id]/   # Note viewer
β”‚   └── rag/              # RAG queries
β”‚       └── query/        # Knowledge base search
β”œβ”€β”€ components/ui/         # Reusable UI components
β”œβ”€β”€ lib/                  # Utility functions
└── routes/               # API route configurations

User Journey Flows

1. Authentication Flow

graph TD
    A[Landing Page] --> B[Login/Register]
    B --> C{Valid Credentials?}
    C -->|Yes| D[Dashboard]
    C -->|No| E[Error Message]
    E --> B
    D --> F[Main Application]
Loading

2. SOAP Generation Flow

graph TD
    A[Dashboard] --> B[New Session]
    B --> C[Patient Selection]
    C --> D[Document Upload]
    D --> E[Text Extraction]
    E --> F[AI Processing]
    F --> G[SOAP Preview]
    G --> H{User Approval?}
    H -->|Yes| I[Save to Database]
    H -->|No| J[Edit/Regenerate]
    J --> F
    I --> K[RAG Embedding]
Loading

3. Patient Management Flow

graph TD
    A[Patient List] --> B{Action}
    B -->|View| C[Patient Details]
    B -->|Edit| D[Update Form]
    B -->|New| E[Create Form]
    C --> F[Visit History]
    C --> G[SOAP Notes]
    D --> H[Save Changes]
    E --> I[Create Patient]
Loading

4. RAG Query Flow

graph TD
    A[RAG Interface] --> B[Enter Query]
    B --> C[Vector Search]
    C --> D[Similarity Matching]
    D --> E[Context Retrieval]
    E --> F[Answer Generation]
    F --> G[Response Display]
Loading

Component Architecture

UI Component Hierarchy

App Layout
β”œβ”€β”€ Navigation Bar
β”‚   β”œβ”€β”€ Logo
β”‚   β”œβ”€β”€ Menu Items
β”‚   └── User Profile
β”œβ”€β”€ Sidebar
β”‚   β”œβ”€β”€ Dashboard Link
β”‚   β”œβ”€β”€ Patients Link
β”‚   β”œβ”€β”€ Sessions Link
β”‚   └── SOAP Notes Link
β”œβ”€β”€ Main Content
β”‚   β”œβ”€β”€ Page Header
β”‚   β”œβ”€β”€ Breadcrumbs
β”‚   └── Dynamic Content
└── Footer
    β”œβ”€β”€ Status Indicators
    └── Version Info

State Management Strategy

// Global State (React Context)
interface AppState {
  user: User | null;
  currentPatient: Patient | null;
  activeSessions: Session[];
  notifications: Notification[];
}

// Component State (React Hooks)
interface ComponentState {
  formData: FormState;
  loading: boolean;
  errors: ValidationErrors;
  modalOpen: boolean;
}

🎯 Unique Selling Propositions (USPs)

1. πŸ€– Advanced AI Integration

  • Dual LLM Architecture: Combines LLaMA 3 (70B) for generation with GPT-4o-mini for validation
  • Biomedical Specialization: Custom-trained models for hearing care terminology
  • Quality Assurance: AI judge validates note quality before saving
  • Context Awareness: RAG system provides relevant historical context

2. πŸ”’ Privacy-First Design

  • PII Protection: Microsoft Presidio integration for automatic PII detection
  • Selective Anonymization: Preserves medical context while protecting privacy
  • HIPAA Compliance: Designed with healthcare regulations in mind
  • Audit Trail: Complete logging of all data access and modifications

3. πŸ—οΈ Scalable Microservice Architecture

  • Independent Scaling: AI services scale separately from business logic
  • Resource Optimization: Dedicated GPU resources for AI workloads
  • Fault Tolerance: Circuit breaker patterns prevent cascading failures
  • Performance: Async operations and intelligent caching

4. πŸ“Š Intelligent Knowledge Management

  • Vector Search: pgvector enables semantic similarity search
  • RAG Integration: Retrieve relevant patient history for context
  • Smart Recommendations: AI suggests relevant information during note creation
  • Continuous Learning: System improves with usage patterns

5. 🎨 Modern User Experience

  • Responsive Design: Works seamlessly across desktop, tablet, and mobile
  • Real-time Updates: Live status indicators and progress tracking
  • Intuitive Workflow: Streamlined process from upload to final note
  • Accessibility: WCAG compliant interface design

6. πŸš€ Developer-Friendly Infrastructure

  • One-Command Deployment: Unified Docker Compose setup
  • Modern Tooling: uv for Python, Next.js 15, TypeScript
  • Comprehensive Testing: Automated testing for all components
  • Clear Documentation: Extensive docs and architecture guides

πŸ”„ API Integration & Communication

Inter-Service Communication

Main Backend ↔ AI Service

# AIServiceClient in Main Backend
class AIServiceClient:
    async def generate_soap_note(self, request_data: Dict) -> Dict:
        """Generate SOAP note via AI service"""
        response = await self.client.post("/soap/generate", json=request_data)
        return response.json()

    async def extract_ner_entities(self, text: str) -> Dict:
        """Extract entities via AI service"""
        response = await self.client.post("/ner/extract", json={"text": text})
        return response.json()

Frontend ↔ Backend API

// API Client in Frontend
class ApiClient {
  async generateSOAP(sessionId: string, text: string): Promise<SOAPNote> {
    const response = await fetch("/api/soap/generate", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ session_id: sessionId, text }),
    });
    return response.json();
  }
}

Error Handling Strategy

# Circuit Breaker Pattern
class AIServiceClient:
    def __init__(self):
        self.circuit_breaker = CircuitBreaker(
            failure_threshold=5,
            timeout=60,
            expected_exception=httpx.HTTPError
        )

    @circuit_breaker
    async def generate_soap_note(self, data: Dict) -> Dict:
        # AI service call with automatic circuit breaking
        pass

πŸ“Š Database Schema & Data Flow

Core Entity Relationships

-- Professional (Healthcare Workers)
professional (id, name, email, role, department)
    ↓
-- Patients (Healthcare Recipients)
patients (id, name, email, phone, address)
    ↓
-- Visit Sessions (Encounters)
patient_visit_sessions (session_id, patient_id, professional_id, visit_date)
    ↓
-- Documents (Files/Transcripts)
uploaded_documents (document_id, session_id, s3_link, extracted_text)
    ↓
-- SOAP Notes (Generated Notes with Vector Embeddings)
session_soap_notes (note_id, session_id, content, embedding[1536])

Vector Search Implementation

-- Semantic similarity search for RAG
SELECT
    note_id,
    content,
    1 - (embedding <=> $1) as similarity
FROM session_soap_notes
WHERE embedding IS NOT NULL
    AND 1 - (embedding <=> $1) > 0.7
ORDER BY embedding <=> $1
LIMIT 10;

πŸš€ Quick Start Guide

Prerequisites

  • Docker & Docker Compose (Latest version)
  • Python 3.11+ (for local development)
  • Node.js 18+ (for frontend development)
  • PostgreSQL (if running locally)

1. Environment Setup

# Clone the repository
git clone <repository-url>
cd echo-notes-service

# Copy environment templates
cp .env.sample .env
cp backend/.env.sample backend/.env
cp ai_service/.env.sample ai_service/.env
cp frontend/.env.sample frontend/.env.local

# Update with your API keys
# Edit .env files with actual OpenAI and HuggingFace keys

2. Unified Development Deployment

# Windows
run-dev-unified.bat

# Linux/Mac
./run-dev-unified.sh

3. Production Deployment

# Deploy to EC2
./deploy-ec2-unified.sh

# Or manual Docker deployment
docker-compose -f docker-compose.unified.yaml up --build -d

4. Access Points

After deployment, access the application at:


πŸ“š Documentation

Architecture Documents

API Documentation

  • Backend API: Available at /docs endpoint (Swagger UI)
  • AI Service API: Available at /docs endpoint (OpenAPI)
  • Frontend Routes: Documented in frontend/routes/

Development Guides

  • Backend Setup: See backend/README.md
  • AI Service Setup: See ai_service/README.md
  • Frontend Setup: See frontend/README.md

🀝 Contributing

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Standards

  • Backend: Follow PEP 8, use type hints, add docstrings
  • Frontend: Use TypeScript, follow React best practices
  • Testing: Write tests for new features
  • Documentation: Update docs for API changes

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ†˜ Support

Getting Help

  • Documentation: Check the comprehensive docs in /docs
  • Issues: Report bugs via GitHub Issues
  • Discussions: Join project discussions
  • Email: Contact the development team

Common Issues

  • Memory Issues: AI service requires 8GB+ RAM
  • Model Loading: First startup takes 10-15 minutes
  • API Keys: Ensure OpenAI and HuggingFace keys are valid
  • Network: Check firewall settings for inter-service communication

πŸŽ‰ Acknowledgments

  • OpenAI - For GPT-4 and embedding models
  • HuggingFace - For biomedical LLaMA models
  • Microsoft - For Presidio PII detection
  • Vercel - For Next.js framework
  • FastAPI Team - For the excellent web framework

Built with ❀️ for Healthcare Professionals

Transforming healthcare documentation through AI innovation

About

Open Hearing is an AI-powered platform designed to help hearing care professionals focus on patient care by automating clinical documentation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors