# sahanhansaja026/bird-species-identification-explanable-ai architecture

> Architecture diagram of the GitHub repository sahanhansaja026/bird-species-identification-explanable-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sahanhansaja026/bird-species-identification-explanable-ai
- Repository: https://github.com/sahanhansaja026/bird-species-identification-explanable-ai

## Overview

This repository combines a bird-audio prediction API, a Firebase-backed bird-data admin site, payment handling, and a Flutter app whose Dart implementation is not present in the supplied tree. The main workflow is audio upload, feature extraction, classification, and a Grad-CAM explanation returned by the API. The admin site manages bird records and media; a Stripe webhook updates subscription state. Mobile-to-API integration is documented, but its implementation cannot be traced here. Edges are limited to shown calls/data operations or README statements.

Main entry points: [`bird-ai-backend/payment.py`](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/payment.py) (Payment Webhook), [`bird-ai-backend/main.py`](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/main.py) (FastAPI Routes), [`birdsweb/bird-admin/src/App.tsx`](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/birdsweb/bird-admin/src/App.tsx) (Bird Management), [`bird-ai-backend/firebase/firebase_admin.py`](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/firebase/firebase_admin.py) (Firebase Admin Setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Prediction API"]
  node_api["FastAPI Routes<br/>[main.py]"]
  node_audio_features["Audio Features<br/>[main.py]"]
  node_classifier["Bird Classifier<br/>[main.py]"]
  node_explanation["Grad-CAM<br/>[main.py]"]
end

subgraph group_admin["Bird Admin"]
  node_admin_ui["Bird Management<br/>[App.tsx]"]
  node_admin_entry["Web Entry<br/>[main.tsx]"]
  node_firebase_client["Firebase Client<br/>[firebase.ts]"]
end

subgraph group_payments["Payments and State"]
  node_payment_router["Payment Webhook<br/>[payment.py]"]
  node_firebase_admin["Firebase Admin Setup<br/>[firebase_admin.py]"]
end

subgraph group_mobile["Mobile App"]
  node_mobile_app["Flutter App"]
end

node_learner(("App User"))
node_audio_source(("Audio Uploader"))
node_bird_records[("Bird Records")]
node_media_storage[("Media Storage")]
node_subscription_state[("Subscription State")]
node_stripe(("Stripe"))
node_firestore[("Firestore")]

node_learner -->|"uses"| node_mobile_app
node_audio_source -->|"uploads audio"| node_api
node_api -->|"extracts features"| node_audio_features
node_audio_features -->|"provides input"| node_classifier
node_classifier -->|"provides activations"| node_explanation
node_api -->|"generates explanation"| node_explanation
node_api -->|"registers routes"| node_payment_router
node_admin_entry -->|"renders"| node_admin_ui
node_admin_ui -->|"uses client"| node_firebase_client
node_admin_ui -->|"reads and writes"| node_bird_records
node_admin_ui -->|"uploads media"| node_media_storage
node_payment_router -->|"verifies events"| node_stripe
node_stripe -->|"posts webhook"| node_payment_router
node_payment_router -->|"imports setup"| node_firebase_admin
node_firebase_admin -->|"initializes client"| node_firestore
node_payment_router -->|"updates records"| node_subscription_state
node_payment_router -->|"reads and writes"| node_firestore
node_mobile_app -.->|"calls API"| node_api

click node_api "https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/main.py"
click node_audio_features "https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/main.py"
click node_classifier "https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/main.py"
click node_explanation "https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/main.py"
click node_admin_ui "https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/birdsweb/bird-admin/src/App.tsx"
click node_admin_entry "https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/birdsweb/bird-admin/src/main.tsx"
click node_firebase_client "https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/birdsweb/bird-admin/src/firebase.ts"
click node_mobile_app "https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/tree/main/birds_app"
click node_payment_router "https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/payment.py"
click node_firebase_admin "https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/firebase/firebase_admin.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_audio_features,node_classifier,node_explanation,node_learner toneBlue
class node_admin_ui,node_admin_entry,node_firebase_client,node_bird_records,node_media_storage,node_subscription_state,node_firestore toneAmber
class node_payment_router,node_firebase_admin toneMint
class node_mobile_app toneRose
class node_audio_source,node_stripe toneIndigo
```

## Components

### Prediction API

- [FastAPI Routes](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/main.py): `bird-ai-backend/main.py`
- [Audio Features](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/main.py): `bird-ai-backend/main.py`
- [Bird Classifier](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/main.py): `bird-ai-backend/main.py`
- [Grad-CAM](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/main.py): `bird-ai-backend/main.py`

### Bird Admin

- [Bird Management](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/birdsweb/bird-admin/src/App.tsx): `birdsweb/bird-admin/src/App.tsx`
- [Web Entry](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/birdsweb/bird-admin/src/main.tsx): `birdsweb/bird-admin/src/main.tsx`
- [Firebase Client](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/birdsweb/bird-admin/src/firebase.ts): `birdsweb/bird-admin/src/firebase.ts`

### Payments and State

- [Payment Webhook](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/payment.py): `bird-ai-backend/payment.py`
- [Firebase Admin Setup](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/blob/main/bird-ai-backend/firebase/firebase_admin.py): `bird-ai-backend/firebase/firebase_admin.py`

### Mobile App

- [Flutter App](https://github.com/sahanhansaja026/bird-species-identification-explanable-ai/tree/main/birds_app): `birds_app`

### Other components

- **App User**
- **Audio Uploader**
- **Bird Records**
- **Media Storage**
- **Subscription State**
- **Stripe**
- **Firestore**

## Connections

- App User → Flutter App: uses
- Audio Uploader → FastAPI Routes: uploads audio (evidence: `bird-ai-backend/main.py`)
- FastAPI Routes → Audio Features: extracts features (evidence: `bird-ai-backend/main.py`)
- Audio Features → Bird Classifier: provides input (evidence: `bird-ai-backend/main.py`)
- Bird Classifier → Grad-CAM: provides activations (evidence: `bird-ai-backend/main.py`)
- FastAPI Routes → Grad-CAM: generates explanation (evidence: `bird-ai-backend/main.py`)
- FastAPI Routes → Payment Webhook: registers routes (evidence: `bird-ai-backend/main.py`)
- Web Entry → Bird Management: renders (evidence: `birdsweb/bird-admin/src/main.tsx`)
- Bird Management → Firebase Client: uses client (evidence: `birdsweb/bird-admin/src/App.tsx`)
- Bird Management → Bird Records: reads and writes (evidence: `birdsweb/bird-admin/src/App.tsx`)
- Bird Management → Media Storage: uploads media (evidence: `birdsweb/bird-admin/src/App.tsx`)
- Payment Webhook → Stripe: verifies events (evidence: `bird-ai-backend/payment.py`)
- Stripe → Payment Webhook: posts webhook (evidence: `bird-ai-backend/payment.py`)
- Payment Webhook → Firebase Admin Setup: imports setup (evidence: `bird-ai-backend/payment.py`)
- Firebase Admin Setup → Firestore: initializes client (evidence: `bird-ai-backend/firebase/firebase_admin.py`)
- Payment Webhook → Subscription State: updates records (evidence: `bird-ai-backend/payment.py`)
- Payment Webhook → Firestore: reads and writes (evidence: `bird-ai-backend/payment.py`)
- Flutter App → FastAPI Routes: calls API
