# arioberek/year-progress architecture

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

- Interactive diagram: https://gitdiagram.com/arioberek/year-progress
- Repository: https://github.com/arioberek/year-progress

## Overview

##### Project Overview and Purpose
- This project is a Python application called “Year Progress Tracker” that calculates the percentage of the year completed. It then generates a visual progress bar image and uploads it to Instagram—essentially automating the process of sharing a yearly progress update.
- The README outlines that the app handles three main tasks: calculating the year’s progress percentage, generating a visual progress bar, and interacting with Instagram (logging in and posting).

##### Analyzing the File Structure
- Top-Level Files and Folders:
- .env.example, README.md, and requirements.txt indicate configuration and dependency management.
- The .github directory with CI/CD workflow files (e.g., main.yml) suggests that there are automated testing/deployment processes.
- The src folder holds the core Python scripts.
- Within the src folder, we see key scripts:
- main.py: Likely the entry point that orchestrates the overall process.
- generate_progress_bar.py: Handles the creation of the visual progress bar image.
- ig_login.py: Deals with Instagram authentication.
- media_upload.py: Manages the image upload process.
- year_progress_percentage.py: Responsible for computing the percentage of the year that has passed.
- The utils subdirectory hints at supporting operations, like image-related utilities (e.g., get_image.py).

##### Main Components
- Calculation Module: Represented by year_progress_percentage.py. This component is responsible for computing the percentage progress of the year.
- Progress Bar Generation Module: Represented by generate_progress_bar.py (and possibly supported by functions in utils). This module takes the calculated percentage and produces a visual progress bar.
- Instagram Login Module: Represented by ig_login.py. It manages credential configuration (via environment variables or secure configuration) and logs into Instagram.
- Media Upload Module: Represented by media_upload.py. This handles posting the generated image to Instagram along with a caption.
- Utility Components: Located in the utils folder (e.g., get_image.py). They support image operations or other helper functionalities.
- External Elements:
- Instagram as an external service that receives the uploaded image.
- Python’s runtime environment and any external libraries/dependencies (as specified in requirements.txt).

##### Relationships and Interactions
- The main.py acts as the central orchestrator:
- It first uses the Calculation Module to determine the year’s percentage.
- Then, it invokes the Progress Bar Generation Module to create an image based on the computed percentage.
- Next, the Instagram Login Module is used for any necessary authentication.
- Finally, the Media Upload Module is called to post the image on Instagram.
- Data flows from the calculation stage to image generation, then to authentication, and finally to media upload—all as sequential steps.

##### Architectural Patterns and Design Principles
- The system appears to be built with a modular design where each component (calculation, image generation, authentication, upload) is encapsulated in its own script.
- The separation of concerns is evident, as each module handles a distinct part of the workflow. This modularity simplifies testing and future modifications.
- Although it’s a relatively simple application, the design might reflect aspects of the layered architecture seen in full-stack applications (i.e., processing, presentation, and external communication layers).

## Diagram (Mermaid)

```mermaid
flowchart TD
    MAIN("Orchestrator (main.py)"):::controller
    CALC("Calculation Module"):::process
    PROG("Progress Bar Generation"):::process
    UTIL("Image Utility"):::utility
    LOGIN("Instagram Login"):::external_module
    UPLOAD("Media Upload"):::external_module
    INSTAGRAM("Instagram Service"):::external
    RUNTIME("Python Environment & Dependencies"):::runtime

    MAIN -->|"calls"| CALC
    CALC -->|"outputsPercentage"| PROG
    PROG -->|"uses"| UTIL
    PROG -->|"calls"| LOGIN
    LOGIN -->|"calls"| UPLOAD
    UPLOAD -->|"postsImage"| INSTAGRAM
    RUNTIME ---|"provides"| MAIN

    click MAIN "https://github.com/arioberek/year-progress/blob/main/src/main.py"
    click CALC "https://github.com/arioberek/year-progress/blob/main/src/year_progress_percentage.py"
    click PROG "https://github.com/arioberek/year-progress/blob/main/src/generate_progress_bar.py"
    click UTIL "https://github.com/arioberek/year-progress/blob/main/src/utils/get_image.py"
    click LOGIN "https://github.com/arioberek/year-progress/blob/main/src/ig_login.py"
    click UPLOAD "https://github.com/arioberek/year-progress/blob/main/src/media_upload.py"

    classDef controller fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef process fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef external_module fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef external fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef utility fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef runtime fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
