adds docstrings

This commit is contained in:
2025-02-10 02:28:50 +01:00
parent e57869374b
commit 595237c172
9 changed files with 225 additions and 22 deletions

View File

@@ -18,13 +18,24 @@ class BasePlotlyAnalysis(BaseAnalysis, ABC):
- Transformation
- Plot generation
- Memory cleanup
Attributes:
plot_filename (str): The filename for the output plot.
alt_text (str): The alt text for the plot.
"""
plot_filename = "default_plot.html"
alt_text = "Default Alt Text"
def execute(self, df: pd.DataFrame):
"""Executes the full analysis pipeline"""
"""
Executes the full analysis pipeline.
Parameters:
df (pd.DataFrame): The input DataFrame containing user activity data.
Returns:
str: HTML iframe containing the URL to the generated plot.
"""
df = prepare_data(df) # Step 1: Prepare data
paths = mk_plotdir(self.plot_filename)
@@ -41,10 +52,23 @@ class BasePlotlyAnalysis(BaseAnalysis, ABC):
@abstractmethod
def transform_data(self, df: pd.DataFrame) -> pd.DataFrame:
"""Subclasses must define how they transform the data"""
"""
Subclasses must define how they transform the data.
Parameters:
df (pd.DataFrame): The input DataFrame containing user activity data.
Returns:
pd.DataFrame: The transformed DataFrame.
"""
pass
@abstractmethod
def plot_data(self, df: pd.DataFrame):
"""Subclasses must define how they generate the plot"""
"""
Subclasses must define how they generate the plot.
Parameters:
df (pd.DataFrame): The transformed DataFrame containing data to be plotted.
"""
pass