Skip to content

Commit 12b76e9

Browse files
authored
Automate CSV example generation with doctools.py (#929)
2 parents 7501dc0 + 1987f53 commit 12b76e9

30 files changed

+1632
-301
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,4 @@ dmypy.json
131131
ssvc2-applier-wip.xlsx
132132
_version.py
133133
node_modules
134+
tmp

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ down:
5555
regenerate_json:
5656
@echo "Regenerating JSON files..."
5757
rm -rf data/json/decision_points
58-
export PYTHONPATH=$(PWD)/src && ./src/ssvc/doctools.py --jsondir=./data/json --overwrite
58+
export PYTHONPATH=$(PWD)/src && ./src/ssvc/doctools.py --datadir=./data --overwrite
5959

6060
clean:
6161
@echo "Cleaning up Docker resources..."

README.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,22 @@ The data folder contains detailed data files that define suggested prioritizatio
4545

4646
There are both `.csv` and `.json` files in this directory.
4747

48-
### `/data/csvs/*`
48+
### `/data/csv/*`
4949

50-
The `.csv` files are the primary data files used by the `ssvc.py` module.
50+
The `.csv` files are generated from the python `ssvc` module.
5151

52-
Also included in data are the lookup tables as csv files which `ssvc_v2.py` reads in.
53-
These files define one row per possible path through the trees as described in the documentation.
52+
These files define one row per possible path through the decision tables as described in the documentation.
5453
Customizing the "outcome" column in this csv is the primary recommended way that stakeholders might adapt SSVC to their environment.
5554

5655
### `/data/json/*`
5756

58-
These json files are generated examples from the python `ssvc` module.
57+
These json files are generated examples from the python `ssvc` module,
58+
which uses `pydantic` to define the data models.
5959

6060
### `/data/schema/*` and `/data/schema_examples/*`
6161

62+
These json schema files are used to validate the structure of the `.json` files in `/data/json/*`.
63+
They are generated from the python `ssvc` module, which uses `pydantic` to define the data models.
6264
These files are used by the `ssvc-calc` module.
6365

6466
## `/docker/*`
@@ -85,15 +87,6 @@ These modules are used to generate documentation for various [Decision Points](h
8587

8688
Documentation for the `ssvc` module can be found at [https://certcc.github.io/SSVC/reference/code/](https://certcc.github.io/SSVC/reference/code/)
8789

88-
### `src/ssvc_v2.py`
89-
90-
A basic Python module for interacting with the SSVC trees. `ssvc_v2.py` has
91-
two methods: `applier_tree()` and `developer_tree()`
92-
93-
The two methods just loop through their respective lookup tables until
94-
they hit a match, then return the outcome. Maybe not the best implementation,
95-
but it worked well enough for what was needed at the time.
96-
9790
## Local development
9891

9992
The simplest way to get started with local development is to use Docker.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
row,Exploitation v1.1.0,Automatable v2.0.0,Technical Impact v1.0.0,Mission and Well-Being Impact v1.0.0,CISA Levels v1.1.0 (cisa)
2+
0,none,no,partial,low,track
3+
1,none,no,partial,medium,track
4+
2,none,no,partial,high,track
5+
3,none,no,total,low,track
6+
4,none,no,total,medium,track
7+
5,none,no,total,high,track*
8+
6,none,yes,partial,low,track
9+
7,none,yes,partial,medium,track
10+
8,none,yes,partial,high,attend
11+
9,none,yes,total,low,track
12+
10,none,yes,total,medium,track
13+
11,none,yes,total,high,attend
14+
12,public poc,no,partial,low,track
15+
13,public poc,no,partial,medium,track
16+
14,public poc,no,partial,high,track*
17+
15,public poc,no,total,low,track
18+
16,public poc,no,total,medium,track*
19+
17,public poc,no,total,high,attend
20+
18,public poc,yes,partial,low,track
21+
19,public poc,yes,partial,medium,track
22+
20,public poc,yes,partial,high,attend
23+
21,public poc,yes,total,low,track
24+
22,public poc,yes,total,medium,track*
25+
23,public poc,yes,total,high,attend
26+
24,active,no,partial,low,track
27+
25,active,no,partial,medium,track
28+
26,active,no,partial,high,attend
29+
27,active,no,total,low,track
30+
28,active,no,total,medium,attend
31+
29,active,no,total,high,act
32+
30,active,yes,partial,low,attend
33+
31,active,yes,partial,medium,attend
34+
32,active,yes,partial,high,act
35+
33,active,yes,total,low,attend
36+
34,active,yes,total,medium,act
37+
35,active,yes,total,high,act

0 commit comments

Comments
 (0)