# usepa/ord_water_source_2020 architecture

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

- Interactive diagram: https://gitdiagram.com/usepa/ord_water_source_2020
- Repository: https://github.com/usepa/ord_water_source_2020

## Overview

This repository documents and implements EPA’s 2020 estimates of domestic-well-supplied housing units, producing estimates at census block and block-group levels. The principal workflow is to process state well-log data and spatial classifications, estimate well counts, and publish the resulting dataset. Script names indicate distinct processing stages, but the excerpts do not show their calls or data transfers, so those links are dashed and unevidenced. The README confirms the product and downloadable output. The public application is an external viewing destination; its integration is documented, not implemented here.

Main entry points: [`outputs/Final_Classification.csv`](https://github.com/usepa/ord_water_source_2020/blob/main/outputs/Final_Classification.csv) (Final classifications), [`scripts/State_Well_Log_Cleaning`](https://github.com/usepa/ord_water_source_2020/tree/main/scripts/State_Well_Log_Cleaning) (State log cleaning), [`scripts/01_disagg_and_crosswalk.R`](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/01_disagg_and_crosswalk.R) (Disaggregate and crosswalk), [`scripts/02_Decision_Tree.R`](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/02_Decision_Tree.R) (Decision tree)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Data preparation"]
  node_state_clean["State log cleaning"]
  node_disaggregate["Disaggregate and crosswalk"]
  node_decision["Decision tree<br/>[02_Decision_Tree.R]"]
  node_islands["Island reclassification"]
  node_combine_reclass["Combine reclassification"]
  node_na_reclass["Missing-data reclassification<br/>[04_reclass_NA.R]"]
end

subgraph group_estimate["Estimation"]
  node_join_blocks["Join wells to blocks"]
  node_random_forest["Well percentage model"]
  node_aggregate["Block-group aggregation"]
  node_block_groups["Block-group conversion"]
end

subgraph group_results["Results and analysis"]
  node_final_data["Final classifications"]
  node_block_estimates["Block estimates"]
  node_validation["Estimate validation<br/>[Validation.R]"]
  node_well_compare["Well comparison"]
  node_well_counts["Method 2 well counts<br/>[Well_Counts.R]"]
end

subgraph group_support["Supporting runtime"]
  node_quarto_runtime["Quarto page behavior<br/>[quarto.js]"]
  node_pdf_reader["PDF text extraction<br/>[readPDF.py]"]
end

node_researcher(("Researcher"))
node_public_app["Public well application"]

node_researcher -.->|"runs analysis"| node_state_clean
node_state_clean -.->|"prepares inputs"| node_disaggregate
node_disaggregate -.->|"classifies inputs"| node_decision
node_decision -.->|"reclassifies"| node_islands
node_islands -.->|"combines classes"| node_combine_reclass
node_combine_reclass -.->|"handles missing data"| node_na_reclass
node_na_reclass -.->|"joins counts"| node_join_blocks
node_join_blocks -.->|"estimates percentages"| node_random_forest
node_random_forest -.->|"aggregates estimates"| node_aggregate
node_aggregate -.->|"converts geography"| node_block_groups
node_block_groups -.->|"produces estimates"| node_block_estimates
node_block_estimates -.->|"informs output"| node_final_data
node_final_data -->|"provides dataset"| node_researcher
node_final_data -->|"viewed in"| node_public_app
node_well_counts -.->|"uses page behavior"| node_quarto_runtime

click node_state_clean "https://github.com/usepa/ord_water_source_2020/tree/main/scripts/State_Well_Log_Cleaning"
click node_disaggregate "https://github.com/usepa/ord_water_source_2020/blob/main/scripts/01_disagg_and_crosswalk.R"
click node_decision "https://github.com/usepa/ord_water_source_2020/blob/main/scripts/02_Decision_Tree.R"
click node_islands "https://github.com/usepa/ord_water_source_2020/blob/main/scripts/03_reclass_islands.R"
click node_combine_reclass "https://github.com/usepa/ord_water_source_2020/blob/main/scripts/04_A_combine_reclass.R"
click node_na_reclass "https://github.com/usepa/ord_water_source_2020/blob/main/scripts/04_reclass_NA.R"
click node_join_blocks "https://github.com/usepa/ord_water_source_2020/blob/main/scripts/05_Join_Wells_2_Blocks.R"
click node_random_forest "https://github.com/usepa/ord_water_source_2020/blob/main/scripts/06_Percent_Wells_Random_Forest.R"
click node_aggregate "https://github.com/usepa/ord_water_source_2020/blob/main/scripts/07_aggregate_to_block_groups.R"
click node_block_groups "https://github.com/usepa/ord_water_source_2020/blob/main/scripts/Blocks_2_BlockGroups.R"
click node_final_data "https://github.com/usepa/ord_water_source_2020/blob/main/outputs/Final_Classification.csv"
click node_block_estimates "https://github.com/usepa/ord_water_source_2020/blob/main/outputs/Well_Estimates_2020_Blocks.csv"
click node_validation "https://github.com/usepa/ord_water_source_2020/blob/main/Analysis/Validation.R"
click node_well_compare "https://github.com/usepa/ord_water_source_2020/blob/main/Analysis/Accurate_Well_Compare.R"
click node_well_counts "https://github.com/usepa/ord_water_source_2020/blob/main/Method_2/Well_Counts.R"
click node_quarto_runtime "https://github.com/usepa/ord_water_source_2020/blob/main/Method_2/workflow_files/libs/quarto-html/quarto.js"
click node_pdf_reader "https://github.com/usepa/ord_water_source_2020/blob/main/scripts/State_Well_Log_Cleaning/readPDF.py"

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_state_clean,node_disaggregate,node_decision,node_islands,node_combine_reclass,node_na_reclass toneBlue
class node_join_blocks,node_random_forest,node_aggregate,node_block_groups toneAmber
class node_final_data,node_block_estimates,node_validation,node_well_compare,node_well_counts toneMint
class node_quarto_runtime,node_pdf_reader toneRose
class node_researcher,node_public_app toneIndigo
```

## Components

### Data preparation

- [State log cleaning](https://github.com/usepa/ord_water_source_2020/tree/main/scripts/State_Well_Log_Cleaning): `scripts/State_Well_Log_Cleaning`
- [Disaggregate and crosswalk](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/01_disagg_and_crosswalk.R): `scripts/01_disagg_and_crosswalk.R`
- [Decision tree](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/02_Decision_Tree.R): `scripts/02_Decision_Tree.R`
- [Island reclassification](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/03_reclass_islands.R): `scripts/03_reclass_islands.R`
- [Combine reclassification](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/04_A_combine_reclass.R): `scripts/04_A_combine_reclass.R`
- [Missing-data reclassification](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/04_reclass_NA.R): `scripts/04_reclass_NA.R`

### Estimation

- [Join wells to blocks](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/05_Join_Wells_2_Blocks.R): `scripts/05_Join_Wells_2_Blocks.R`
- [Well percentage model](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/06_Percent_Wells_Random_Forest.R): `scripts/06_Percent_Wells_Random_Forest.R`
- [Block-group aggregation](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/07_aggregate_to_block_groups.R): `scripts/07_aggregate_to_block_groups.R`
- [Block-group conversion](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/Blocks_2_BlockGroups.R): `scripts/Blocks_2_BlockGroups.R`

### Results and analysis

- [Final classifications](https://github.com/usepa/ord_water_source_2020/blob/main/outputs/Final_Classification.csv): `outputs/Final_Classification.csv`
- [Block estimates](https://github.com/usepa/ord_water_source_2020/blob/main/outputs/Well_Estimates_2020_Blocks.csv): `outputs/Well_Estimates_2020_Blocks.csv`
- [Estimate validation](https://github.com/usepa/ord_water_source_2020/blob/main/Analysis/Validation.R): `Analysis/Validation.R`
- [Well comparison](https://github.com/usepa/ord_water_source_2020/blob/main/Analysis/Accurate_Well_Compare.R): `Analysis/Accurate_Well_Compare.R`
- [Method 2 well counts](https://github.com/usepa/ord_water_source_2020/blob/main/Method_2/Well_Counts.R): `Method_2/Well_Counts.R`

### Supporting runtime

- [Quarto page behavior](https://github.com/usepa/ord_water_source_2020/blob/main/Method_2/workflow_files/libs/quarto-html/quarto.js): `Method_2/workflow_files/libs/quarto-html/quarto.js`
- [PDF text extraction](https://github.com/usepa/ord_water_source_2020/blob/main/scripts/State_Well_Log_Cleaning/readPDF.py): `scripts/State_Well_Log_Cleaning/readPDF.py`

### Other components

- **Researcher**
- **Public well application**

## Connections

- Researcher → State log cleaning: runs analysis
- State log cleaning → Disaggregate and crosswalk: prepares inputs
- Disaggregate and crosswalk → Decision tree: classifies inputs
- Decision tree → Island reclassification: reclassifies
- Island reclassification → Combine reclassification: combines classes
- Combine reclassification → Missing-data reclassification: handles missing data
- Missing-data reclassification → Join wells to blocks: joins counts
- Join wells to blocks → Well percentage model: estimates percentages
- Well percentage model → Block-group aggregation: aggregates estimates
- Block-group aggregation → Block-group conversion: converts geography
- Block-group conversion → Block estimates: produces estimates
- Block estimates → Final classifications: informs output
- Final classifications → Researcher: provides dataset (evidence: `readme.md`)
- Final classifications → Public well application: viewed in (evidence: `readme.md`)
- Method 2 well counts → Quarto page behavior: uses page behavior
