Skip to content

Commit

Permalink
Update ads validation (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjambrecic authored Sep 3, 2024
1 parent 54926d9 commit 496b296
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions google_sheets/data_processing/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,13 @@ def _validate_output_data_ad(df: pd.DataFrame) -> pd.DataFrame: # noqa: C901
description_columns = [col for col in df.columns if "Description" in col]

for index, row in df.iterrows():
# Check for duplicate headlines and descriptions
if len(set(row[headline_columns])) != len(row[headline_columns]):
headlines = [headline for headline in row[headline_columns] if headline]
descriptions = [
description for description in row[description_columns] if description
]
if len(set(headlines)) != len(headlines):
df.loc[index, "Issues"] += "Duplicate headlines found.\n"
if len(set(row[description_columns])) != len(row[description_columns]):
if len(set(descriptions)) != len(descriptions):
df.loc[index, "Issues"] += "Duplicate descriptions found.\n"

# Check for the number of headlines and descriptions
Expand Down
2 changes: 2 additions & 0 deletions tests/data_processing/test_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ def test_process_campaign_data_f(
"Headline 1": ["H1", "H1", "H1", "H1"],
"Headline 2": ["H2", "H2", "H2", "H2"],
"Headline 3": ["H3", "H3", "H3", "H3"],
"Headline 4": ["", "", "", ""],
"Headline 5": ["", "", "", ""],
"Description 1": ["D1", "D1", "D1", "D1"],
"Description 2": ["D2", "D2", "D2", "D2"],
"Path 1": ["P1", "P1", "P1", "P1"],
Expand Down

0 comments on commit 496b296

Please sign in to comment.