Skip to content

Commit

Permalink
Merge pull request #247 from TogetherCrew/feat/246-violation-detectio…
Browse files Browse the repository at this point in the history
…n-unique-report

feat: sending unique reports!
  • Loading branch information
amindadgar authored Aug 7, 2024
2 parents 1a95e04 + 870cd21 commit 587edf3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion dags/discourse_analyzer_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,9 @@ def analyze_discourse(platform_processed: dict[str, str | bool]) -> None:

raw_data_etl = discourse_etl_raw_data.expand(platform_info=platform_modules)
raw_members_etl = discourse_etl_raw_members.expand(platform_info=platform_modules)
raw_members_etl >> analyze_discourse(platform_processed=raw_data_etl)

analyze_discourse_task = analyze_discourse.expand(
platform_processed=platform_modules
)

[raw_data_etl, raw_members_etl] >> analyze_discourse_task
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def test_multiple_valid_inputs(self):
"Document link: https://sample_link2.com | Label: Identifying, Sexualized\n"
"Document link: https://sample_link3.com | Label: Sexualized"
)
self.assertEqual(result, expected_report, "Expected a valid report string")
for report in expected_report.split("\n"):
self.assertIn(report, result, "Expected a valid report string")

@patch("logging.error")
def test_missing_link(self, mock_logging_error):
Expand Down
2 changes: 1 addition & 1 deletion dags/violation_detection_helpers/utils/prepare_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def prepare(self, transformed_documents: list[dict[str, Any]]) -> str | None:
if len(reports) != 0:
report = (
"Here's a list of messages with detected violation\n\n"
+ "\n".join(reports)
+ "\n".join(list(set(reports)))
)
else:
logging.warning(
Expand Down

0 comments on commit 587edf3

Please sign in to comment.