From 92edecc0a523bcaea9d40a48f887c37cb3ceee69 Mon Sep 17 00:00:00 2001 From: Montana Date: Thu, 8 Dec 2022 15:45:26 -0800 Subject: [PATCH 1/5] extreme_events slot usage added --- src/schema/nmdc.yaml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/schema/nmdc.yaml b/src/schema/nmdc.yaml index 3fa79346f2..e3ca52d92a 100644 --- a/src/schema/nmdc.yaml +++ b/src/schema/nmdc.yaml @@ -460,7 +460,6 @@ classes: description: An NMDC assigned unique identifier for a biosample submitted to NMDC. required: true pattern: '^nmdc:' - lat_lon: required: false description: This is currently a required field but it's not clear if this @@ -476,6 +475,24 @@ classes: required: false part_of: required: true + extreme_event: + name: extreme_event + title: history/extreme events + aliases: + - mixs:0000320 + description: Unusual physical events that may have affected microbial populations + examples: + - 1980-05-18, volcanic eruption + annotations: + expected_value: + tag: expected_value + value: date, text + occurrence: + tag: occurrence + value: '1' + is_a: attribute + multivalued: false + range: text id_prefixes: - GOLD From 987c962d670f583196ea486d66ee48eb32b7e2f7 Mon Sep 17 00:00:00 2001 From: Montana Date: Thu, 8 Dec 2022 15:46:30 -0800 Subject: [PATCH 2/5] extreme_events slot usage added --- src/schema/nmdc.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/schema/nmdc.yaml b/src/schema/nmdc.yaml index e3ca52d92a..d0bb859035 100644 --- a/src/schema/nmdc.yaml +++ b/src/schema/nmdc.yaml @@ -452,7 +452,6 @@ classes: tag: display_hint value: >- Provide the GOLD biosample IDs associated with this biosample. - alternative_identifiers: description: Unique identifier for a biosample submitted to additional resources. Matches the entity that has been submitted to NMDC required: false From e9d0dff57b8d575d23a2a1adcc5b0b38690e5f87 Mon Sep 17 00:00:00 2001 From: Montana Date: Thu, 8 Dec 2022 16:40:22 -0800 Subject: [PATCH 3/5] corrected example --- src/schema/nmdc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/schema/nmdc.yaml b/src/schema/nmdc.yaml index d0bb859035..44e70b0b6d 100644 --- a/src/schema/nmdc.yaml +++ b/src/schema/nmdc.yaml @@ -481,7 +481,7 @@ classes: - mixs:0000320 description: Unusual physical events that may have affected microbial populations examples: - - 1980-05-18, volcanic eruption + - value: 1980-05-18, volcanic eruption annotations: expected_value: tag: expected_value From 8ff6cda7f86f60a1e11fcaf5f4ded2fbecebc295 Mon Sep 17 00:00:00 2001 From: "Mark A. Miller" Date: Wed, 14 Dec 2022 10:06:41 -0500 Subject: [PATCH 4/5] just some helpers --- pyproject.toml | 1 + util/compare_new_usage.py | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 util/compare_new_usage.py diff --git a/pyproject.toml b/pyproject.toml index 098c952295..b09b5d539f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ check-jsonschema = "^0.19.2" pendulum = "^2.1.2" pymongo = "^4.3.3" python-dotenv = "^0.21.0" +deepdiff = "^6.2.1" [tool.poetry.dev-dependencies] black = "^22.3.0" diff --git a/util/compare_new_usage.py b/util/compare_new_usage.py new file mode 100644 index 0000000000..6a03ccb404 --- /dev/null +++ b/util/compare_new_usage.py @@ -0,0 +1,39 @@ +import pprint + +from linkml_runtime import SchemaView +from linkml_runtime.dumpers import yaml_dumper + +import ruamel.yaml + +from deepdiff import DeepDiff \ +# print_diff + +schema_file = "../src/schema/nmdc.yaml" +slots_added_in_induction = ['owner','domain_of'] +schema_view = SchemaView(schema_file) + +global_extreme_event = schema_view.get_slot("extreme_event") +biosample_extreme_event = schema_view.induced_slot("extreme_event", "Biosample") + +# refactor +# or better yet, direct element -> text dict conversion +# and vice versa +gee_yaml = yaml_dumper.dumps(global_extreme_event) +gee_dict = ruamel.yaml.load(gee_yaml, Loader=ruamel.yaml.RoundTripLoader) + +bee_yaml = yaml_dumper.dumps(biosample_extreme_event) +bee_dict = ruamel.yaml.load(bee_yaml, Loader=ruamel.yaml.RoundTripLoader) +for i in slots_added_in_induction: + del bee_dict[i] + +print("Global extreme event") +pprint.pprint(gee_dict) + +print("\n") +print("Biosample extreme event") +pprint.pprint(bee_dict) + +diff = DeepDiff(gee_dict, bee_dict) + +print("\n") +pprint.pprint(diff) From c75d9533b426bd936cfa087ab5d3d6e44762c4cf Mon Sep 17 00:00:00 2001 From: Montana Date: Fri, 16 Dec 2022 12:32:39 -0800 Subject: [PATCH 5/5] corrected range, removed repeats --- src/schema/nmdc.yaml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/schema/nmdc.yaml b/src/schema/nmdc.yaml index 44e70b0b6d..67b1ce2455 100644 --- a/src/schema/nmdc.yaml +++ b/src/schema/nmdc.yaml @@ -475,23 +475,13 @@ classes: part_of: required: true extreme_event: - name: extreme_event - title: history/extreme events - aliases: - - mixs:0000320 - description: Unusual physical events that may have affected microbial populations examples: - value: 1980-05-18, volcanic eruption annotations: expected_value: tag: expected_value - value: date, text - occurrence: - tag: occurrence - value: '1' - is_a: attribute - multivalued: false - range: text + value: date, string + range: string id_prefixes: - GOLD