Skip to content

Repository files navigation

HealthLens

MIT License Vite FastAPI Node.js PostgreSQL

Table of Contents


Overview

HealthLens is an AI-powered medical report analysis platform for healthcare professionals and patients. It enables instant upload, analysis, and summarization of medical reports and images using advanced AI models.

Features

  • Upload and analyze PDF medical reports and images (PNG, JPG, JPEG)
  • AI-powered doctor-level and patient-level summaries
  • OCR for medical images
  • RESTful API for integration
  • User authentication (TODO: expand details)
  • Patient management dashboard (TODO: expand details)
  • Secure file storage
  • Scalable backend with PostgreSQL
  • Modern React frontend with shadcn-ui and Tailwind CSS

Tech Stack

  • Frontend: Vite, React, TypeScript, shadcn-ui, Tailwind CSS
  • Backend: Node.js, Express, Sequelize, Multer, PostgreSQL
  • AI Service: Python (FastAPI, pdfplumber, Pillow, pytesseract, google-generativeai)
  • AI Service: Python (FastAPI, pdfplumber, Pillow, pytesseract, Genkit)
  • Other: Docker (TODO: confirm usage), GitHub Actions (TODO: confirm usage)

Installation

Genkit (LLM Integration)

Genkit is a flexible framework for integrating Large Language Models (LLMs) into your Python applications. You can use Genkit to connect to various LLM providers and switch between them easily.

Installation

pip install genkit

Basic Usage Example

from genkit import LLM

# Initialize an LLM (example: OpenAI)
llm = LLM(provider="openai", api_key="YOUR_OPENAI_API_KEY")

# Generate a response
response = llm.generate("Summarize this medical report:", input_text)
print(response)

Configuration

  • Add your LLM provider API keys and settings to python/.env (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.)
  • Update your Python service to use Genkit for all LLM tasks.

For more details, see the Genkit documentation.

Prerequisites

  • Node.js & npm
  • Python 3.10+
  • PostgreSQL

Step-by-Step Setup

Frontend

cd frontend
npm install
npm run dev

Backend (Node.js)

cd backend
npm install
npm start

Python AI Service

cd python
pip install -r requirements.txt
python server.py

Database

  • Ensure PostgreSQL is running and credentials are set in .env files (see Configuration).

Usage Examples

Uploading a Medical Report (API)

import requests
files = {'file': open('lab.pdf', 'rb')}
response = requests.post('http://localhost:8000/analyze-report', files=files)
print(response.json())

Frontend Usage

  • Visit http://localhost:8080 and use the dashboard to upload and analyze reports.

Configuration

  • Backend: Set environment variables in backend/.env (DB, DB_USER, DB_PASSWORD, HOST, etc.)
  • Python: Set OPENAI_API_KEY in python/.env
  • Python: Configure Genkit in python/.env for LLM usage
  • Frontend: Edit config files as needed (see vite.config.ts, tailwind.config.ts)
  • TODO: Document all config options and secrets

Project Structure

HealthLens/
├── backend/        # Node.js API, uploads, database
├── frontend/       # React app, UI components
├── python/         # FastAPI AI service, report analysis
├── LICENSE         # MIT License
  • backend/: Express server, file uploads, database models
  • frontend/: Vite+React app, shadcn-ui, Tailwind CSS
  • python/: FastAPI service, AI pipeline, OCR, PDF/image processing

API Documentation

Python FastAPI Endpoints

  • POST /analyze-report: Upload and analyze medical report/image
  • GET /health: Health check
  • POST /process: Process message from frontend
  • GET /hello: Test endpoint
  • TODO: Document Node.js backend endpoints

Request/Response Example

  • Request: multipart/form-data with file
  • Response: JSON with doctor_summary, patient_summary, metadata

Testing Instructions

  • Frontend:
    • npm run lint (ESLint)
    • Manual UI testing (TODO: add automated tests)
  • Backend:
    • npm test (placeholder)
    • Manual API testing (TODO: add automated tests)
  • Python:
    • Run test_api.sh for API tests
    • Run test_pdf.py, test_images.py for unit tests

Deployment Guide

  • Frontend: Deploy via Lovable or Vercel (TODO: add steps)
  • Backend: Deploy Node.js server (TODO: add steps)
  • Python: Deploy FastAPI service (TODO: add steps)
  • Database: Provision PostgreSQL (TODO: add steps)
  • TODO: Add Docker/CI/CD instructions if available

Contributions

  • Fork the repo, create feature branches, follow commit conventions, submit PRs.

Security Practices

  • MIT License
  • .env files are gitignored
  • Uses bcrypt for password hashing
  • TODO: Add more security details and practices

Performance Notes

  • FastAPI and Express are optimized for high throughput
  • Uses async processing for uploads and AI analysis
  • TODO: Add benchmarks and performance metrics

Scalability Considerations

  • Modular architecture: separate frontend, backend, AI service

  • PostgreSQL for scalable data storage

  • Multer for efficient file uploads

  • TODO: Add horizontal scaling, cloud deployment notes

  • Author

Created by abhishekmallav, Prathmesh9523, Yashwant1566

This project is licensed under the MIT License.

Releases

Packages

Contributors

Languages