Before running MaterialGraph, ensure the following are installed:
- Python 3.11+
- PostgreSQL 15+
- Git
- Materials Project API Key
git clone https://github.com/<your-username>/materialgraph.git
cd materialgraphpython -m venv .venvActivate:
Windows
.venv\Scripts\activateLinux / macOS
source .venv/bin/activatepip install -r requirements.txtCreate a .env file:
DATABASE_URL=postgresql+psycopg://postgres:postgres@localhost/materialgraph
MP_API_KEY=your_materials_project_api_keyPostgreSQL:
CREATE DATABASE materialgraph;alembic upgrade headMaterialGraph imports a curated set of battery-relevant candidates from Materials Project.
python scripts/import_materials_project.pyVerify import:
python scripts/check_import_counts.pyExample output:
Materials: 28
Elements: 9
MaterialElements: 94
uvicorn app.main:app --reloadServer:
http://127.0.0.1:8000
Swagger UI:
http://127.0.0.1:8000/docs
Run all tests:
pytestRun specific test groups:
pytest tests/servicespytest tests/apiPOST /api/v1/screening/candidates
Evaluate battery material candidates under:
- lithium scarcity
- cobalt avoidance
- stability constraints
- supply-risk constraints
POST /api/v1/comparison/materials
Compare two candidate materials and receive:
- screening scores
- risk scores
- ranking explanations
POST /api/v1/scenarios/rank
Rank candidates under scenarios such as:
- lithium_supply_shock
- cobalt_avoidance
- low_supply_risk
POST /api/v1/sensitivity/material
Analyze candidate robustness under changing supply-risk conditions.
POST /api/v1/substitutions/analyze
Identify alternative candidate materials based on:
- chemistry similarity
- risk profile
- substitution potential