Converted "v1.46-2024-05-02-ror-data.json" with allow_unicode=False
Included additional title languages, where available
Included acronyms only where they exist
Here is the code used to convert the data for easier review:
import json
import yaml
def convert_json_to_yaml(json_filepath, yaml_filepath):
with open(json_filepath, 'r', encoding='utf-8') as json_file, open(yaml_filepath, 'w', encoding='utf-8') as yaml_file:
data = json.load(json_file)
yaml_data = []
for item in data:
identifier_entry = {
'identifier': item['id'].split('/')[-1],
'scheme': 'ror'
}
# Prepare the title structure with translations if available
title = {'en': item['name']} # default to English title
for label in item.get('labels', []):
if label.get('iso639') and label.get('label'):
title[label['iso639']] = label['label']
# Prepare the basic YAML entry structure
yaml_entry = {
'id': item['id'].split('/')[-1],
'name': item['name'],
'title': title,
'identifiers': [identifier_entry]
}
# Check if acronyms is not empty and add if it's not
if item['acronyms'] and item['acronyms'][0] != "":
yaml_entry['acronym'] = item['acronyms'][0]
yaml_data.append(yaml_entry)
yaml.safe_dump(yaml_data, yaml_file, allow_unicode=False, default_flow_style=False)
json_input = "v1.46-2024-05-02-ror-data.json"
yaml_output = "affiliations_ror.yaml"
convert_json_to_yaml(json_input, yaml_output)
Checklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
:heart: Thank you for your contribution!
Description
2024-05-02
(last updated 3 years ago)allow_unicode=False
Here is the code used to convert the data for easier review:
Checklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
Frontend
Reminder
By using GitHub, you have already agreed to the GitHub’s Terms of Service including that: