Skip to content

Commit

Permalink
Correction du type d'alerte pour les alertes de suspicion de sous-d…
Browse files Browse the repository at this point in the history
…éclaration (#3865)

## Linked issues

- Resolve #3864
  • Loading branch information
VincentAntoine authored Nov 15, 2024
2 parents 68d1446 + 9e400d5 commit 236e3e2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion datascience/src/pipeline/entities/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ class AlertType(Enum):
MISSING_DEP_ALERT = "MISSING_DEP_ALERT"
MISSING_FAR_ALERT = "MISSING_FAR_ALERT"
MISSING_FAR_48_HOURS_ALERT = "MISSING_FAR_48_HOURS_ALERT"
SUSPICION_OF_UNDER_DECLARATION = "SUSPICION_OF_UNDER_DECLARATION"
SUSPICION_OF_UNDER_DECLARATION_ALERT = "SUSPICION_OF_UNDER_DECLARATION_ALERT"
RTC_FISHING_ALERT = "RTC_FISHING_ALERT"
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ def extract_suspicions_of_under_declaration():

alerts = make_alerts(
vessels_with_suspicions_of_under_declaration,
AlertType.SUSPICION_OF_UNDER_DECLARATION.value,
AlertType.SUSPICION_OF_UNDER_DECLARATION.value,
AlertType.SUSPICION_OF_UNDER_DECLARATION_ALERT.value,
AlertType.SUSPICION_OF_UNDER_DECLARATION_ALERT.value,
)
silenced_alerts = extract_silenced_alerts(
AlertType.SUSPICION_OF_UNDER_DECLARATION.value
AlertType.SUSPICION_OF_UNDER_DECLARATION_ALERT.value
)
active_reportings = extract_active_reportings(
AlertType.SUSPICION_OF_UNDER_DECLARATION.value
AlertType.SUSPICION_OF_UNDER_DECLARATION_ALERT.value
)
filtered_alerts = filter_alerts(alerts, silenced_alerts, active_reportings)

# Load
load_alerts(
filtered_alerts,
alert_config_name=AlertType.SUSPICION_OF_UNDER_DECLARATION.value,
alert_config_name=AlertType.SUSPICION_OF_UNDER_DECLARATION_ALERT.value,
)

flow.file_name = Path(__file__).name
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_extract_suspicions_of_under_declaration(


def test_flow(reset_test_data_suspicions_of_under_declaration_alerts):
query = "SELECT * FROM pending_alerts WHERE alert_config_name = 'SUSPICION_OF_UNDER_DECLARATION'"
query = "SELECT * FROM pending_alerts WHERE alert_config_name = 'SUSPICION_OF_UNDER_DECLARATION_ALERT'"

initial_pending_alerts = read_query(query, db="monitorfish_remote")

Expand All @@ -113,12 +113,12 @@ def test_flow(reset_test_data_suspicions_of_under_declaration_alerts):
"trip_number": None,
"value": {
"dml": "DML 29",
"type": "SUSPICION_OF_UNDER_DECLARATION",
"type": "SUSPICION_OF_UNDER_DECLARATION_ALERT",
"seaFront": "SA",
"riskFactor": 2.58,
},
"vessel_identifier": "INTERNAL_REFERENCE_NUMBER",
"alert_config_name": "SUSPICION_OF_UNDER_DECLARATION",
"alert_config_name": "SUSPICION_OF_UNDER_DECLARATION_ALERT",
"vessel_id": 1.0,
"latitude": 49.606,
"longitude": -0.736,
Expand Down

0 comments on commit 236e3e2

Please sign in to comment.