# tranhao-wq/forget-chart-python architecture

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

- Interactive diagram: https://gitdiagram.com/tranhao-wq/forget-chart-python
- Repository: https://github.com/tranhao-wq/forget-chart-python

## Overview

##### Project type and purpose
- This is a lightweight, open-source Python data-visualization tool that renders the Ebbinghaus forgetting curve in 2D/3D (static and animated) and exports GIFs.

##### File structure
- Top-level
– README.md: project overview, usage, dependencies
- pydata/
– ebbinghaus_curve.py: generates static 2D & 3D plots
– ebbinghaus_curve_animation.py: generates 2D animations (GIF)
– ebbinghaus_curve_animation_3d.py: generates 3D animations (GIF)

No complex subdirectories or microservices—just three CLI entry-points sharing common data and logic.

##### README for additional insights
- Dependencies: matplotlib, numpy, pillow
- Data: built-in arrays for “labels” (time intervals) and “memory_percent”
- Outputs: on-screen plots and exported GIF files

a. Main components
1. User / CLI Interface
- The “python …py” invocation
2. Data Layer
- Built-in data arrays (labels, memory_percent)
3. Processing Engine
- Memory-retention calculation (Ebbinghaus formula or lookup)
4. Visualization Layer
- Matplotlib plotting modules
– 2D Charting
– 3D Charting (mpl_toolkits.mplot3d)
– Animation (FuncAnimation)
5. I/O / Export Module
- pillow (for saving GIF)
- File system (writes .gif)

b. Relationships and interactions
- User → Script (entry point)
- Script → Data Layer (loads labels & memory values)
- Script → Processing Engine (applies forgetting-curve logic)
- Processing Engine → Visualization Layer (provides numeric series)
- Visualization Layer → I/O Module (display vs .save for GIF)
- I/O Module → File System (writes images/GIFs)

c. Architectural patterns & principles
- Modular separation: data vs compute vs presentation vs I/O
- Single-responsibility: each script focuses on one plot type
- Reuse: common arrays & formula logic across scripts

d. Key technologies & libraries
- Python 3.x
- numpy (numeric arrays)
- matplotlib (plotting, static & animation)
- pillow (image I/O, GIF export)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User / CLI Interface
    subgraph "User / CLI Interface"
        CurveStatic["Static Plot CLI\n(pydata/ebbinghaus_curve.py)"]:::cli
        CurveAnim2D["2D Animation CLI\n(pydata/ebbinghaus_curve_animation.py)"]:::cli
        CurveAnim3D["3D Animation CLI\n(pydata/ebbinghaus_curve_animation_3d.py)"]:::cli
    end

    %% Data Layer
    DataLayer["Data Layer\n(labels & memory_percent)"]:::data

    %% Processing Engine
    Processing["Processing Engine\n(Ebbinghaus retention logic)"]:::compute

    %% Visualization Layer
    subgraph "Visualization Layer"
        Static2D["Static 2D Plot\n(matplotlib)"]:::visualize
        Static3D["Static 3D Plot\n(mpl_toolkits.mplot3d)"]:::visualize
        Anim2D["Animated 2D GIF\n(FuncAnimation)"]:::visualize
        Anim3D["Animated 3D GIF\n(FuncAnimation)"]:::visualize
    end

    %% I/O Module
    IOModule["I/O Module\n(pillow GIF export)"]:::io

    %% File System
    FileSystem["File System\n(.gif writes)"]:::fs

    %% Relationships
    CurveStatic -->|loads| DataLayer
    CurveAnim2D -->|loads| DataLayer
    CurveAnim3D -->|loads| DataLayer

    DataLayer -->|calculates| Processing

    Processing -->|renders| Static2D
    Processing -->|renders| Static3D
    Processing -->|renders| Anim2D
    Processing -->|renders| Anim3D

    Anim2D -->|exports| IOModule
    Anim3D -->|exports| IOModule

    IOModule -->|writes| FileSystem

    %% Click Events
    click CurveStatic "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve.py"
    click CurveAnim2D "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve_animation.py"
    click CurveAnim3D "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve_animation_3d.py"
    click DataLayer "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve.py"
    click DataLayer "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve_animation.py"
    click DataLayer "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve_animation_3d.py"
    click Processing "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve.py"
    click Processing "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve_animation.py"
    click Processing "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve_animation_3d.py"
    click Static2D "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve.py"
    click Static3D "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve.py"
    click Anim2D "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve_animation.py"
    click Anim3D "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve_animation_3d.py"
    click IOModule "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve_animation.py"
    click IOModule "https://github.com/tranhao-wq/forget-chart-python/blob/main/pydata/ebbinghaus_curve_animation_3d.py"

    %% Styles
    classDef cli fill:#cccccc,stroke:#333,stroke-width:1px;
    classDef data fill:#add8e6,stroke:#333,stroke-width:1px;
    classDef compute fill:#90ee90,stroke:#333,stroke-width:1px;
    classDef visualize fill:#ffcc99,stroke:#333,stroke-width:1px;
    classDef io fill:#f99,stroke:#333,stroke-width:1px;
    classDef fs fill:#eee,stroke:#333,stroke-width:1px,shape:cylinder;
```
