-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add private spam metrics report with preprint inclusion
- Loading branch information
Uditi Mehta
authored and
Uditi Mehta
committed
Nov 4, 2024
1 parent
1c35276
commit 771830b
Showing
6 changed files
with
76 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from osf.metrics.reports import SpamSummaryReport | ||
from osf.external.oopspam.client import OOPSpamClient | ||
from osf.external.askismet.client import AkismetClient | ||
from ._base import MonthlyReporter | ||
|
||
class PrivateSpamMetricsReporter(MonthlyReporter): | ||
report_name = 'Private Spam Metrics' | ||
|
||
def report(self, report_yearmonth): | ||
target_month = report_yearmonth.target_month() | ||
next_month = report_yearmonth.next_month() | ||
|
||
oopspam_client = OOPSpamClient() | ||
akismet_client = AkismetClient() | ||
|
||
report = SpamSummaryReport( | ||
report_yearmonth=str(report_yearmonth), | ||
node_oopspam_flagged=oopspam_client.get_flagged_count(target_month, next_month, category='node'), | ||
node_oopspam_hammed=oopspam_client.get_hammed_count(target_month, next_month, category='node'), | ||
node_akismet_flagged=akismet_client.get_flagged_count(target_month, next_month, category='node'), | ||
node_akismet_hammed=akismet_client.get_hammed_count(target_month, next_month, category='node'), | ||
preprint_oopspam_flagged=oopspam_client.get_flagged_count(target_month, next_month, category='preprint'), | ||
preprint_oopspam_hammed=oopspam_client.get_hammed_count(target_month, next_month, category='preprint'), | ||
preprint_akismet_flagged=akismet_client.get_flagged_count(target_month, next_month, category='preprint'), | ||
preprint_akismet_hammed=akismet_client.get_hammed_count(target_month, next_month, category='preprint') | ||
) | ||
|
||
return [report] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters