Skip to content

Commit

Permalink
fix up datamap generation
Browse files Browse the repository at this point in the history
bugs were found with systems with no privacy declarations and when having custom fields on more than one system
  • Loading branch information
adamsachs committed Mar 10, 2023
1 parent 03e830b commit 6127411
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/fides/core/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,10 @@ def generate_system_records( # pylint: disable=too-many-nested-blocks, too-many
if key not in known_fields:
keys = list(output_list[0])
key_string = f"system.{key}"
keys.append(key_string)
output_list[0] = tuple(keys)
custom_columns[key_string] = key
if key_string not in keys:
keys.append(key_string)
output_list[0] = tuple(keys)
custom_columns[key_string] = key
if isinstance(value, list):
system_custom_field_data[key_string] = ", ".join(value)
else:
Expand Down Expand Up @@ -339,23 +340,20 @@ def generate_system_records( # pylint: disable=too-many-nested-blocks, too-many
system_ingress,
system_egress,
]
if system_custom_field_data:
for _, v in system_custom_field_data.items():
system_row.append(v)
len_no_privacy = len(system_row)
num_privacy_declaration_fields = 12
for i in range(num_privacy_declaration_fields):
system_row.insert(len_no_privacy + i, EMPTY_COLUMN_PLACEHOLDER)

system_row.append(data_protection_impact_assessment["is_required"])
system_row.append(data_protection_impact_assessment["progress"])
system_row.append(data_protection_impact_assessment["link"])
num_privacy_declaration_fields = 3
privacy_declaration_start_index = (
len_no_privacy - num_privacy_declaration_fields
)
for i in range(num_privacy_declaration_fields):
system_row.insert(
i + privacy_declaration_start_index, EMPTY_COLUMN_PLACEHOLDER
)
system_row.append(EMPTY_COLUMN_PLACEHOLDER)

if system_custom_field_data:
for _, v in system_custom_field_data.items():
system_row.append(v)

# also add n/a for the dataset reference
output_list += [tuple(system_row)]

Expand Down

0 comments on commit 6127411

Please sign in to comment.