# scr255/rename-by-metadata architecture

> Architecture diagram of the GitHub repository scr255/rename-by-metadata, 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/scr255/rename-by-metadata
- Repository: https://github.com/scr255/rename-by-metadata

## Overview

##### Main components
- User Interface / Interaction:
- Jupyter Notebook (rename_by_metadata.ipynb) – serves as an interactive entry point and demonstration of the tool.
- Dockerized environment potentially used via Dockerfile and docker-compose.yml.
- Core Processing Module:
- src/functions.py – contains the business logic for renaming media files.
- Configuration & Dependencies:
- requirements.txt – enumerates the required Python packages and tools (including ExifTool integration).
- jupyter_notebook_config.py – configuration settings specifically for running Jupyter Notebook.
- Deployment & Containerization:
- Dockerfile – defines the container image for running the project.
- Auxiliary Files:
- .gitignore, LICENSE, README.md – standard repository management and documentation files.

##### Relationships and Flow
- The Notebook communicates with the core library (located in src/functions.py) to invoke renaming functions.
- External tools, such as ExifTool, are indirectly interfaced through procedures in functions.py to extract metadata.
- The Dockerfile and docker-compose.yml indicate that the application is packaged and run within a container environment. Be sure to show that the container encapsulates the dependencies, configurations (from requirements.txt and jupyter_notebook_config.py), and the source code.
- File renaming process as a data flow: Media Files (photos and videos) → Input into the tool → Metadata extraction via ExifTool → Decision making/logic in functions.py → Renamed files output back to the filesystem.

##### Architectural Patterns and Design Data Flow
- Although the project is relatively simple, emphasize the separation of concerns: interactive interface (Notebook), business logic (functions.py), and deployment (Docker-related files).
- You might also show an “external dependency” component (ExifTool) that is integrated within the renaming logic.

##### Relevant Technologies & Their Roles
- Docker & Docker Compose: For containerization and deployment.
- Python: The primary programming language (as seen in requirements.txt and .py files).
- Jupyter Notebook: For interactive demonstrations and possibly as an exploratory environment.
- ExifTool: Although not directly visible in the code, it’s pivotal based on the README description for extracting metadata.
- Git for version control, as indicated by .gitignore.

##### Components
- Each component should have a clear, descriptive label:
- “User Interface (Jupyter Notebook)”
- “Core Processing Module (src/functions.py)”
- “Docker Container Environment (Dockerfile & docker-compose.yml)”
- “External Metadata Extraction (ExifTool)”
- “Configuration & Dependencies (requirements.txt, jupyter_notebook_config.py)”
- Data flow from the Notebook to functions.py.
- Interaction between functions.py and ExifTool.
- The encapsulation of all components in the Docker container.
- User Interfaces versus backend processing.
- Static configuration versus dynamic processing modules.
- External dependencies (ExifTool) versus internal project components.

- The entry point where a user initiates the renaming process (via Jupyter Notebook or CLI).
- The invocation of the renaming logic in the functions module.
- The interaction with ExifTool for metadata extraction.
- The resulting action where files are renamed based on the logic guided by CreateDate and SubSecCreateDate.
- The encapsulation of the entire process within a container (Docker) ensuring consistency across environments.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction Layer
    subgraph "User Interaction Layer"
        UI("User Interface (Jupyter Notebook)"):::ui
        MF("Media Files (Photos/Videos)"):::media
    end

    %% Processing Layer
    subgraph "Processing Layer"
        CPM("Core Processing Module (src/functions.py)"):::core
        EXIF("External Metadata Extraction (ExifTool)"):::external
        RF("Renamed Files"):::output
    end

    %% Containerization & Deployment
    subgraph "Containerization & Deployment"
        DC("Docker Container Environment (Dockerfile & docker-compose.yml)"):::container
        CONF("Configuration & Dependencies (requirements.txt, jupyter_notebook_config.py)"):::config
        AUX("Auxiliary Files (.gitignore, LICENSE, README.md)"):::aux
    end

    %% Relationships and Data Flow
    UI -->|"triggersRenaming"| CPM
    MF -->|"inputFiles"| CPM
    CPM -->|"extractsMetadata"| EXIF
    EXIF -->|"returnsMetadata"| CPM
    CPM -->|"outputsRenamedFiles"| RF
    UI -->|"receivesRenamedFiles"| RF

    %% Docker encapsulates core modules and configurations
    DC --> CPM
    DC --> CONF
    DC --> AUX

    %% Click Events
    click UI "https://github.com/scr255/rename-by-metadata/blob/main/rename_by_metadata.ipynb"
    click CPM "https://github.com/scr255/rename-by-metadata/blob/main/src/functions.py"
    click CONF "https://github.com/scr255/rename-by-metadata/blob/main/requirements.txt"
    click CONF "https://github.com/scr255/rename-by-metadata/blob/main/jupyter_notebook_config.py"
    click DC "https://github.com/scr255/rename-by-metadata/tree/main/Dockerfile"
    click DC "https://github.com/scr255/rename-by-metadata/blob/main/docker-compose.yml"
    click AUX "https://github.com/scr255/rename-by-metadata/blob/main/.gitignore"
    click AUX "https://github.com/scr255/rename-by-metadata/tree/main/LICENSE"
    click AUX "https://github.com/scr255/rename-by-metadata/blob/main/README.md"

    %% Styles
    classDef ui fill:#a3d579,stroke:#333,stroke-width:2px;
    classDef media fill:#79c7e3,stroke:#333,stroke-width:2px;
    classDef core fill:#f4d03f,stroke:#333,stroke-width:2px;
    classDef external fill:#e74c3c,stroke:#333,stroke-width:2px;
    classDef output fill:#a3d579,stroke:#333,stroke-width:2px;
    classDef container fill:#9b59b6,stroke:#333,stroke-width:2px;
    classDef config fill:#e67e22,stroke:#333,stroke-width:2px;
    classDef aux fill:#95a5a6,stroke:#333,stroke-width:2px;
```
