How mahakagarwal7/diffucat works
Purpose and entry points
DiffuCat is a catalyst-discovery platform: it accepts molecular SMILES, runs GNN-based prediction/generation/ranking workflows, exposes lab-validation operations, and presents results in a Next.js research console with 3D molecular views. Backend entry point: src/backend/main.py; frontend route root: frontend/app/page.tsx; primary researcher workspace: frontend/app/(main)/dashboard/page.tsx.
API and orchestration boundary
FastAPI separates UI clients from scientific services through versioned endpoints for candidate generation, property prediction, ranking, and lab submission. API handlers should remain transport-facing and delegate workflow logic to services.
• src/backend/api/v1/generate.py
• src/backend/api/v1/predict.py
• src/backend/api/v1/rank.py
• src/backend/api/v1/lab.py
• src/backend/services/pipeline.py
Molecular ML pipeline
The core pipeline converts chemical data into model-ready representations, trains or invokes predictive models, and produces candidate-level properties/uncertainty for downstream ranking and visualization. Diffusion-based generation and predictor inference are distinct model concerns.
• src/data/processor.py
• src/models/diffusion.py
• src/models/predictor.py
• src/training/trainer.py
Selection, learning, and explainability
Post-inference services prioritize molecules, select informative candidates for active-learning cycles, and derive interpretable signals intended for structural uncertainty display. This is the decision layer between raw model output and user/lab actions.
• src/services/ranking.py
• src/services/active_learning.py
• src/services/explainability.py
Validation and laboratory integration
Candidates can be validated through interchangeable engines: mock execution, local ORCA computation, or a cloud API. A validation manager abstracts engine selection; the backend lab client connects digital pipeline outcomes to external or simulated laboratory workflows.
• src/validation/manager.py
• src/validation/engines/orca.py
• src/validation/engines/cloud_api.py
• src/backend/services/lab_client.py
Asynchronous and live execution
Celery supports non-blocking prediction work, while WebSocket functionality supports live visualization/status delivery. This boundary prevents long-running inference or validation from blocking HTTP request handling. Required broker/result infrastructure is implied by Celery configuration and Docker Compose.
• src/backend/core/celery_app.py
• src/backend/tasks/predict_tasks.py
• src/backend/websockets/visualization.py
• docker/docker-compose.yml
Research UI and visualization
The Next.js frontend provides discovery input/results, laboratory job tracking, and interactive 3D molecular rendering via 3Dmol.js. Client hooks/store form the UI state boundary for molecule and lab-job data; API connectivity is expected to target the FastAPI service.
• frontend/components/discovery/DashboardUI.jsx
• frontend/components/discovery/MoleculeInput.tsx
• frontend/components/visualization/Molecule3DViewer.tsx
• frontend/components/lab/OptimizationConsole.tsx
• frontend/store/discovery.ts
Data, reproducibility, and deployment
DVC governs reproducible data assets/pipelines; configuration is split between shared and backend settings. Docker supplies deployable service composition. Persisted example and DFT outputs under results/ act as local artifacts for validation/demo workflows.
• dvc.yaml
• configs/default.yaml
• configs/backend.yaml
• docker/Dockerfile
• results/dft_validation.json
Main entry points: predictor.py Property predictor · generate.py Versioned API · manager.py Validation manager · processor.py Molecular processor
Components 23
Research Console
- Research dashboard
frontend/app/(main)/dashboard/page.tsx - Discovery UI
frontend/components/discovery/DashboardUI.jsx - Discovery state · Molecule and lab-job UI state boundary.
frontend/store/discovery.ts - 3D molecule viewer
frontend/components/visualization/Molecule3DViewer.tsx
FastAPI & Workflows
- Versioned API · Generation, prediction, ranking, and lab endpoints.
src/backend/api/v1/generate.py - Workflow pipeline · Orchestrates scientific workflow requests.
src/backend/services/pipeline.py - Lab client
src/backend/services/lab_client.py
Molecular ML
- Molecular processor · Converts chemical inputs to model-ready representations.
src/data/processor.py - Diffusion generator
src/models/diffusion.py - Property predictor · Produces candidate properties and uncertainty.
src/models/predictor.py - Model training
src/training/trainer.py
Decision Layer
- Candidate ranking
src/services/ranking.py - Active learning · Selects informative candidates for learning cycles.
src/services/active_learning.py - Structural explanations · Derives signals for uncertainty display.
src/services/explainability.py
Validation
- Validation manager · Selects mock, local, or cloud validation engines.
src/validation/manager.py - ORCA engine
src/validation/engines/orca.py - Cloud validation
src/validation/engines/cloud_api.py - DFT result artifacts · Persisted validation and demo outputs.
results/dft_validation.json
Async & Delivery
- Celery app
src/backend/core/celery_app.py - Prediction tasks · Moves long-running prediction off HTTP requests.
src/backend/tasks/predict_tasks.py - Live visualization · Streams status and visualization updates.
src/backend/websockets/visualization.py - Service composition · Supplies deployable services and Celery broker/result infrastructure.
docker/docker-compose.yml
Other components
- Data reproducibility
dvc.yaml
Connections 24
- Research dashboard → Discovery UI: renders
- Discovery UI → Discovery state: reads/writes
- Discovery state → Versioned API: API requests
- Versioned API → Workflow pipeline: delegates
- Versioned API → Lab client: lab submission
- Versioned API → Prediction tasks: queues prediction
- Prediction tasks → Celery app: runs on
- Celery app → Service composition: uses broker/results
- Workflow pipeline → Molecular processor: prepares SMILES
- Molecular processor → Diffusion generator: model inputs
- Molecular processor → Property predictor: model inputs
- Diffusion generator → Property predictor: generated candidates
- Property predictor → Candidate ranking: properties & uncertainty
- Candidate ranking → Active learning: prioritized candidates
- Property predictor → Structural explanations: model outputs
- Candidate ranking → Lab client: selected candidates
- Lab client → Validation manager: validation request
- Validation manager → ORCA engine: local engine
- Validation manager → Cloud validation: cloud engine
- Validation manager → DFT result artifacts: writes outputs
- Live visualization → 3D molecule viewer: streams status/structures
- Discovery state → 3D molecule viewer: molecule data
- Property predictor → Model training: trained by
- Data reproducibility → Molecular processor: versioned data