Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Change "CI Type" key check to "CI Systems" to match the data dictionary.
Browse files Browse the repository at this point in the history
Rearrange key checks to be alphabetical for easier reading.
  • Loading branch information
mcdonnnj committed Feb 28, 2020
1 parent c9c93be commit a30839e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/ade/assessment_data_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def convert_xml_to_json(xml_filename, output_filename):

# Iterate through XML data and build JSON data
for assessment in assessment_data:
assessment_json = {"Requested Services": [], "Operators": [], "CI Type": []}
assessment_json = {"Requested Services": [], "Operators": []}

# Grab data from key required fields
for field in ("summary", "created", "updated", "status"):
Expand All @@ -184,6 +184,9 @@ def convert_xml_to_json(xml_filename, output_filename):
# Make the Assessment ID our primary id
if key == "Asmt ID":
assessment_json["id"] = custom_field_values.get("$")
# Build the list of CI Systems
elif key == "CI Systems":
assessment_json[key] = field_values_to_list(custom_field_values)
# Turn Election value into a true boolean
elif key == "Election":
value = custom_field_values.get("$")
Expand All @@ -193,6 +196,9 @@ def convert_xml_to_json(xml_filename, output_filename):
assessment_json["Election"] = False
else:
assessment_json["Election"] = None
# Build the list of Operators
elif operator_regex.match(key):
assessment_json["Operators"].append(custom_field_values.get("$"))
# Gobble up POC info; we don't want to pass it on
elif key in ["POC Name", "POC Email", "POC Phone"]:
assessment_json[key] = None
Expand All @@ -207,14 +213,6 @@ def convert_xml_to_json(xml_filename, output_filename):
# There are multiple requested services
for service in custom_field_values:
assessment_json["Requested Services"].append(service.get("$"))
# Build the list of Operators
elif operator_regex.match(key):
assessment_json["Operators"].append(custom_field_values.get("$"))
# Build the list of CI Types
elif key == "CI Type":
assessment_json["CI Type"] = [
i.strip() for i in custom_field_values.get("$").split(",")
]
elif key == "Testing Phase":
assessment_json[key] = field_values_to_list(custom_field_values)
else:
Expand Down

0 comments on commit a30839e

Please sign in to comment.