Skip to content

Latest commit

 

History

History
45 lines (27 loc) · 1.83 KB

File metadata and controls

45 lines (27 loc) · 1.83 KB

Plan for Implementing Real-Time Alert Engine

This plan outlines the steps to implement the real-time alert engine for the LifeLine-ICT project, as described in GitHub Issue #3.

Status: Implemented

1. Create the alert_engine Module

  • Create a new directory backend/app/alert_engine.
  • This module will contain the logic for the real-time alert engine.

2. Implement the Alert Model

  • Create a new file backend/app/models/alert.py.
  • This model will represent an alert in the database, including fields for sensor_id, metric, value, threshold, and timestamp.

3. Implement the AlertRepository

  • Create a new file backend/app/repositories/alert_repository.py.
  • This repository will handle the database operations for the Alert model, including creating and retrieving alerts.

4. Implement the AlertService

  • Create a new file backend/app/services/alert_service.py.
  • This service will contain the business logic for creating and retrieving alerts, including checking for threshold breaches.

5. Implement the alert_router

  • Create a new file backend/app/api/alert_router.py.
  • This router will expose the alert endpoints to the API, including an endpoint for creating alerts and an endpoint for retrieving alerts.

6. Integrate the alert_router into the Main Application

  • In backend/app/main.py, import and include the alert_router.
  • This will make the alert endpoints available to users.

7. Add Unit Tests for the alert_engine Module

  • Create a new file backend/tests/alert_engine/test_alert_service.py.
  • Add unit tests to ensure that the alert engine is working correctly, including testing the threshold breach logic.

8. Create a CI Pipeline

  • Create a new file .github/workflows/ci.yml.
  • This pipeline will automate the testing of the application on every push to the repository.