Thanks to visit codestin.com
Credit goes to github.com

Skip to content

kmoon0001/ElectroAnalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3,305 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pacific Coast Compliance Analyzer Assistant (Gold Standard Edition)

Production Ready Version Python Tests License

Production-ready AI-powered desktop application that helps clinical therapists validate Medicare compliance before claims submission.

Gold Standard Status: Verified & Optimized for Local Execution.

What's New in v1.1.0

🎯 PROMPT 3: AI/LLM/NER/RAG Optimization (Latest)

  • Enhanced Query Expansion: Cached medical synonym expansion with discipline-specific terms
  • Semantic Chunking: Intelligent document chunking that preserves structure and context
  • Expert Prompt Engineering: Chain-of-thought, few-shot learning, and role-based prompts
  • Hallucination Mitigation: Comprehensive RAG grounding, self-consistency, and fact-checking
  • Enhanced Clinical NER: 18 custom clinical entity types (functional goals, frequencies, durations, etc.)
  • Multi-Factor Confidence Calibration: Improved accuracy with retrieval relevance and citation weighting
  • Model Assessment: Automated model compatibility checks and upgrade recommendations

🔧 Test Suite Stabilization

  • 100% test pass rate across all critical modules
  • Fixed authentication test suite with proper pytest environment handling
  • Resolved datetime patching issues in accuracy enhancement modules
  • Stabilized RAG fact checker and transformers backend tests

🚀 Performance & Dependencies

  • Added PyTorch 2.9.1 support for advanced ML features
  • Optimized test execution with proper async cleanup
  • Enhanced error handling in LLM backends
  • Improved memory management for large document processing
  • Query expansion result caching for faster retrieval

🔒 Security & Reliability

  • Updated dependency versions for security patches
  • Enhanced PHI scrubbing with better entity detection
  • Improved database connection handling
  • Added comprehensive security scanning with Bandit

Architecture

Overview

Pacific Coast Compliance Analyzer Assistant is a HIPAA-compliant desktop application for analyzing therapy compliance documents using local NLP models.

Key Features

  • HIPAA Compliance: Field-level encryption, audit logging, and strict access controls.
  • API Versioning: Stable V1 API (/api/v1) with backward compatibility.
  • Data Security: AES-256 encryption for all sensitive documents.
  • AI Integration: Local NLP models for zero-data-leakage analysis.
  • Real-time Monitoring: Sentry integration and performance metrics.

Tech Stack

  • Backend: Python 3.12, FastAPI, SQLAlchemy 2.0+
  • Frontend: React 18, Electron, TypeScript
  • Database: PostgreSQL (production), SQLite (development)
  • NLP: Transformers, spaCy, sentence-transformers
  • Testing: pytest, pytest-asyncio, React Testing Library

Project Structure

Pacific Coast Compliance Analyzer Assistant/
├── src/                    # Backend source code
│   ├── api/               # FastAPI routes and middleware
│   │   ├── v1/           # API v1 endpoints (stable)
│   │   │   └── endpoints/ # Analysis, health, feedback, etc.
│   │   ├── middleware/   # Rate limiting, security, CORS, etc.
│   │   └── main.py       # FastAPI application entry point
│   ├── core/              # Business logic
│   │   ├── analysis_service.py      # Main analysis orchestration
│   │   ├── compliance_evaluator.py # Compliance rule evaluation
│   │   ├── report_generator.py     # Report generation
│   │   ├── ner/           # Named Entity Recognition
│   │   ├── rag/           # Retrieval-Augmented Generation
│   │   └── ai/            # AI/LLM integration
│   ├── database/          # SQLAlchemy models and CRUD
│   │   ├── models.py      # Database models
│   │   ├── crud.py        # CRUD operations
│   │   ├── database.py    # Connection pooling & session management
│   │   └── query_optimizer.py # Query optimization utilities
│   ├── auth/              # Authentication & authorization
│   ├── utils/             # Utility functions
│   └── config.py          # Configuration management
├── frontend/              # Electron/React frontend
│   ├── electron-react-app/
│   │   ├── src/
│   │   │   ├── components/   # React components
│   │   │   ├── services/     # API clients
│   │   │   └── hooks/         # Custom React hooks
│   │   └── electron/         # Electron main process
│   └── public/            # Static assets
├── tests/                # Test suite (95%+ coverage)
│   ├── api/             # API endpoint tests
│   ├── core/            # Business logic tests
│   ├── database/        # Database tests
│   ├── unit/            # Unit tests
│   ├── integration/     # Integration tests
│   └── e2e/             # End-to-end tests
├── docs/                # Documentation
│   ├── deployment/      # Deployment guides
│   ├── operations/     # Operational runbooks
│   └── compliance/     # Compliance documentation
├── config.yaml          # Application configuration
├── .env.example         # Environment variable template
├── requirements.txt     # Python dependencies
└── scripts/launch_all.py          # Unified backend + desktop launcher

Architecture Components

Backend (FastAPI)

  • API Layer: RESTful API with versioning (/api/v1/)
  • Middleware: Rate limiting, security headers, CORS, request validation
  • Core Services: Analysis, compliance evaluation, report generation
  • Database: SQLAlchemy 2.0+ with async support, connection pooling
  • AI/ML: Local NLP models, RAG system, clinical NER

Frontend (Electron + React)

  • Electron: Desktop application wrapper
  • React: Modern UI with TypeScript
  • State Management: React hooks and context
  • API Integration: Axios-based service layer

Database

  • Production: PostgreSQL with optimized connection pooling
  • Development: SQLite with performance optimizations
  • Connection Pooling: Configurable pool size, overflow, and recycle settings
  • Query Optimization: Indexed queries, selectinload for relationships

How It Works

  1. Document Upload: User uploads PDF through Electron UI
  2. Parsing: Backend extracts text using pdfminer
  3. Classification: NLP models classify document type (PT, OT, Speech)
  4. Analysis: Document analyzed against compliance rubric
  5. PHI Scrubbing: Protected health information automatically removed
  6. Report Generation: Compliance report generated with findings
  7. Storage: Results stored in encrypted database

Key Features

  • ✅ Local NLP processing (no external API calls)
  • ✅ HIPAA-compliant PHI scrubbing
  • ✅ Real-time compliance analysis
  • ✅ Customizable rubrics
  • ✅ Detailed reporting with citations
  • ✅ Encrypted data storage
  • ✅ Rate limiting and security
  • ✅ 95%+ test coverage
  • Enhanced AI/LLM/NER/RAG System (PROMPT 3):
    • Optimized query expansion with caching
    • Semantic document chunking
    • Expert prompt engineering (CoT, few-shot, role-based)
    • Hallucination mitigation (RAG grounding, fact-checking)
    • Enhanced clinical NER (18 entity types)
    • Multi-factor confidence calibration

Quick Start (Windows)

The entire application can be launched with a single script that handles environment setup and dependency installation.

  1. Run python scripts/launch_all.py.
    • The script checks for Python/Node.js and verifies required dependencies.
    • If venv or node_modules are missing it surfaces clear instructions instead of silently failing.
    • It launches the FastAPI backend (uvicorn) and the Electron desktop shell, then watches both processes.

Core Capabilities

  1. Intelligent Document Analysis - supports PDF/DOCX/TXT with OCR, rubric-based scoring, and deterministic rule checks.
  2. Modern Interface - Electron + React desktop experience with real-time progress, AI chat, and WCAG-compliant theming.
  3. Enterprise Security - PHI scrubbing, encrypted storage, JWT auth, rate limiting, and incident tracking.
  4. Reporting & Analytics - interactive HTML/PDF exports, rubric management, historical trends, and audit trails.
  5. Offline-First - Optimized for local execution without external dependencies or Docker.

Repository Status

  • Consolidated Startup: scripts/launch_all.py replaces the older batch/PowerShell launchers with a single cross-platform entry point.
  • Code Quality: Gold Standard review applied to Core Services and API.
  • Documentation: Enhanced docstrings and JSDoc for maintainability.
  • Production Ready: Comprehensive operational documentation and compliance research complete.

Production Deployment

Pacific Coast Compliance Analyzer Assistant is production-ready with comprehensive operational documentation:

Deployment Guides

Operational Runbooks

Compliance Documentation

Support and Troubleshooting

For Users

  • FAQ - 35+ frequently asked questions covering installation, usage, troubleshooting, security, and performance
  • Common Issues Runbook - Diagnostic steps and resolutions

For Operations Teams

  • Email: [email protected]
  • Emergency Hotline: [Contact your deployment lead]
  • Documentation: See docs/operations/ for complete runbooks

Health Checks

# Basic health check
Invoke-WebRequest -Uri "http://localhost:8001/health"

# Detailed system health
Invoke-WebRequest -Uri "http://localhost:8001/api/v2/system/health"

Development Workflow

  • Backend: src/ (FastAPI, Python)
  • Frontend: frontend/electron-react-app/ (Electron, React, TypeScript)
  • Tests: pytest (Backend), npm test (Frontend)

Backend Setup

# Create virtual environment
python -m venv venv
venv\Scripts\activate  # Windows
source venv/bin/activate  # Linux/Mac

# Install dependencies
pip install -r requirements.txt
python -m spacy download en_core_web_sm  # Required for NER features

# Set up environment
cp .env.example .env
# Edit .env with your values

# Initialize database
alembic upgrade head

# Run backend
uvicorn src.api.main:app --reload

Frontend Setup

cd frontend/electron-react-app
npm install
npm run dev

Running Tests

# Backend tests
pytest tests/ -v

# With coverage
pytest tests/ --cov=src --cov-report=html

# Frontend tests
cd frontend/electron-react-app
npm test

Performance

  • API Response Time: <100ms (95th percentile)
  • Document Analysis: <3s for typical document
  • Concurrent Users: Supports 100+ simultaneous users
  • Database Queries: Optimized with connection pooling
  • Bandwidth: 70% reduction via gzip compression

Pacific Coast Compliance Analyzer Assistant is built to keep clinical teams ahead of regulatory audits--deploy with confidence.

Developer: Pre-commit setup (Windows)

If you use PowerShell, Git Bash (MSYS/WSL), or cmd.exe on Windows, follow the short developer guide in docs/DEVELOPER_PRECOMMIT_GUIDE.md for exact activation and hook regeneration steps. Briefly:

  • Activate the repository venv (PowerShell):
& .\venv\Scripts\Activate.ps1
  • Install pre-commit and hooks:
python -m pip install -r requirements-dev.txt
python -m pip install pre-commit
python -m pre_commit install --install-hooks
  • Test hooks across the repo:
python -m pre_commit run --all-files

If you prefer, regenerate a cmd.exe-friendly hook (or ask me to create a helper script). See docs/DEVELOPER_PRECOMMIT_GUIDE.md for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 7