Skip to content

Commit 54dd097

Browse files
committed
Merged
2 parents 5f57988 + 5a8c2db commit 54dd097

43 files changed

Lines changed: 3018 additions & 715 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

doc/sprint3/NFR.pdf

88.2 KB
Binary file not shown.

doc/sprint3/RPM.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# EpiReady Sprint 3 Release Planning Meeting
2+
3+
## Release Goal
4+
To implement comprehensive alert management and action tracking capabilities for the cold-chain logistics monitoring system, enabling users to receive real-time notifications, manage alert statuses, and maintain detailed action logs for audit trails.
5+
6+
## Project Scope
7+
8+
### Included Features
9+
10+
#### 1. Alert Management System
11+
- **Purpose**: Complete alert lifecycle management with status tracking
12+
- **Details**: Alert creation, status updates (active, inprogress, resolved), alert deactivation, and comprehensive alert history with timestamps
13+
14+
#### 2. Action History & Logging
15+
- **Purpose**: Detailed tracking of all actions taken on shipments and alerts
16+
- **Details**: ActionLog model for alert-related actions, ShipmentAction model for shipment operations, and comprehensive action history API endpoints
17+
18+
<!-- #### 3. Manual Override Capabilities
19+
- **Purpose**: Allow users to manually control alert statuses and actions
20+
- **Details**: Alert status override functionality, action creation and management, and user permission-based access control -->
21+
22+
#### 3. Real-time Alert Notifications
23+
- **Purpose**: Instant notification delivery through WebSocket connections
24+
- **Details**: Real-time breach alerts, temperature monitoring, and live status updates with socket-based communication
25+
26+
#### 4. Organization Management System
27+
- **Purpose**: Multi-tenant organization support for team collaboration
28+
- **Details**: Organization creation, join code system, user organization association, and organization-based access control
29+
30+
#### 5. Shipment Analytics & Visualization
31+
- **Purpose**: Data visualization and historical analysis for shipment monitoring
32+
- **Details**: Graphs tab with temperature/humidity charts, history tab with action logs and timeline, and interactive data visualization components
33+
34+
### Excluded Features
35+
- **SMS/Text Alerts**: Limited to email notifications due to unnecessary api costs addition
36+
- **Change Password**: Axed due to safety and security concerns for users
37+
## Bug Fixes
38+
- Fixed alert status update functionality
39+
- Resolved action history display issues
40+
- Improved error handling for alert management operations
41+
42+
## Non-Functional Requirements
43+
44+
| Requirement | Description | Measurable Criteria |
45+
|----------------|---------------------------------------------------------------------|----------------------------------------------|
46+
| **Performance** | Alert system responds within 500ms for email delivery | 95% of email alerts delivered within 500ms |
47+
| **Security** | Alert access control and action logging | All alert operations require valid authentication |
48+
| **Usability** | Intuitive alert management interface | Users can manage alerts in under 1 minute |
49+
| **Reliability** | Robust email delivery and alert persistence | 99% alert delivery success rate |
50+
| **Data Integrity** | Complete audit trail for all actions | 100% action logging accuracy |
51+
52+
## Dependencies
53+
- **Real-time Communication**: Flask-SocketIO with eventlet
54+
- **Database**: PostgreSQL with Alembic migrations
55+
- **Frontend**: React with Socket.IO client
56+
- **Authentication**: JWT token-based with role-based access
57+
58+
## Known Limitations
59+
- **Email Rate Limiting**: Maximum 2 emails per monitoring cycle to stay within free tier for email pushes
60+
- **Mock Data**: Temperature and humidity data still simulated rather than real sensor feeds due to missing OpenWeatherAPI
61+
- **Limited Email Customization**: Basic email templates without rich formatting
62+
- **No SMS Integration**: Text alerts not implemented due to service costs
63+
64+
## Participants
65+
- **Frontend Team**: Bo, Shubham, David
66+
- **Backend Team**: Eric, Ansh
67+
- **Project Lead**: Team coordination and feature prioritization
68+
- **Stakeholder**: Founder consultation for feature requirements
69+
70+
## Release Criteria
71+
- All alert management endpoints functional and tested
72+
- Email notification system operational with error handling
73+
- Action history tracking working for all user operations
74+
- Real-time notifications delivering alerts within 1 second
75+
- Manual override capabilities accessible to authorized users

doc/sprint3/burndown.pdf

35.2 KB
Binary file not shown.

doc/sprint3/schedule.pdf

65.9 KB
Binary file not shown.

doc/sprint3/sprint-03-review.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# EpiReady
2+
3+
> _Note:_ This document is meant to be written during (or shortly after) your review meeting, which should happen fairly close to the due date.
4+
>
5+
> _Suggestion:_ Have your review meeting a day or two before the due date. This way you will have some time to go over (and edit) this document, and all team members should have a chance to make their contribution.
6+
7+
8+
## Iteration 3 - Review & Retrospect
9+
10+
* When: July 20th, 2025
11+
* Where: Online
12+
13+
#### Decisions that turned out well
14+
15+
* Implementing email alerts with Flask-Mail was successful and provides reliable notification delivery for critical temperature breaches. The integration with the existing socket system ensures real-time updates reach users immediately.
16+
* The action history and logging system provides comprehensive audit trails, which is crucial for medical logistics compliance and accountability.
17+
* Manual override capabilities give users control over alert management, improving the system's usability and trustworthiness.
18+
* The modular approach to alert management (separate models for Alert and ActionLog) allows for flexible future enhancements.
19+
20+
#### Decisions that did not turn out as well as we hoped
21+
22+
* We had to limit email notifications to 2 per monitoring cycle to prevent spam, which may not be sufficient for high-volume operations.
23+
* SMS/text alerts were not implemented due to the complexity of integrating third-party SMS services, limiting notification options.
24+
* The alert system still relies on mock data rather than real sensor feeds, which affects the authenticity of the monitoring experience.
25+
* The alert system still relies on mock data rather than real sensor feeds, which affects the authenticity of the monitoring experience.
26+
27+
## Product - Review
28+
29+
#### Goals and/or tasks that were met/completed:
30+
31+
* Successfully implemented email alert system with Flask-Mail integration for temperature and humidity breach notifications
32+
* Created comprehensive alert management system with status tracking (active, inprogress, resolved)
33+
* Implemented action history and logging with ActionLog and ShipmentAction models
34+
* Added manual override capabilities for alert status management
35+
* Established real-time alert notifications through WebSocket connections
36+
* Created alert viewing interface with pagination and filtering capabilities
37+
* Implemented alert deactivation functionality for better user control
38+
* Added shipment analytics with graphs tab showing temperature/humidity charts and trends
39+
* Implemented history tab with comprehensive action logs and timeline visualization
40+
* Implemented organization management system with creation and joining functionality
41+
42+
#### Goals and/or tasks that were planned but not met/completed:
43+
44+
* SMS/text alerts were not implemented due to third-party service integration complexity and time constraints
45+
* Real-time push notifications for mobile devices were not implemented
46+
* Custom alert rules configuration interface was not developed - alerts use predefined conditions
47+
* Real-time push notifications for mobile devices were not implemented
48+
* Integration with real sensor data feeds instead of mock data was not achieved
49+
50+
## Meeting Highlights
51+
52+
Going into the next iteration, our main insights are:
53+
54+
* The alert system foundation is solid and provides a good base for future enhancements. The modular design allows for easy addition of new notification channels and alert types.
55+
* We need to prioritize real data integration to make the system more valuable for actual cold-chain operations. Mock data limits the system's practical utility.
56+
* User feedback indicates a need for more sophisticated alert visualization and analytics to help identify trends and patterns in shipment issues.
57+
* The email rate limiting (2 emails per cycle) may need to be configurable based on user needs and operational requirements.
58+
* Future sprints should focus on data integration, advanced analytics, and mobile notification capabilities to make the system more comprehensive and user-friendly.

epiready-backend/app.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import eventlet
2-
eventlet.monkey_patch()
3-
1+
if __name__ == '__main__':
2+
import eventlet
3+
eventlet.monkey_patch()
44
from flask import Flask, jsonify
55
from flask_mail import Mail
66
from flask_cors import CORS
@@ -10,7 +10,7 @@
1010
from config.database import init_db, db
1111
import os
1212
from flask_migrate import Migrate
13-
import models
13+
from models import user, shipment, temperature, alert, weather, shipment_action, chat, organization
1414

1515
load_dotenv()
1616

@@ -32,8 +32,9 @@ def create_app():
3232
app.config['MAIL_USE_TLS'] = True
3333

3434
from socket_events import register_socketio_events
35-
from models import user, shipment, temperature, alert, weather, shipment_action
36-
35+
36+
print("we are here")
37+
3738
migrate = Migrate(app, db)
3839
socketio.init_app(app)
3940
mail = Mail(app)
@@ -43,9 +44,9 @@ def create_app():
4344

4445
register_socketio_events(socketio, app, mail)
4546
return app
46-
47-
app = create_app()
4847

48+
app = create_app()
49+
4950
@app.route("/health", methods=["GET"])
5051
def health_check():
5152
print("CORS_ORIGIN:", os.getenv("CORS_ORIGIN"))
@@ -58,5 +59,7 @@ def add_security_headers(response):
5859
response.headers['Content-Security-Policy'] = "frame-ancestors 'none';"
5960
return response
6061

62+
6163
if __name__ == '__main__' and os.getenv("FLASK_ENV") == "development":
64+
6265
socketio.run(app, debug=True)

epiready-backend/controllers/alerts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
from flask_mail import Message, Mail
1111
import eventlet
1212

13+
eventlet.monkey_patch()
14+
1315
def parse_temp_range(temp_range):
1416
"""Parses a string like '2 to 8' into (2.0, 8.0)."""
1517
try:

epiready-backend/controllers/auth.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,26 @@ def signup():
2222
2323
Registers a new user.
2424
25+
Role of the user is by default manufacturer when registering.
26+
2527
Request Body:
2628
{
2729
"email": "user@example.com",
2830
"password": "password123",
29-
"role": "manufacturer" // Optional: manufacturer, transporter, transporter_manager
3031
}
3132
3233
Possible Error Responses:
3334
- 400 Bad Request: "Please type both email and password as they are both required."
34-
- 400 Bad Request: "Invalid role. Must be one of: manufacturer, transporter, transporter_manager"
3535
- 400 Bad Request: "This email address is already registered as a user."
3636
"""
3737

3838
data = request.get_json(force=True)
3939
email, password = data.get("email"), data.get("password")
40-
role = data.get("role", "manufacturer")
4140

4241
if not email or not password:
4342
return jsonify({"error": "Please type both email and password as they are both required."}), 400
4443

45-
valid_roles = ['manufacturer', 'transporter', 'transporter_manager']
46-
if role not in valid_roles:
47-
return jsonify({"error": f"Invalid role. Must be one of: {', '.join(valid_roles)}"}), 400
48-
49-
if not create_user(email, password, role):
44+
if not create_user(email, password):
5045
return jsonify({"error": "This email address is already registered as a user."}), 400
5146

5247
return jsonify({"message": "User registered successfully!"}), 200

0 commit comments

Comments
 (0)