Python-first open-source ABDM integration toolkit
Project description
Krama Core
Python-first ABDM/FHIR bundle generation for Indian healthcare products.
Built by Nirvya Labs.
Krama Core helps developers generate ABDM-compliant FHIR R4 document bundles
without hand-assembling every resource and reference. It is intentionally small:
Pydantic for input validation, plain Python dictionaries for output, and no
runtime dependency beyond pydantic.
Installation
pip install krama-core
For local development:
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Quick Start
import json
from krama.fhir import create_op_consult_bundle
from krama.fhir.bundles import (
DiagnosisInfo,
OrganizationInfo,
PatientInfo,
PractitionerInfo,
)
bundle = create_op_consult_bundle(
patient=PatientInfo(
name="Ravi Kumar",
abha_address="ravi.kumar@abdm",
gender="male",
date_of_birth="1990-05-15",
),
practitioner=PractitionerInfo(
name="Dr. Priya Sharma",
identifier="DOC-12345",
),
organization=OrganizationInfo(
name="District Hospital Guntur",
hfr_id="IN0410000123",
),
diagnosis=DiagnosisInfo(
description="Essential hypertension",
snomed_code="59621000",
clinical_notes="BP 150/95, prescribed amlodipine 5mg",
),
encounter_date="2026-05-06",
)
print(json.dumps(bundle, indent=2))
Supported Bundles
Krama Core v0.1 supports three ABDM care contexts:
create_op_consult_bundle()for outpatient consultation recordscreate_prescription_bundle()for prescription recordscreate_discharge_summary_bundle()for inpatient discharge summaries
Each bundle is returned as a JSON-serializable Python dictionary.
What Krama Handles
Bundle.type = "document"Compositionas the first bundle entry- Internal
urn:uuid:references between resources - Patient, practitioner, organization, encounter, diagnosis, and medication resources
- SNOMED CT coding fields for diagnoses and medications
- Pydantic validation for required inputs and FHIR gender values
Development
Run the checks:
pytest -v
ruff check src/ tests/ examples/
bandit -r src/
pip-audit
python examples/basic_usage.py
Build and validate package artifacts:
python -m build
twine check dist/*
Status
Alpha. The API is small and usable, but still expected to evolve as ABDM integration coverage expands.
Roadmap
- Local mock ABDM gateway for offline development
- Async webhook handler with callback reliability helpers
- Diagnostic Report and Immunization bundle types
- FHIR R4 bundle validator
- FastAPI integration examples
Why "Krama"?
Krama means order, sequence, or method. ABDM integration is a strict sequence of care contexts, callbacks, consent flows, and clinical records. Krama exists to make that sequence easier to build and reason about.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file krama_core-0.1.0.tar.gz.
File metadata
- Download URL: krama_core-0.1.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18ecbeca921d6dbe6f0a5403066ef71861dedd6316db99649e9f1886afc78b7f
|
|
| MD5 |
ab59024550af9298f1437ee8d5e3bee5
|
|
| BLAKE2b-256 |
41005f9fc3d0f6698ac7df84e55d2cc8e66018e5222abaad2a9ef4f1f60604b3
|
File details
Details for the file krama_core-0.1.0-py3-none-any.whl.
File metadata
- Download URL: krama_core-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38a3853b0acf73e75ffdff28a3f2b911216edbd18bb9aa4e310550014b050e40
|
|
| MD5 |
da01b794abbe4a0930d14ed2222f3590
|
|
| BLAKE2b-256 |
62e1874c22960d5c688e2670f64e6a8c84831dfc19e2d04b22482a6219c5edda
|