A lightweight FastAPI backend for monitoring store uptime/downtime and generating performance reports.
This project builds a data-driven backend service that analyzes activity logs from multiple store locations and generates operational uptime metrics. It's designed to simulate how retail or restaurant chains can track store performance, service availability, and SLA adherence using automated API-triggered reports.
Retail and franchise-based businesses rely on uptime (hours the store is open) for revenue consistency and customer experience.
Manual tracking of uptime vs. downtime is slow, inaccurate, and often lacks visibility across locations.
This API solves that by enabling:
✅ On-demand uptime/downtime report generation
✅ Background processing for long-running jobs
✅ REST-based access to store performance metrics
✅ CSV exports for further BI analysis
All built using FastAPI + Pandas, without requiring any external database — ideal for analytics prototyping or data workflows.
| Feature | Description |
|---|---|
POST /trigger_report |
Starts the uptime report generation asynchronously |
GET /get_report |
Fetches the status or completed report |
| CSV-based reporting | Generates uptime/downtime metrics for hour/day/week |
| Clean service architecture | Single main.py file with background task handling |
| Built-in interactive API docs | Swagger UI at /docs |
| Component | Tool |
|---|---|
| Backend Framework | FastAPI |
| Runtime Server | Uvicorn |
| Data Processing | Pandas |
| Language | Python 3.10+ |
| Dependencies Management | requirements.txt |
flowchart TD
A["Raw Store Activity Logs (CSV)"] --> B["FastAPI Service"]
B --> C["Trigger Async Report Generation"]
C --> D["Pandas Processing<br/>(hour/day/week uptime)"]
D --> E["CSV Output<br/>Accessible via API"]
Store-Uptime-Analytics-API/
│── main.py # FastAPI app and async background tasks
│── requirements.txt # Python dependencies
│── reports/ # Generated uptime/downtime reports (CSV)
│ └── report.csv
│── data/ # Input store activity logs (optional)
│── README.md # Project documentation (you are here ✅)
| Method | Endpoint | Description |
|---|---|---|
POST |
/trigger_report |
Starts background job to generate uptime report |
GET |
/get_report?report_id= |
Fetch status or completed report CSV |
POST /trigger_report
Response:
{
"report_id": "123e4567-e89b-12d3-a456-426614174000"
}GET /get_report?report_id=123e4567-e89b-12d3-a456-426614174000
If pending:
{ "status": "Running" }
If complete:
{
"status": "Complete",
"report": "store_id,uptime_last_day,..."
}store_id,uptime_last_hour(in minutes),uptime_last_day(in hours),uptime_last_week(in hours),downtime_last_hour(in minutes),downtime_last_day(in hours),downtime_last_week(in hours)
1,45,22.5,140,15,1.5,28
2,60,24,168,0,0,0git clone https://github.com//Store-Uptime-Analytics-API.git cd Store-Uptime-Analytics-API
python -m venv .venv source .venv/bin/activate ### macOS/Linux
pip install -r requirements.txt
uvicorn main:app --reload
Swagger UI available at: 👉 http://127.0.0.1:8000/docs
Feel free to fork and enhance the project. Key areas for contribution:
- Add database storage (PostgreSQL, MongoDB)
- Support for real-time activity logs
- Improve uptime analytics with visualizations
- Deploy using Docker or GCP/AWS Lambda
| Business Area | Impact |
|---|---|
| Operations | Real-time monitoring of store availability |
| Customer Experience | Detect high-downtime stores to prevent service disruption |
| Revenue Assurance | Predict revenue loss due to downtime |
| SLA Compliance | Measure weekly/monthly uptime across all locations |
- LinkedIn: https://www.linkedin.com/in/advait-chavadekar/
- GitHub: https://github.com/crazyandiee