# ericksontest/rainfall_api_official architecture

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

- Interactive diagram: https://gitdiagram.com/ericksontest/rainfall_api_official
- Repository: https://github.com/ericksontest/rainfall_api_official
- Video tour (about a minute): https://gitdiagram.com/ericksontest/rainfall_api_official/video

## Overview

Rainfall API is an acceptance-test suite for the Environment Agency rainfall service, not the service implementation itself. Its main workflow expresses a consumer request as a typed query, routes it through scenario bindings and a driver, and uses either a deterministic in-memory client or the live HTTP client to produce a typed response for assertions. The feature tree preserves coverage of reading selection, data quality, and live compatibility. The README documents the overall design; links for unsampled feature bindings and data selection are limited to that documentation.

Main entry points: [`Rainfall API/Hooks/DependencyRegistration.cs`](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Hooks/DependencyRegistration.cs) (Scenario registration), [`Rainfall API/StepDefinitions/ReadingQuerySteps.cs`](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/StepDefinitions/ReadingQuerySteps.cs) (Reading query steps), [`Rainfall API/Clients/RainfallApiClient.cs`](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Clients/RainfallApiClient.cs) (HTTP client), [`Rainfall API/Context/RainfallScenarioContext.cs`](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Context/RainfallScenarioContext.cs) (Scenario state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_specifications["Business specifications"]
  node_reading_features["Reading scenarios"]
  node_quality_features["Data quality"]
  node_live_features["Live compatibility"]
end

subgraph group_workflow["Scenario workflow"]
  node_query_steps["Reading query steps"]
  node_assertion_steps["Reading assertions"]
  node_station_steps["Station setup<br/>[StationSteps.cs]"]
  node_scenario_context["Scenario state"]
  node_registration["Scenario registration"]
  node_driver["Rainfall driver<br/>[RainfallDriver.cs]"]
end

subgraph group_domain["Rainfall domain"]
  node_domain_types["Queries and readings"]
  node_clock["Scenario clock<br/>[SystemClock.cs]"]
end

subgraph group_clients["Service boundaries"]
  node_api_contract["Client contract"]
  node_http_client["HTTP client"]
  node_api_options["Service options"]
  node_memory_client["In-memory client"]
end

node_consumer(("Scenario consumer"))
node_environment_service{{"Environment Agency API"}}

node_consumer -->|"executes scenarios"| node_reading_features
node_consumer -->|"executes scenarios"| node_quality_features
node_consumer -->|"opts into"| node_live_features
node_reading_features -.->|"binds workflows"| node_query_steps
node_quality_features -.->|"checks semantics"| node_assertion_steps
node_live_features -.->|"binds workflows"| node_query_steps
node_query_steps -->|"stores query"| node_scenario_context
node_query_steps -->|"requests readings"| node_driver
node_driver -->|"delegates request"| node_api_contract
node_assertion_steps -->|"reads response"| node_scenario_context
node_station_steps -->|"sets station"| node_scenario_context
node_query_steps -->|"builds query"| node_domain_types
node_api_contract -->|"uses request types"| node_domain_types
node_registration -->|"registers state"| node_scenario_context
node_registration -->|"registers driver"| node_driver
node_registration -->|"selects live client"| node_http_client
node_registration -->|"selects test client"| node_memory_client
node_http_client -->|"configures base address"| node_api_options
node_http_client -->|"requests readings"| node_environment_service
node_http_client -->|"maps JSON response"| node_domain_types
node_registration -->|"registers clock"| node_clock

click node_reading_features "https://github.com/ericksontest/rainfall_api_official/tree/master/Rainfall%20API/Features/Readings"
click node_quality_features "https://github.com/ericksontest/rainfall_api_official/tree/master/Rainfall%20API/Features/DataQuality"
click node_live_features "https://github.com/ericksontest/rainfall_api_official/tree/master/Rainfall%20API/Features/Live"
click node_query_steps "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/StepDefinitions/ReadingQuerySteps.cs"
click node_assertion_steps "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/StepDefinitions/ReadingAssertionSteps.cs"
click node_station_steps "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/StepDefinitions/StationSteps.cs"
click node_scenario_context "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Context/RainfallScenarioContext.cs"
click node_registration "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Hooks/DependencyRegistration.cs"
click node_driver "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Drivers/RainfallDriver.cs"
click node_domain_types "https://github.com/ericksontest/rainfall_api_official/tree/master/Rainfall%20API/Domain"
click node_clock "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Support/SystemClock.cs"
click node_api_contract "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Clients/IRainfallApiClient.cs"
click node_http_client "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Clients/RainfallApiClient.cs"
click node_api_options "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Configuration/RainfallApiOptions.cs"
click node_memory_client "https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Support/TestData/InMemoryRainfallApiClient.cs"

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_reading_features,node_quality_features,node_live_features toneBlue
class node_query_steps,node_assertion_steps,node_station_steps,node_scenario_context,node_registration,node_driver toneAmber
class node_domain_types,node_clock,node_environment_service toneMint
class node_api_contract,node_http_client,node_api_options,node_memory_client toneRose
class node_consumer toneIndigo
```

## Components

### Business specifications

- [Reading scenarios](https://github.com/ericksontest/rainfall_api_official/tree/master/Rainfall%20API/Features/Readings): `Rainfall API/Features/Readings`
- [Data quality](https://github.com/ericksontest/rainfall_api_official/tree/master/Rainfall%20API/Features/DataQuality): `Rainfall API/Features/DataQuality`
- [Live compatibility](https://github.com/ericksontest/rainfall_api_official/tree/master/Rainfall%20API/Features/Live): `Rainfall API/Features/Live`

### Scenario workflow

- [Reading query steps](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/StepDefinitions/ReadingQuerySteps.cs): `Rainfall API/StepDefinitions/ReadingQuerySteps.cs`
- [Reading assertions](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/StepDefinitions/ReadingAssertionSteps.cs): `Rainfall API/StepDefinitions/ReadingAssertionSteps.cs`
- [Station setup](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/StepDefinitions/StationSteps.cs): `Rainfall API/StepDefinitions/StationSteps.cs`
- [Scenario state](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Context/RainfallScenarioContext.cs): `Rainfall API/Context/RainfallScenarioContext.cs`
- [Scenario registration](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Hooks/DependencyRegistration.cs): `Rainfall API/Hooks/DependencyRegistration.cs`
- [Rainfall driver](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Drivers/RainfallDriver.cs): `Rainfall API/Drivers/RainfallDriver.cs`

### Rainfall domain

- [Queries and readings](https://github.com/ericksontest/rainfall_api_official/tree/master/Rainfall%20API/Domain): `Rainfall API/Domain`
- [Scenario clock](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Support/SystemClock.cs): `Rainfall API/Support/SystemClock.cs`

### Service boundaries

- [Client contract](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Clients/IRainfallApiClient.cs): `Rainfall API/Clients/IRainfallApiClient.cs`
- [HTTP client](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Clients/RainfallApiClient.cs): `Rainfall API/Clients/RainfallApiClient.cs`
- [Service options](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Configuration/RainfallApiOptions.cs): `Rainfall API/Configuration/RainfallApiOptions.cs`
- [In-memory client](https://github.com/ericksontest/rainfall_api_official/blob/master/Rainfall%20API/Support/TestData/InMemoryRainfallApiClient.cs): `Rainfall API/Support/TestData/InMemoryRainfallApiClient.cs`

### Other components

- **Scenario consumer**
- **Environment Agency API**

## Connections

- Scenario consumer → Reading scenarios: executes scenarios (evidence: `README.md`)
- Scenario consumer → Data quality: executes scenarios (evidence: `README.md`)
- Scenario consumer → Live compatibility: opts into (evidence: `README.md`)
- Reading scenarios → Reading query steps: binds workflows
- Data quality → Reading assertions: checks semantics
- Live compatibility → Reading query steps: binds workflows
- Reading query steps → Scenario state: stores query (evidence: `Rainfall API/StepDefinitions/ReadingQuerySteps.cs`)
- Reading query steps → Rainfall driver: requests readings (evidence: `Rainfall API/StepDefinitions/ReadingQuerySteps.cs`)
- Rainfall driver → Client contract: delegates request (evidence: `Rainfall API/Drivers/RainfallDriver.cs`)
- Reading assertions → Scenario state: reads response (evidence: `Rainfall API/StepDefinitions/ReadingAssertionSteps.cs`)
- Station setup → Scenario state: sets station (evidence: `Rainfall API/StepDefinitions/StationSteps.cs`)
- Reading query steps → Queries and readings: builds query (evidence: `Rainfall API/StepDefinitions/ReadingQuerySteps.cs`)
- Client contract → Queries and readings: uses request types (evidence: `Rainfall API/Clients/IRainfallApiClient.cs`)
- Scenario registration → Scenario state: registers state (evidence: `Rainfall API/Hooks/DependencyRegistration.cs`)
- Scenario registration → Rainfall driver: registers driver (evidence: `Rainfall API/Hooks/DependencyRegistration.cs`)
- Scenario registration → HTTP client: selects live client (evidence: `Rainfall API/Hooks/DependencyRegistration.cs`)
- Scenario registration → In-memory client: selects test client (evidence: `Rainfall API/Hooks/DependencyRegistration.cs`)
- HTTP client → Service options: configures base address (evidence: `Rainfall API/Clients/RainfallApiClient.cs`)
- HTTP client → Environment Agency API: requests readings (evidence: `Rainfall API/Clients/RainfallApiClient.cs`)
- HTTP client → Queries and readings: maps JSON response (evidence: `Rainfall API/Clients/RainfallApiClient.cs`)
- Scenario registration → Scenario clock: registers clock (evidence: `Rainfall API/Hooks/DependencyRegistration.cs`)
