Skip to content

Commit

Permalink
Update suspicions of under declaration alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentAntoine committed Dec 13, 2024
1 parent 1e7ba34 commit be3472f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def extract_suspicions_of_under_declaration():
AlertType.SUSPICION_OF_UNDER_DECLARATION_ALERT.value,
)
silenced_alerts = extract_silenced_alerts(
AlertType.SUSPICION_OF_UNDER_DECLARATION_ALERT.value
AlertType.SUSPICION_OF_UNDER_DECLARATION_ALERT.value,
# 8 days, to cover the date range analyzed in
# `extract_suspicions_of_under_declaration`
number_of_hours=192,
)
active_reportings = extract_active_reportings(
AlertType.SUSPICION_OF_UNDER_DECLARATION_ALERT.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ SELECT
fe.dml,
fe.flag_state,
lp.risk_factor,
DATE_TRUNC('day', CURRENT_TIMESTAMP AT TIME ZONE 'UTC') - INTERVAL '7 days' AS triggering_behaviour_datetime_utc,
lp.latitude,
lp.longitude
FROM fishing_efforts fe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime, timezone
from datetime import datetime, timedelta, timezone

import pandas as pd
import pytest
Expand All @@ -17,6 +17,10 @@

@pytest.fixture
def expected_suspicions_of_under_declaration() -> pd.DataFrame:
today_at_zero_hours = datetime.utcnow().replace(
hour=0, minute=0, second=0, microsecond=0
)
one_day = timedelta(days=1)
return pd.DataFrame(
{
"cfr": ["ABC000306959"],
Expand All @@ -29,6 +33,7 @@ def expected_suspicions_of_under_declaration() -> pd.DataFrame:
"dml": ["DML 29"],
"flag_state": ["FR"],
"risk_factor": [2.58],
"triggering_behaviour_datetime_utc": [today_at_zero_hours - 7 * one_day],
"latitude": [49.606],
"longitude": [-0.736],
}
Expand Down

0 comments on commit be3472f

Please sign in to comment.