Skip to content

Commit a075f58

Browse files
Create incident.js
Automatically detect the root cause category of an Incident based on keywords in the short description or description.
1 parent 07aac64 commit a075f58

File tree

1 file changed

+22
-0
lines changed
  • Server-Side Components/Script Includes/Root-Cause Predictor

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//Scenario : Automatically detect the root cause category of an Incident based on keywords in the short description or description.
2+
3+
// Script Include
4+
var RootCausePredictor = Class.create();
5+
RootCausePredictor.prototype = {
6+
predict: function(text) {
7+
var data = {
8+
network: ['router', 'switch', 'wifi', 'dns'],
9+
hardware: ['laptop', 'keyboard', 'printer', 'battery'],
10+
application: ['login', 'error', 'bug', 'page'],
11+
security: ['virus', 'attack', 'unauthorized']
12+
};
13+
text = text.toLowerCase();
14+
for (var cat in data) {
15+
for (var i = 0; i < data[cat].length; i++) {
16+
if (text.includes(data[cat][i])) return cat;
17+
}
18+
}
19+
return 'general';
20+
},
21+
type: 'RootCausePredictor'
22+
};

0 commit comments

Comments
 (0)