# mdelobelle/metadatamenu architecture

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

- Interactive diagram: https://gitdiagram.com/mdelobelle/metadatamenu
- Repository: https://github.com/mdelobelle/metadatamenu

## Overview

##### Component Relationships

a) Field Processing Flow:
**UI Components -> Field Handlers -> Database Storage -> File System**

b) FileClass Management Flow:
**FileClass Definition -> Field Settings -> Field Validation -> Note Updates**

##### Specific Implementation Details

Crucial subsystems:

a) Field Types System:
- Hierarchy of field types from `src/fields/models`
- Abstract base classes
- To the validation and processing components

b) Database Management:
- StoreManager and DatabaseManager relationship
- FileClassViews store

c) Command System:
- Command registration flow
- How commands interact with the field system

##### External Integrations

Integration points with:
- Obsidian API
- Dataview Plugin
- File System
- Canvas Feature

##### Key Design Patterns

Use of:
- Observer Pattern (for field updates)
- Factory Pattern (for field creation)
- Strategy Pattern (for field type handling)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI["User Interface Layer"]
        direction TB
        MENU["Context Menus"]
        AUTO["Autocompletion"]
        DVTABLES["Dataview Tables"]
        MODALS["Modal System"]:::modal
        SETTINGS["Settings Interface"]:::settings
        SUGGEST["Suggestion System"]:::suggest
    end

    subgraph CORE["Core Processing Layer"]
        direction TB
        FIELD["Field Management System"]:::field
        FCLASS["File Class System"]:::fclass
        CMD["Command System"]:::cmd
        DB["Database Management"]:::db
        
        subgraph FTS["Field Types System"]
            direction TB
            BASE["Base Field Types"]:::basefield
            MODELS["Field Models"]:::fieldmodels
        end
        
        subgraph DBS["Database Storage"]
            direction TB
            STORE["Store Manager"]:::dbstore
            FCVIEWS["FileClass Views"]:::fcviews
            IDX["Index Management"]:::idx
        end
    end

    subgraph INT["Integration Layer"]
        direction TB
        OBAPI["Obsidian API"]:::api
        DVAPI["Dataview Integration"]:::dvapi
        FSYS["File System"]:::fsys
    end

    %% Relationships
    UI --> CORE
    CORE --> INT
    
    %% Field Processing Flow
    MODALS --> FIELD
    FIELD --> DB
    DB --> FSYS
    
    %% FileClass Flow
    FCLASS --> FIELD
    FIELD --> MODELS
    MODELS --> BASE
    
    %% Database Flow
    DB --> STORE
    STORE --> FCVIEWS
    
    %% Integration Flow
    FIELD --> OBAPI
    DVTABLES --> DVAPI
    DB --> FSYS

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef modal fill:#FFA07A,stroke:#333
    classDef settings fill:#FFA07A,stroke:#333
    classDef suggest fill:#FFA07A,stroke:#333
    classDef field fill:#87CEEB,stroke:#333
    classDef fclass fill:#87CEEB,stroke:#333
    classDef cmd fill:#87CEEB,stroke:#333
    classDef db fill:#DDA0DD,stroke:#333
    classDef basefield fill:#87CEEB,stroke:#333
    classDef fieldmodels fill:#87CEEB,stroke:#333
    classDef dbstore fill:#DDA0DD,stroke:#333
    classDef fcviews fill:#DDA0DD,stroke:#333
    classDef idx fill:#DDA0DD,stroke:#333
    classDef api fill:#90EE90,stroke:#333
    classDef dvapi fill:#90EE90,stroke:#333
    classDef fsys fill:#90EE90,stroke:#333

    %% Click Events
    click MODALS "https://github.com/mdelobelle/metadatamenu/tree/master/src/modals/"
    click SETTINGS "https://github.com/mdelobelle/metadatamenu/tree/master/src/settings/"
    click SUGGEST "https://github.com/mdelobelle/metadatamenu/tree/master/src/suggester/"
    click FIELD "https://github.com/mdelobelle/metadatamenu/tree/master/src/fields/"
    click FCLASS "https://github.com/mdelobelle/metadatamenu/tree/master/src/fileClass/"
    click CMD "https://github.com/mdelobelle/metadatamenu/tree/master/src/commands/"
    click DB "https://github.com/mdelobelle/metadatamenu/tree/master/src/db/"
    click BASE "https://github.com/mdelobelle/metadatamenu/tree/master/src/fields/base/"
    click MODELS "https://github.com/mdelobelle/metadatamenu/tree/master/src/fields/models/"
    click STORE "https://github.com/mdelobelle/metadatamenu/tree/master/src/db/stores/"
    click FCVIEWS "https://github.com/mdelobelle/metadatamenu/tree/master/src/fileClass/views/"
    click IDX "https://github.com/mdelobelle/metadatamenu/tree/master/src/index/"
    click OBAPI "https://github.com/mdelobelle/metadatamenu/blob/master/src/MetadataMenuApi.ts"
    click DVAPI "https://github.com/mdelobelle/metadatamenu/blob/master/src/types/dataviewTypes.ts"
    click FSYS "https://github.com/mdelobelle/metadatamenu/blob/master/src/utils/fileUtils.ts"
```
