main
ArithMedic
ArithMedic is a free, open-source, FHIR-native medical calculation API.
📁 Project Structure
arithmedic
├── api # API mappings
│ ├── egfr
│ └── __init__.py
├── calculators # Calculator logic
│ ├── egfr
│ └── __init__.py
├── fhir_mappings # fhir.resources schemas for I/O validation
│ └── egfr
├── schemas # Pydantic schemas for I/O validation
│ ├── egfr
│ └── __init__.py
├── templates # HTML templates
│ ├── egfr
│ ├── base.html
│ └── index.html
├── tests # pytest test files
│ ├── calculators
│ └── __init__.py
├── README.md
├── __init__.py
├── conftest.py
├── main.py
├── pyproject.toml
└── requirements.txt
🛠️ Technical Architecture
The project uses a modular design with the following main components:
- API (
main.py,api/): Provides API interface - Calculator Logic (
calculators/): Medical calculators separated by category and specific calculator. - FHIR mappings (
fhir_mappings/): I/O mappings to FHIR standard. - Pydantic Schemas (
schemas/): I/O validation. - HTML Templates (
templates/): HTML templates for landing page and example web calculator. - Test Suite (
tests/): Tests and functionality verification for API, calculators, FHIR mappings, schemas, and templates.
Example:
Request body:
curl -X 'POST' \
'https://www.arithmedic.eu/fhir/egfr/ckd-epi-2021' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"resourceType": "Parameters",
"parameter": [
{
"name": "serum-creatinine",
"valueQuantity": {
"value": 88,
"unit": "umol/L"
}
},
{
"name": "age",
"valueInteger": 65
},
{
"name": "sex",
"valueCode": "female"
}
]
}'
Response body:
{
"resourceType": "Parameters",
"parameter": [
{
"name": "egfr",
"valueQuantity": {
"value": 63,
"unit": "mL/min/1.73m2",
"system": "http://unitsofmeasure.org",
"code": "mL/min/{1.73_m2}"
}
},
{
"name": "ckd-stage-code",
"valueCode": "G2"
},
{
"name": "ckd-stage-description",
"valueString": "Mildly decreased (60–89)"
},
{
"name": "formula",
"valueString": "2021 CKD-EPI Creatinine"
},
{
"name": "reference",
"valueUri": "https://doi.org/10.1056/NEJMoa2102953"
}
]
}
Description
Languages
HTML
53.1%
Python
46.9%