Skip to content

Pipeline interface

Pipeline (Interface)

This file provides the framework for the transformation pipeline from raw track data located in data/tracks.csv through to features used for similarity calculations. Each pipeline must inherent from the pipeline interface.

Note: Different pipelines may result in varied features, hence the need for a pipeline interface, such that there exists a common method for the front-end to make use of.

Pipeline Interface Documentation

Pipeline

Bases: ABC

This class serves as transformation pipeline from Spotify tracks raw data to track features

Note, the tracks database is stored in the data/tracks.csv file.

Source code in src/pipeline_interface.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
class Pipeline(ABC):
    """This class serves as transformation pipeline from Spotify tracks raw data to track features

    Note, the tracks database is stored in the `data/tracks.csv` file.
    """
    @staticmethod
    @abstractmethod
    def data_pipeline(df):
        """This method enacts the transformation pipeline to produce a set of track features.
        It is expected for the playlist to return a pandas DataFrame containing all features.

        Args:
            df (DataFrame): The dataframe containing the raw data from the `data/tracks.csv` file
        """
        pass

data_pipeline(df) abstractmethod staticmethod

This method enacts the transformation pipeline to produce a set of track features. It is expected for the playlist to return a pandas DataFrame containing all features.

Parameters:

Name Type Description Default
df DataFrame

The dataframe containing the raw data from the data/tracks.csv file

required
Source code in src/pipeline_interface.py
 9
10
11
12
13
14
15
16
17
18
@staticmethod
@abstractmethod
def data_pipeline(df):
    """This method enacts the transformation pipeline to produce a set of track features.
    It is expected for the playlist to return a pandas DataFrame containing all features.

    Args:
        df (DataFrame): The dataframe containing the raw data from the `data/tracks.csv` file
    """
    pass