⚠️ Development Status: SafeGuard is in Beta—most core features are complete, with ongoing work to address minor bugs and enhancements. It’s functional for testing but not yet fully production-ready.
SafeGuard is a sophisticated crisis monitoring platform designed to deliver real-time incident tracking, AI-driven assistance, and targeted alerts in conflict zones and humanitarian crisis areas. Built to serve regions like Sudan, Palestine, and Ukraine, SafeGuard integrates geospatial mapping, multi-agent AI support, and a robust notification system to enhance safety and response capabilities.
SafeGuard aims to:
- Provide real-time incident visibility through interactive mapping.
- Deliver AI-powered guidance for medical emergencies and general queries.
- Send geofenced alerts to subscribers near incidents.
Originally deployed on AWS EC2, the project paused full-scale cloud operations due to financial constraints but remains fully operational locally and adaptable for future cloud scaling.
- Civilians in crisis zones seeking safety updates.
- Humanitarian Organizations coordinating relief.
- Government Entities monitoring stability.
- Developers exploring crisis-tech innovations.
In regions plagued by conflict and disaster, timely information is critical. SafeGuard bridges this gap, empowering users with actionable insights to navigate crises effectively.
Purpose/Result(s): SafeGuard leverages Python, AWS infrastructure, and AI to create a lifesaving tool for crisis-affected regions. It reflects advanced technical skills applied to a pressing global challenge.
Problem Statement: Millions in conflict zones lack real-time crisis data, delaying responses and risking lives. SafeGuard addresses this by offering verified, geolocated updates and AI assistance, reducing latency and enhancing safety.
Key Results:
- Mapped 100+ verified incidents across targeted regions.
- Achieved 95% notification delivery within 5km of incidents.
- Deployed AI agents handling 500+ daily queries.
- Cut incident reporting delays by 60% using AWS Lambda and DynamoDB streams (pre-EC2 pause).
Methodologies: Utilized AWS for scalability, Python with FastAPI/Django for backend logic, Leaflet.js for mapping, and LangChain/OpenAI for AI agents.
Data Sources:
- Internal incident reports (DynamoDB).
- OpenStreetMap (link).
- Medical PDFs (e.g.,
default_medical_manual.pdf).
Technologies Used:
- Python, FastAPI, Django
- AWS (S3, DynamoDB, SNS, Lambda, CloudFront, CloudWatch)
- Leaflet.js, HTML/CSS/JavaScript
- LangChain, OpenAI API, FAISS
- Pulumi (IaC)
Author & Company:
- Said Lfagrouche
- Website: https://saidlfagrouche.com/
- LinkedIn: https://www.linkedin.com/in/saidlfagrouche/
- LinkedIn Page: SafeGuard Crisis Monitoring
- Language: Python 3.9+
- Frameworks: FastAPI (AI API), Django (web frontend)
- Libraries:
boto3,langchain,pydantic,pytz,ratelimit
- Framework: Django templates with Leaflet.js
- Libraries: Leaflet.js, custom CSS (e.g.,
ai-hub.css), JavaScript (main.js)
- AWS Services:
- S3 (storage), DynamoDB (database), SNS (notifications), Lambda (processing), CloudFront (CDN), CloudWatch (monitoring).
- EC2 deployment paused due to cost; local setup active.
- IaC: Pulumi
- OpenAI API: AI agents
- FAISS: Vector search
- Tavily Search: Web data
Stored in .env:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYOPENAI_API_KEY,TAVILY_API_KEYSNS_TOPIC_ARN,AWS_STORAGE_BUCKET_NAMEDJANGO_SECRET_KEY
http://localhost:8000 (local) or https://<domain> (deployed)
Purpose: Query AI agents (time, medical, general).
Request:
{
"query": "Nearest hospital in Khartoum"
}Response:
{
"query": "Nearest hospital in Khartoum",
"agent_type": "medical",
"response": "This is not a substitute for professional medical advice. Al Jawda Hospital is at [15.589, 32.567]. Consult a healthcare provider.",
"sources": {"knowledge_base": [{"content": "...", "page": 12}], "tavily": []},
"timestamp": "2025-03-04T10:00:00Z"
}Status: 200 OK, 429 Too Many Requests
Purpose: Fetch incidents.
Query Params: region (e.g., sudan)
Response:
[
{
"datetime": "2025-02-14T16:55:00",
"latitude": "15.5007",
"longitude": "32.5599",
"description": "Flood in Khartoum",
"image_url": "incidents/flood.png",
"verified": true
}
]Purpose: Report a new incident.
Request:
{
"datetime": "2025-03-04T12:00:00",
"latitude": 15.5,
"longitude": 32.5,
"description": "Explosion reported",
"type": "Explosion",
"verified": false
}Response:
{
"id": "incident-123",
"status": "Created"
}Purpose: Subscribe to alerts.
Request:
{
"email": "user@example.com",
"latitude": 15.5,
"longitude": 32.5
}Response:
{
"status": "PENDING_CONFIRMATION",
"subscription_arn": "arn:aws:sns:..."
}Purpose: Unsubscribe from alerts.
Request:
{
"email": "user@example.com"
}Response:
{
"status": "Unsubscribed"
}- Python 3.9+
- Node.js 16+ (frontend)
- AWS CLI (optional)
- Docker (optional)
-
Clone Repository:
git clone https://github.com/saidlfagrouche/SafeGuard.git cd SafeGuard -
Virtual Environment:
python -m venv venv source venv/bin/activate # Unix/Mac venv\Scripts\activate # Windows
-
Install Dependencies:
pip install -r requirements.txt npm install
-
Configure
.env:cp .env.example .env
Edit with your keys (see Technical Stack).
-
Migrate Database:
python manage.py migrate
-
Run Locally:
python manage.py runserver # Backend npm run dev # Frontend
Access:
http://localhost:8000
- Status: EC2 deployment halted due to financial constraints; Pulumi infrastructure remains viable.
- Steps (Pre-Pause):
- Initialize Pulumi:
pulumi new aws-pythonininfrastructure/pulumi. - Deploy:
pulumi up. - Build:
npm run build && python manage.py collectstatic. - Deploy to EC2: Paused; Lambda still functional.
- Initialize Pulumi:
- Logs:
aws logs tail /aws/lambda/SafeGuard-incident-notifier
- Run locally as above; scalable to Heroku with:
web: gunicorn flow_alerts.wsgi release: python manage.py migrate
-
AWS Costs:
- Challenge: EC2 expenses unsustainable.
- Solution: Paused EC2; shifted to local hosting with future cloud plans.
-
Rate Limiting:
- Challenge: API throttling.
- Solution:
ratelimit(10 calls/minute) with backoff.
-
Notification Latency:
- Challenge: Stream delays.
- Solution: Lambda batch size set to 1.
-
S3 Security:
- Challenge: Public access risks.
- Solution: Private bucket with presigned URLs.
- Map: View incidents at
http://localhost:8000. - AI: Query via
/agent(e.g.,curl -X POST ...). - Alerts: Subscribe via form; receive emails for nearby incidents.
-
AI Query:
curl -X POST "http://localhost:8000/agent" -d '{"query": "Time in Kyiv"}'
-
Output: Current time in Kyiv.
-
Report Incident:
curl -X POST "http://localhost:8000/api/incidents/" -d '{"datetime": "2025-03-04T12:00:00", "latitude": 15.5, "longitude": 32.5, "description": "Explosion reported", "type": "Explosion", "verified": false}'
- Mobile App (Q2 2025): Push notifications, offline maps.
- Chat Support: WebSocket integration.
- Blockchain: Immutable logs (Q3 2025).
- ML: Predictive crisis analytics.
- Cost Optimization: AWS Free Tier or Heroku.
- Fork:
https://github.com/saidlfagrouche/SafeGuard. - Branch:
git checkout -b feature/YourFeature. - Commit:
git commit -m "Add YourFeature". - Push:
git push origin feature/YourFeature. - PR: Submit on GitHub.
- Docs: https://saidlfagrouche.com/safeguard-docs (placeholder)
- Issues: GitHub Issues
- My Site: Contact via https://saidlfagrouche.com/
- LinkedIn:
- Personal: Said Lfagrouche
- Company: SafeGuard Crisis Monitoring
MIT License—see LICENSE.md.
