Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
again add pits suggestions

Co-authored-by: Pit Buttchereit <[email protected]>
  • Loading branch information
nils-schmitt and PitButtchereit authored May 24, 2024
1 parent c227dfb commit 35b0441
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __rate_activity_relevance(activity: str, condition: str | None) -> str:
return category

def __rate_timestamps_correctness(
self, activity: str, start, end
self, activity: str, start: pd.DateTime, end: pd.DateTime
) -> Tuple[str, float]:
messages = Prompt.objects.get(name="METRIC_TIMESTAMP_MESSAGES").text
messages.append(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,20 @@ def __calculate_duration(row: pd.Series) -> str:
def __post_processing(df: pd.DataFrame) -> pd.DataFrame:
"""Fill missing values for dates with default values."""

def convert_to_datetime(df: pd.DataFrame, column: pd.Series):
def convert_to_datetime(df: pd.DataFrame, column: pd.Series) -> pd.DataFrame:
df[column] = pd.to_datetime(
df[column], format="%Y%m%dT%H%M", errors="coerce"
)

return df

def set_default_date_if_na(df: pd.DataFrame, column: pd.Series):
def set_default_date_if_na(df: pd.DataFrame, column: pd.Series) -> pd.DataFrame:
if df[column].isna().all():
df[column] = df[column].fillna(pd.Timestamp("2020-01-01 00:00"))

return df

def fill_missing_values(df: pd.DataFrame, column: pd.Series):
def fill_missing_values(df: pd.DataFrame, column: pd.Series) -> pd.DataFrame:
df[column] = df[column].ffill().bfill()

return df
Expand Down
2 changes: 1 addition & 1 deletion tracex_project/extraction/logic/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def get_configuration(self):
"""Return the configuration for the orchestrator instance."""
return self.configuration

def set_data(self, data: pd.DataFrame):
def set_data(self, data: pd.DataFrame) -> None:
"""Set the data for the orchestrator instance."""
self.data = data

Expand Down

0 comments on commit 35b0441

Please sign in to comment.