You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: HEC.FDA.TestingUtility/README.md
+72-13Lines changed: 72 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# HEC.FDA.TestingUtility
2
2
3
-
A command-line regression testing tool for HEC-FDA studies. It loads FDA study databases, runs computations (stage damage, scenarios, alternatives, and alternative comparisons), and produces a comprehensive CSV report of the results.
3
+
A command-line regression testing tool for HEC-FDA studies. It loads FDA study databases, runs computations (stage damage, scenarios, alternatives, and alternative comparisons), and produces comprehensive CSV reports of the results.
4
4
5
5
## Purpose
6
6
@@ -18,7 +18,17 @@ This utility runs FDA computations outside the GUI so that results can be valida
### 2a. Run directly against a study file (simplest)
22
+
23
+
If you just want to run all computations on a single study, point directly at its `.sqlite` file:
24
+
25
+
```bash
26
+
dotnet run --project HEC.FDA.TestingUtility -- compute -sp "C:/path/to/my/study/MyStudy.sqlite" -o results
27
+
```
28
+
29
+
This auto-discovers and runs all stage damage, scenario, alternative, and alternative comparison elements in the study. Output defaults to the study's directory if `-o` is not specified.
30
+
31
+
### 2b. Run with a configuration file (multiple studies or selective runs)
22
32
23
33
Copy `example-config.json` from this project directory and update `networkSourcePath` to point to your FDA study folder (the folder containing the `.sqlite` or `.db` file):
24
34
@@ -82,11 +92,32 @@ dotnet run --project HEC.FDA.TestingUtility -- compute -c my-test.json -o result
dotnet run --project HEC.FDA.TestingUtility -- compute -sp "C:/Studies/Muncie/Muncie.sqlite" -o results
85
98
```
86
99
87
100
### 4. Check the output
88
101
89
-
After the run completes, look for `results_report.csv` in the output directory. It contains separate sections for scenario EAD, damage by category, performance metrics, alternative EqAD, stage damage summaries, and alternative comparison results.
102
+
After the run completes, the output directory will contain:
103
+
104
+
```
105
+
results/
106
+
results_report.csv # Global summary across all studies
107
+
muncie/
108
+
results_report.csv # Per-study report for Muncie
109
+
StructureDetails/
110
+
My Stage Damage_StructureStageDamageDetails.csv
111
+
My Stage Damage_DamagedElementCountsByStage.csv
112
+
greenbrook/
113
+
results_report.csv # Per-study report for Greenbrook
114
+
StructureDetails/
115
+
...
116
+
```
117
+
118
+
-**`results_report.csv`** (root) - Combined report across all studies with sections for scenario EAD, damage by category, performance metrics, alternative EqAD, stage damage summaries, and alternative comparison results.
119
+
-**`{studyId}/results_report.csv`** - Same report format, but scoped to a single study.
120
+
-**`{studyId}/StructureDetails/`** - Generated for computed (non-manual) stage damage elements. Contains per-structure stage-damage details and damaged element counts by stage.
The utility uses the `System.CommandLine` library and exposes a `compute` subcommand:
119
150
120
151
```bash
121
-
dotnet run --project HEC.FDA.TestingUtility -- compute --config <path-to-config.json>[options]
152
+
dotnet run --project HEC.FDA.TestingUtility -- compute [options]
122
153
```
123
154
155
+
You must provide either `--config` or `--study-path` (but not both).
156
+
124
157
### Options
125
158
126
-
| Option | Alias | Required | Description |
127
-
|---|---|---|---|
128
-
|`--config`|`-c`| Yes | Path to a JSON configuration file defining the studies and computations to run. |
129
-
|`--output`|`-o`| No | Output directory for generated files. Defaults to the current working directory. |
130
-
|`--study`|`-s`| No | Filter to one or more specific study IDs. Can be specified multiple times. |
159
+
| Option | Alias | Description |
160
+
|---|---|---|
161
+
|`--config`|`-c`| Path to a JSON configuration file defining the studies and computations to run. Required unless `--study-path` is used. |
162
+
|`--study-path`|`-sp`| Path to a `.sqlite` study file. Runs all computations (stage damage, scenarios, alternatives, alternative comparisons) automatically. Required unless `--config` is used. |
163
+
|`--output`|`-o`| Output directory for generated files. Defaults to the current working directory (or the study directory when using `--study-path`). |
164
+
|`--study`|`-s`| Filter to one or more specific study IDs. Can be specified multiple times. Only applies when using `--config`. |
131
165
132
166
### Examples
133
167
@@ -143,6 +177,18 @@ Run only a specific study:
143
177
dotnet run --project HEC.FDA.TestingUtility -- compute -c tests/regression.json -s "muncie"
144
178
```
145
179
180
+
Run a single study directly without a config file:
181
+
182
+
```bash
183
+
dotnet run --project HEC.FDA.TestingUtility -- compute -sp "E:/Studies/Muncie/Muncie.sqlite" -o results/
184
+
```
185
+
186
+
Run all case studies from a directory (see `example-directory.json`):
187
+
188
+
```bash
189
+
dotnet run --project HEC.FDA.TestingUtility -- compute -c example-directory.json -o results/
190
+
```
191
+
146
192
## Configuration File
147
193
148
194
The configuration is a JSON file with the following structure:
@@ -152,7 +198,7 @@ The configuration is a JSON file with the following structure:
152
198
"testSuiteId": "regression-v1",
153
199
"globalSettings": {
154
200
"localTempDirectory": "C:/temp/FDATests",
155
-
"timeoutMinutes": 30
201
+
"timeoutMinutes": 120
156
202
},
157
203
"studies": [
158
204
{
@@ -174,7 +220,7 @@ The configuration is a JSON file with the following structure:
174
220
| Field | Default | Description |
175
221
|---|---|---|
176
222
|`localTempDirectory`| System temp + `FDATests`| Directory where studies are copied locally before computation. |
177
-
|`timeoutMinutes`|`30`| Maximum wall-clock time for all computations before cancellation. |
223
+
|`timeoutMinutes`|`120`| Maximum wall-clock time for all computations before cancellation. Set to `0` to disable the timeout. |
Computations are automatically sorted in dependency order: stage damage -> scenario -> alternative -> alternative comparison. This means you can list them in any order and the utility will execute them correctly.
213
259
260
+
## Example Configuration Files
261
+
262
+
| File | Description |
263
+
|---|---|
264
+
|`example-config.json`| Minimal template for a single study with all `runAll*` flags enabled. |
265
+
|`example-directory.json`| Template for running all studies found as subfolders under a common parent directory. |
266
+
|`all_case_studies.json`| Real-world config targeting 9 case studies with all computations. |
267
+
|`sunnyvale_alt_only.json`| Example of a selective run (alternatives only). |
268
+
214
269
## How It Works
215
270
216
271
1.**Study Loading** - The study folder is copied from `networkSourcePath` to a local temp directory to avoid locking network files. The SQLite database is opened and all element types are loaded into the `StudyCache` in dependency order (terrains, impact areas, hydraulics, frequencies, inventories, stage damage, scenarios, alternatives, etc.).
@@ -223,7 +278,7 @@ Computations are automatically sorted in dependency order: stage damage -> scena
223
278
224
279
3.**Result Saving** - Computed results are saved back to the temp study database so that downstream computations (e.g., alternatives depending on scenario results) can access them.
225
280
226
-
4.**CSV Report** - A single `results_report.csv` file is written to the output directory containing sections for:
281
+
4.**CSV Report** - A `results_report.csv` file is written both globally (to the output directory) and per-study (to `{outputDir}/{studyId}/`). Each report contains sections for:
227
282
- Scenario results (mean and percentile EAD by impact area)
@@ -234,7 +289,11 @@ Computations are automatically sorted in dependency order: stage damage -> scena
234
289
- Alternative comparison summary (EqAD reduced, base/future EAD reduced)
235
290
- Alternative comparison by damage category
236
291
237
-
5.**Cleanup** - When a study finishes, the temp copy is deleted automatically.
292
+
5.**Structure Details** - For computed (non-manual) stage damage elements, two additional CSVs are written to `{outputDir}/{studyId}/StructureDetails/`:
0 commit comments