idmd.data.uploader.FileUploader
- class idmd.data.uploader.FileUploader(file_types=None, default_file=None)[source]
Bases:
objectHandles file upload and data initialization.
Initializes the FileUploader with allowed file types and a default file.
- Args:
file_types (list, optional): List of allowed file types for upload. Defaults to [“csv”, “xlsx”]. default_file (str, optional): Path to a default file to load if no file is uploaded. Defaults to None.
Methods
Checks if the uploaded file is new.
Loads the default file and initializes the dataset in the session state.
Processes the uploaded file and initializes the dataset in the session state.
- is_new_file(file, session_state)[source]
Checks if the uploaded file is new.
- Return type:
bool
- Args:
file: The uploaded file. session_state (dict): The session state to track the uploaded file.
- Returns:
bool: True if the file is new, False otherwise.