Skip to content
nwaughachukwumaPublic

About

a clinical decision support system with advanced medical document intelligence

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

131 Commits

Folders and files

Repository files navigation

Cedar

Gemini_Generated_Image_6jhso96jhso96jhs

Clinical Decision Support

Clinical decision support powered by AI

License: MIT Platform: macOS Platform: Windows Platform: Linux TypeScript


About

Cedar is a clinical support application that augments medical practitioners with AI-powered document analysis, second opinions on lab reports, imaging studies, and healthcare documents. Built with Electron, React, and Python, Cedar provides intelligent document processing, semantic search, and contextual AI assistance for healthcare professionals.

Features

Feature Description
πŸ“„ Multi-Format Documents PDF, DOCX, XLSX, PPTX, images, and more
πŸ–ΌοΈ Medical Image Analysis Multi-angle analysis using MedGemma
πŸ” Semantic Search Vector-based similarity search across documents
πŸ’¬ AI-Powered Chat Contextual conversations with RAG pipeline
🎀 Voice Input OpenAI gpt-4o-transcribe for hands-free operation
πŸ“Ž Attachments Upload supplementary files during chat
πŸ“‹ Summarization AI-generated document summaries
πŸ“ Notes Professional notes linked to documents

Tech Stack

Frontend

  • React 18 + TypeScript
  • Tailwind CSS + shadcn/ui
  • Zustand for state management
  • Vite build tool

Main Process

  • Electron desktop runtime
  • SQLite with better-sqlite3
  • hnswlib-node for vector similarity search
  • gpt-4o-transcribe for speech-to-text

Backend API

  • FastAPI with Granian ASGI server
  • MarkItDown for document extraction
  • OpenAI SDK for embeddings and transcription

Cloud Services

  • Google Vertex AI – MedGemma-1-27B IT for chat completions and image analysis
  • OpenAI API – text-embedding-3-small for semantic embeddings, gpt-4o-transcribe for speech-to-text

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      CEDAR APPLICATION                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   ELECTRON UI    β”‚    β”‚         PYTHON API              β”‚  β”‚
β”‚  β”‚   (Renderer)     β”‚    β”‚     (FastAPI + Granian)         β”‚  β”‚
β”‚  β”‚                  β”‚    β”‚                                  β”‚  β”‚
β”‚  β”‚  React +         │◄──►│  - Chat Completions             β”‚  β”‚
β”‚  β”‚  TypeScript      β”‚    β”‚  - Image Analysis (MedGemma)    β”‚  β”‚
β”‚  β”‚  Tailwind CSS    β”‚    β”‚  - Document Extraction          β”‚  β”‚
β”‚  β”‚  Zustand Store   β”‚    β”‚  - Embeddings (OpenAI)          β”‚  β”‚
β”‚  β”‚  Lucide Icons    β”‚    β”‚  - Speech Transcription        β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  - Summarization                β”‚  β”‚
β”‚           β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚           β”‚                          β”‚                        β”‚
β”‚           β–Ό                          β–Ό                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚                 MAIN PROCESS (Electron)                   β”‚ β”‚
β”‚  β”‚                                                          β”‚ β”‚
β”‚  β”‚  - IPC Bridge (preload.js)                               β”‚ β”‚
β”‚  β”‚  - File System Access                                    β”‚ β”‚
β”‚  β”‚  - SQLite Database (metadata, FTS5)                      β”‚ β”‚
β”‚  β”‚  - HNSW Vector Store (embeddings)                        β”‚ β”‚
β”‚  β”‚  - Processing Queue                                      β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                              β”‚                                  β”‚
β”‚                              β–Ό                                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚                    CLOUD SERVICES                          β”‚ β”‚
β”‚  β”‚                                                          β”‚ β”‚
β”‚  β”‚  Google Vertex AI (MedGemma-1-27B IT)                       β”‚ β”‚
β”‚  β”‚  β”œβ”€β”€ Chat completions with streaming                     β”‚ β”‚
β”‚  β”‚  └── Multi-angle image analysis                          β”‚ β”‚
β”‚  β”‚                                                          β”‚ β”‚
β”‚  β”‚  OpenAI API (text-embedding-3-small, gpt-4o-transcribe) β”‚ β”‚
β”‚  β”‚  └── 768-dimension semantic embeddings, speech-to-text   β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Getting Started

Prerequisites

  • Node.js 20+ and npm or pnpm
  • Python 3.12+
  • Google Cloud credentials for Vertex AI access
  • OpenAI API key for embeddings and transcription

Installation

# Clone the repository
git clone https://github.com/nwaughachukwuma/cedar.git
cd cedar

# Install dependencies
pnpm install

# Install Python dependencies
cd api && uv pip install -e . && cd ..

# Configure environment variables
cp .env.example .env
# Edit .env with your API keys

# Start development servers
npm run dev

Building for Production

# Build the application
npm run build
npm run package

Project Structure

cedar/
β”œβ”€β”€ api/                         # Python FastAPI backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main.py              # FastAPI application entry
β”‚   β”‚   β”œβ”€β”€ _env.py              # Environment configuration
β”‚   β”‚   β”œβ”€β”€ constants.py         # API constants and endpoints
β”‚   β”‚   β”œβ”€β”€ logger.py            # Logging utilities
β”‚   β”‚   β”œβ”€β”€ chat_agent/          # Chat completions
β”‚   β”‚   β”‚   β”œβ”€β”€ base.py
β”‚   β”‚   β”‚   β”œβ”€β”€ no_streaming.py
β”‚   β”‚   β”‚   β”œβ”€β”€ use_openai.py
β”‚   β”‚   β”‚   └── with_streaming.py
β”‚   β”‚   β”œβ”€β”€ embeddings/          # Text embeddings
β”‚   β”‚   β”‚   β”œβ”€β”€ base.py
β”‚   β”‚   β”‚   β”œβ”€β”€ nvidia_nim.py
β”‚   β”‚   β”‚   └── utils.py
β”‚   β”‚   β”œβ”€β”€ image_agent/         # Medical image analysis
β”‚   β”‚   β”‚   β”œβ”€β”€ base.py
β”‚   β”‚   β”‚   β”œβ”€β”€ image_analysis.py
β”‚   β”‚   β”‚   β”œβ”€β”€ use_openai.py
β”‚   β”‚   β”‚   β”œβ”€β”€ utils.py
β”‚   β”‚   β”‚   └── nvidia_nim/
β”‚   β”‚   β”œβ”€β”€ speech_transcription/ # Speech-to-text
β”‚   β”‚   β”‚   β”œβ”€β”€ base.py
β”‚   β”‚   β”‚   β”œβ”€β”€ nvidia_nim.py
β”‚   β”‚   β”‚   └── use_openai.py
β”‚   β”‚   β”œβ”€β”€ summarization/       # Text summarization
β”‚   β”‚   β”‚   β”œβ”€β”€ base.py
β”‚   β”‚   β”‚   β”œβ”€β”€ use_openai.py
β”‚   β”‚   β”‚   └── utils.py
β”‚   β”‚   └── utils/               # Shared utilities
β”‚   β”‚       β”œβ”€β”€ medgemma_response.py
β”‚   β”‚       β”œβ”€β”€ nim_sdk.py
β”‚   β”‚       β”œβ”€β”€ openai_sdk.py
β”‚   β”‚       β”œβ”€β”€ parse_document.py
β”‚   β”‚       └── vertext_auth.py
β”‚   β”œβ”€β”€ pyproject.toml
β”‚   └── install.sh
β”‚
β”œβ”€β”€ electron/                     # Electron main process
β”‚   β”œβ”€β”€ main.ts                   # Application entry point
β”‚   β”œβ”€β”€ preload.ts                # IPC context bridge
β”‚   β”œβ”€β”€ defineEnv.ts              # Environment type definitions
β”‚   β”œβ”€β”€ ipc/
β”‚   β”‚   β”œβ”€β”€ index.ts              # IPC handler registration
β”‚   β”‚   β”œβ”€β”€ chatHandlers.ts       # Chat streaming handlers
β”‚   β”‚   β”œβ”€β”€ fileHandlers.ts       # File upload/management
β”‚   β”‚   β”œβ”€β”€ noteHandlers.ts       # Notes CRUD
β”‚   β”‚   β”œβ”€β”€ searchHandlers.ts     # Search handlers
β”‚   β”‚   β”œβ”€β”€ debugHandler.ts       # Debug utilities
β”‚   β”‚   └── helpers/              # IPC helper modules
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ database.ts           # SQLite database operations
β”‚   β”‚   β”œβ”€β”€ vectorStore.ts        # HNSW vector storage
β”‚   β”‚   β”œβ”€β”€ modelService.ts       # Model orchestration
β”‚   β”‚   β”œβ”€β”€ searchService.ts      # Search coordination
β”‚   β”‚   β”œβ”€β”€ speechToText.ts       # OpenAI gpt-4o-transcribe
β”‚   β”‚   β”œβ”€β”€ documentProcessor.ts  # Document processing
β”‚   β”‚   └── imageProcessor.ts     # Image processing
β”‚   β”œβ”€β”€ workers/
β”‚   β”‚   β”œβ”€β”€ workerManager.ts      # Background worker management
β”‚   β”‚   └── worker.js             # Worker script
β”‚   └── utils/
β”‚       β”œβ”€β”€ fileProcessingQueue.ts # Async processing queue
β”‚       β”œβ”€β”€ runMigrations.ts       # Database migrations
β”‚       └── ...
β”‚
β”œβ”€β”€ src/                          # React frontend
β”‚   β”œβ”€β”€ App.tsx                   # Main application component
β”‚   β”œβ”€β”€ main.tsx                  # React entry point
β”‚   β”œβ”€β”€ components/               # React components
β”‚   β”‚   β”œβ”€β”€ FileList.tsx          # Document browser
β”‚   β”‚   β”œβ”€β”€ FileDetailView.tsx    # Document viewer + chat
β”‚   β”‚   β”œβ”€β”€ FilePreview.tsx       # Document viewer
β”‚   β”‚   β”œβ”€β”€ ChatPanel.tsx         # Chat interface
β”‚   β”‚   β”œβ”€β”€ ChatInput.tsx         # Message input component
β”‚   β”‚   β”œβ”€β”€ SearchBar.tsx         # Semantic search bar
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ stores/                   # Zustand state stores
β”‚   β”‚   β”œβ”€β”€ fileStore.ts
β”‚   β”‚   β”œβ”€β”€ filesStore.ts
β”‚   β”‚   β”œβ”€β”€ chatStore.ts
β”‚   β”‚   β”œβ”€β”€ messageStore.ts
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ lib/                      # Utilities and hooks
β”‚   └── types/                    # TypeScript type definitions
β”‚
β”œβ”€β”€ migrations/                   # SQLite migrations
β”œβ”€β”€ tests/                        # Test suite
β”œβ”€β”€ docs/                         # Documentation
β”œβ”€β”€ dist-electron/                # Built Electron application
β”œβ”€β”€ package.json
└── README.md

Environment Variables

# API Configuration
OPENAI_API_KEY=sk-...
GRANIAN_WORKERS=4
APP_ENV=dev

# Google Cloud (Vertex AI)
# Ensure gcloud CLI is authenticated

Data Model

Core Tables

Table Description
files Uploaded documents and images
chunks Document content segments for RAG
embeddings Vector embedding metadata
annotations Image analysis results
chat_sessions Chat conversation sessions
chat_messages Individual chat messages
notes Professional notes
processing_queue Async job tracking

See migrations/ for complete schema.

API Endpoints

Endpoint Method Description
/health-check GET Health check
/analyze-image POST MedGemma image analysis
/extract POST Document content extraction
/chat POST Chat completions
/get-embeddings POST Generate text embeddings
/get-transcription POST Speech-to-text transcription
/summarize-text POST Text summarization

Development

# Run development server
pnpm dev

# Run tests
pnpm test

# Lint and format
pnpm lint
pnpm format

# Type check
pnpm typecheck

Contributing

  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

License

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

Disclaimer

Cedar is a clinical decision support tool. It is not intended to replace professional medical judgment or diagnosis. Always verify AI-generated insights with qualified healthcare providers.


Cedar – Empowering healthcare professionals with AI

About

a clinical decision support system with advanced medical document intelligence

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages