Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 374 update extreme events #545

Merged
merged 8 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,26 @@ migrate_3_2_to_7 = "nmdc_schema.migrate_3_2_to_7:cli"

[tool.poetry.dependencies]
python = "^3.9"
linkml-runtime ="^1.3.0"
linkml-runtime = "^1.3.0"

[tool.poetry.dev-dependencies]
black = "^22.10.0"
build = "^0.9.0"
check-jsonschema = "^0.19.2"
click-log = "^0.4.0"
deepdiff = "^6.2.1"
docutils = "^0.19"
jq = "^1.3.0"
jupyter = "^1.0.0"
linkml = "^1.3.15"
mkdocs = "^1.4.2"
mkdocs-material = "^8.5.7"
mkdocs-mermaid2-plugin = "^0.6.0"
twine = "^4.0.1"
check-jsonschema = "^0.19.2"
docutils = "^0.19"
jupyter = "^1.0.0"
linkml = "^1.3.15"
pandas = "^1.5.1"
pendulum = "^2.1.2"
pymongo = "^4.3.3"
python-dotenv = "^0.21.0"
twine = "^4.0.1"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
12 changes: 12 additions & 0 deletions src/schema/nmdc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ classes:
syntax: "{id_nmdc_prefix}:{id_typecode_biosample}-{id_shoulder}-{id_blade}{id_version}{id_locus}"
interpolated: true
partial_match: false

gold_biosample_identifiers:
description: Unique identifier for a biosample submitted to GOLD that matches the NMDC submitted biosample
comments: This is the ID provided by GOLD that starts with 'GB'
Expand All @@ -507,6 +508,7 @@ classes:
alternative_identifiers:
description: Unique identifier for a biosample submitted to additional resources. Matches the entity that has been submitted to NMDC
required: false

lat_lon:
required: false
description: This is currently a required field but it's not clear if this
Expand All @@ -522,6 +524,16 @@ classes:
required: false
part_of:
required: true

extreme_event:
turbomam marked this conversation as resolved.
Show resolved Hide resolved
examples:
- value: 1980-05-18, volcanic eruption
annotations:
expected_value:
tag: expected_value
value: date, string
range: string

id_prefixes:
- GOLD
exact_mappings:
Expand Down
39 changes: 39 additions & 0 deletions util/compare_new_usage.py
Original file line number Diff line number Diff line change
@@ -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)