Skip to content

andreazedda/bmyCure4MM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

99 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

bmyCure4MM 🧬

A comprehensive Django-based platform for Multiple Myeloma research, clinical decision support, and drug discovery.

License: MIT Python 3.10+ Django 4.2+

image

🎯 Overview

bmyCure4MM is an integrated research platform that combines:

  • πŸ”¬ Drug Discovery Tools - Molecular structure analysis, ADME property calculation, and similarity search
  • πŸ’Š PKPD Simulation - Pharmacokinetic/pharmacodynamic modeling for treatment optimization
  • πŸ‘€ Digital Patient Twins - Virtual patient modeling for personalized treatment planning
  • πŸ“Š Clinical Decision Support - Evidence-based scenario management with educational validation
  • πŸ§ͺ Computational Biology - Integration with PDB, molecular visualization, and cheminformatics

Perfect for researchers, clinicians, and students working on multiple myeloma treatment optimization and drug discovery.


✨ Key Features

πŸ”¬ ChemTools - Drug Discovery Suite

  • 3D Molecular Visualization: Interactive py3Dmol-based structure viewer
  • Similarity Search: Find similar compounds using RDKit fingerprints (best-effort; if RDKit isn’t available in your environment, similarity scoring may be omitted)
  • ADME Prediction: Calculate drug-like properties (Lipinski's Rule of Five)
  • PDB Integration: Fetch and analyze protein structures from Protein Data Bank
  • Structure Caching: Fast retrieval of previously analyzed molecules

πŸ’Š Simulator - PKPD Modeling

  • Treatment Optimization: Bayesian optimization with Optuna for finding optimal drug regimens
  • Virtual Patients: 7 clinical archetypes (newly diagnosed, refractory, frail elderly, etc.)
  • Mathematical Models: Differential equation-based tumor growth and drug response models
  • Clinical Scenarios: Educational case studies with comprehensive validation
  • Difficulty Scoring: Auto-calculated complexity for training scenarios
  • πŸ“Š NEW: Interactive Plot Embedding: Inline Plotly visualizations with embed-safe rendering

πŸ‘₯ Clinic - Patient Management

  • Patient record management with comprehensive history tracking
  • Clinical assessments tracking (lab values, biomarkers)
  • Treatment history documentation
  • 🎯 NEW: AI-Powered Decision Support System:
    • Automatic interpretation of simulation results
    • Priority-ranked actionable recommendations (Critical/High/Medium/Low)
    • Smart accordion UI that opens automatically on warnings
    • Direct links to modify scenarios and implement suggestions
    • Specific numerical guidance ("Reduce doses by 20-30%", "Extend horizon to 224 days")
    • 6 intelligent scenarios: high toxicity, low efficacy, tumor growth, early recurrence, moderate toxicity, favorable balance
    • Step-by-step implementation guides
    • Bilingual support (English/Italian)
  • CRUD operations with role-based access

πŸ“š Docs Viewer

  • Multi-language documentation (English/Italian)
  • Markdown rendering with syntax highlighting
  • Search functionality
  • Contextual help system

πŸš€ Quick Start (For Learners & New Users)

Want to learn how to simulate treatments? Start here! πŸ‘‡

πŸŽ“ Option 1: Quick Start with Demo Data (Recommended)

Perfect for learning the platform without creating data manually:

# Clone the repository
git clone https://github.com/andreazedda/bmyCure4MM.git
cd bmyCure4MM

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# πŸŽ‰ ONE-COMMAND SETUP with demo patients!
./quick_start.sh

# Start the server
python manage.py runserver

βœ… You now have:

  • βœ“ 3 demo patients (high/medium/low risk)
  • βœ“ 4 pre-filled clinical assessments
  • βœ“ Admin user admin with a random password printed by ./quick_start.sh
  • βœ“ Ready to simulate treatments immediately!

πŸ“– Next Step: Visit http://127.0.0.1:8000 and look for the blue "πŸš€ New to the Platform?" card on the dashboard. It will guide you through your first simulation step-by-step.


πŸ”§ Option 2: Manual Setup

For production or custom setup:

# Clone the repository
git clone https://github.com/andreazedda/bmyCure4MM.git
cd bmyCure4MM

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Set up environment variables (optional)
cp .env.example .env

# IMPORTANT: Generate and set DJANGO_SECRET_KEY
# Generate a secure key:
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
# Copy the output and add to .env file:
# DJANGO_SECRET_KEY=<paste-generated-key-here>

# Run database migrations
python manage.py migrate

# Create a superuser (admin)
python manage.py createsuperuser

# Install Redis (if not already installed)
# macOS: brew install redis
# Linux: sudo apt-get install redis-server
# Windows: https://github.com/microsoftarchive/redis/releases

Running the Application

Option 1: All services with one command (Recommended)

./start_dev.sh

This starts Redis, Celery, and Django development server automatically.

Option 2: Without background tasks (Development)

export CELERY_TASK_ALWAYS_EAGER=True
python manage.py runserver 8001

Option 3: Docker Compose (Most Portable)

docker-compose up -d

Visit http://127.0.0.1:8001 in your browser.


πŸ“– Documentation

Comprehensive documentation is available in the /docs directory:

Quick Links

Topic Documentation
Getting Started Quickstart Guide
PKPD Simulation Simulator Docs
Patient Twins Digital Twin System
πŸ†• Decision Support AI Assistant Guide
Drug Discovery ChemTools Guide
Mathematical Models PKPD Models
Embed Debugging Iframe Troubleshooting
Troubleshooting Common Issues

πŸ—οΈ Project Structure

bmyCure4MM/
β”œβ”€β”€ chemtools/          # Drug discovery and molecular analysis
β”œβ”€β”€ simulator/          # PKPD simulation and optimization
β”œβ”€β”€ clinic/             # Patient management
β”œβ”€β”€ docs_viewer/        # Documentation system
β”œβ”€β”€ modules/            # Standalone analysis modules
β”‚   β”œβ”€β”€ binding_visualizer/
β”‚   └── lipinski_analyzer/
β”œβ”€β”€ pipelines/          # Data processing pipelines
β”œβ”€β”€ lab/                # Research notebooks and experiments
β”œβ”€β”€ docs/               # Comprehensive documentation
β”œβ”€β”€ templates/          # HTML templates
β”œβ”€β”€ static/             # CSS, JavaScript, images
└── tests/              # Test suites

πŸ”¬ Use Cases

For Researchers

  • Evaluate drug candidates using ADME predictions
  • Run PKPD simulations to understand drug kinetics
  • Optimize treatment protocols using virtual patients
  • Analyze protein-ligand interactions

For Clinicians

  • Access evidence-based treatment scenarios
  • Understand drug dosing guidelines and contraindications
  • Learn about risk stratification and patient assessment
  • Review clinical decision support recommendations

For Educators

  • Create educational clinical scenarios with difficulty scoring
  • Teach pharmacology through interactive simulations
  • Demonstrate drug-target interactions with 3D visualization
  • Assess learner understanding through scenario challenges

For Students

  • Learn PKPD concepts through hands-on simulation
  • Practice clinical decision-making with virtual patients
  • Explore drug discovery through molecular analysis
  • Understand mathematical modeling in medicine

πŸ§ͺ Testing

# Run all tests
python manage.py test

# Run specific app tests
python manage.py test simulator
python manage.py test chemtools

# Run with coverage
coverage run --source='.' manage.py test
coverage report

# Run with verbose output
python manage.py test -v 2

🧬 Design / Simulation Report (MVP)

An early design/simulation engine prototype can generate a JSON report with:

  • TP/FP tradeoffs + Pareto front
  • Bulk vs reservoir dynamics (with subclone evolution)
  • Relapse forecast proxy
  • Mechanistic toxicity decomposition + rationale

Generate report (CLI)

python manage.py generate_design_report --out artifacts/design_report.json

Fetch report (HTTP)

  • GET /api/design-report/
  • Optional query params: seed, steps, dt_days
curl 'http://127.0.0.1:8001/api/design-report/?seed=123&steps=12&dt_days=7'

Current Test Coverage: 94% (30/32 tests passing)


🀝 Contributing

We welcome contributions from the community! Whether you're fixing bugs, adding features, improving documentation, or suggesting ideas, your help is appreciated.

How to Contribute

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

See CONTRIBUTING.md for detailed guidelines.

Development Setup

# Install dev dependencies
pip install -r requirements.txt

# Run tests before committing
python manage.py test

# Check code style (optional)
ruff check .

πŸ“Š Technology Stack

Backend

  • Django 4.2+ - Web framework
  • Django REST Framework - API development
  • Celery - Asynchronous task queue
  • Redis - Message broker and caching

Scientific Computing

  • NumPy & SciPy - Numerical computing and ODE solving
  • RDKit - Cheminformatics and molecular analysis
  • BioPython - Biological structure parsing
  • Optuna - Bayesian optimization
  • py3Dmol - 3D molecular visualization

Frontend

  • HTMX - Dynamic HTML without JavaScript frameworks
  • Alpine.js - Lightweight reactive components
  • Chart.js - Interactive charts and visualizations
  • Custom CSS - Responsive design

Database

  • SQLite (development) / PostgreSQL (production-ready)

πŸ” Security & Privacy

This repository is prepared for public release with:

  • βœ… No hardcoded credentials or API keys
  • βœ… Environment variable configuration (see .env.example)
  • βœ… No absolute filesystem paths
  • βœ… Comprehensive .gitignore for sensitive files
  • βœ… CSRF protection and secure session handling
  • βœ… SQL injection prevention through Django ORM

Important: Never commit:

  • .env files with real credentials
  • Database files (*.sqlite3, *.db)
  • API keys or secrets
  • User data or media uploads

πŸ“„ License

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

MIT License

Copyright (c) 2024 Andrea Zedda

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

πŸ‘€ Author

Andrea Zedda


πŸ™ Acknowledgments

  • Multiple Myeloma research community
  • Open-source contributors
  • Django and Python communities
  • RDKit and BioPython developers
  • Clinical collaborators and advisors

πŸ“ž Support & Contact


πŸ—ΊοΈ Roadmap

Upcoming Features

  • PostgreSQL migration guide
  • Enhanced API documentation with Swagger/OpenAPI
  • Real-time collaboration features
  • Mobile-responsive interface improvements
  • Integration with external drug databases (DrugBank, ChEMBL)
  • Machine learning models for response prediction
  • Multi-user simulation sessions
  • Export/import clinical scenarios

Research Goals

  • Validate PKPD models against clinical trial data
  • Expand virtual patient library
  • Add more multiple myeloma drugs to library
  • Integrate pharmacogenomics data
  • Develop resistance prediction models

πŸ“ˆ Project Status

Active Development - This project is actively maintained and welcomes contributions.

  • Latest Release: v1.0.0
  • Last Updated: November 2024
  • Test Coverage: 94%
  • Documentation: Comprehensive

⭐ If you find this project useful, please consider giving it a star on GitHub!