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
| class RiskTreatmentPlan:
def __init__(self):
self.treatment_plans = {}
self.implementation_timeline = {}
self.responsibilities = {}
self.budget_allocations = {}
def create_treatment_plan(self, plan_id, risk_id, treatment_strategy, details):
"""Crear plan de tratamiento"""
self.treatment_plans[plan_id] = {
'plan_id': plan_id,
'risk_id': risk_id,
'strategy': treatment_strategy,
'details': details,
'status': 'Draft',
'created_date': '2025-10-26',
'target_completion': None,
'actual_completion': None,
'budget_required': 0,
'budget_allocated': 0
}
def set_implementation_timeline(self, plan_id, start_date, end_date, milestones):
"""Establecer cronograma de implementación"""
self.implementation_timeline[plan_id] = {
'start_date': start_date,
'end_date': end_date,
'milestones': milestones,
'status': 'Scheduled'
}
def assign_responsibility(self, plan_id, responsible_party, role):
"""Asignar responsabilidad"""
self.responsibilities[plan_id] = {
'responsible_party': responsible_party,
'role': role,
'assigned_date': '2025-10-26'
}
def allocate_budget(self, plan_id, budget_amount, budget_source):
"""Asignar presupuesto"""
self.budget_allocations[plan_id] = {
'amount': budget_amount,
'source': budget_source,
'allocated_date': '2025-10-26',
'status': 'Allocated'
}
# Actualizar plan
if plan_id in self.treatment_plans:
self.treatment_plans[plan_id]['budget_allocated'] = budget_amount
def get_plan_summary(self, plan_id):
"""Obtener resumen del plan"""
if plan_id not in self.treatment_plans:
return None
plan = self.treatment_plans[plan_id]
timeline = self.implementation_timeline.get(plan_id, {})
responsibility = self.responsibilities.get(plan_id, {})
budget = self.budget_allocations.get(plan_id, {})
return {
'plan_id': plan_id,
'risk_id': plan['risk_id'],
'strategy': plan['strategy'],
'status': plan['status'],
'timeline': timeline,
'responsible': responsibility,
'budget': budget
}
def get_plans_by_strategy(self, strategy):
"""Obtener planes por estrategia"""
return [plan_id for plan_id, plan in self.treatment_plans.items()
if plan['strategy'] == strategy]
# Ejemplo de uso
treatment_plan = RiskTreatmentPlan()
# Crear plan de mitigación
treatment_plan.create_treatment_plan('PLAN-001', 'RISK-001', 'Mitigate', {
'description': 'Implementar firewall avanzado',
'controls': ['CTRL-001', 'CTRL-002'],
'expected_effectiveness': 0.8
})
# Establecer cronograma
treatment_plan.set_implementation_timeline('PLAN-001', '2025-11-01', '2025-12-31', [
{'milestone': 'Procurement', 'date': '2025-11-15'},
{'milestone': 'Installation', 'date': '2025-12-01'},
{'milestone': 'Testing', 'date': '2025-12-15'},
{'milestone': 'Go-live', 'date': '2025-12-31'}
])
# Asignar responsabilidad
treatment_plan.assign_responsibility('PLAN-001', 'IT Manager', 'Implementation Lead')
# Asignar presupuesto
treatment_plan.allocate_budget('PLAN-001', 150000, 'Security Budget')
# Obtener resumen
summary = treatment_plan.get_plan_summary('PLAN-001')
print(f"Resumen del plan: {summary}")
|