An open API service indexing awesome lists of open source software.

https://github.com/anav5704/honeywell-aog-zero

Data-driven, proactive maintenance sheduling system for APUs
https://github.com/anav5704/honeywell-aog-zero

docker fastapi nextjs postgresql scikit-learn

Last synced: 5 months ago
JSON representation

Data-driven, proactive maintenance sheduling system for APUs

Awesome Lists containing this project

README

          

# Honeywell AOG Zero - APU Health Monitoring System

A real-time Aircraft on Ground (AOG) prevention system that monitors Auxiliary Power Unit (APU) health across your fleet. Built with Next.js, FastAPI, and Firebase Authentication.

## Preview

### Fleet Page

![Fleet Page](./.github/docs/fleet-page.png)

### Sensor Data Page

![Snesor Data Page](./.github/docs/sensor-data-page.png)

### Aircrafts Page

![Aircrafts page](./.github/docs/aircrafts-page.png)

## Overview

AOG Zero helps airlines prevent unplanned aircraft groundings by:
- **Real-time APU health monitoring** with predictive analytics
- **Fleet-wide dashboard** showing aircraft health status
- **Priority-based alerts** (Critical, Urgent, Warning, Monitor, Healthy)
- **Historical flight tracking** with maintenance insights
- **Secure authentication** via Google OAuth (WorkOS AuthKit)

## Project Structure

```
ai-hackathon/
├── frontend/ # Next.js 15 + TypeScript
│ ├── app/
│ │ ├── page.tsx # Landing page (redirects to /login or /dashboard)
│ │ ├── login/ # Authentication page
│ │ ├── dashboard/ # Protected dashboard (aircraft fleet overview)
│ │ │ ├── page.tsx # Server component with auth guard
│ │ │ └── DashboardClient.tsx # Client component with fleet data
│ │ └── aircraft/[id]/ # Individual aircraft detail view
│ ├── components/
│ │ ├── AuthProvider.tsx # Firebase auth context
│ │ ├── Navbar.tsx # Navigation with user menu
│ │ └── AircraftCard.tsx # Aircraft status card component
│ ├── public/
│ │ └── media/ # Static assets (logos, icons)
│ └── .env.local # Frontend environment variables

├── backend/ # FastAPI + PostgreSQL
│ ├── main.py # API server entry point
│ ├── database.py # PostgreSQL connection & models
│ ├── models.py # Pydantic schemas
│ ├── scripts/
│ │ ├── reset_database.py # Clears database tables
│ │ └── seed_database.py # Populates with sample data
│ ├── seed_apu_data.py # Seeds APU health metrics
│ └── requirements.txt # Python dependencies

└── README.md
```

## Setup & Installation

### Prerequisites

- **Node.js** 18+ and npm/pnpm/yarn
- **Python** 3.10+
- **PostgreSQL** 14+ (local or cloud instance)
- **Firebase** project (for authentication)
- **WorkOS** account (optional, for AuthKit)

### Clone the Repository

```bash
git clone
cd ai-hackathon
```

### Backend Setup

```bash
cd backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Initialize database
python scripts/reset_database.py --yes
python scripts/seed_database.py --yes
python seed_apu_data.py

# Start backend server
uvicorn main:app --reload --reload-dir .
```

Backend runs at **http://localhost:8000**

### Frontend Setup

```bash
cd frontend

# Install dependencies
npm install
# or
pnpm install
# or
yarn install

# Configure environment variables
# Create .env.local file with:
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_firebase_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=123456789
NEXT_PUBLIC_FIREBASE_APP_ID=1:123456789:web:abcdef

# Start development server
npm run dev
# or
pnpm dev
# or
yarn dev
```

Frontend runs at **http://localhost:3000**

## Firebase Authentication Setup

1. Go to [Firebase Console](https://console.firebase.google.com/)
2. Create a new project (or use existing)
3. Enable **Authentication** → **Google Sign-In**
4. Copy your Firebase config values to `.env.local`
5. Add `http://localhost:3000` to authorized domains

## API Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/aircrafts` | List all aircraft with health status |
| GET | `/aircrafts/{id}` | Get specific aircraft details |
| GET | `/aircrafts/{id}/flights` | Get flight history for aircraft |
| GET | `/health` | API health check |

## Features

### Dashboard
- **Fleet Overview**: Real-time health status for all aircraft
- **Filtering**: View by health category (Critical, Urgent, Warning, etc.)
- **Sorting**: By urgency, health score, or tail number
- **Fleet Summary**: Total aircraft count and health distribution

### Aircraft Detail Page
- **APU Health Metrics**: Temperature, pressure, vibration, oil levels
- **Flight History**: Last 10 flights with timestamps
- **Predictive Alerts**: AI-powered maintenance recommendations
- **Real-time Updates**: Auto-refresh every 30 seconds

### Authentication
- **Google OAuth**: Secure sign-in with Google accounts
- **Protected Routes**: Server-side auth guards on sensitive pages
- **Session Management**: Persistent auth state with Firebase

## Tech Stack

**Frontend:**
- Next.js 15 (App Router)
- TypeScript
- Firebase Authentication
- React Hooks
- CSS-in-JS (inline styles)

**Backend:**
- FastAPI
- PostgreSQL
- SQLAlchemy
- Pydantic
- Uvicorn

## Development Notes

- Frontend uses **Server Components** for auth checks (no flicker on protected routes)
- Backend uses **async/await** for non-blocking database queries
- Database seeding includes realistic APU metrics and flight data
- CORS enabled for `localhost:3000` during development

## Troubleshooting

**Port already in use:**
```bash
# Windows
netstat -aon | findstr :3000
taskkill /PID /F

# macOS/Linux
lsof -ti:3000 | xargs kill -9
```

**Database connection error:**
- Verify PostgreSQL is running
- Check `DATABASE_URL` in `.env`
- Ensure database exists: `createdb aog_zero`

**Firebase auth not working:**
- Verify all Firebase config values in `.env.local`
- Check authorized domains in Firebase Console
- Clear browser cookies and try again

## 👥 Contributors
Anav
Parvish
Trishal
Shaneel
Yash
Shivam
Rohan
Danvil