pat2vec.patvec_get_batch_methods.get_prefetch_batches

Functions

prefetch_batches(pat2vec_obj)

Prefetches and processes patient data batches with progress tracking.

Classes

BatchConfig(name,Β enabled_option,Β ...[,Β ...])

Configuration for a single data type batch processing operation.

class pat2vec.patvec_get_batch_methods.get_prefetch_batches.BatchConfig(name, enabled_option, get_function, save_path_attr, search_term=None)[source]

Bases: object

Configuration for a single data type batch processing operation.

Parameters:
  • name (str)

  • enabled_option (str)

  • get_function (callable)

  • save_path_attr (str)

  • search_term (str | None)

name

A human-readable name for the batch type (e.g., β€œbloods”).

enabled_option

The key in the main options config that enables/disables this batch type.

get_function

The function used to retrieve the merged batch of data.

save_path_attr

The attribute name in the main config object that holds the save path for the split patient files.

search_term

An optional search term required by the get_function.

name: str
enabled_option: str
get_function: callable
save_path_attr: str
search_term: Optional[str] = None
pat2vec.patvec_get_batch_methods.get_prefetch_batches.prefetch_batches(pat2vec_obj)[source]

Prefetches and processes patient data batches with progress tracking.

This function orchestrates the pre-fetching of data for multiple data types (e.g., bloods, drugs, documents) in bulk. For each enabled data type, it calls the appropriate get_merged_pat_batch_* function to retrieve data for all patients at once. It then splits these large, merged DataFrames into individual patient files and saves them to their respective directories.

This approach is often more efficient than fetching data patient-by-patient, especially when dealing with a large cohort.

Parameters:

pat2vec_obj (Any) – The patient vector object containing configuration and patient data.

Return type:

List[BatchConfig]

Returns:

A list of the BatchConfig objects that were processed.