Skip to main content

Official Python SDK for the MedIntell REST API.

Project description

medintell

Official Python SDK for the MedIntell REST API. Zero third-party dependencies (standard-library only).

Install

pip install medintell

Quickstart

import os
from medintell import MedIntell

mi = MedIntell(api_key=os.environ["MI_KEY"])

# Verify the connection
health = mi.health()
# {"status": "ok", "org_id": "org_3aK9Lm", "role": "manager", "facility_id": "fac_1B7dQ2"}

# Seed reference data in dependency order, reusing the returned ids
dept = mi.departments.create(name="Cardiology", facility_id="fac_1B7dQ2")
doc = mi.doctors.create(name="Dr. Shakshouka Hummusi", department_id=dept["id"], facility_id="fac_1B7dQ2")
payer = mi.payers.create(name="Falafel Assurance Co.")

patient = mi.patients.create(
    mrn="MRN-2026-00001",
    facility_id="fac_1B7dQ2",
    first_name="Kabsa",
    last_name="Al-Majboos",
    dob="1985-03-15",
    gender="M",
)

visit = mi.visits.create(
    facility_id="fac_1B7dQ2",
    patient_mrn="MRN-2026-00001",
    source_visit_id="V-2026-12345",
    visit_date="2026-06-15T10:30:00",
    type_of_visit="Consultation",
    department_id=dept["id"],
    doctor_id=doc["id"],
    payer_id=payer["payer_id"],
    total_cost=1500.0,
)

Features

  • Resource modelmi.<resource>.<action>() mirrors the REST API.
  • Auth — the API key is attached to every request.
  • Idempotency — every create sends an Idempotency-Key automatically; pass idempotency_key=... to make a specific retry idempotent.
  • Retries429 / 5xx / network errors retry with backoff (honours Retry-After).
  • Cursor paginationfor patient in mi.patients.iterate(): ....
  • Typed errors — failures raise MedIntellError with .status, .code, .request_id.
  • Analytics — the full Analysis Hub: mi.analytics.overview() / .clinical() / .demographics() / .financial() / .operational() / .patients() / .data_range() / .filter_options(dimension). List filters serialize to CSV; discover valid filter values (and numeric ids) with filter_options().

Analytics

kpis = mi.analytics.overview(start_date="2026-01-01", end_date="2026-06-30")
cardio = mi.analytics.filter_options("department_ids", search="cardio")
burden = mi.analytics.clinical(department_ids=[cardio["data"][0]["value"]], genders=["male"])

Pagination

for patient in mi.patients.iterate(search="MRN-2026"):
    print(patient["mrno"])

Errors

from medintell import MedIntell, MedIntellError

try:
    mi.patients.retrieve("pat_does_not_exist")
except MedIntellError as err:
    print(err.status, err.code, err.request_id)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

medintell-0.2.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

medintell-0.2.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file medintell-0.2.0.tar.gz.

File metadata

  • Download URL: medintell-0.2.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for medintell-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c25fde7ffb7d8d1cf268ac2e3bd85b631615b74ec7635b0e6a299aa20df1d424
MD5 31ec6cd606a4f3937f770397562fa773
BLAKE2b-256 99e7a88fc3b989b8af167ce3994629ccb4688ddfe8845d7591f4f84f78e65c31

See more details on using hashes here.

File details

Details for the file medintell-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: medintell-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for medintell-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c436601fa06bdcf4be187f95a83f271187a483060855494260a0a1886be489c8
MD5 b69690d5103f86bc53b54f5992e14390
BLAKE2b-256 e38cc5690e2dfc5fcc2d4443d9af63a7dcffeb2606efe15c4fc753b9e644ad09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page