ingelise commited on
Commit
d416e0e
·
verified ·
1 Parent(s): 7976155

Update executor file through web ui

Browse files

Update the risk atlas nexus library methods

Files changed (1) hide show
  1. executor.py +5 -5
executor.py CHANGED
@@ -66,12 +66,12 @@ def mitigations(riskid: str, taxonomy: str) -> tuple[gr.Markdown, gr.Dataset, gr
66
  """
67
 
68
  try:
69
- risk_desc = ran.get_risk_by_id(riskid).description # type: ignore
70
  risk_sec = f"<h3>Description: </h3> {risk_desc}"
71
  except AttributeError:
72
  risk_sec = ""
73
 
74
- related_risk_ids = ran.get_related_risk_ids_by_risk_id(riskid)
75
 
76
  action_ids = []
77
 
@@ -79,7 +79,7 @@ def mitigations(riskid: str, taxonomy: str) -> tuple[gr.Markdown, gr.Dataset, gr
79
  # look for actions associated with related risks
80
  if related_risk_ids:
81
  for i in related_risk_ids:
82
- rai = ran.get_risk_actions_by_risk_id(i)
83
  if rai:
84
  action_ids += rai
85
 
@@ -87,7 +87,7 @@ def mitigations(riskid: str, taxonomy: str) -> tuple[gr.Markdown, gr.Dataset, gr
87
  action_ids = []
88
  else:
89
  # Use only actions related to primary risks
90
- action_ids = ran.get_risk_actions_by_risk_id(riskid)
91
 
92
  # Sanitize outputs
93
  if not related_risk_ids:
@@ -97,7 +97,7 @@ def mitigations(riskid: str, taxonomy: str) -> tuple[gr.Markdown, gr.Dataset, gr
97
  else:
98
  label = f"Risks from other taxonomies related to {riskid}"
99
  samples = related_risk_ids
100
- sample_labels = [i.name for i in ran.get_related_risks_by_risk_id(riskid)] #type: ignore
101
 
102
  if not action_ids:
103
  alabel = "No mitigations found."
 
66
  """
67
 
68
  try:
69
+ risk_desc = ran.get_risk(id=riskid).description # type: ignore
70
  risk_sec = f"<h3>Description: </h3> {risk_desc}"
71
  except AttributeError:
72
  risk_sec = ""
73
 
74
+ related_risk_ids = [r.id for r in ran.get_related_risks(id=riskid)]
75
 
76
  action_ids = []
77
 
 
79
  # look for actions associated with related risks
80
  if related_risk_ids:
81
  for i in related_risk_ids:
82
+ rai = ran.get_related_actions(id=i)
83
  if rai:
84
  action_ids += rai
85
 
 
87
  action_ids = []
88
  else:
89
  # Use only actions related to primary risks
90
+ action_ids = ran.get_related_actions(id=riskid)
91
 
92
  # Sanitize outputs
93
  if not related_risk_ids:
 
97
  else:
98
  label = f"Risks from other taxonomies related to {riskid}"
99
  samples = related_risk_ids
100
+ sample_labels = [i.name for i in ran.get_related_risks(id=riskid)] #type: ignore
101
 
102
  if not action_ids:
103
  alabel = "No mitigations found."