# mptwaktusolat/waktusolat-fetcher architecture

> Architecture diagram of the GitHub repository mptwaktusolat/waktusolat-fetcher, 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/mptwaktusolat/waktusolat-fetcher
- Repository: https://github.com/mptwaktusolat/waktusolat-fetcher

## Overview

##### Main Entry Point & CLI Layer
- Component: main.py
- Purpose: Acts as the CLI interface that parses command-line arguments and dispatches commands. It essentially determines whether to “fetch”, “process”, or “push” data based on user input.
- Representation: Use a rectangle labeled “CLI/Entry (main.py)” which is the starting point of the system.

##### Functional Modules (Sub-components)
- Module 1: Fetcher (scripts/fetcher.py)
- Role: Responsible for scraping prayer time data from JAKIM’s website (external data source).
- Module 2: Processor (scripts/process_db.py)
- Role: Reads the fetched JSON data, parses and processes the date time fields (e.g., converts them into UNIX timestamps).
- Module 3: Pusher (scripts/push_db.py)
- Role: Pushes the processed data to Firebase Firestore (remote external service). This step is optional – it can be skipped by passing a command-line argument.

##### Data Flow & File Output
- The system produces output files (e.g., month-year.json and month-year.processed.json) stored in the output directory (even though this directory isn’t explicitly shown in the file tree, it’s mentioned in the README).

##### External Dependencies & Services
- External Service: Firebase Firestore, which is used by the Pusher module.

## Diagram (Mermaid)

```mermaid
flowchart TD
    mainCLI["CLI/Entry (main.py)"]:::cli
    fetcher["Fetcher Module"]:::module
    processor["Processor Module"]:::module
    pusher["Pusher Module"]:::module
    output["Output Files"]:::output
    firebase["Firebase Firestore"]:::external
    jakim["JAKIM Website"]:::external
    cicd["CI/CD (GitHub Actions)"]:::cicd

    mainCLI -->|"dispatch"| fetcher
    fetcher -->|"passData"| processor
    processor -->|"triggerPush"| pusher
    processor -->|"storeFiles"| output
    pusher -->|"pushToFirebase"| firebase
    fetcher -.->|"scrapesData"| jakim
    cicd -.->|"triggers"| mainCLI

    click mainCLI "https://github.com/mptwaktusolat/waktusolat-fetcher/blob/main/main.py"
    click fetcher "https://github.com/mptwaktusolat/waktusolat-fetcher/blob/main/scripts/fetcher.py"
    click processor "https://github.com/mptwaktusolat/waktusolat-fetcher/blob/main/scripts/process_db.py"
    click pusher "https://github.com/mptwaktusolat/waktusolat-fetcher/blob/main/scripts/push_db.py"
    click cicd "https://github.com/mptwaktusolat/waktusolat-fetcher/tree/main/.github/workflows"

    classDef cli fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef module fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef output fill:#FFFACD,stroke:#000,stroke-width:1px;
    classDef external fill:#F4A460,stroke:#000,stroke-width:1px;
    classDef cicd fill:#FFB6C1,stroke:#000,stroke-width:1px;
```
