# cdcgov/rnssp architecture

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

- Interactive diagram: https://gitdiagram.com/cdcgov/rnssp
- Repository: https://github.com/cdcgov/rnssp

## Overview

Rnssp is an R package of reusable NSSP data-processing and analytics tools. Its documented example has an analyst create a credential profile, adjust an ESSENCE API URL, and retrieve syndromic-surveillance data, either directly or through the profile. The repository also includes alert-detection methods, geospatial reference data, text-mining utilities, report templates, and an app. Source excerpts were unavailable, so links beyond the README’s documented API workflow are omitted rather than inferred.

Main entry points: [`R/api_utilities.R`](https://github.com/cdcgov/rnssp/blob/master/R/api_utilities.R) (ESSENCE API access), [`R/credentials.R`](https://github.com/cdcgov/rnssp/blob/master/R/credentials.R) (Credential profiles), [`R/token.R`](https://github.com/cdcgov/rnssp/blob/master/R/token.R) (Token profiles), [`R/utility.R`](https://github.com/cdcgov/rnssp/blob/master/R/utility.R) (URL date updates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["API access"]
  node_profiles["Credential profiles<br/>[credentials.R]"]
  node_token["Token profiles<br/>[token.R]"]
  node_auth["Authentication<br/>[auth.R]"]
  node_api["ESSENCE API access<br/>[api_utilities.R]"]
  node_datechange["URL date updates<br/>[utility.R]"]
end

subgraph group_analytics["Surveillance analytics"]
  node_alerts["Alert methods<br/>[alert_ewma.R]"]
  node_farrington["Farrington alerts<br/>[alert_farrington.R]"]
  node_nbinom["Negative binomial<br/>[alert_nbinom.R]"]
  node_regression["Regression alerts<br/>[alert_regression.R]"]
  node_serfling["Serfling alerts<br/>[alert_serfling.R]"]
  node_switch["Alert switching<br/>[alert_switch.R]"]
  node_trend["Trend classification<br/>[classify_trend.R]"]
end

subgraph group_reference["Reference data"]
  node_geodata[("Geospatial datasets<br/>[state_sf.R]")]
end

subgraph group_tools["Reusable tools"]
  node_text["Text mining<br/>[rnssp_stopwords.R]"]
  node_icd["ICD web scraping<br/>[webscrape_icd.R]"]
  node_templates["Report templates"]
  node_addins["RStudio add-ins<br/>[rnssp_addins.R]"]
  node_app["Shiny app<br/>[run_app.R]"]
end

node_analyst(("R user"))
node_essence{{"ESSENCE API"}}

node_analyst -->|"creates profile"| node_profiles
node_analyst -->|"creates token profile"| node_token
node_analyst -->|"updates URL dates"| node_datechange
node_analyst -->|"requests data"| node_api
node_profiles -->|"gets data"| node_api
node_api -->|"requests data"| node_essence

click node_profiles "https://github.com/cdcgov/rnssp/blob/master/R/credentials.R"
click node_token "https://github.com/cdcgov/rnssp/blob/master/R/token.R"
click node_auth "https://github.com/cdcgov/rnssp/blob/master/R/auth.R"
click node_api "https://github.com/cdcgov/rnssp/blob/master/R/api_utilities.R"
click node_datechange "https://github.com/cdcgov/rnssp/blob/master/R/utility.R"
click node_alerts "https://github.com/cdcgov/rnssp/blob/master/R/alert_ewma.R"
click node_farrington "https://github.com/cdcgov/rnssp/blob/master/R/alert_farrington.R"
click node_nbinom "https://github.com/cdcgov/rnssp/blob/master/R/alert_nbinom.R"
click node_regression "https://github.com/cdcgov/rnssp/blob/master/R/alert_regression.R"
click node_serfling "https://github.com/cdcgov/rnssp/blob/master/R/alert_serfling.R"
click node_switch "https://github.com/cdcgov/rnssp/blob/master/R/alert_switch.R"
click node_trend "https://github.com/cdcgov/rnssp/blob/master/R/classify_trend.R"
click node_geodata "https://github.com/cdcgov/rnssp/blob/master/R/state_sf.R"
click node_text "https://github.com/cdcgov/rnssp/blob/master/R/rnssp_stopwords.R"
click node_icd "https://github.com/cdcgov/rnssp/blob/master/R/webscrape_icd.R"
click node_templates "https://github.com/cdcgov/rnssp/tree/master/inst/rmarkdown/templates"
click node_addins "https://github.com/cdcgov/rnssp/blob/master/R/rnssp_addins.R"
click node_app "https://github.com/cdcgov/rnssp/blob/master/R/run_app.R"

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_profiles,node_token,node_auth,node_api,node_datechange,node_analyst toneBlue
class node_alerts,node_farrington,node_nbinom,node_regression,node_serfling,node_switch,node_trend toneAmber
class node_geodata,node_essence toneMint
class node_text,node_icd,node_templates,node_addins,node_app toneRose
```

## Components

### API access

- [Credential profiles](https://github.com/cdcgov/rnssp/blob/master/R/credentials.R): `R/credentials.R`
- [Token profiles](https://github.com/cdcgov/rnssp/blob/master/R/token.R): `R/token.R`
- [Authentication](https://github.com/cdcgov/rnssp/blob/master/R/auth.R): `R/auth.R`
- [ESSENCE API access](https://github.com/cdcgov/rnssp/blob/master/R/api_utilities.R): `R/api_utilities.R`
- [URL date updates](https://github.com/cdcgov/rnssp/blob/master/R/utility.R): `R/utility.R`

### Surveillance analytics

- [Alert methods](https://github.com/cdcgov/rnssp/blob/master/R/alert_ewma.R): `R/alert_ewma.R`
- [Farrington alerts](https://github.com/cdcgov/rnssp/blob/master/R/alert_farrington.R): `R/alert_farrington.R`
- [Negative binomial](https://github.com/cdcgov/rnssp/blob/master/R/alert_nbinom.R): `R/alert_nbinom.R`
- [Regression alerts](https://github.com/cdcgov/rnssp/blob/master/R/alert_regression.R): `R/alert_regression.R`
- [Serfling alerts](https://github.com/cdcgov/rnssp/blob/master/R/alert_serfling.R): `R/alert_serfling.R`
- [Alert switching](https://github.com/cdcgov/rnssp/blob/master/R/alert_switch.R): `R/alert_switch.R`
- [Trend classification](https://github.com/cdcgov/rnssp/blob/master/R/classify_trend.R): `R/classify_trend.R`

### Reference data

- [Geospatial datasets](https://github.com/cdcgov/rnssp/blob/master/R/state_sf.R): `R/state_sf.R`

### Reusable tools

- [Text mining](https://github.com/cdcgov/rnssp/blob/master/R/rnssp_stopwords.R): `R/rnssp_stopwords.R`
- [ICD web scraping](https://github.com/cdcgov/rnssp/blob/master/R/webscrape_icd.R): `R/webscrape_icd.R`
- [Report templates](https://github.com/cdcgov/rnssp/tree/master/inst/rmarkdown/templates): `inst/rmarkdown/templates`
- [RStudio add-ins](https://github.com/cdcgov/rnssp/blob/master/R/rnssp_addins.R): `R/rnssp_addins.R`
- [Shiny app](https://github.com/cdcgov/rnssp/blob/master/R/run_app.R): `R/run_app.R`

### Other components

- **R user**
- **ESSENCE API**

## Connections

- R user → Credential profiles: creates profile (evidence: `README.md`)
- R user → Token profiles: creates token profile (evidence: `README.md`)
- R user → URL date updates: updates URL dates (evidence: `README.md`)
- R user → ESSENCE API access: requests data (evidence: `README.md`)
- Credential profiles → ESSENCE API access: gets data (evidence: `README.md`)
- ESSENCE API access → ESSENCE API: requests data (evidence: `README.md`)
