streamsightv2.metadata.Metadata

class streamsightv2.metadata.Metadata(filename: str | None = None, base_path: str | None = None)

Bases: ABC

__init__(filename: str | None = None, base_path: str | None = None)

Methods

__init__([filename, base_path])

fetch_metadata([force])

Check if metadata is present, if not download

load()

Load the metadata from file and return it as a DataFrame.

Attributes

DEFAULT_BASE_PATH

Default base path where the dataset will be stored.

DEFAULT_FILENAME

Default filename that will be used if it is not specified by the user.

file_path

File path of the metadata.

name

Name of the object's class.

DEFAULT_BASE_PATH = 'metadata'

Default base path where the dataset will be stored.

DEFAULT_FILENAME = None

Default filename that will be used if it is not specified by the user.

_abc_impl = <_abc._abc_data object>
_check_safe()

Check if the directory is safe. If directory does not exit, create it.

abstract _download_metadata()

Downloads the metadata.

Downloads the csv file from the metadata URL and saves it to the file path.

_fetch_remote(url: str, filename: str) str

Fetch metadata from remote url and save locally

Parameters:
  • url (str) – url to fetch metadata from

  • filename (str) – Path to save file to

Returns:

The filename where metadata was saved

Return type:

str

abstract _load_metadata_dataframe() DataFrame

Load the raw metadata from file, and return it as a pandas DataFrame.

Warning

This does not apply any preprocessing, and returns the raw dataset.

Returns:

Dataframe containing the raw metadata

Return type:

pd.DataFrame

fetch_metadata(force=False) None

Check if metadata is present, if not download

Parameters:

force (bool, optional) – If True, metadata will be downloaded, even if the file already exists. Defaults to False.

property file_path: str

File path of the metadata.

load() DataFrame

Load the metadata from file and return it as a DataFrame.

Returns:

Dataframe containing the metadata

Return type:

pd.DataFrame

property name

Name of the object’s class.