Browse Source

Refactor export output

master
Joshua Rubingh 2 months ago
parent
commit
81e403c81a
  1. 12
      export.py

12
export.py

@ -17,10 +17,20 @@ if __name__ == "__main__":
# Get the data from the LDAP server
(researchers, studies) = ldap_client.export()
# convert study dict to list. Is less data and easier for the import later on.
studies_list = []
for study_data in studies.values():
contributor_list = []
for contributor in study_data['contributors'].values():
contributor_list.append(contributor)
study_data['contributors'] = contributor_list
studies_list.append(study_data)
# Make a nice dict for JSON export saving
data = {
'researchers': researchers,
'studies': studies,
'studies': studies_list,
}
json_data = json.dumps(data, indent=2)

Loading…
Cancel
Save