imednet.core.endpoint.mixins package

Submodules

imednet.core.endpoint.mixins.caching module

class imednet.core.endpoint.mixins.caching.CacheMixin[source]

Bases: object

Mixin for handling endpoint caching.

requires_study_key: bool = True
class imednet.core.endpoint.mixins.caching.CachedEndpointMixin[source]

Bases: object

Mixin that enables caching and sets the default page size for metadata endpoints.

PAGE_SIZE: int = 500

imednet.core.endpoint.mixins.get module

class imednet.core.endpoint.mixins.get.FilterGetEndpointMixin(*args, **kwargs)[source]

Bases: EndpointABC[T]

Mixin implementing get via filtering.

ASYNC_PAGINATOR_CLS

alias of AsyncPaginator

PAGINATOR_CLS

alias of Paginator

async async_get(study_key, item_id)[source]

Asynchronously get an item by ID using filtering.

Return type:

TypeVar(T, bound= JsonModel)

Parameters:
  • study_key (str | None) –

  • item_id (Any) –

get(study_key, item_id)[source]

Get an item by ID using filtering.

Return type:

TypeVar(T, bound= JsonModel)

Parameters:
  • study_key (str | None) –

  • item_id (Any) –

class imednet.core.endpoint.mixins.get.PathGetEndpointMixin(*args, **kwargs)[source]

Bases: ParsingMixin[T], EndpointABC[T]

Mixin implementing get via direct path.

async async_get(study_key, item_id)[source]

Asynchronously get an item by ID using direct path.

Return type:

TypeVar(T, bound= JsonModel)

Parameters:
  • study_key (str | None) –

  • item_id (Any) –

get(study_key, item_id)[source]

Get an item by ID using direct path.

Return type:

TypeVar(T, bound= JsonModel)

Parameters:
  • study_key (str | None) –

  • item_id (Any) –

imednet.core.endpoint.mixins.list module

class imednet.core.endpoint.mixins.list.ListEndpointMixin(*args, **kwargs)[source]

Bases: ParamMixin, CacheMixin, ParsingMixin[T], EndpointABC[T]

Mixin implementing list helpers.

ASYNC_PAGINATOR_CLS

alias of AsyncPaginator

PAGE_SIZE: int = 100
PAGINATOR_CLS

alias of Paginator

async async_list(study_key=None, **filters)[source]

List items asynchronously.

Return type:

List[TypeVar(T, bound= JsonModel)]

Parameters:
  • study_key (str | None) –

  • filters (Any) –

async async_list_by_attribute(attr_name, target_value, study_key=None, **filters)[source]

Asynchronously list items filtered by a specific attribute.

Return type:

List[TypeVar(T, bound= JsonModel)]

Parameters:
  • attr_name (str) –

  • target_value (Any) –

  • study_key (str | None) –

  • filters (Any) –

list(study_key=None, **filters)[source]

List items.

Return type:

List[TypeVar(T, bound= JsonModel)]

Parameters:
  • study_key (str | None) –

  • filters (Any) –

list_by_attribute(attr_name, target_value, study_key=None, **filters)[source]

List items filtered by a specific attribute.

Return type:

List[TypeVar(T, bound= JsonModel)]

Parameters:
  • attr_name (str) –

  • target_value (Any) –

  • study_key (str | None) –

  • filters (Any) –

imednet.core.endpoint.mixins.params module

class imednet.core.endpoint.mixins.params.ParamMixin[source]

Bases: object

Mixin for handling endpoint parameters and filters.

PARAM_PROCESSOR: Optional[ParamProcessor] = None
PARAM_PROCESSOR_CLS

alias of DefaultParamProcessor

STUDY_KEY_STRATEGY: Optional[StudyKeyStrategy] = None
property param_processor: ParamProcessor

Get the configured parameter processor.

Returns:

The processor instance to use.

requires_study_key: bool = True
property study_key_strategy: StudyKeyStrategy

Get the configured study key strategy.

Returns:

The strategy instance to use.

imednet.core.endpoint.mixins.parsing module

class imednet.core.endpoint.mixins.parsing.ParsingMixin[source]

Bases: Generic[T]

Mixin implementing model parsing helpers.

MODEL: Type[TypeVar(T, bound= JsonModel)]

Module contents

class imednet.core.endpoint.mixins.AsyncPaginator(client, path, params=None, page_size=100, page_param='page', size_param='size', data_key='data', metadata_key='metadata')[source]

Bases: BasePaginator[AsyncRequestorProtocol]

Asynchronous variant of Paginator.

Parameters:
  • client (ClientT) –

  • path (str) –

  • params (Dict[str, Any] | None) –

  • page_size (int) –

  • page_param (str) –

  • size_param (str) –

  • data_key (str) –

  • metadata_key (str) –

class imednet.core.endpoint.mixins.CacheMixin[source]

Bases: object

Mixin for handling endpoint caching.

requires_study_key: bool = True
class imednet.core.endpoint.mixins.CachedEndpointMixin[source]

Bases: object

Mixin that enables caching and sets the default page size for metadata endpoints.

PAGE_SIZE: int = 500
class imednet.core.endpoint.mixins.FilterGetEndpointMixin(*args, **kwargs)[source]

Bases: EndpointABC[T]

Mixin implementing get via filtering.

ASYNC_PAGINATOR_CLS

alias of AsyncPaginator

PAGINATOR_CLS

alias of Paginator

async async_get(study_key, item_id)[source]

Asynchronously get an item by ID using filtering.

Return type:

TypeVar(T, bound= JsonModel)

Parameters:
  • study_key (str | None) –

  • item_id (Any) –

get(study_key, item_id)[source]

Get an item by ID using filtering.

Return type:

TypeVar(T, bound= JsonModel)

Parameters:
  • study_key (str | None) –

  • item_id (Any) –

class imednet.core.endpoint.mixins.ListEndpointMixin(*args, **kwargs)[source]

Bases: ParamMixin, CacheMixin, ParsingMixin[T], EndpointABC[T]

Mixin implementing list helpers.

ASYNC_PAGINATOR_CLS

alias of AsyncPaginator

PAGE_SIZE: int = 100
PAGINATOR_CLS

alias of Paginator

async async_list(study_key=None, **filters)[source]

List items asynchronously.

Return type:

List[TypeVar(T, bound= JsonModel)]

Parameters:
  • study_key (str | None) –

  • filters (Any) –

async async_list_by_attribute(attr_name, target_value, study_key=None, **filters)[source]

Asynchronously list items filtered by a specific attribute.

Return type:

List[TypeVar(T, bound= JsonModel)]

Parameters:
  • attr_name (str) –

  • target_value (Any) –

  • study_key (str | None) –

  • filters (Any) –

list(study_key=None, **filters)[source]

List items.

Return type:

List[TypeVar(T, bound= JsonModel)]

Parameters:
  • study_key (str | None) –

  • filters (Any) –

list_by_attribute(attr_name, target_value, study_key=None, **filters)[source]

List items filtered by a specific attribute.

Return type:

List[TypeVar(T, bound= JsonModel)]

Parameters:
  • attr_name (str) –

  • target_value (Any) –

  • study_key (str | None) –

  • filters (Any) –

class imednet.core.endpoint.mixins.Paginator(client, path, params=None, page_size=100, page_param='page', size_param='size', data_key='data', metadata_key='metadata')[source]

Bases: BasePaginator[RequestorProtocol]

Iterate synchronously over paginated API results.

Parameters:
  • client (ClientT) –

  • path (str) –

  • params (Dict[str, Any] | None) –

  • page_size (int) –

  • page_param (str) –

  • size_param (str) –

  • data_key (str) –

  • metadata_key (str) –

class imednet.core.endpoint.mixins.ParamMixin[source]

Bases: object

Mixin for handling endpoint parameters and filters.

PARAM_PROCESSOR: Optional[ParamProcessor] = None
PARAM_PROCESSOR_CLS

alias of DefaultParamProcessor

STUDY_KEY_STRATEGY: Optional[StudyKeyStrategy] = None
property param_processor: ParamProcessor

Get the configured parameter processor.

Returns:

The processor instance to use.

requires_study_key: bool = True
property study_key_strategy: StudyKeyStrategy

Get the configured study key strategy.

Returns:

The strategy instance to use.

class imednet.core.endpoint.mixins.ParsingMixin[source]

Bases: Generic[T]

Mixin implementing model parsing helpers.

MODEL: Type[TypeVar(T, bound= JsonModel)]
class imednet.core.endpoint.mixins.PathGetEndpointMixin(*args, **kwargs)[source]

Bases: ParsingMixin[T], EndpointABC[T]

Mixin implementing get via direct path.

async async_get(study_key, item_id)[source]

Asynchronously get an item by ID using direct path.

Return type:

TypeVar(T, bound= JsonModel)

Parameters:
  • study_key (str | None) –

  • item_id (Any) –

get(study_key, item_id)[source]

Get an item by ID using direct path.

Return type:

TypeVar(T, bound= JsonModel)

Parameters:
  • study_key (str | None) –

  • item_id (Any) –

imednet.core.endpoint.mixins.build_filter_string(filters, and_connector=';', or_connector=',')[source]

Return a filter string constructed according to iMednet rules.

Each key in filters is converted to camelCase. Raw values imply equality, tuples allow explicit operators, and lists generate multiple equality filters joined by or_connector. Conditions are then joined by and_connector.

Return type:

str

Parameters:
  • filters (Dict[str, Any | Tuple[str, Any] | List[Any]]) –

  • and_connector (str) –

  • or_connector (str) –

Examples

>>> build_filter_string({'age': ('>', 30), 'status': 'active'})
'age>30;status==active'
>>> build_filter_string({'type': ['A', 'B']})
'type==A,type==B'