Patients
Fetch one patient, search across practices, stream an entire patient roster with cursor pagination, and manage patient records.
- Resource
client.patients- SOAP operations
- GetPatient, GetPatients, GetAllPatients, CreatePatient, UpdatePatient, UpdatePatientsExternalID, UpdatePrimaryPatientCase
- Flat methods
get_patient,get_patients,iter_all_patients,get_all_patients- Writes
- create, update, update_external_ids, update_primary_case
Methods
client.patients.get#
readasync get(patient_id=None, *, external_id=None, external_vendor_id=None) -> dict | NoneFetch full demographics and cases for a single patient using GetPatient. Returns None when no matching patient exists.
| Parameter | Type | Description |
|---|---|---|
patient_id | int | str | None | Patient ID. Required unless external_id is given. |
external_id | str | None | External system identifier. |
external_vendor_id | int | None | External vendor ID used with external_id. |
dict[str, Any] | NoneValueError when neither patient_id nor external_id is supplied.patient = await client.patients.get(patient_id=119246)
if patient:
print(patient["PatientFullName"])client.patients.list#
readasync list(*, practice_id=None, practice_name=None, first_name=None, middle_name=None, last_name=None, full_name=None, dob=None, from_dob=None, to_dob=None, is_active=None, gender=None, ssn=None, from_created_date=None, to_created_date=None, from_last_modified_date=None, to_last_modified_date=None, from_last_encounter_date=None, to_last_encounter_date=None, fields=None, extra_filter=None) -> list[dict]Search patients across one or all practices using GetPatients. When dob is provided it overrides both from_dob and to_dob (exact date match).
| Parameter | Type | Description |
|---|---|---|
practice_id | int | str | None | Filter by practice ID (sent as a string). |
practice_name | str | None | Filter by practice name. |
first_name | str | None | First name filter. |
middle_name | str | None | Middle name filter. |
last_name | str | None | Last name filter. |
full_name | str | None | Full name filter. |
dob | str | date | datetime | None | Exact date of birth. Sets both DOB bounds. |
from_dob | str | date | datetime | None | Lower DOB bound (ignored when dob is set). |
to_dob | str | date | datetime | None | Upper DOB bound (ignored when dob is set). |
is_active | bool | str | None | Active flag. Booleans are sent as "True" / "False". |
gender | str | None | Gender filter. |
ssn | str | None | SSN filter. |
from_created_date | str | date | datetime | None | Lower creation-date bound. |
to_created_date | str | date | datetime | None | Upper creation-date bound. |
from_last_modified_date | str | date | datetime | None | Lower last-modified bound. |
to_last_modified_date | str | date | datetime | None | Upper last-modified bound. |
from_last_encounter_date | str | date | datetime | None | Lower last-encounter bound. |
to_last_encounter_date | str | date | datetime | None | Upper last-encounter bound. |
fields | Iterable[str] | Mapping[str, bool] | None | Field selector; None requests all fields. |
extra_filter | Mapping[str, Any] | None | Additional raw Filter keys. |
list[dict[str, Any]]matches = await client.patients.list(
practice_name="Becki Lentz Physical Therapy, Inc",
last_name="Patient",
fields=["ID", "FirstName", "LastName", "PatientFullName"],
)client.patients.list_batch#
readasync list_batch(*, practice_id, batch_size=500, start_key=0, fields=None) -> tuple[list[dict], int | None]Fetch a single cursor page of patients for a practice using GetAllPatients. Returns the rows and the next start key from Key.nextStartKey.
| Parameter | Type | Description |
|---|---|---|
practice_idrequired | int | Practice ID. |
batch_size | int | Page size. Default 500. |
start_key | int | Cursor position. Default 0. |
fields | Iterable[str] | Mapping[str, bool] | None | Field selector. |
tuple[list[dict[str, Any]], int | None]client.patients.iter_all#
readiter_all(*, practice_id, batch_size=500, start_key=0, max_pages=None, fields=None) -> AsyncIterator[dict]Async iterator that streams every patient in a practice using cursor pagination. Stops when the page is empty or short, when the cursor stops advancing, or after max_pages. Wrap it in async for.
| Parameter | Type | Description |
|---|---|---|
practice_idrequired | int | Practice ID. |
batch_size | int | Page size. Default 500. |
start_key | int | Initial cursor. Default 0. |
max_pages | int | None | Optional page cap. |
fields | Iterable[str] | Mapping[str, bool] | None | Field selector applied to each page. |
AsyncIterator[dict[str, Any]]async for patient in client.patients.iter_all(practice_id=7, batch_size=250):
print(patient["ID"], patient.get("PatientFullName"))client.patients.list_all#
readasync list_all(*, practice_id, batch_size=500, start_key=0, max_pages=None, fields=None) -> list[dict]Collect every paginated patient into one list. Same parameters and stop conditions as iter_all.
list[dict[str, Any]]client.patients.create#
writeasync create(patient) -> dictCreate a new patient using CreatePatient. Blocked when read_only=True.
| Parameter | Type | Description |
|---|---|---|
patientrequired | Mapping[str, Any] | Raw Patient payload expected by the WSDL. |
dict[str, Any] (the SOAP response)client.patients.update#
writeasync update(patient) -> dictUpdate an existing patient using UpdatePatient. Blocked when read_only=True.
| Parameter | Type | Description |
|---|---|---|
patientrequired | Mapping[str, Any] | Raw Patient payload, including the patient ID. |
dict[str, Any] (the SOAP response)UpdatePatientReq instead of request, matching Tebra's WSDL.client.patients.update_external_ids#
writeasync update_external_ids(updates) -> list[dict]Batch-update patient external IDs using UpdatePatientsExternalID. Returns the ItemsUpdated rows.
| Parameter | Type | Description |
|---|---|---|
updatesrequired | list[Mapping[str, Any]] | One PatientExternalIDSetting mapping per patient. |
list[dict[str, Any]]updated = await client.patients.update_external_ids([
{"patientID": 119246, "externalID": "EXT-001", "externalVendorID": 1},
])client.patients.update_primary_case#
writeasync update_primary_case(patient_case_id) -> boolSet the primary case for a patient using UpdatePrimaryPatientCase. Returns the response Success flag.
| Parameter | Type | Description |
|---|---|---|
patient_case_idrequired | int | Patient case ID to make primary. |
boolCursor pagination
iter_all is the safest way to read a full practice roster. It respects Tebra's 2500 ms GetAllPatients throttle automatically.
total = 0
async for patient in client.iter_all_patients(practice_id=7, batch_size=250):
total += 1
print("patients:", total)
# Or collect everything at once
all_patients = await client.get_all_patients(practice_id=7)