pat2vec.patvec_get_batch_methods.get_prefetch_batchesο
Functions
|
Prefetches and processes patient data batches with progress tracking. |
Classes
|
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.