This is a simple open-source API which allows users to calculate common medical formulas. It is built using FastAPI and follows the OpenAPI specification. It can be integrated into other applications such as OpenAI's new GPTs functionality. For educational use only. Not for patient care.
Full article describing its use integrated into ChatGPT is available in npj Digital Medicine: "Large language model agents can use tools to perform clinical calculations".
(Preprint originally available on Medrxiv).
Interactive live API documentation available here:
This project uses uv for dependency management.
- Clone the repo
- Install dependencies:
make install(oruv sync) - Run the app:
make run(oruv run uvicorn main:app --reload) - Stop the app:
make stop
The API will be available at http://127.0.0.1:8000.
This application supports deployment to Cloudflare Workers using Python Workers (currently in beta).
- Install Pywrangler (Python Workers CLI):
uv tool install workers-py- Authenticate with Cloudflare:
npx wrangler login- Deploy to Cloudflare Workers:
uv run pywrangler deployThe application will be deployed to Cloudflare's edge network. Pywrangler will automatically:
- Read dependencies from
pyproject.toml - Bundle Python packages with your worker
- Deploy to Cloudflare with the
python_workerscompatibility flag
To test locally before deploying:
uv run pywrangler devThe deployment is configured via wrangler.jsonc:
- Entry point:
worker.py- Cloudflare Workers adapter for the FastAPI app - Main app:
main.py- The core FastAPI application - Compatibility: Requires
python_workersflag (beta feature)
Once deployed, the API is available at:
https://api.openmedcalc.orghttps://api.openmedcalc.com
- First request may experience cold start (1-10 seconds)
- Some Python packages may have limited support
- Check Cloudflare's Python package compatibility for details
- MELD
- MELD-Na
- Caprini VTE
- Wells DVT score
- PSI/PORT (BETA)
- Improve documentation
- Add more formulas
Licensed under MIT license.
The tool is intended for use as a research and informational tool only and is not a substitute for professional medical advice, diagnosis, or treatment. The Service is provided "as is" without any warranties of any kind, express or implied, including but not limited to the accuracy, completeness, or reliability of the calculations or results.
Choice of calculation tasks chosen from "most popular" calculators list from website of MDCalc Ltd (New York, NY). Used with permission. Inclusion of these calculators does not constitute endorsement by MDCalc.