-
Notifications
You must be signed in to change notification settings - Fork 8
/
changeImpactAnalysisSettings.vm
188 lines (174 loc) · 8.16 KB
/
changeImpactAnalysisSettings.vm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<h2>Change Impact Analysis (CIA) Settings</h2>
#set($ciaConfig = $project.getChangeImpactAnalysisConfiguration())
<p>On this page, the rationale manager can configure the default rules for change impact analysis.
During change impact analysis, each knowledge element (node/vertex) in the knowledge graph is given an impact value. If
links are being recommended, these elements are also included in the used knowledge graph.
High impact values indicate that the element is highly affected by the change and needs to be changed as well.
The impact value of an element (<var>elementImpact</var>) is calculated using the following equation:</p>
<p><b><code>elementImpact = (1 - decayValue) * linkTypeWeight * ruleBasedValue * recommendationScore</code></b>, </p>
<p>where <var>decayValue</var> is the decay per iteration step,</p>
<p><var>linkTypeWeight</var> is a link type specific decay value between 0 and 1 of the traversed edge between the
parent/ancestor element and the current element, and</p>
<p><var>ruleBasedValue</var> is the normalized sum of all enabled rules:
<p><b><code>ruleBasedValue = (∑<sup>N</sup>(ruleValue<sub>i</sub> * ruleWeight<sub>i</sub> -〚ruleWeight<sub>i</sub> < 0〛ruleWeight<sub>i</sub>)) / ∑<sup>N</sup>ruleWeight<sub>i</sub></code></b></p>
<p>, where <var>N</var> is the number of enabled rules and <b><code>-〚ruleWeight<sub>i</sub> < 0〛ruleWeight<sub>i</sub></code></b> denotes that the subtraction is only done for negative rule weights to reverse the effect.</p>
<p>In addition, <var>recommendationScore</var> is the link recommendation score of the current element, if the element was recommended.</p>
<p>The element is included in the impact graph if <b><code>elementImpact >= threshold</code></b>.</p>
<h3>Decay Value and Threshold</h3>
<div class="field-group">
<label for="cia-decay-value">Decay Value</label>
<input class="text short-field"
type="number"
data-aui-validation-field
value="$ciaConfig.getDecayValue()"
step="0.01"
min="0"
max="1"
id="cia-decay-value"
name="cia-decay-value"/>
<div class="description">
Set the decay per iteration step.
When the decay value is set to 1, no decay happens and the CIA strongly depends on the <var>linkTypeWeight</var>s.
</div>
</div>
<div class="field-group">
<label for="cia-threshold">Threshold</label>
<input class="text short-field"
type="number"
data-aui-validation-field
value="$ciaConfig.getThreshold()"
step="0.01"
min="0"
max="1"
id="cia-threshold"
name="cia-threshold"/>
<div class="description">
Set minimum <var>elementImpact</var> at which the propagation is stopped.
The element is included in the impact graph if <code>elementImpact >= threshold</code>.
</div>
</div>
<h3>Ruleset Parameters</h3>
<p>Select the default ruleset and weights for individual rules.</p>
<table class="aui aui-table-list aui-table-sortable">
<thead>
<tr>
<th>Rule Name</th>
<th>Enabled by Default?</th>
<th>
Weight
<a data-aui-trigger aria-controls='Weight-help'>
<span class='aui-icon aui-icon-small aui-iconfont-question-circle'></span>
</a>
<aui-inline-dialog id='Weight-help' responds-to='hover'>
<p>Value designating the importance of a rule. A higher value indicates a rule being more important than usual
and increases the impact of that rule accordingly, e.g. a value of 1.2 indicates a rule is 20% more important.
The calculation is as follows:</p>
<p>ruleBasedValue = result of rule calculation * weightValue</p>
<p>Rules can also receive negative weights that reverse the effect of the rule, e.g. for BoostWhenTimelyCoupled:
Elements that are not timely coupled are assigned a higher score.</p>
</aui-inline-dialog>
</th>
</tr>
</thead>
<tbody>
<script>
var changePropagationRuleNames = [];
</script>
#foreach($propagationRule in $ciaConfig.getPropagationRules())
#if($propagationRule.doesRuleExist())
<script>
changePropagationRuleNames.push("$propagationRule.getType().name()");
</script>
<tr>
<td>
$propagationRule.getDescription()
<a data-aui-trigger aria-controls='$propagationRule.getType().name()-help'>
<span class='aui-icon aui-icon-small aui-iconfont-question-circle'></span>
</a>
<aui-inline-dialog id='$propagationRule.getType().name()-help' responds-to='hover'>
$propagationRule.getType().getExplanation()
</aui-inline-dialog>
</td>
<td>
<aui-toggle id="$propagationRule.getType().name()-toggle" label=""
#if ($propagationRule.isActive())
checked
#end
></aui-toggle>
</td>
<td>
#if ($propagationRule.getDescription().contains("Boost"))
<input class="text short-field"
type="number"
data-aui-validation-field
value="$propagationRule.getWeightValue()"
step="0.1"
min="-2.0"
max="2.0"
id="$propagationRule.getType().name()-weight"/>
#end
</td>
</tr>
#end
#end
</tbody>
</table>
<h3>Link Type Weights</h3>
<p id="cia-link-type-settings">
Set the link type specific decay value between 0 and 1 of the traversed edge between the parent/ancestor element and the current element.
When the <var>linkTypeWeight</var> is set to 1, CIA strongly depends on the <var>decayValue</var>.
</p>
<input type="button" id='save-cia-settings-btn' class="aui-button aui-button-primary"
value="Save Change Impact Analysis Configuration"/>
<script>
var linkTypes = conDecAPI.getAllLinkTypes().sort();
linkTypes.push("wrongly linked to");
let html = "";
html += "";
for (i in linkTypes) {
var toggleName = linkTypes[i];
html += "<div class='field-group'>";
// Reference Decay Value
html += "<label for=" + toggleName + ">" + linkTypes[i] + "</label>";
html += "<input class='text short-field' type='number' step='0.01' min='0' max='1'"
+ "value='1' id='" + toggleName + "'"
+ "name='" + toggleName + "' />"
html += "<div class='description'>Describes the impact/weight of the " + linkTypes[i] + " link type for this project.</div>";
html += "</div>";
}
document.getElementById("cia-link-type-settings").insertAdjacentHTML('afterend', html);
$("#save-cia-settings-btn").click((event) => {
var linkTypes = conDecAPI.getAllLinkTypes().sort();
linkTypes.push("wrongly linked to");
var linkImpact = {};
for (i in linkTypes) {
linkImpact[linkTypes[i]] = document.getElementById(linkTypes[i]).value;
}
var changePropagationRuleset = [];
for (var ruleName of changePropagationRuleNames) {
var weight = 0;
var weightInput = document.getElementById(ruleName + "-weight");
if (weightInput) {
weight = weightInput.value;
}
changePropagationRuleset.push({
"name": ruleName,
"isActive": document.getElementById(ruleName + "-toggle").checked,
"weightValue": weight
});
}
let ciaConfig = {
"decayValue": $("#cia-decay-value")[0].value,
"threshold": $("#cia-threshold")[0].value,
"linkImpact": linkImpact,
"propagationRules": changePropagationRuleset
}
conDecChangeImpactAnalysisAPI.setChangeImpactAnalysisConfiguration("$projectKey", ciaConfig);
});
</script>
#set($linkImpacts = $ciaConfig.getLinkImpact())
#foreach($key in ${linkImpacts.keySet()})
<script>
document.getElementById("$key").value = $linkImpacts.get($key);
</script>
#end