flip.core.base
FLIP Base Classes.
This module contains the abstract base class for all FLIP implementations.
Classes
Abstract base class for FLIP functionality across all job types. |
Module Contents
- class flip.core.base.FLIPBase[source]
Bases:
abc.ABCAbstract base class for FLIP functionality across all job types.
This class defines the interface that all FLIP implementations must follow. Concrete implementations handle the differences between development and production environments, as well as job-type-specific behavior.
- abstractmethod get_dataframe(project_id: str, query: str) pandas.DataFrame[source]
Returns a dataframe for the project/query.
- abstractmethod get_by_accession_number(project_id: str, accession_id: str, resource_type: flip.constants.flip_constants.ResourceType | List[flip.constants.flip_constants.ResourceType] = ResourceType.NIFTI) pathlib.Path[source]
Returns the path to the data for the given accession number.
- Parameters:
project_id (str) – The project identifier
accession_id (str) – The accession ID of the imaging study
resource_type (Union[ResourceType, List[ResourceType]]) – Type(s) of resources to download
- Returns:
Path – Path to the downloaded data
- abstractmethod add_resource(project_id: str, accession_id: str, scan_id: str, resource_id: str, files: List[str]) None[source]
Adds specific image to XNAT for an accession ID.
- abstractmethod update_status(model_id: str, new_model_status: flip.constants.flip_constants.ModelStatus) None[source]
Updates training status in Central Hub.
- Parameters:
model_id (str) – The model UUID
new_model_status (ModelStatus) – The new status to set
- abstractmethod send_metrics(client_name: str, model_id: str, label: str, value: float, round: int) None[source]
Sends a metric value to the Central Hub.
- abstractmethod send_handled_exception(formatted_exception: str, client_name: str, model_id: str) None[source]
Sends a training-related exception to Central Hub.
- abstractmethod upload_results_to_s3(results_folder: pathlib.Path, model_id: str) None[source]
Uploads results to S3 bucket.
- Parameters:
results_folder (Path) – The folder containing results to upload
model_id (str) – The model UUID for which results are being uploaded
- abstractmethod cleanup(path: pathlib.Path) None[source]
Cleans up local files.
- Parameters:
path (Path) – The path to the file or directory to clean up
- check_resource_type(resource_type: flip.constants.flip_constants.ResourceType | List[flip.constants.flip_constants.ResourceType]) List[flip.constants.flip_constants.ResourceType][source]
Check whether resource type is valid and returns them reformatted.
- Parameters:
resource_type (Union[ResourceType, List[ResourceType]]) – Single ResourceType or list of ResourceTypes
- Returns:
List[ResourceType] – List of validated resource types
- Raises:
TypeError – If resource_type is not valid