Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 PRs #176

Merged
merged 3 commits into from
Dec 9, 2024
Merged

3 PRs #176

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions google_sheets/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,13 @@ async def process_data(
status_code=status.HTTP_400_BAD_REQUEST, detail=validation_error_msg
)

template_df["Category"] = template_df["Category"].str.lower()
new_campaign_df["Category"] = new_campaign_df["Category"].str.lower()
for col in ["Ad Group Category", "Real Category"]:
merged_campaigns_ad_groups_df[col] = merged_campaigns_ad_groups_df[
col
].str.lower()

processed_df = process_data_f(
merged_campaigns_ad_groups_df,
template_df,
Expand Down
2 changes: 1 addition & 1 deletion google_sheets/data_processing/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def _replace_headline_values(new_row: pd.Series, station: Dict[str, Any]) -> pd.
return new_row


USE_ORIGINAL_STATION_FROM = ["Transfer", "Taxi"]
USE_ORIGINAL_STATION_FROM = ["transfer", "taxi"]


def _process_row(
Expand Down
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies = [
"pydantic>=2.3,<3",
"fastapi>=0.110.2",
"prisma==0.13.1",
"google-api-python-client==2.149.0",
"google-api-python-client==2.154.0",
"asyncify==0.10.0",
"pandas==2.2.3"
]
Expand All @@ -56,7 +56,7 @@ dependencies = [
# public distributions

server = [
"uvicorn==0.32.0",
"uvicorn==0.32.1",
]

# dev dependencies
Expand All @@ -67,16 +67,16 @@ lint = [
"types-Pygments",
"types-docutils",
"mypy==1.13.0",
"ruff==0.6.9",
"ruff==0.8.1",
"pyupgrade-directories==0.3.0",
"bandit==1.7.10",
"semgrep==1.90.0",
"bandit==1.8.0",
"semgrep==1.97.0",
"pytest-mypy-plugins==3.1.2",
]

test-core = [
"coverage[toml]==7.6.4",
"pytest==8.3.3",
"coverage[toml]==7.6.8",
"pytest==8.3.4",
"pytest-asyncio==0.24.0",
]

Expand Down
20 changes: 8 additions & 12 deletions tests/app/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ class TestProcessData:
(
GoogleSheetValues(
values=[
["Fake column"],
["fake"],
["Fake column", "Category"],
["fake", "Bus"],
]
),
GoogleSheetValues(
Expand All @@ -371,6 +371,7 @@ class TestProcessData:
"Final Url From",
"Final Url To",
"Language Code",
"Category",
],
[
"India",
Expand All @@ -379,6 +380,7 @@ class TestProcessData:
"https://www.example.com/from",
"https://www.example.com/to",
"EN",
"Bus",
],
]
),
Expand All @@ -394,8 +396,6 @@ class TestProcessData:
"Negative",
"Language Code",
"Category",
"Ad Group Category",
"Real Category",
],
[
"Keyword A",
Expand All @@ -404,8 +404,6 @@ class TestProcessData:
"False",
"EN",
"Bus",
"Bus",
"Bus",
],
[
"Keyword N",
Expand All @@ -414,8 +412,6 @@ class TestProcessData:
"True",
"EN",
"Bus",
"Bus",
"Bus",
],
]
),
Expand Down Expand Up @@ -498,6 +494,8 @@ async def test_process_data_keywords(
"Ad Group Name": ["{INSERT_STATION_FROM} - {INSERT_STATION_TO}"],
"Match Type": ["Exact"],
"Target Category": ["True"],
"Ad Group Category": ["Bus"],
"Real Category": ["Bus"],
}
)
if isinstance(detail, GoogleSheetValues):
Expand Down Expand Up @@ -535,8 +533,6 @@ async def test_process_data_ads(self) -> None:
"Path 1",
"Path 2",
"Match Type",
"Ad Group Category",
"Real Category",
],
[
"EN",
Expand All @@ -550,8 +546,6 @@ async def test_process_data_ads(self) -> None:
"Path 1",
"Path 2",
"Exact",
"Bus",
"Bus",
],
]
)
Expand Down Expand Up @@ -588,6 +582,8 @@ async def test_process_data_ads(self) -> None:
"Ad Group Name": ["{INSERT_STATION_FROM} - {INSERT_STATION_TO}"],
"Match Type": ["Exact"],
"Target Category": ["False"],
"Ad Group Category": ["bus"],
"Real Category": ["bus"],
}
)
result = await process_data(
Expand Down
Loading