Promenjene vrednosti weight + likelihood
This commit is contained in:
@@ -4,56 +4,48 @@ from backend.core.utils import calculate_aggregate_likelihood, calculate_aggrega
|
||||
|
||||
def risk_matrix_table():
|
||||
likelihood_labels = [
|
||||
"Certain (90-100%)",
|
||||
"Almost Certain (80-89%)",
|
||||
"Very Probable (70-79%)",
|
||||
"Probable (60-69%)",
|
||||
"Highly Likely (50-59%)",
|
||||
"Likely (40-49%)",
|
||||
"Occasional (30-39%)",
|
||||
"Possible (20-29%)",
|
||||
"Unlikely (10-19%)",
|
||||
"Rare (0-9%)"
|
||||
"Almost Certain (90-100%) (5)",
|
||||
"Probable (51-89%) (4)",
|
||||
"Possible (25-50%) (3)",
|
||||
"Unlikely (11-24%) (2)",
|
||||
"Rare (0-10%) (1)"
|
||||
]
|
||||
|
||||
impact_labels = [
|
||||
"Insignificant",
|
||||
"Minor",
|
||||
"Moderate",
|
||||
"Major",
|
||||
"Severe",
|
||||
"Catastrophic",
|
||||
"Critical",
|
||||
"Extreme",
|
||||
"Disastrous",
|
||||
"Unrecoverable"
|
||||
"Insignificant (1)",
|
||||
"Significant (2)",
|
||||
"Severe (3)",
|
||||
"Material (4)",
|
||||
"Major (5)"
|
||||
]
|
||||
|
||||
color_mapping = {
|
||||
"Very Low": "green",
|
||||
"Low": "lightgreen",
|
||||
"Very Low": "lightgreen",
|
||||
"Low": "green",
|
||||
"Medium": "yellow",
|
||||
"High": "orange",
|
||||
"Critical": "red"
|
||||
}
|
||||
|
||||
table_matrix_risk = [["Impact ↓ / Likelihood →"] + impact_labels]
|
||||
def get_label(score):
|
||||
if score <= 2:
|
||||
return "Very Low"
|
||||
elif score <= 4:
|
||||
return "Low"
|
||||
elif score <= 10:
|
||||
return "Medium"
|
||||
elif score <= 16:
|
||||
return "High"
|
||||
else:
|
||||
return "Critical"
|
||||
|
||||
for likelihood_index, likelihood_label in enumerate(likelihood_labels, start=1):
|
||||
reversed_index = 11 - likelihood_index
|
||||
row = [likelihood_label]
|
||||
for impact_index in range(1, 11):
|
||||
score = reversed_index * impact_index
|
||||
if score <= 20:
|
||||
label = "Very Low"
|
||||
elif score <= 40:
|
||||
label = "Low"
|
||||
elif score <= 60:
|
||||
label = "Medium"
|
||||
elif score <= 80:
|
||||
label = "High"
|
||||
else:
|
||||
label = "Critical"
|
||||
table_matrix_risk = [["Likelihood ↓ / Impact →"] + impact_labels]
|
||||
|
||||
for likelihood in range(5, 0, -1):
|
||||
row = [likelihood_labels[5 - likelihood]]
|
||||
for impact in range(1, 6):
|
||||
score = likelihood * impact
|
||||
label = get_label(score)
|
||||
color_class = color_mapping[label]
|
||||
row.append((score, label, color_class))
|
||||
table_matrix_risk.append(row)
|
||||
@@ -82,7 +74,7 @@ def get_risk_table(document):
|
||||
.values('control', 'control__name', 'weight', 'likelihood')
|
||||
.distinct()
|
||||
)
|
||||
max_weight = 10*10
|
||||
max_weight = 10*5
|
||||
total_weight = calculate_aggregate_weight(controls)
|
||||
total_likelihood = calculate_aggregate_likelihood(controls)
|
||||
impact, likelihood = map_weight_to_impact_likelihood(total_weight, total_likelihood, max_weight)
|
||||
|
||||
Reference in New Issue
Block a user