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.3.0.tar.gz (6.2 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.3.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for medintell-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c72091d9be4f15bc143c564bee596152e406946ab3cccc60a65cfcbde9001829
MD5 ea6f87378516f356eb21456a49738211
BLAKE2b-256 a82b1b3fc363ef1dcdd4d4f900c6411a0af20ab5a4c7d8f86e81ea769ba891b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: medintell-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08cfb9c9b04368dacd1bbfc19105a321a653ae9a0484c6ffcc1cc529e923aa19
MD5 bbb31fb4d3e4a7465edd5f29fb065c91
BLAKE2b-256 078e34a4157f23236e6aea12da321eba533c39af01642284790d04ad2d6cacb5

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