# nsls-ii/lsdc architecture

> Architecture diagram of the GitHub repository nsls-ii/lsdc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nsls-ii/lsdc
- Repository: https://github.com/nsls-ii/lsdc

## Overview

##### Main Components

a) Core System Components:
- Data Acquisition System (indicated by daq_*.py files)
- Beamline Control System (beamline_*.py files)
- GUI Interface (gui/ directory)
- Robot Control System (robot_*.py files)
- Database Layer (db_lib.py, lsdb1.py)
- Processing Pipeline (indicated by various processing scripts)

b) External Integrations:
- EPICS Control System (epics_det.py)
- Kafka Message Queue (kafka_producer.py)
- Bluesky Framework Integration (mxbluesky/ directory)

##### Implementation Details

- Hierarchical layouts
- Detailed annotations
- Export to high-resolution formats

##### Documentation Integration

References to:
- Configuration files
- Documentation (docs/ directory)
- API endpoints
- Service interfaces

For this scientific instrument control system, emphasis should be placed on:
- Real-time control flows
- Data acquisition paths
- Hardware interfaces
- Processing pipelines
- User interaction points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI
        GUI["GUI Interface"]:::ui
        Remote["Remote Access Interface"]:::ui
    end

    subgraph Core
        DAQ["Data Acquisition System"]:::core
        BCS["Beamline Control System"]:::core
        RCS["Robot Control System"]:::core
    end

    subgraph Processing
        PP["Processing Pipeline"]:::processing
        subgraph ProcessingTasks
            EDNA["EDNA"]:::task
            FastDP["FastDP"]:::task
            SpotFinder["Spot Finder"]:::task
            PinAlign["Pin Alignment"]:::task
        end
    end

    subgraph Storage
        DB["Database Layer"]:::storage
    end

    subgraph External
        EPICS["EPICS Control System"]:::external
        Kafka["Kafka Message Queue"]:::external
        Bluesky["Bluesky Framework"]:::external
    end

    GUI --> DAQ
    Remote --> DAQ
    DAQ --> BCS
    DAQ --> RCS
    DAQ --> DB
    BCS --> EPICS
    DAQ --> Kafka
    DAQ --> Bluesky
    DAQ --> PP
    PP --> ProcessingTasks
    ProcessingTasks --> DB

    %% Click events for component mapping
    click GUI "https://github.com/NSLS-II/lsdc/tree/master/gui/"
    click Remote "https://github.com/NSLS-II/lsdc/tree/master/bin/lsdcRemote"
    click DAQ "https://github.com/NSLS-II/lsdc/blob/master/daq_main2.py"
    click BCS "https://github.com/NSLS-II/lsdc/blob/master/beamline_lib.py"
    click RCS "https://github.com/NSLS-II/lsdc/blob/master/robot_lib.py"
    click DB "https://github.com/NSLS-II/lsdc/blob/master/db_lib.py"
    click EPICS "https://github.com/NSLS-II/lsdc/blob/master/epics_det.py"
    click Kafka "https://github.com/NSLS-II/lsdc/blob/master/kafka_producer.py"
    click Bluesky "https://github.com/NSLS-II/lsdc/tree/master/mxbluesky/"
    click EDNA "https://github.com/NSLS-II/lsdc/blob/master/runEdna.py"
    click FastDP "https://github.com/NSLS-II/lsdc/blob/master/runFastDPH5.py"
    click SpotFinder "https://github.com/NSLS-II/lsdc/blob/master/runSpotFinder4syncW.py"
    click PinAlign "https://github.com/NSLS-II/lsdc/blob/master/runPinAlign.py"

    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,stroke-width:2px
    classDef core fill:#2ecc71,stroke:#27ae60,stroke-width:2px
    classDef processing fill:#e74c3c,stroke:#c0392b,stroke-width:2px
    classDef storage fill:#f1c40f,stroke:#f39c12,stroke-width:2px
    classDef external fill:#9b59b6,stroke:#8e44ad,stroke-width:2px
    classDef task fill:#e74c3c,stroke:#c0392b,stroke-width:1px

    %% Legend
    subgraph Legend
        L1["UI Components"]:::ui
        L2["Core Components"]:::core
        L3["Processing Components"]:::processing
        L4["Storage Components"]:::storage
        L5["External Services"]:::external
    end
```
