otc-metadata-swiss/tools/split_metadata.py
Artem Goncharov b532f938e9
All checks were successful
gl/check check status: success (b532f938e9012f7910822aec1adfeb687ee5220b)
gl/gate gate status: success (b532f938e9012f7910822aec1adfeb687ee5220b)
feat: split metadata into smal pieces
2023-06-01 16:51:48 +02:00

42 lines
899 B
Python

# import copy
from pathlib import Path
import yaml
import otc_metadata
data = otc_metadata.services.Services()
for item in data.all_docs:
with open(
Path(
otc_metadata.data.DATA_DIR,
"documents",
f"{item['service_type']}-{item['type']}.yaml",
),
"w",
) as fp:
yaml.dump(item, fp, explicit_start=True)
for item in data.all_services:
with open(
Path(
otc_metadata.data.DATA_DIR,
"services",
f"{item['service_type']}.yaml",
),
"w",
) as fp:
yaml.dump(item, fp, explicit_start=True)
for item in data.service_categories:
with open(
Path(
otc_metadata.data.DATA_DIR,
"service_categories",
f"{item['name']}.yaml",
),
"w",
) as fp:
yaml.dump(item, fp, explicit_start=True)