# ejiang-airta/airsavvy architecture

> Architecture diagram of the GitHub repository ejiang-airta/airsavvy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ejiang-airta/airsavvy
- Repository: https://github.com/ejiang-airta/airsavvy

## Overview

##### Main Components
- Backend Application: Represented by main Python scripts such as flights_app.py and auth.py. These files likely handle core application logic including user authentication and flight search functionality.
- Database: Include the flight_search_app.db and any associated schema/verification scripts (create_db.py, verify_db.py, updated_db_schema.xml). This component is responsible for storing flight data, user info, and searches.
- External API Integration: rapidAPI_test.py indicates interactions with external flight search APIs. Show this as a separate external service component.
- Data Processing: parse_search_results.py suggests there’s an engine for processing or parsing the returned search data.
- Utilities & Testing: Files like testing.py, and mvp_issues_summary (both CSV and XLSX versions) indicate logging, testing, or tracking issues. Include a component for testing/metrics/logs.
- Deployment/Configuration: The vercel.json file hints that the application may be deployed via Vercel, so add a deployment/infrastructure component.

##### Relationships and Interactions
- From the external API (RapidAPI or similar) to the backend, indicating that the backend (flights_app.py) interacts with external flight search services.
- From the backend to the database, showing operations for creating, verifying, and updating data.
- From auth.py to the backend, highlighting authentication and possibly session/user management.
- Data flows between parse_search_results.py and the backend, as well as between the testing/metrics components (mvp_issues_summary files) and the main application for issue tracking.

##### Architectural Patterns & Design Principles
- Modular Design: Different Python scripts are separated by functionality (e.g., authentication, DB creation, API tests) which shows a modular approach.
- Separate Data Processing: The presence of a dedicated parser script encourages a separation of concerns—keeping the data processing logic separate from business logic.
- Database Management: There is a clear emphasis on database integrity with scripts dedicated to creation and verification, along with documented DB schemas in XML.
- External Integration: The clear interface between internal flight search methods and external APIs is visible from files like rapidAPI_test.py.

##### Technical Details
- Frameworks/Libraries: Even though there isn’t an explicit web framework shown, list your Python runtime environment and note any dependencies from requirements.txt.
- That the application could be extended with more robust authentication or frontend components in the future if necessary.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Backend Layer
    subgraph "Backend Components"
        AuthModule["Authentication (auth.py)"]:::backend
        BackendApp["Main Application (flights_app.py)"]:::backend
    end

    %% External API & Data Processing
    subgraph "External Services"
        RapidAPI["RapidAPI Integration (rapidAPI_test.py)"]:::external
        Parser["Search Result Parser (parse_search_results.py)"]:::external
    end

    %% Database Layer
    subgraph "Database Layer"
        DB_Main["Flight Search DB (flight_search_app.db)"]:::database
        DB_Create["DB Creation Script (create_db.py)"]:::database
        DB_Verify["DB Verification Script (verify_db.py)"]:::database
        DBSchemas["DB Schemas (updated_db_schema.xml, flight_search_db.xml, updated_flight_search_db.xml)"]:::database
    end

    %% Utilities & Testing
    subgraph "Utilities & Testing"
        Testing["Testing Module (testing.py)"]:::utility
        IssueTracker["Issue Tracker (mvp_issues_summary.csv, mvp_issues_summary.xlsx, updated_mvp_issues_summary.csv)"]:::utility
    end

    %% Deployment
    subgraph "Deployment"
        Vercel["Vercel Deployment (vercel.json)"]:::deployment
    end

    %% Relationships
    AuthModule -->|"authenticates"| BackendApp

    BackendApp -->|"calls"| RapidAPI
    RapidAPI -->|"returns"| Parser
    Parser -->|"sendsProcessedData"| BackendApp

    BackendApp -->|"readsWrites"| DB_Main
    DB_Main -->|"createdBy"| DB_Create
    DB_Main -->|"verifiedBy"| DB_Verify
    DB_Main -->|"schemaDefinedBy"| DBSchemas

    BackendApp -->|"monitoredBy"| Testing
    Testing -->|"logsIssuesTo"| IssueTracker

    Vercel -->|"hosts"| BackendApp

    %% Click Events
    click BackendApp "https://github.com/ejiang-airta/airsavvy/blob/main/flights_app.py"
    click AuthModule "https://github.com/ejiang-airta/airsavvy/blob/main/auth.py"
    click RapidAPI "https://github.com/ejiang-airta/airsavvy/blob/main/rapidAPI_test.py"
    click Parser "https://github.com/ejiang-airta/airsavvy/blob/main/parse_search_results.py"
    click DB_Main "https://github.com/ejiang-airta/airsavvy/blob/main/flight_search_app.db"
    click DB_Create "https://github.com/ejiang-airta/airsavvy/blob/main/create_db.py"
    click DB_Verify "https://github.com/ejiang-airta/airsavvy/blob/main/verify_db.py"
    click DBSchemas "https://github.com/ejiang-airta/airsavvy/blob/main/updated_db_schema.xml"
    click Testing "https://github.com/ejiang-airta/airsavvy/blob/main/testing.py"
    click IssueTracker "https://github.com/ejiang-airta/airsavvy/blob/main/mvp_issues_summary.csv"
    click Vercel "https://github.com/ejiang-airta/airsavvy/blob/main/vercel.json"

    %% Styles
    classDef backend fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef database fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef utility fill:#F5CBA7,stroke:#D35400,stroke-width:2px;
    classDef deployment fill:#D2B4DE,stroke:#7D3C98,stroke-width:2px;
```
