Skip to content

Latest commit

 

History

History
214 lines (137 loc) · 2.43 KB

File metadata and controls

214 lines (137 loc) · 2.43 KB

Getting Started

Prerequisites

Before running MaterialGraph, ensure the following are installed:

  • Python 3.11+
  • PostgreSQL 15+
  • Git
  • Materials Project API Key

Clone Repository

git clone https://github.com/<your-username>/materialgraph.git
cd materialgraph

Create Virtual Environment

python -m venv .venv

Activate:

Windows

.venv\Scripts\activate

Linux / macOS

source .venv/bin/activate

Install Dependencies

pip install -r requirements.txt

Configure Environment Variables

Create a .env file:

DATABASE_URL=postgresql+psycopg://postgres:postgres@localhost/materialgraph

MP_API_KEY=your_materials_project_api_key

Create Database

PostgreSQL:

CREATE DATABASE materialgraph;

Run Database Migrations

alembic upgrade head

Import Battery Material Candidates

MaterialGraph imports a curated set of battery-relevant candidates from Materials Project.

python scripts/import_materials_project.py

Verify import:

python scripts/check_import_counts.py

Example output:

Materials: 28
Elements: 9
MaterialElements: 94

Start API Server

uvicorn app.main:app --reload

Server:

http://127.0.0.1:8000

Swagger UI:

http://127.0.0.1:8000/docs

Run Tests

Run all tests:

pytest

Run specific test groups:

pytest tests/services
pytest tests/api

Example Workflows

Candidate Screening

POST /api/v1/screening/candidates

Evaluate battery material candidates under:

  • lithium scarcity
  • cobalt avoidance
  • stability constraints
  • supply-risk constraints

Candidate Comparison

POST /api/v1/comparison/materials

Compare two candidate materials and receive:

  • screening scores
  • risk scores
  • ranking explanations

Scenario Ranking

POST /api/v1/scenarios/rank

Rank candidates under scenarios such as:

  • lithium_supply_shock
  • cobalt_avoidance
  • low_supply_risk

Sensitivity Analysis

POST /api/v1/sensitivity/material

Analyze candidate robustness under changing supply-risk conditions.


Substitution Analysis

POST /api/v1/substitutions/analyze

Identify alternative candidate materials based on:

  • chemistry similarity
  • risk profile
  • substitution potential