# cardio-ai/fl-multi-modal-dataset-creation architecture

> Architecture diagram of the GitHub repository cardio-ai/fl-multi-modal-dataset-creation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cardio-ai/fl-multi-modal-dataset-creation
- Repository: https://github.com/cardio-ai/fl-multi-modal-dataset-creation

## Overview

##### Main Components

a) Data Input Layer:
- DICOM Files (Images, Waveforms)
- Annotations (Segmentations)
- Structured Reports (ECG Reports, Basic Diagnostic Reports)

b) Processing Components:
- highdicom Extension Module
- SR Template Processors (TID 2000, TID 3700, TID 3802)
- DICOM SR to FHIR Converter

c) Kaapana Integration Layer:
- Airflow DAGs Components
- Metadata Collection Workflows
- Installation/Uninstallation Workflows
- Docker Container Environment

d) Storage and Indexing:
- Metadata Index
- Dashboard Data Storage
- Backup Systems

##### Component Relationships

- Data input → Processing Components
- Processing Components → Kaapana Integration Layer
- Kaapana Integration Layer → Storage and Indexing
- Storage and Indexing → Dashboard/UI Layer

##### Specific Implementation Details

- Blue: Core DICOM processing components
- Green: Kaapana extension components
- Yellow: Storage/database components
- Purple: User interface/dashboard components

##### Architectural Patterns to Highlight

- Workflow-based Architecture (evidenced by DAG files)
- Modular Design (separate operators for different functions)
- Plugin Architecture (extension-based design)

##### Key Technical Elements

- Annotation Collectors
- Metadata Operators
- Dcm2JsonOperator
- Json2MetaOperator
- MetaBackupOperator
- MetaInstallOperator
- Dashboard Integration

##### Data Flow Patterns

Following flows:

##### Integration Points

Highlight:
- Kaapana Platform Integration
- FHIR Conversion Capabilities
- Dashboard Data Export/Import

Special Considerations:

##### A separate section showing the template structure
- TID 2000 (Basic Diagnostic Imaging Report)
- TID 3700 (ECG Report)
- TID 3802 (Cardiovascular Patient History)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input["Data Input Layer"]
        DICOM["DICOM Files"]
        ANN["Annotations"]
        SR["Structured Reports"]
    end

    subgraph Processing["Processing Components"]
        direction TB
        subgraph HD["highdicom Extension"]
            direction TB
            SRT["SR Template Processors"]:::file
            FHIR["DICOM SR to FHIR Converter"]:::file
            SUTIL["SR Processing Utilities"]:::file
        end
        click HD "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/tree/main/highdicom/"
        click SRT "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/blob/main/structured_reports.py"
        click FHIR "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/blob/main/ecg_report_dicom_sr_to_fhir.ipynb"
        click SUTIL "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/blob/main/annotation-collect-metadata/extension/docker/files/annotation_collect_metadata/sr_meta.py"
    end

    subgraph Kaapana["Kaapana Integration Layer"]
        direction TB
        subgraph Docker["Docker Environment"]
            direction TB
            DAGS["Airflow DAGs"]:::file
            MO["Metadata Operators"]
        end
        
        subgraph MetaOps["Metadata Operations"]
            direction TB
            DCM["Dcm2JsonOperator"]:::file
            JSN["Json2MetaOperator"]:::file
            BAK["MetaBackupOperator"]:::file
            INS["MetaInstallOperator"]:::file
        end
    end
    click Docker "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/tree/main/annotation-collect-metadata/extension/docker/"
    click DAGS "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/blob/main/annotation-collect-metadata/extension/docker/files/annotation_collect_metatdata_dags/dag_service_extract_annotation_metadata.py"
    click DCM "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/blob/main/annotation-collect-metadata/extension/docker/files/annotation_collect_metadata/LocalAnnotationDcm2JsonOperator.py"
    click JSN "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/blob/main/annotation-collect-metadata/extension/docker/files/annotation_collect_metadata/LocalAnnotationJson2MetaOperator.py"
    click BAK "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/blob/main/annotation-collect-metadata/extension/docker/files/annotation_collect_metadata/LocalMetaBackupOperator.py"
    click INS "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/blob/main/annotation-collect-metadata/extension/docker/files/annotation_collect_metadata/LocalMetaInstallOperator.py"

    subgraph Storage["Storage and Indexing"]
        direction TB
        META["Metadata Index"]:::file
        DASH["Dashboard Data"]:::file
        BACKUP["Backup Systems"]
    end
    click META "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/blob/main/annotation-collect-metadata/extension/docker/files/annotation_collect_metadata/os_dashboard_data/meta-index_configs.json"
    click DASH "https://github.com/Cardio-AI/fl-multi-modal-dataset-creation/tree/main/annotation-collect-metadata/extension/docker/files/annotation_collect_metadata/os_dashboard_data/"

    subgraph Templates["SR Templates"]
        direction TB
        TID2000["TID 2000<br/>Basic Diagnostic"]
        TID3700["TID 3700<br/>ECG Report"]
        TID3802["TID 3802<br/>CV Patient History"]
    end

    %% Connections
    DICOM --> HD
    ANN --> HD
    SR --> HD
    
    HD --> Docker
    Docker --> MetaOps
    MetaOps --> Storage
    
    SRT --> Templates

    %% Styles
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:1px
    classDef file fill:#e1f5fe,stroke:#0288d1,stroke-width:2px
    classDef storage fill:#fff3e0,stroke:#ff9800,stroke-width:2px
    classDef processing fill:#e8f5e9,stroke:#4caf50,stroke-width:2px
    
    %% Legend
    subgraph Legend
        L1["Component"]
        L2["File/Directory"]:::file
        L3["Storage"]:::storage
        L4["Processing"]:::processing
    end
```
