Typed Python SDK for Medelement MIS API
Project description
medelement-mis
Typed Python SDK for Medelement MIS API.
Public Interface
Top-level imports are stable and intended for package consumers:
from medelement_mis import (
MedelementClient,
MedelementConfig,
Environment,
Gender,
ColorCode,
SOCIAL_STATUSES,
CONCESSIONS,
)
Main API resources exposed by MedelementClient:
client.patientssearch(...)create(...)get(patient_code)update(...)
client.receptionscreate(...)search(...)search_pd(...)get(reception_code)reschedule(...)remove(reception_code)
client.specialistslist()
client.timetableget_timetable(...)get_specialist_receptions(...)
client.nomenclatureslist(...)
Reference catalogs from docs:
SOCIAL_STATUSES(fromdocs/api/social_status.md)CONCESSIONS(fromdocs/api/concessions.md)
Quick Start
from medelement_mis import MedelementClient, MedelementConfig
config = MedelementConfig(
user_id="your_user_id",
password="your_password",
integrator_key="your_integrator_key",
base_url="https://api.medelement.com/v1",
)
with MedelementClient(config=config) as client:
patients = client.patients.search(lastname="Ivanov")
for patient in patients:
print(patient.profile_code, patient.lastname, patient.name)
Error Handling
from httpx import TimeoutException, TransportError
from medelement_mis import APIError, AuthenticationError, MedelementClient, MedelementConfig, NotFoundError
config = MedelementConfig()
try:
with MedelementClient(config=config) as client:
patient = client.patients.get(123)
except NotFoundError:
print("Patient not found")
except AuthenticationError:
print("Check Basic auth credentials and X-Integrator-Key")
except APIError as exc:
print(f"API returned an error: {exc}")
except (TimeoutException, TransportError) as exc:
print(f"Network error after retries: {exc}")
HTTP 401, 403, 404, and 422 responses are normalized into SDK exceptions.
Network timeouts and transport failures are retried for idempotent requests (GET, HEAD, OPTIONS) and then bubble up as httpx exceptions if all retries fail.
Logging
The SDK logs request and response lines at DEBUG level via the medelement_mis logger:
import logging
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("medelement_mis").setLevel(logging.DEBUG)
This logs method, URL, and status code, but does not log authentication headers.
API Naming Notes
Most request models use snake_case field names. Some timetable endpoints use camelCase aliases because the upstream Medelement API requires that exact payload shape, for example specialistCode, beginDatetime, and companyCabinetCode in get_receptions_short.
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
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 medelement_mis-0.1.4.tar.gz.
File metadata
- Download URL: medelement_mis-0.1.4.tar.gz
- Upload date:
- Size: 40.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2024f20a01e7a4f423a8707e13abb199a2ab58c69de5a5e9a2232266d5515907
|
|
| MD5 |
b027efd498ac274a31ae1b276ca6cc38
|
|
| BLAKE2b-256 |
062520d5264c7a96622de251ac2ee0fdf21a9b1f4ca9b682847c058eaec5422e
|
File details
Details for the file medelement_mis-0.1.4-py3-none-any.whl.
File metadata
- Download URL: medelement_mis-0.1.4-py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ccf4b26859a328bee3d2a0b42f7b9fb3b1b07150e3b1dc5e05463284e1a721
|
|
| MD5 |
c5c8872c0c5a55e06e057c5acb799abc
|
|
| BLAKE2b-256 |
93a5d92798e934d07bca046ea36493ef0d15da12d4bcf06fe2657df04142fbf7
|