BioLens is a privacy-focused healthcare accessibility application that combines natural language processing and computer vision to provide preliminary health assessments. The system processes user-submitted symptom descriptions and medical images to generate risk assessments and provide guidance toward appropriate medical care.
The system follows a microservices architecture with clean separation between:
- Frontend (Next.js): Conversational chat interface with image upload
- Backend (FastAPI): API gateway and orchestration layer
- BioMed Clip Service: Medical Image extraction and symptom analysis
- Fusion Classifier: Classify on embedded image and text
- Image Analysis Service: Computer vision for medical image analysis
- Redis: Session management and caching
- Docker and Docker Compose
- Node.js 18+ (for local frontend development)
- Python 3.11+ (for local backend development)
- Poetry (for Python dependency management)
-
Clone the repository
git clone <repository-url> cd biolens-symptom-checker
-
Set up environment variables
cp .env.example .env cp backend/.env.example backend/.env cp frontend/.env.example frontend/.env.local
-
Start development environment
# Using Docker Compose (recommended) docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d # Or using the setup script (Linux/macOS) ./scripts/dev-setup.sh
-
Access the services
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- BioMed & Fusion Classifier Service: http://localhost:8001
- Image Analysis Service: http://localhost:8002
- API Documentation: http://localhost:8000/docs
If you prefer to run services individually:
-
Start Redis
docker run -d -p 6379:6379 redis:7-alpine
-
Backend
cd backend poetry install poetry run uvicorn app.main:app --reload --port 8000 -
BioBERT Service
cd ml-services/biobert-service poetry install poetry run uvicorn app.main:app --reload --port 8001 -
Image Analysis Service
cd ml-services/image-analysis-service poetry install poetry run uvicorn app.main:app --reload --port 8002 -
Frontend
cd frontend npm install npm run dev
biolens-symptom-checker/
βββ frontend/ # Next.js frontend application
β βββ src/
β β βββ app/ # Next.js app router
β β βββ components/ # React components
β βββ Dockerfile
β βββ package.json
βββ backend/ # FastAPI backend service
β βββ app/
β β βββ main.py # FastAPI application
β β βββ config.py # Configuration settings
β βββ Dockerfile
β βββ pyproject.toml
βββ ml-services/ # ML microservices
β βββ biobert-service/ # BioBERT NLP service
β βββ image-analysis-service/ # Computer vision service
βββ scripts/ # Development scripts
βββ .github/workflows/ # CI/CD pipelines
βββ docker-compose.yml # Production Docker Compose
βββ docker-compose.dev.yml # Development overrides
βββ README.md
# Backend tests
cd backend
poetry run pytest
# BioBERT service tests
cd ml-services/biobert-service
poetry run pytest
# Image analysis service tests
cd ml-services/image-analysis-service
poetry run pytest
# Frontend tests (when implemented)
cd frontend
npm testThe project uses property-based testing with Hypothesis for Python services to ensure correctness across a wide range of inputs. Tests are designed to validate the correctness properties defined in the design document.
# Start all services
docker-compose up -d
# Start with development overrides
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
# View logs
docker-compose logs -f [service-name]
# Stop services
docker-compose down
# Rebuild services
docker-compose build
# Clean up everything
docker-compose down -v --rmi all# Backend
cd backend
poetry install # Install dependencies
poetry run uvicorn app.main:app --reload # Start development server
poetry run pytest # Run tests
poetry run black . # Format code
poetry run isort . # Sort imports
# Frontend
cd frontend
npm install # Install dependencies
npm run dev # Start development server
npm run build # Build for production
npm run lint # Run linting
npm run type-check # Type checkingDEBUG: Enable debug modeSECRET_KEY: JWT secret keyREDIS_URL: Redis connection URLFIREBASE_CREDENTIALS_PATH: Path to Firebase credentialsGEMINI_API_KEY: Google Gemini API key
NEXT_PUBLIC_API_URL: Backend API URL
# Build all services for production
docker-compose build
# Start production environment
docker-compose up -d- Development: Uses
docker-compose.dev.ymlwith hot reloading - Production: Uses base
docker-compose.ymlwith optimized builds
BioLens prioritizes user privacy and data protection:
- On-device processing where technically feasible
- Automatic data cleanup within 24 hours
- Encrypted data transmission for cloud processing
- No PII storage without explicit consent
- Medical disclaimers on all health assessments
The implementation addresses the following key requirements:
- Requirement 7.1: Clean separation between frontend, backend, and ML components
- Requirement 8.3: Proper configuration management for different environments
- Performance: Response times under 10s for text, 30s for images
- Privacy: Automatic data cleanup and encryption
- Medical Ethics: Comprehensive disclaimers and escalation
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and ensure they pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Check the API documentation at
/docsendpoints - Review the requirements and design documents in
.kiro/specs/ - Check Docker logs:
docker-compose logs -f [service-name] - Ensure all environment variables are properly configured