# norc-uchicago/mends architecture

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

- Interactive diagram: https://gitdiagram.com/norc-uchicago/mends
- Repository: https://github.com/norc-uchicago/mends

## Overview

This repository is an annotated SAS/R analytics workflow for producing weighted MENDS chronic-disease estimates, currently including hypertension indicators. Its principal workflow runs from EHR-file preparation through weighting and estimation, with direct and modeled small-area estimates and a suppression/export stage. The tree identifies these distinct stages and geographic levels; no source excerpts were provided, so inter-stage links are shown as unverified rather than asserted calls. The README documents the overall purpose and geographic scope, but not detailed runtime connections.

Main entry points: [`2_Weighting/2_2_Weighting_national.sas`](https://github.com/norc-uchicago/mends/blob/main/2_Weighting/2_2_Weighting_national.sas) (National weighting), [`2_Weighting/2_2_Weighting_state.sas`](https://github.com/norc-uchicago/mends/blob/main/2_Weighting/2_2_Weighting_state.sas) (State weighting), [`2_Weighting/2_1_Raking_macros.sas`](https://github.com/norc-uchicago/mends/blob/main/2_Weighting/2_1_Raking_macros.sas) (Raking macros), [`3_Estimation/3_2_estimates.sas`](https://github.com/norc-uchicago/mends/blob/main/3_Estimation/3_2_estimates.sas) (Indicator estimates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Reference inputs"]
  node_population[("Population totals")]
  node_crosswalks[("Geographic crosswalks")]
end

subgraph group_prep["Data preparation"]
  node_ehrprep["EHR preparation"]
end

subgraph group_weight["Weighting"]
  node_raking["Raking macros"]
  node_nationalweight["National weighting"]
  node_stateweight["State weighting"]
end

subgraph group_est["Estimation"]
  node_exclusions["Estimate exclusions<br/>[3_1_exclusions.sas]"]
  node_estimates["Indicator estimates<br/>[3_2_estimates.sas]"]
  node_direct["Direct estimates"]
  node_models["Small-area models"]
end

subgraph group_publish["Suppression and export"]
  node_suppression["Suppression export"]
  node_report["Report creation"]
end

node_analyst(("MENDS analyst"))

node_analyst -.->|"runs workflow"| node_ehrprep
node_ehrprep -.->|"prepares weighting"| node_raking
node_population -.->|"calibrates to"| node_nationalweight
node_population -.->|"calibrates to"| node_stateweight
node_crosswalks -.->|"supports geography"| node_nationalweight
node_crosswalks -.->|"supports geography"| node_stateweight
node_raking -.->|"used by"| node_nationalweight
node_raking -.->|"used by"| node_stateweight
node_nationalweight -.->|"feeds estimates"| node_exclusions
node_stateweight -.->|"feeds estimates"| node_exclusions
node_exclusions -.->|"filters records"| node_estimates
node_estimates -.->|"supports small areas"| node_direct
node_estimates -.->|"supports modeling"| node_models
node_direct -.->|"prepared for export"| node_suppression
node_models -.->|"prepared for export"| node_suppression
node_suppression -.->|"creates report"| node_report

click node_population "https://github.com/norc-uchicago/mends/tree/main/0_Control_Totals"
click node_crosswalks "https://github.com/norc-uchicago/mends/tree/main/0_Crosswalks"
click node_ehrprep "https://github.com/norc-uchicago/mends/blob/main/1_Data_Preparation/1_0_quickstart_MENDS_create_ehr_files.sas"
click node_raking "https://github.com/norc-uchicago/mends/blob/main/2_Weighting/2_1_Raking_macros.sas"
click node_nationalweight "https://github.com/norc-uchicago/mends/blob/main/2_Weighting/2_2_Weighting_national.sas"
click node_stateweight "https://github.com/norc-uchicago/mends/blob/main/2_Weighting/2_2_Weighting_state.sas"
click node_exclusions "https://github.com/norc-uchicago/mends/blob/main/3_Estimation/3_1_exclusions.sas"
click node_estimates "https://github.com/norc-uchicago/mends/blob/main/3_Estimation/3_2_estimates.sas"
click node_direct "https://github.com/norc-uchicago/mends/blob/main/4_SAE_estimates/County_Direct_Estimates.sas"
click node_models "https://github.com/norc-uchicago/mends/tree/main/4_SAE_estimates"
click node_suppression "https://github.com/norc-uchicago/mends/blob/main/5_Suppression/4_0_quickstart_MENDS_suppression_export.sas"
click node_report "https://github.com/norc-uchicago/mends/blob/main/5_Suppression/4_1_Create_report.sas"

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_population,node_crosswalks toneBlue
class node_ehrprep toneAmber
class node_raking,node_nationalweight,node_stateweight toneMint
class node_exclusions,node_estimates,node_direct,node_models toneRose
class node_suppression,node_report,node_analyst toneIndigo
```

## Components

### Reference inputs

- [Population totals](https://github.com/norc-uchicago/mends/tree/main/0_Control_Totals): `0_Control_Totals`
- [Geographic crosswalks](https://github.com/norc-uchicago/mends/tree/main/0_Crosswalks): `0_Crosswalks`

### Data preparation

- [EHR preparation](https://github.com/norc-uchicago/mends/blob/main/1_Data_Preparation/1_0_quickstart_MENDS_create_ehr_files.sas): `1_Data_Preparation/1_0_quickstart_MENDS_create_ehr_files.sas`

### Weighting

- [Raking macros](https://github.com/norc-uchicago/mends/blob/main/2_Weighting/2_1_Raking_macros.sas): `2_Weighting/2_1_Raking_macros.sas`
- [National weighting](https://github.com/norc-uchicago/mends/blob/main/2_Weighting/2_2_Weighting_national.sas): `2_Weighting/2_2_Weighting_national.sas`
- [State weighting](https://github.com/norc-uchicago/mends/blob/main/2_Weighting/2_2_Weighting_state.sas): `2_Weighting/2_2_Weighting_state.sas`

### Estimation

- [Estimate exclusions](https://github.com/norc-uchicago/mends/blob/main/3_Estimation/3_1_exclusions.sas): `3_Estimation/3_1_exclusions.sas`
- [Indicator estimates](https://github.com/norc-uchicago/mends/blob/main/3_Estimation/3_2_estimates.sas): `3_Estimation/3_2_estimates.sas`
- [Direct estimates](https://github.com/norc-uchicago/mends/blob/main/4_SAE_estimates/County_Direct_Estimates.sas): `4_SAE_estimates/County_Direct_Estimates.sas`
- [Small-area models](https://github.com/norc-uchicago/mends/tree/main/4_SAE_estimates): `4_SAE_estimates`

### Suppression and export

- [Suppression export](https://github.com/norc-uchicago/mends/blob/main/5_Suppression/4_0_quickstart_MENDS_suppression_export.sas): `5_Suppression/4_0_quickstart_MENDS_suppression_export.sas`
- [Report creation](https://github.com/norc-uchicago/mends/blob/main/5_Suppression/4_1_Create_report.sas): `5_Suppression/4_1_Create_report.sas`

### Other components

- **MENDS analyst**

## Connections

- MENDS analyst → EHR preparation: runs workflow
- EHR preparation → Raking macros: prepares weighting
- Population totals → National weighting: calibrates to
- Population totals → State weighting: calibrates to
- Geographic crosswalks → National weighting: supports geography
- Geographic crosswalks → State weighting: supports geography
- Raking macros → National weighting: used by
- Raking macros → State weighting: used by
- National weighting → Estimate exclusions: feeds estimates
- State weighting → Estimate exclusions: feeds estimates
- Estimate exclusions → Indicator estimates: filters records
- Indicator estimates → Direct estimates: supports small areas
- Indicator estimates → Small-area models: supports modeling
- Direct estimates → Suppression export: prepared for export
- Small-area models → Suppression export: prepared for export
- Suppression export → Report creation: creates report
