# playpowerlabs/edoptimize architecture

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

- Interactive diagram: https://gitdiagram.com/playpowerlabs/edoptimize
- Repository: https://github.com/playpowerlabs/edoptimize

## Overview

##### Project Type and Purpose
- This is an open-source R/Shiny-based learning analytics suite.
- It consists of three independent but structurally identical Shiny dashboard applications (Platform Analytics, Curriculum Analytics, Implementation Analytics), plus a shared data-prep component.
- It processes two raw data formats (event logs + assessment/item responses) into consumable RData artifacts, then serves them via interactive dashboards.

##### Top-Level Architecture Overview
- Data Ingestion Layer
– Raw Event Log & Raw Item Response Log (CSV or RData)
– `data_prep/raw_data_simulation.R` (optional simulator)
- Data Processing Layer (per dashboard)
– `*_analytics/data/*_data_prep.R` scripts
– Outputs: dashboard-specific RData files under each `*/data/` folder
- Application Layer (per dashboard)
– app.R (assembles UI + Server)
– appCSS.R (styling)
– functions.R (business logic + data wrangling helpers)
– plot.R (visualization helpers)
– ui/ … (Shiny UI modules, one file per tab)
– server/ … (Shiny server modules, one file per tab)
- Presentation Layer
– Shiny front-end delivered via Shiny Server or shinyapps.io
– End users interact via browser

##### Main Components & Their Relationships
A. Raw Data Sources
– Label: “Event Log”, “Item Response Log”
B. Data Prep Scripts (Orchestrator)
– Label: “platform_analytics_data_prep.R” (and analogous scripts)
C. Processed Data Store
– Label: “RData files”
– Loaded by app.R at startup
D. Dashboard Apps (three parallel apps)
– For each of Platform, Curriculum, Implementation:
- app.R (entry-point)
- UI Modules (ui/*.R)
- Server Modules (server/*.R)
- Shared functions.R & plot.R
E. User Interface & Interaction
– Label: “Web Browser (Shiny UI)”

##### Architectural Patterns & Design Principles
- Modularization: Each dashboard is composed of Shiny modules—one UI + one server file per tab.
- Separation of Concerns:
– Data Prep ↔ Business Logic (functions.R) ↔ Presentation (plot.R + UI)
- Reusability: Shared helper scripts (functions.R, plot.R) across dashboards.
- Stateless Frontend: All data is pre-computed; Shiny server only reacts to UI inputs.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Ingestion Layer
    subgraph "Data Ingestion Layer"
        direction TB
        RawEvent["Event Log"]:::data
        RawItem["Item Response Log"]:::data
        RawSim["raw_data_simulation.R"]:::process
        RawEvent -->|feeds| RawSim
        RawItem -->|feeds| RawSim
    end

    %% Data Processing Layer
    subgraph "Data Processing Layer"
        direction TB
        PA_Prep["platform_analytics_data_prep.R"]:::process
        CA_Prep["curriculum_analytics_data_prep.R"]:::process
        IA_Prep["implementation_analytics_data_prep.R"]:::process
        RawSim -->|simulates| PA_Prep
        RawSim -->|simulates| CA_Prep
        RawSim -->|simulates| IA_Prep
    end

    %% Processed Data Store
    subgraph "Processed Data Store"
        direction TB
        PA_Data["Platform RData files"]:::store
        CA_Data["Curriculum RData files"]:::store
        IA_Data["Implementation RData files"]:::store
        PA_Prep -->|writes| PA_Data
        CA_Prep -->|writes| CA_Data
        IA_Prep -->|writes| IA_Data
    end

    %% Application Layer: Dashboard Apps
    subgraph "Platform Analytics App" 
        direction TB
        PA_App["app.R"]:::app
        PA_CSS["appCSS.R"]:::app
        PA_Func["functions.R"]:::process
        PA_Plot["plot.R"]:::process
        PA_App --> PA_CSS
        PA_App --> PA_Func
        PA_App --> PA_Plot
        PA_Data -->|loads| PA_App
    end

    subgraph "Curriculum Analytics App"
        direction TB
        CA_App["app.R"]:::app
        CA_CSS["appCSS.R"]:::app
        CA_Func["functions.R"]:::process
        CA_Plot["plot.R"]:::process
        CA_App --> CA_CSS
        CA_App --> CA_Func
        CA_App --> CA_Plot
        CA_Data -->|loads| CA_App
    end

    subgraph "Implementation Analytics App"
        direction TB
        IA_App["app.R"]:::app
        IA_CSS["appCSS.R"]:::app
        IA_Func["functions.R"]:::process
        IA_Plot["plot.R"]:::process
        IA_App --> IA_CSS
        IA_App --> IA_Func
        IA_App --> IA_Plot
        IA_Data -->|loads| IA_App
    end

    %% Presentation Layer
    Browser["Web Browser (Shiny UI)"]:::ui
    Browser -->|interacts| PA_App
    Browser -->|interacts| CA_App
    Browser -->|interacts| IA_App

    %% Click Events
    click RawSim "https://github.com/playpowerlabs/edoptimize/blob/master/data_prep/raw_data_simulation.R"
    click PA_Prep "https://github.com/playpowerlabs/edoptimize/blob/master/platform_analytics/data/platform_analytics_data_prep.R"
    click CA_Prep "https://github.com/playpowerlabs/edoptimize/blob/master/curriculum_analytics/data/curriculum_analytics_data_prep.R"
    click IA_Prep "https://github.com/playpowerlabs/edoptimize/blob/master/implementation_analytics/data/implementation_analytics_data_prep.R"
    click PA_App "https://github.com/playpowerlabs/edoptimize/blob/master/platform_analytics/app.R"
    click PA_CSS "https://github.com/playpowerlabs/edoptimize/blob/master/platform_analytics/appCSS.R"
    click PA_Func "https://github.com/playpowerlabs/edoptimize/blob/master/platform_analytics/functions.R"
    click PA_Plot "https://github.com/playpowerlabs/edoptimize/blob/master/platform_analytics/plot.R"
    click CA_App "https://github.com/playpowerlabs/edoptimize/blob/master/curriculum_analytics/app.R"
    click CA_CSS "https://github.com/playpowerlabs/edoptimize/blob/master/curriculum_analytics/appCSS.R"
    click CA_Func "https://github.com/playpowerlabs/edoptimize/blob/master/curriculum_analytics/functions.R"
    click CA_Plot "https://github.com/playpowerlabs/edoptimize/blob/master/curriculum_analytics/plot.R"
    click IA_App "https://github.com/playpowerlabs/edoptimize/blob/master/implementation_analytics/app.R"
    click IA_CSS "https://github.com/playpowerlabs/edoptimize/blob/master/implementation_analytics/appCSS.R"
    click IA_Func "https://github.com/playpowerlabs/edoptimize/blob/master/implementation_analytics/functions.R"
    click IA_Plot "https://github.com/playpowerlabs/edoptimize/blob/master/implementation_analytics/plot.R"

    %% Styles
    classDef data fill:#a8ddb5,stroke:#333,stroke-width:1px
    classDef process fill:#9ecae1,stroke:#333,stroke-width:1px
    classDef store fill:#74c476,stroke:#333,stroke-width:1px
    classDef app fill:#fdae6b,stroke:#333,stroke-width:1px
    classDef ui fill:#fdd0a2,stroke:#333,stroke-width:1px
```
