Skip to content

Commit 38e1ec4

Browse files
More experiments with diagrams
1 parent f2a6a36 commit 38e1ec4

File tree

4 files changed

+56
-27
lines changed

4 files changed

+56
-27
lines changed

app/tests/example_tests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
from ..preview import preview_function
66

77
def create_diagram_for_documentation(filename, result):
8-
for (index, graph) in result["criteria_graphs_vis"].values():
9-
with open(filename+"_"+str(index)+"_"+".mmd", "w") as f:
8+
for (index, graph) in enumerate(result["criteria_graphs_vis"].values()):
9+
with open(filename+"_"+str(index)+".html", "w") as f:
1010
#f.write(r'<!DOCTYPE html><html lang="en"><body><style>.mermaid {display: inline-flex;}</style>'+'\n')
11+
f.write("```mermaid")
1112
for g in result["criteria_graphs_vis"].values():
1213
print(g)
1314
f.write('<pre class="mermaid">\n'+g+'\n</pre>\n')
1415
#f.write('<script type="module"> import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";</script></body></html>')
16+
f.write("```")
1517

1618
class TestEvaluationFunction():
1719
"""
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
<!DOCTYPE html><html lang="en"><body><style>.mermaid {display: inline-flex;}</style>
2-
<pre class="mermaid">
1+
```mermaid<pre class="mermaid">
32
flowchart TD
43
N_0_0(["2+answer > response<br/>---<br/>Checks if 2+answer > response is true."])
54
N_1_0["2+answer > response_TRUE<br/>---<br/>2+answer > response is true."]
65
N_1_1["2+answer > response_FALSE<br/>---<br/>2+answer > response is false."]
76
N_1_2["2+answer > response_UNKNOWN<br/>---<br/>2+answer > response is false."]
87
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
9-
N_0_0 --> N_1_1
8+
N_1_1 --> N_2_0
109
N_1_0 --> N_2_0
1110
N_0_0 --> N_1_2
12-
N_1_1 --> N_2_0
13-
N_1_2 --> N_2_0
1411
N_0_0 --> N_1_0
12+
N_0_0 --> N_1_1
13+
N_1_2 --> N_2_0
1514
</pre>
1615
<pre class="mermaid">
1716
flowchart TD
@@ -20,11 +19,11 @@
2019
N_1_1["answer <= response_FALSE<br/>---<br/>answer <= response is false."]
2120
N_1_2["answer <= response_UNKNOWN<br/>---<br/>answer <= response is false."]
2221
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
23-
N_0_0 --> N_1_1
22+
N_1_1 --> N_2_0
2423
N_1_0 --> N_2_0
2524
N_0_0 --> N_1_2
26-
N_1_1 --> N_2_0
27-
N_1_2 --> N_2_0
2825
N_0_0 --> N_1_0
26+
N_0_0 --> N_1_1
27+
N_1_2 --> N_2_0
2928
</pre>
30-
<script type="module"> import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";</script></body></html>
29+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
```mermaid<pre class="mermaid">
2+
flowchart TD
3+
N_0_0(["2+answer > response<br/>---<br/>Checks if 2+answer > response is true."])
4+
N_1_0["2+answer > response_TRUE<br/>---<br/>2+answer > response is true."]
5+
N_1_1["2+answer > response_FALSE<br/>---<br/>2+answer > response is false."]
6+
N_1_2["2+answer > response_UNKNOWN<br/>---<br/>2+answer > response is false."]
7+
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
8+
N_1_1 --> N_2_0
9+
N_1_0 --> N_2_0
10+
N_0_0 --> N_1_2
11+
N_0_0 --> N_1_0
12+
N_0_0 --> N_1_1
13+
N_1_2 --> N_2_0
14+
</pre>
15+
<pre class="mermaid">
16+
flowchart TD
17+
N_0_0(["answer <= response<br/>---<br/>Checks if answer <= response is true."])
18+
N_1_0["answer <= response_TRUE<br/>---<br/>answer <= response is true."]
19+
N_1_1["answer <= response_FALSE<br/>---<br/>answer <= response is false."]
20+
N_1_2["answer <= response_UNKNOWN<br/>---<br/>answer <= response is false."]
21+
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
22+
N_1_1 --> N_2_0
23+
N_1_0 --> N_2_0
24+
N_0_0 --> N_1_2
25+
N_0_0 --> N_1_0
26+
N_0_0 --> N_1_1
27+
N_1_2 --> N_2_0
28+
</pre>
29+
```
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<!DOCTYPE html><html lang="en"><body><style>.mermaid {display: inline-flex;}</style>
2-
<pre class="mermaid">
1+
```mermaid<pre class="mermaid">
32
flowchart TD
43
N_0_0(["response matches answer<br/>---<br/>Converts QUANTITY: response tags: {} and QUANTITY: answer tags: {} match to a common set of base units and compares their values."])
54
N_0_1(["response matches answer_DIMENSION_MATCH<br/>---<br/>Do the dimensions of QUANTITY: response tags: {} and QUANTITY: answer tags: {} match?"])
@@ -17,27 +16,27 @@
1716
N_1_10["response matches answer_UNIT_COMPARISON_PREFIX_IS_LARGE<br/>---<br/>The units of QUANTITY: response tags: {} are at least 1000 times greater than the units of QUANTITY: answer tags: {}."]
1817
N_1_11["response matches answer_UNIT_COMPARISON_PREFIX_IS_SMALL<br/>---<br/>The units of QUANTITY: response tags: {} are at least 1000 times smaller than the units of QUANTITY: answer tags: {}."]
1918
N_2_0{{"END<br/>---<br/>Evaluation completed."}}
19+
N_0_0 --> N_1_5
20+
N_1_4 --> N_2_0
21+
N_0_2 --> N_1_11
2022
N_0_0 --> N_1_1
2123
N_1_2 --> N_2_0
2224
N_0_0 --> N_1_3
23-
N_0_0 --> N_1_4
24-
N_0_0 --> N_1_5
25-
N_1_7 --> N_2_0
26-
N_1_0 --> N_0_2
27-
N_1_1 --> N_0_1
2825
N_1_10 --> N_2_0
29-
N_0_2 --> N_1_11
30-
N_0_1 --> N_1_6
26+
N_1_7 --> N_2_0
27+
N_0_2 --> N_1_9
28+
N_0_0 --> N_1_4
3129
N_1_5 --> N_2_0
32-
N_1_3 --> N_2_0
30+
N_0_1 --> N_1_6
31+
N_1_1 --> N_0_1
3332
N_0_2 --> N_1_8
33+
N_1_11 --> N_2_0
34+
N_0_2 --> N_1_10
3435
N_0_0 --> N_1_2
36+
N_0_0 --> N_1_0
3537
N_0_1 --> N_1_7
36-
N_1_4 --> N_2_0
38+
N_1_0 --> N_0_2
39+
N_1_3 --> N_2_0
3740
N_1_6 --> N_2_0
38-
N_0_0 --> N_1_0
39-
N_0_2 --> N_1_9
40-
N_1_11 --> N_2_0
41-
N_0_2 --> N_1_10
4241
</pre>
43-
<script type="module"> import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";</script></body></html>
42+
```

0 commit comments

Comments
 (0)