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
Metadata
Release files for krama-core 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| krama_core-0.1.0.tar.gz | 10.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| krama_core-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.4 kB
Release files / krama_core-0.1.0.tar.gz
| Download URL | krama_core-0.1.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18ecbeca921d6dbe6f0a5403066ef71861dedd6316db99649e9f1886afc78b7f
|
|
BLAKE2b-256 checksum How to use checksums |
41005f9fc3d0f6698ac7df84e55d2cc8e66018e5222abaad2a9ef4f1f60604b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / krama_core-0.1.0-py3-none-any.whl
| Download URL | krama_core-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38a3853b0acf73e75ffdff28a3f2b911216edbd18bb9aa4e310550014b050e40
|
|
BLAKE2b-256 checksum How to use checksums |
62e1874c22960d5c688e2670f64e6a8c84831dfc19e2d04b22482a6219c5edda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for krama-core 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.