- Removed obsolete slots: `has_or_had_custodian_observation`, `provider`, and `specificity_annotation`. - Updated `has_or_had_score` slot to use `SpecificityScore` class and modified its description and examples. - Added new slots: `end_seconds`, `end_time`, `has_archive_path`, `has_or_had_custodian_name`, `protocol_name`, and `protocol_version`. - Introduced a script `check_annotation_types.py` to validate the presence and structure of `custodian_types` in YAML files. - Added a script `update_specificity.py` to automate updates related to `SpecificityAnnotation` to `SpecificityScore`.
33 lines
1 KiB
Python
33 lines
1 KiB
Python
import yaml
|
|
import os
|
|
|
|
def check_dict(d, path, context="root"):
|
|
if not isinstance(d, dict):
|
|
return
|
|
|
|
for k, v in d.items():
|
|
if k == 'custodian_types':
|
|
if context != 'annotations':
|
|
print(f"Misplaced custodian_types in {path} at context '{context}'")
|
|
|
|
if isinstance(v, dict):
|
|
check_dict(v, path, k)
|
|
elif isinstance(v, list):
|
|
for item in v:
|
|
check_dict(item, path, k)
|
|
|
|
def process_directory(directory):
|
|
for root, dirs, files in os.walk(directory):
|
|
for file in files:
|
|
if file.endswith(".yaml"):
|
|
path = os.path.join(root, file)
|
|
try:
|
|
with open(path, 'r') as f:
|
|
data = yaml.safe_load(f)
|
|
check_dict(data, path)
|
|
except Exception as e:
|
|
# Ignore parse errors
|
|
pass
|
|
|
|
process_directory("schemas/20251121/linkml/modules/classes")
|
|
process_directory("schemas/20251121/linkml/modules/slots")
|