# eastsidepreparatoryschool/epschedule architecture

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

- Interactive diagram: https://gitdiagram.com/eastsidepreparatoryschool/epschedule
- Repository: https://github.com/eastsidepreparatoryschool/epschedule

## Overview

##### Project type and purpose
- EPSchedule is a full-stack, schedule-delivery web application for Eastside Preparatory School.
- Backend: Python code running on Google App Engine (GAE).
- Frontend: Polymer-based static assets (HTML/CSS/JS).
- Data store: Firebase Realtime Database (and possibly Cloud Storage for photos/keys).
- Auxiliary: cron jobs for periodic schedule updates and a set of Python scripts for data crawling/formatting.

##### File structure
- Top-level configuration:
- app.yaml, cron.yaml (GAE service + cron definitions)
- firebase.json, database.rules.json, .firebaserc (Firebase config)
- .github/workflows/*.yml (CI: tests, deploy)
- Backend code:
- main.py (entry point, HTTP handlers)
- app.py, update.py, scripts/*.py (data-gathering & upload utilities)
- cron/ (scheduled tasks + unit tests)
- requirements.txt (Python dependencies)
- Frontend assets:
- static/ (Polymer components: js, css, html, images, favicon)
- templates/ (Jinja/HTML templates served by GAE)
- Data/testing artifacts:
- data/*.json (master_schedule & test fixtures)
- main_test.py, cron/test_*.py (pytest suite)

##### README for architectural hints
- Mentions GAE + Polymer.
- Service account credentials are used to read “schedules, photos, and crypto keys” from GCP.
- CI via GitHub Actions runs pytest and deploys to App Engine.
- Scripts automate master schedule crawling and uploading.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend
    subgraph "Frontend Layer"
        direction TB
        Browser["Polymer SPA"]:::frontend
        Templates["HTML Templates"]:::frontend
    end

    Browser -->|"loads"| Templates
    Browser -->|"HTTPS API calls"| API

    %% Backend
    subgraph "App Engine Service" 
        direction TB
        subgraph "Configuration"
            AppYAML["GAE Service Configuration (app.yaml)"]:::config
            CronYAML["GAE Cron Configuration (cron.yaml)"]:::config
        end
        subgraph "API Entry Points"
            API["App Engine Python API"]:::backend
            MainPY["main.py"]:::backend
            AppPY["app.py"]:::backend
            UpdatePY["update.py"]:::backend
        end
        subgraph "Cron Subsystem"
            direction TB
            Four11["four11.py"]:::cron
            PhotosCron["photos.py"]:::cron
            SchedulesCron["schedules.py"]:::cron
            LunchCron["update_lunch.py"]:::cron
            subgraph "Cron Tests"
                direction TB
                TestFour11["test_four11.py"]:::test
                TestLunch["test_lunch.py"]:::test
            end
        end
    end

    Templates -->|"serves"| API
    API -->|"calls"| MainPY
    MainPY --> AppPY
    MainPY --> UpdatePY

    CronYAML --> Four11
    CronYAML --> PhotosCron
    CronYAML --> SchedulesCron
    CronYAML --> LunchCron

    Four11 --> TestFour11
    LunchCron --> TestLunch

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        FirebaseDB["Firebase Realtime Database"]:::database
        CloudStorage["Cloud Storage"]:::database
    end

    API -->|"reads/writes"| FirebaseDB
    API -->|"stores assets"| CloudStorage
    scripts --> FirebaseDB

    %% Scripts & Data Fixtures
    subgraph "Auxiliary Scripts & Data"
        direction TB
        Scripts["Crawling & Uploading Scripts"]:::scripts
        DataFixtures["Data Fixtures & Master Schedule"]:::data
    end

    Scripts --> FirebaseDB
    DataFixtures --> Scripts

    %% CI/CD Pipeline
    subgraph "CI/CD (GitHub Actions)"
        direction TB
        TestsCI["tests.yml"]:::ci
        DeployCI["deploy.yml"]:::ci
        JSONCI["json.yml"]:::ci
    end

    TestsCI -->|"runs pytest"| API
    DeployCI -->|"deploys to GAE"| AppYAML

    %% Repo Metadata
    subgraph "Repository Metadata"
        direction TB
        ReqTxt["requirements.txt"]:::config
        GitIgnore[".gitignore"]:::config
        GCloudIgnore[".gcloudignore"]:::config
        Justfile["Justfile"]:::config
        License["LICENSE"]:::config
        Readme["README.md"]:::config
        MainTest["main_test.py"]:::test
    end

    MainTest --> API
    ReqTxt --> API

    %% Relationships
    Browser -->|"static assets"| staticAssets["static/"]:::frontend

    %% Click Events
    click Browser "https://github.com/eastsidepreparatoryschool/epschedule/tree/master/static/"
    click Templates "https://github.com/eastsidepreparatoryschool/epschedule/tree/master/templates/"
    click AppYAML "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/app.yaml"
    click CronYAML "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/cron.yaml"
    click MainPY "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/main.py"
    click AppPY "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/app.py"
    click UpdatePY "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/update.py"
    click Four11 "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/cron/four11.py"
    click PhotosCron "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/cron/photos.py"
    click SchedulesCron "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/cron/schedules.py"
    click LunchCron "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/cron/update_lunch.py"
    click TestFour11 "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/cron/test_four11.py"
    click TestLunch "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/cron/test_lunch.py"
    click FirebaseDB "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/firebase.json"
    click FirebaseDB "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/database.rules.json"
    click FirebaseDB "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/.firebaserc"
    click DataFixtures "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/data/master_schedule.json"
    click DataFixtures "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/data/test_schedule.json"
    click DataFixtures "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/data/test_lunch.ics"
    click Scripts "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/scripts/create_master_schedule.py"
    click Scripts "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/scripts/upload_master_schedule.py"
    click Scripts "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/scripts/format.sh"
    click ReqTxt "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/requirements.txt"
    click TestsCI "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/.github/workflows/tests.yml"
    click DeployCI "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/.github/workflows/deploy.yml"
    click JSONCI "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/.github/workflows/json.yml"
    click MainTest "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/main_test.py"
    click GCloudIgnore "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/.gcloudignore"
    click GitIgnore "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/.gitignore"
    click Justfile "https://github.com/eastsidepreparatoryschool/epschedule/tree/master/Justfile"
    click License "https://github.com/eastsidepreparatoryschool/epschedule/tree/master/LICENSE"
    click Readme "https://github.com/eastsidepreparatoryschool/epschedule/blob/master/README.md"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#006064,color:#006064
    classDef backend fill:#BBDEFB,stroke:#0D47A1,color:#0D47A1
    classDef cron fill:#FFECB3,stroke:#FF6F00,color:#FF6F00
    classDef database fill:#C8E6C9,stroke:#2E7D32,color:#2E7D32
    classDef scripts fill:#F3E5F5,stroke:#6A1B9A,color:#6A1B9A
    classDef data fill:#FFF9C4,stroke:#F57F17,color:#F57F17
    classDef config fill:#ECEFF1,stroke:#37474F,color:#37474F
    classDef ci fill:#FFE0B2,stroke:#EF6C00,color:#EF6C00
    classDef test fill:#FCE4EC,stroke:#880E4F,color:#880E4F
```
