diff --git a/pipelines/metadata_revision.py b/pipelines/metadata_revision.py index f7e8a94..c22deb3 100644 --- a/pipelines/metadata_revision.py +++ b/pipelines/metadata_revision.py @@ -9,8 +9,8 @@ import yaml import src.hdf5_ops as hdf5_ops -def load_yaml(yaml_review_file): - with open(yaml_review_file, 'r') as stream: +def load_yaml(review_yaml_file): + with open(review_yaml_file, 'r') as stream: try: return yaml.load(stream, Loader=yaml.FullLoader) except yaml.YAMLError as exc: @@ -78,7 +78,7 @@ def validate_yaml_dict(input_hdf5_file, yaml_dict): return len(errors) == 0, errors, notes -def update_hdf5_file_with_review(input_hdf5_file, yaml_review_file): +def update_hdf5_file_with_review(input_hdf5_file, review_yaml_file): """ Updates, appends, or deletes metadata attributes in an HDF5 file based on a provided YAML dictionary. @@ -97,11 +97,11 @@ def update_hdf5_file_with_review(input_hdf5_file, yaml_review_file): } } """ - yaml_dict = load_yaml(yaml_review_file) + yaml_dict = load_yaml(review_yaml_file) success, errors, notes = validate_yaml_dict(input_hdf5_file,yaml_dict) if not success: - raise ValueError(f"Review yaml file {yaml_review_file} is invalid. Validation errors: {errors}") + raise ValueError(f"Review yaml file {review_yaml_file} is invalid. Validation errors: {errors}") # Initialize HDF5 operations manager DataOpsAPI = hdf5_ops.HDF5DataOpsManager(input_hdf5_file) @@ -165,6 +165,6 @@ if __name__ == "__main__": if sys.argv[1] == 'update': input_hdf5_file = sys.argv[2] - yaml_review_file = sys.argv[3] - update_hdf5_file_with_review(input_hdf5_file, yaml_review_file) + review_yaml_file = sys.argv[3] + update_hdf5_file_with_review(input_hdf5_file, review_yaml_file) #run(sys.argv[2])