loading…
Search for a command to run...
loading…
Provides over 300 medical calculator tools for AI assistants, supporting evidence-based medicine through modular API endpoints.
Provides over 300 medical calculator tools for AI assistants, supporting evidence-based medicine through modular API endpoints.
Modular API for medical calculations and scores developed with FastAPI, originally designed for Nobra, our AI research agent for medical doctors.
🚀 Try it now at: https://calculator.nobra.app.br/docs
Nobra Calculator is a scalable REST API that allows the calculation of various medical scores and indices. Originally developed as part of the Nobra ecosystem at Nobrega MedTech, we've decided to open-source this powerful tool to benefit the global medical community.
Our company specializes in AI solutions for healthcare, focusing on academic support and medical decision-making tools. This calculator represents our commitment to advancing evidence-based medicine through technology.
git clone https://github.com/danielxmed/nobra_calculator.git
cd nobra_calculator
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
python main.py
The API will be available at http://localhost:8000
http://localhost:8000/docshttp://localhost:8000/redochttp://localhost:8000/healthGET /api/scores - Lists all available scoresGET /api/scores/{score_id} - Metadata for a specific scoreGET /api/categories - Lists medical categoriesPOST /api/reload - Reloads scores and calculatorsEach score also has its dedicated endpoint:
POST /ckd_epi_2021 - CKD-EPI 2021POST /cha2ds2_vasc - CHA₂DS₂-VASc
...GET /health - API health checkGET / - API informationnobra_calculator/
├── app/
│ ├── models/
│ │ ├── shared.py # Common models and enums
│ │ └── scores/ # Score models by specialty
│ │ ├── cardiology/
│ │ ├── nephrology/
│ │ ├── pulmonology/
│ │ └── ...
│ ├── routers/
│ │ ├── scores.py # Main router with common endpoints
│ │ └── scores/ # Score endpoints by specialty
│ │ ├── cardiology/
│ │ ├── nephrology/
│ │ └── ...
│ └── services/ # Business Logic
├── calculators/ # Calculation Modules
├── scores/ # Score Metadata (JSON)
├── main.py # Main application
└── requirements.txt # Dependencies
To add a new score:
Create /scores/{score_id}.json with the score metadata:
{
"id": "new_score",
"title": "Score Title",
"description": "Detailed description",
"category": "medical_specialty",
"parameters": [...],
"result": {...},
"interpretation": {...}
}
Create /calculators/{score_id}.py:
def calculate_new_score(param1, param2):
# Calculation logic
result = ...
return {
"result": result,
"unit": "unit",
"interpretation": "interpretation"
}
Create /app/models/scores/{specialty}/{score_id}.py:
from pydantic import BaseModel, Field
class NewScoreRequest(BaseModel):
"""Request model for New Score"""
param1: str = Field(..., description="Parameter 1")
param2: float = Field(..., description="Parameter 2")
class NewScoreResponse(BaseModel):
"""Response model for New Score"""
result: float = Field(..., description="Calculation result")
unit: str = Field(..., description="Result unit")
interpretation: str = Field(..., description="Clinical interpretation")
Create /app/routers/scores/{specialty}/{score_id}.py:
from fastapi import APIRouter, HTTPException
from app.models.scores.{specialty}.{score_id} import NewScoreRequest, NewScoreResponse
from app.services.calculator_service import calculator_service
router = APIRouter()
@router.post("/new_score", response_model=NewScoreResponse)
async def calculate_new_score(request: NewScoreRequest):
"""Calculate New Score"""
try:
result = calculator_service.calculate_score("new_score", request.dict())
return NewScoreResponse(**result)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
/app/models/scores/{specialty}/__init__.py/app/routers/scores/{specialty}/__init__.pycurl -X POST http://localhost:8000/api/reload
# Health check
curl http://localhost:8000/health
# List scores
curl http://localhost:8000/api/scores
# Calculate CKD-EPI 2021 (Live API)
curl -X POST https://calculator.nobra.app.br/ckd_epi_2021 \
-H "Content-Type: application/json" \
-d '{"sex": "female", "age": 65, "serum_creatinine": 1.2}'
# Calculate CKD-EPI 2021 (Local)
curl -X POST http://localhost:8000/ckd_epi_2021 \
-H "Content-Type: application/json" \
-d '{"sex": "female", "age": 65, "serum_creatinine": 1.2}'
We welcome contributions from the medical and developer communities! This project is part of our mission to democratize access to evidence-based medical tools.
git checkout -b feature/amazing-new-score)git commit -am 'Add APACHE II score')git push origin feature/amazing-new-score)This project is licensed under Apache 2.0. See the LICENSE file for details.
Daniel Nobrega Medeiros
Nobrega MedTech - AI Solutions for Healthcare
This calculator was originally developed as a component of Nobra, our comprehensive AI research agent designed to assist medical doctors with:
By open-sourcing this calculator API, we're contributing to the global effort to make medical knowledge more accessible and standardized.
The Nobra Calculator API includes built-in MCP server support, allowing AI assistants and other MCP-compatible clients to interact with all medical calculators as native tools.
https://calculator.nobra.app.br/mcp⚠️ WARNING: The MCP server exposes over 300 medical calculator tools. When connecting:
When configuring your MCP client, consider:
For more information about MCP integration, refer to the MCP documentation.
IMPORTANT: This API is intended for educational and research purposes only. It should not be used as a substitute for professional clinical judgment. All medical calculations should be verified independently, and clinical decisions should always involve qualified healthcare professionals.
Run in your terminal:
claude mcp add nobra-calculator-mcp-server -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.