Skip to content

FastAPI-based backend to analyze store uptime/downtime and generate scheduled or on-demand CSV reports. Built with async processing, Pandas data pipelines, and auto-documented REST endpoints.

Notifications You must be signed in to change notification settings

crazyandiee/Store-Uptime-Analytics-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🏪 Store Uptime Analytics API

Python Framework Data Status License

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.


📌 Project Overview

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.


✅ Key Features

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

🧰 Tech Stack

Component Tool
Backend Framework FastAPI
Runtime Server Uvicorn
Data Processing Pandas
Language Python 3.10+
Dependencies Management requirements.txt

🔁 API Workflow

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"]

Loading

📂 Repository Structure

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 ✅)


🔗 API Endpoints

Method Endpoint Description
POST /trigger_report Starts background job to generate uptime report
GET /get_report?report_id= Fetch status or completed report CSV

🔄 Sample Request/Response

1️⃣ Trigger Report

POST /trigger_report
Response:
{
  "report_id": "123e4567-e89b-12d3-a456-426614174000"
}

2️⃣ Fetch Report Status / Results

GET /get_report?report_id=123e4567-e89b-12d3-a456-426614174000

If pending:

{ "status": "Running" }

If complete:

{
  "status": "Complete",
  "report": "store_id,uptime_last_day,..."
}

📊 Sample Report Output (CSV)

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,0

⚙️ Setup & Usage (For Users)

Clone the repo

git clone https://github.com//Store-Uptime-Analytics-API.git cd Store-Uptime-Analytics-API

Create virtual env

python -m venv .venv source .venv/bin/activate ### macOS/Linux

.venv\Scripts\activate ### Windows

Install dependencies

pip install -r requirements.txt

Start API server

uvicorn main:app --reload

Swagger UI available at: 👉 http://127.0.0.1:8000/docs

🔧 For Contributors (Optional)

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

💼 Why This Project Matters (Business Value)

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

📬 Connect With Me

👋 I’m always happy to collaborate or discuss backend + analytics projects.

⭐ If this project helped you or inspired you — feel free to star the repo!

About

FastAPI-based backend to analyze store uptime/downtime and generate scheduled or on-demand CSV reports. Built with async processing, Pandas data pipelines, and auto-documented REST endpoints.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages