imednet.endpoints package¶
Endpoints package for the iMedNet SDK.
This package contains all API endpoint implementations for accessing iMedNet resources.
Submodules¶
imednet.endpoints.codings module¶
Endpoint for managing codings (medical coding) in a study.
- class imednet.endpoints.codings.AsyncCodingsEndpoint[source]¶
Bases:
CodingsOperationDef,EdcAsyncListEndpoint[Coding]Asynchronous endpoint for managing Codings.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
AsyncIterator[Coding]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.codings.CodingsEndpoint[source]¶
Bases:
CodingsOperationDef,EdcSyncListEndpoint[Coding]Synchronous endpoint for managing Codings.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
Iterator[Coding]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
imednet.endpoints.forms module¶
Endpoint for managing forms in a study.
- class imednet.endpoints.forms.AsyncFormsEndpoint[source]¶
Bases:
FormsOperationDef,EdcAsyncListGetEndpoint[Form]Asynchronous endpoint for managing Forms.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- async get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
AsyncIterator[Form]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.forms.FormsEndpoint[source]¶
Bases:
FormsOperationDef,EdcSyncListGetEndpoint[Form]Synchronous endpoint for managing Forms.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
Iterator[Form]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
imednet.endpoints.intervals module¶
Endpoint for managing intervals (visit definitions) in a study.
- class imednet.endpoints.intervals.AsyncIntervalsEndpoint[source]¶
Bases:
IntervalsOperationDef,EdcAsyncListGetEndpoint[Interval]Asynchronous endpoint for managing Intervals.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- async get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
AsyncIterator[Interval]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.intervals.IntervalsEndpoint[source]¶
Bases:
IntervalsOperationDef,EdcSyncListGetEndpoint[Interval]Synchronous endpoint for managing Intervals.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
Iterator[Interval]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
imednet.endpoints.jobs module¶
Endpoint for checking job status in a study.
- class imednet.endpoints.jobs.AsyncJobsEndpoint[source]¶
Bases:
JobsOperationDef,EdcAsyncGetEndpoint[JobStatus]Asynchronous endpoint for managing Jobs.
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- async fetch_result(result_url)[source]¶
Asynchronously fetch a terminal Job
resultUrlpayload via the hardened helper.- Parameters:
result_url (str) –
- Return type:
Any
- async get(study_key, item_id)¶
Get a single Job by ID.
- Parameters:
study_key (str | None) –
item_id (str | int) –
- Return type:
- async poll(study_key, batch_id, *, interval=5.0, timeout=300.0, on_progress=None, resolve_results=False)[source]¶
Wait asynchronously for a terminal Job, optionally inspecting
resultUrlpayloads.- Parameters:
study_key (str) –
batch_id (str) –
interval (float) –
timeout (float) –
on_progress (JobProgressCallback | Callable[[JobStatusEvent], None] | None) –
resolve_results (bool) –
- Return type:
- async poll_many(study_key, batch_ids, *, interval=5.0, timeout=300.0, on_progress=None, fail_fast=False, resolve_results=False)[source]¶
Collect async terminal statuses and failures, optionally resolving
resultUrlpayloads.- Parameters:
study_key (str) –
batch_ids (list[str]) –
interval (float) –
timeout (float) –
on_progress (JobProgressCallback | Callable[[JobStatusEvent], None] | None) –
fail_fast (bool) –
resolve_results (bool) –
- Return type:
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- class imednet.endpoints.jobs.JobsEndpoint[source]¶
Bases:
JobsOperationDef,EdcSyncGetEndpoint[JobStatus]Synchronous endpoint for managing Jobs.
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- fetch_result(result_url)[source]¶
Fetch a terminal Job
resultUrlpayload via the hardened endpoint helper.- Parameters:
result_url (str) –
- Return type:
Any
- get(study_key, item_id)¶
Get a single Job by ID.
- Parameters:
study_key (str | None) –
item_id (str | int) –
- Return type:
- poll(study_key, batch_id, *, interval=5.0, timeout=300.0, on_progress=None, resolve_results=False)[source]¶
Wait for a terminal Job, optionally inspecting its
resultUrlwhenresolve_resultsis True.- Parameters:
study_key (str) –
batch_id (str) –
interval (float) –
timeout (float) –
on_progress (JobProgressCallback | Callable[[JobStatusEvent], None] | None) –
resolve_results (bool) –
- Return type:
- poll_many(study_key, batch_ids, *, interval=5.0, timeout=300.0, on_progress=None, fail_fast=False, resolve_results=False)[source]¶
Collect terminal statuses and per-job failures, optionally resolving
resultUrlpayloads.- Parameters:
study_key (str) –
batch_ids (list[str]) –
interval (float) –
timeout (float) –
on_progress (JobProgressCallback | Callable[[JobStatusEvent], None] | None) –
fail_fast (bool) –
resolve_results (bool) –
- Return type:
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
imednet.endpoints.queries module¶
Endpoint for managing queries (dialogue/questions) in a study.
- class imednet.endpoints.queries.AsyncQueriesEndpoint[source]¶
Bases:
QueriesOperationDef,EdcAsyncListEndpoint[Query]Asynchronous endpoint for managing Queries.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- list(study_key=None, **filters)¶
List queries matching upstream filters while evaluating status locally.
- Parameters:
study_key (str | None) –
filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) –
- Return type:
AsyncIterator[Query]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.queries.QueriesEndpoint[source]¶
Bases:
QueriesOperationDef,EdcSyncListEndpoint[Query]Synchronous endpoint for managing Queries.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- list(study_key=None, **filters)¶
List queries matching upstream filters while evaluating status locally.
- Parameters:
study_key (str | None) –
filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) –
- Return type:
Iterator[Query]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.queries.QueriesOperationDef[source]¶
Bases:
objectDefinition for Query operations.
- list(study_key=None, **filters)[source]¶
List queries matching upstream filters while evaluating status locally.
- Parameters:
study_key (str | None) –
filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) –
- Return type:
Iterator[Query]
imednet.endpoints.record_revisions module¶
Endpoint for retrieving record revision history in a study.
- class imednet.endpoints.record_revisions.AsyncRecordRevisionsEndpoint[source]¶
Bases:
RecordRevisionsOperationDef,EdcAsyncListGetEndpoint[RecordRevision]Asynchronous endpoint for managing Record Revisions.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- MODEL¶
alias of
RecordRevision
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- async get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List record revisions matching filters, splitting secondary date bounds locally.
- Parameters:
study_key (str | None) –
filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) –
- Return type:
AsyncIterator[RecordRevision]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.record_revisions.RecordRevisionsEndpoint[source]¶
Bases:
RecordRevisionsOperationDef,EdcSyncListGetEndpoint[RecordRevision]Synchronous endpoint for managing Record Revisions.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- MODEL¶
alias of
RecordRevision
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List record revisions matching filters, splitting secondary date bounds locally.
- Parameters:
study_key (str | None) –
filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) –
- Return type:
Iterator[RecordRevision]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.record_revisions.RecordRevisionsOperationDef[source]¶
Bases:
objectDefinition for Record Revision operations.
- MODEL¶
alias of
RecordRevision
- list(study_key=None, **filters)[source]¶
List record revisions matching filters, splitting secondary date bounds locally.
- Parameters:
study_key (str | None) –
filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) –
- Return type:
Iterator[RecordRevision]
imednet.endpoints.records module¶
Endpoint for managing records (form instances) in a study.
- class imednet.endpoints.records.AsyncRecordsEndpoint[source]¶
Bases:
RecordsOperationDef,EdcAsyncListGetEndpoint[Record]Async API endpoint for interacting with records (form instances).
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- async create(study_key, records_data, email_notify=None, *, schema=None, skip_validation=False)¶
Create one or more records in a study.
- Parameters:
study_key (str) – The study key.
records_data (Sequence[BaseRecordRequest | Mapping[str, Any]] | DataFrameLike | str | PathLike[str]) – Record dicts, a pandas DataFrame, or a CSV file path.
email_notify (bool | str | None) – Whether to send email notifications.
schema (ValidationSchemaProtocol | None) – Optional validation schema (SchemaCache or DataDictionary).
skip_validation (bool) – Whether to skip schema validation if already validated.
- Returns:
The background job for the creation operation.
- Return type:
- async create_batch(study_key, records_data, email_notify=None, *, schema=None, chunk_size=100, skip_validation=False, wait_for_completion=False, timeout=300.0, interval=5.0, on_progress=None, dry_run=False, collect_errors=False, resolve_results=True)[source]¶
Validate once, asynchronously submit records in bounded chunks, and optionally poll.
- Parameters:
study_key (str) –
records_data (Sequence[BaseRecordRequest | Mapping[str, Any]] | DataFrameLike | str | PathLike[str]) –
email_notify (bool | str | None) –
schema (ValidationSchemaProtocol | None) –
chunk_size (int) –
skip_validation (bool) –
wait_for_completion (bool) –
timeout (float) –
interval (float) –
on_progress (JobProgressCallback | Callable[[JobStatusEvent], None] | None) –
dry_run (bool) –
collect_errors (bool) –
resolve_results (bool) –
- Return type:
- async get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
AsyncIterator[Record]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, flatten=False, mask_phi=True, **filters)[source]¶
Export queried records asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
flatten (bool) – Whether to flatten record_data dictionary into columns.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried records.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.records.RecordsEndpoint[source]¶
Bases:
RecordsOperationDef,EdcSyncListGetEndpoint[Record]API endpoint for interacting with records (form instances).
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- create(study_key, records_data, email_notify=None, *, schema=None, skip_validation=False)¶
Create one or more records in a study.
- Parameters:
study_key (str) – The study key.
records_data (Sequence[BaseRecordRequest | Mapping[str, Any]] | DataFrameLike | str | PathLike[str]) – Record dicts, a pandas DataFrame, or a CSV file path.
email_notify (bool | str | None) – Whether to send email notifications.
schema (ValidationSchemaProtocol | None) – Optional validation schema (SchemaCache or DataDictionary).
skip_validation (bool) – Whether to skip schema validation if already validated.
- Returns:
The background job for the creation operation.
- Return type:
- create_batch(study_key, records_data, email_notify=None, *, schema=None, chunk_size=100, skip_validation=False, wait_for_completion=False, timeout=300.0, interval=5.0, on_progress=None, dry_run=False, collect_errors=False, resolve_results=True)[source]¶
Validate once, submit records in bounded chunks, and optionally poll jobs.
- Parameters:
study_key (str) –
records_data (Sequence[BaseRecordRequest | Mapping[str, Any]] | DataFrameLike | str | PathLike[str]) –
email_notify (bool | str | None) –
schema (ValidationSchemaProtocol | None) –
chunk_size (int) –
skip_validation (bool) –
wait_for_completion (bool) –
timeout (float) –
interval (float) –
on_progress (JobProgressCallback | Callable[[JobStatusEvent], None] | None) –
dry_run (bool) –
collect_errors (bool) –
resolve_results (bool) –
- Return type:
- get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
Iterator[Record]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, flatten=False, mask_phi=True, **filters)[source]¶
Export queried records directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
flatten (bool) – Whether to flatten record_data dictionary into columns.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried records.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.records.RecordsOperationDef[source]¶
Bases:
objectDefinition for Record operations.
- create(study_key, records_data, email_notify=None, *, schema=None, skip_validation=False)[source]¶
Create one or more records in a study.
- Parameters:
study_key (str) – The study key.
records_data (Sequence[BaseRecordRequest | Mapping[str, Any]] | DataFrameLike | str | PathLike[str]) – Record dicts, a pandas DataFrame, or a CSV file path.
email_notify (bool | str | None) – Whether to send email notifications.
schema (ValidationSchemaProtocol | None) – Optional validation schema (SchemaCache or DataDictionary).
skip_validation (bool) – Whether to skip schema validation if already validated.
- Returns:
The background job for the creation operation.
- Return type:
imednet.endpoints.registry module¶
Registry for all available API endpoints.
This module decouples the endpoint implementations from the main SDK class, allowing for easier extension and maintenance.
imednet.endpoints.sites module¶
Endpoint for managing sites (study locations) in a study.
- class imednet.endpoints.sites.AsyncSitesEndpoint[source]¶
Bases:
SitesOperationDef,EdcAsyncListGetEndpoint[Site]Asynchronous endpoint for managing Sites.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- async get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
AsyncIterator[Site]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.sites.SitesEndpoint[source]¶
Bases:
SitesOperationDef,EdcSyncListGetEndpoint[Site]Synchronous endpoint for managing Sites.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
Iterator[Site]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
imednet.endpoints.studies module¶
Endpoint for managing studies in the iMedNet system.
- class imednet.endpoints.studies.AsyncStudiesEndpoint[source]¶
Bases:
StudiesOperationDef,EdcAsyncListGetEndpoint[Study]Asynchronous endpoint for managing Studies.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- async get(study_key=None, item_id=None, *args)¶
Retrieve a single study by key via
GET /api/v1/edc/studies?filter=studyKey==<key>.Supports both the preferred single-argument signature
get("STUDY")and the legacy two-argument signatureget(None, "STUDY").- Parameters:
study_key (str | None) – The study key (or None if passed in legacy format).
item_id (str | int | None) – The study key when passed as the second argument in legacy format.
*args (Any) – Additional positional arguments (disallowed).
- Returns:
The retrieved study model.
- Raises:
TypeError – If no study key is provided or too many arguments are given.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
AsyncIterator[Study]
- requires_study_key: bool = False¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.studies.StudiesEndpoint[source]¶
Bases:
StudiesOperationDef,EdcSyncListGetEndpoint[Study]Synchronous endpoint for managing Studies.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- get(study_key=None, item_id=None, *args)¶
Retrieve a single study by key via
GET /api/v1/edc/studies?filter=studyKey==<key>.Supports both the preferred single-argument signature
get("STUDY")and the legacy two-argument signatureget(None, "STUDY").- Parameters:
study_key (str | None) – The study key (or None if passed in legacy format).
item_id (str | int | None) – The study key when passed as the second argument in legacy format.
*args (Any) – Additional positional arguments (disallowed).
- Returns:
The retrieved study model.
- Raises:
TypeError – If no study key is provided or too many arguments are given.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
Iterator[Study]
- requires_study_key: bool = False¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.studies.StudiesOperationDef[source]¶
Bases:
objectDefinition for Study operations.
- get(study_key=None, item_id=None, *args)[source]¶
Retrieve a single study by key via
GET /api/v1/edc/studies?filter=studyKey==<key>.Supports both the preferred single-argument signature
get("STUDY")and the legacy two-argument signatureget(None, "STUDY").- Parameters:
study_key (str | None) – The study key (or None if passed in legacy format).
item_id (str | int | None) – The study key when passed as the second argument in legacy format.
*args (Any) – Additional positional arguments (disallowed).
- Returns:
The retrieved study model.
- Raises:
TypeError – If no study key is provided or too many arguments are given.
- Return type:
imednet.endpoints.subjects module¶
Endpoint for managing subjects in a study.
- class imednet.endpoints.subjects.AsyncSubjectsEndpoint[source]¶
Bases:
SubjectsOperationDef,EdcAsyncListGetEndpoint[Subject]Asynchronous endpoint for managing Subjects.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- async get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
AsyncIterator[Subject]
- async list_by_site(study_key, site_id)¶
List subjects by site ID.
- Parameters:
study_key (str) –
site_id (str | int) –
- Return type:
list[Subject]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.subjects.ListBySiteOperation[source]¶
Bases:
objectList by site operation.
- __init__(endpoint, study_key, site_id)[source]¶
Initialize.
- Parameters:
endpoint (Any) –
study_key (str) –
site_id (str | int) –
- class imednet.endpoints.subjects.SubjectsEndpoint[source]¶
Bases:
SubjectsOperationDef,EdcSyncListGetEndpoint[Subject]Synchronous endpoint for managing Subjects.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
Iterator[Subject]
- list_by_site(study_key, site_id)¶
List subjects by site ID.
- Parameters:
study_key (str) –
site_id (str | int) –
- Return type:
list[Subject]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
imednet.endpoints.users module¶
Endpoint for managing users in a study.
- class imednet.endpoints.users.AsyncUsersEndpoint[source]¶
Bases:
UsersOperationDef,EdcAsyncListEndpoint[User]Asynchronous endpoint for managing Users.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
AsyncIterator[User]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)[source]¶
Export queried users asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried users.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.users.UsersEndpoint[source]¶
Bases:
UsersOperationDef,EdcSyncListEndpoint[User]Synchronous endpoint for managing Users.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
Iterator[User]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)[source]¶
Export queried users directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried users.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.users.UsersOperationDef[source]¶
Bases:
objectDefinition for User operations.
imednet.endpoints.variables module¶
Endpoint for managing variables (data points on forms) in a study.
- class imednet.endpoints.variables.AsyncVariablesEndpoint[source]¶
Bases:
VariablesOperationDef,EdcAsyncListGetEndpoint[Variable]Asynchronous endpoint for managing Variables.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- async get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
AsyncIterator[Variable]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.variables.VariablesEndpoint[source]¶
Bases:
VariablesOperationDef,EdcSyncListGetEndpoint[Variable]Synchronous endpoint for managing Variables.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- get(study_key, item_id)¶
Retrieve a single resource by its ID.
- Parameters:
study_key (str | None) – The study key.
item_id (int) – The ID of the resource to retrieve.
- Returns:
The requested resource.
- Return type:
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
Iterator[Variable]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
imednet.endpoints.visits module¶
Endpoint for managing visits (interval instances) in a study.
- class imednet.endpoints.visits.AsyncVisitsEndpoint[source]¶
Bases:
VisitsOperationDef,EdcAsyncListEndpoint[Visit]Asynchronous endpoint for managing Visits.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(async_client)¶
Initialize the asynchronous endpoint.
- Parameters:
async_client (AsyncRequesterProtocol) –
- Return type:
None
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
AsyncIterator[Visit]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- async to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources asynchronously directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame
- class imednet.endpoints.visits.VisitsEndpoint[source]¶
Bases:
VisitsOperationDef,EdcSyncListEndpoint[Visit]Synchronous endpoint for managing Visits.
- ASYNC_PAGINATOR_CLS¶
alias of
AsyncPaginator
- __init__(client)¶
Initialize the synchronous endpoint.
- Parameters:
client (RequesterProtocol) –
- Return type:
None
- list(study_key=None, **filters)¶
List resources matching the given filters.
- Parameters:
study_key (str | None) – Optional study key to override the default.
**filters (str | int | float | bool | tuple[str, str | int | float | bool | None] | list[tuple[str, str | int | float | bool | None]] | list[str | int | float | bool | None] | None) – Resource filters.
- Returns:
An iterator over the matching resources.
- Return type:
Iterator[Visit]
- requires_study_key: bool = True¶
Whether this endpoint requires a study key. Defaults to True. Override in subclasses if needed.
- to_dataframe(study_key=None, *, mask_phi=True, **filters)¶
Export queried resources directly to a pandas DataFrame.
- Parameters:
study_key (str | None) – Optional study key override.
mask_phi (bool) – Whether to mask sensitive PHI fields by default.
**filters (Any) – Resource filters passed to
list().
- Returns:
A pandas DataFrame containing the queried resources.
- Raises:
ImportError – If pandas is not installed.
- Return type:
DataFrame