# lwillem/socrates_rshiny architecture

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

- Interactive diagram: https://gitdiagram.com/lwillem/socrates_rshiny
- Repository: https://github.com/lwillem/socrates_rshiny

## Overview

SOCRATES is a social-contact data tool with online Shiny applications and a documented local CLI entry point. The tree indicates survey-data preprocessing, contact-matrix handling, analysis/plotting, and a separate socialmixr implementation. No source excerpts were available, so internal call relationships and data flow cannot be verified; the graph shows only documented user entry points and groups the remaining capabilities by their visible modules.

Main entry points: [`ui.R`](https://github.com/lwillem/socrates_rshiny/blob/master/ui.R) (Shiny UI), [`R/modules/socrates_cli.R`](https://github.com/lwillem/socrates_rshiny/blob/master/R/modules/socrates_cli.R) (Local CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_shiny_ui["Shiny UI<br/>[ui.R]"]
  node_shiny_server["Shiny server<br/>[server.R]"]
  node_cli["Local CLI<br/>[socrates_cli.R]"]
  node_local["Local workflow<br/>[socrates_local.R]"]
  node_main["SOCRATES core<br/>[socrates_main.R]"]
end

subgraph group_survey["Survey data"]
  node_preprocess_survey["Survey preprocessing"]
  node_preprocess_holiday["Holiday preprocessing"]
  node_survey_variants["Survey variants"]
  node_survey_tools["Survey utilities"]
end

subgraph group_analysis["Contact analysis"]
  node_contact_matrix["Contact matrices<br/>[contact_matrix.r]"]
  node_next_gen["Next-generation analysis<br/>[next_gen_lib.R]"]
  node_wave["Wave analysis<br/>[wave_lib.R]"]
  node_plots["Analysis plots"]
end

subgraph group_support["Configuration and data"]
  node_matrix_download["Matrix downloads"]
  node_config["Configuration<br/>[load_config_base.R]"]
  node_admin["Country administration"]
  node_survey_data[("Survey datasets")]
end

node_user(("User"))

node_user -->|"uses online UI"| node_shiny_ui
node_user -->|"runs locally"| node_cli

click node_shiny_ui "https://github.com/lwillem/socrates_rshiny/blob/master/ui.R"
click node_shiny_server "https://github.com/lwillem/socrates_rshiny/blob/master/server.R"
click node_cli "https://github.com/lwillem/socrates_rshiny/blob/master/R/modules/socrates_cli.R"
click node_local "https://github.com/lwillem/socrates_rshiny/blob/master/R/modules/socrates_local.R"
click node_main "https://github.com/lwillem/socrates_rshiny/blob/master/R/socrates_main.R"
click node_preprocess_survey "https://github.com/lwillem/socrates_rshiny/blob/master/R/modules/preprocess_survey_data.R"
click node_preprocess_holiday "https://github.com/lwillem/socrates_rshiny/blob/master/R/modules/preprocess_holiday_data.R"
click node_survey_variants "https://github.com/lwillem/socrates_rshiny/tree/master/R/modules"
click node_survey_tools "https://github.com/lwillem/socrates_rshiny/tree/master/R_socialmixr"
click node_contact_matrix "https://github.com/lwillem/socrates_rshiny/blob/master/R_socialmixr/contact_matrix.r"
click node_next_gen "https://github.com/lwillem/socrates_rshiny/blob/master/R/next_gen_lib.R"
click node_wave "https://github.com/lwillem/socrates_rshiny/blob/master/R/wave_lib.R"
click node_plots "https://github.com/lwillem/socrates_rshiny/tree/master/R"
click node_matrix_download "https://github.com/lwillem/socrates_rshiny/blob/master/R/download_matrices.R"
click node_config "https://github.com/lwillem/socrates_rshiny/blob/master/R/load_config_base.R"
click node_admin "https://github.com/lwillem/socrates_rshiny/blob/master/R/load_country_admin.R"
click node_survey_data "https://github.com/lwillem/socrates_rshiny/tree/master/data"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_shiny_ui,node_shiny_server,node_cli,node_local,node_main,node_user toneBlue
class node_preprocess_survey,node_preprocess_holiday,node_survey_variants,node_survey_tools toneAmber
class node_contact_matrix,node_next_gen,node_wave,node_plots toneMint
class node_matrix_download,node_config,node_admin,node_survey_data toneRose
```

## Components

### User entry points

- [Shiny UI](https://github.com/lwillem/socrates_rshiny/blob/master/ui.R): `ui.R`
- [Shiny server](https://github.com/lwillem/socrates_rshiny/blob/master/server.R): `server.R`
- [Local CLI](https://github.com/lwillem/socrates_rshiny/blob/master/R/modules/socrates_cli.R): `R/modules/socrates_cli.R`
- [Local workflow](https://github.com/lwillem/socrates_rshiny/blob/master/R/modules/socrates_local.R): `R/modules/socrates_local.R`
- [SOCRATES core](https://github.com/lwillem/socrates_rshiny/blob/master/R/socrates_main.R): `R/socrates_main.R`

### Survey data

- [Survey preprocessing](https://github.com/lwillem/socrates_rshiny/blob/master/R/modules/preprocess_survey_data.R): `R/modules/preprocess_survey_data.R`
- [Holiday preprocessing](https://github.com/lwillem/socrates_rshiny/blob/master/R/modules/preprocess_holiday_data.R): `R/modules/preprocess_holiday_data.R`
- [Survey variants](https://github.com/lwillem/socrates_rshiny/tree/master/R/modules): `R/modules`
- [Survey utilities](https://github.com/lwillem/socrates_rshiny/tree/master/R_socialmixr): `R_socialmixr`

### Contact analysis

- [Contact matrices](https://github.com/lwillem/socrates_rshiny/blob/master/R_socialmixr/contact_matrix.r): `R_socialmixr/contact_matrix.r`
- [Next-generation analysis](https://github.com/lwillem/socrates_rshiny/blob/master/R/next_gen_lib.R): `R/next_gen_lib.R`
- [Wave analysis](https://github.com/lwillem/socrates_rshiny/blob/master/R/wave_lib.R): `R/wave_lib.R`
- [Analysis plots](https://github.com/lwillem/socrates_rshiny/tree/master/R): `R`

### Configuration and data

- [Matrix downloads](https://github.com/lwillem/socrates_rshiny/blob/master/R/download_matrices.R): `R/download_matrices.R`
- [Configuration](https://github.com/lwillem/socrates_rshiny/blob/master/R/load_config_base.R): `R/load_config_base.R`
- [Country administration](https://github.com/lwillem/socrates_rshiny/blob/master/R/load_country_admin.R): `R/load_country_admin.R`
- [Survey datasets](https://github.com/lwillem/socrates_rshiny/tree/master/data): `data`

### Other components

- **User**

## Connections

- User → Shiny UI: uses online UI
- User → Local CLI: runs locally
