Skip to content
This repository was archived by the owner on Jun 24, 2026. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion notebooks/utils/dataframe_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import re
import pandas as pd

from utils.api_helpers import get_applications, get_frameworks, get_vendors, get_application_by_id, get_controls
from utils.fairnow import get_client

Expand Down Expand Up @@ -351,12 +353,16 @@ def create_risks_df(client_id):
app_id = app['id']
risk_items = app.get('assigned_risk_items', []) or []
for risk_item in risk_items:
description = risk_item.get('description', '')
# Replace all newlines/tabs with a space and clean quotes
description = re.sub(r'[\r\n\t]+', ' ', description).strip()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we should be transforming the data. If this is being exported into CVS/TSV then the tabs/newlines should be escaped as part of the serialization. If the consumer of the CSV/TSV cannot handle properly escaped data - that is something they should fix.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point. Using my DE brain too much. I will reach out to them

description = description.replace('"', "'")
risk_data.append({
'application_id': app_id,
'risk_type': risk_item.get('risk_type', ''),
'severity': risk_item.get('severity', ''),
'probability': risk_item.get('probability', ''),
'description': risk_item.get('description', '')
'description': description
})

# Convert risk data to DataFrame
Expand Down
Loading