Knowledge-Graph-Hub / kg-phenio

A graph for accessing and comparing knowledge concerning phenotypes across species and genetic backgrounds.
BSD 3-Clause "New" or "Revised" License
4 stars 4 forks source link

Build fails due to pydantic `ValidationError` #124

Closed caufieldjh closed 10 months ago

caufieldjh commented 10 months ago

New build of kg-phenio fails in the transform stage due to:

11:07:07  Converting data/raw/phenio.owl to data/raw/phenio.json...
11:07:07  Complete.
11:07:07  Transforming to KGX TSV with config in transform.yaml...
11:07:07  [KGX][cli_utils.py][           transform] INFO: Spawning process for 'phenio-transform'
11:07:07  INFO:root:Importing linkml:types as /var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/linkml_runtime/linkml_model/model/schema/types from source https://raw.githubusercontent.com/biolink/biolink-model/v3.5.4/biolink-model.yaml; base_dir=None
11:07:07  INFO:root:Importing linkml:types as /var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/linkml_runtime/linkml_model/model/schema/types from source https://raw.githubusercontent.com/biolink/biolink-model/v3.5.4/biolink-model.yaml; base_dir=None
11:08:43  INFO:root:Importing linkml:types as /var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/linkml_runtime/linkml_model/model/schema/types from source https://raw.githubusercontent.com/biolink/biolink-model/v3.5.4/biolink-model.yaml; base_dir=None
11:14:49  2023-11-14_08:14:42 | INFO     | koza.app         | Transforming source: phenio_node_sources
11:14:50  2023-11-14_08:14:50 | ERROR    | koza.app         | Validation error while processing: {'id': 'FBbt:00000054', 'category': 'biolink:OntologyClass', 'name': 'cleavage stage embryo', 'description': 'A collective term for stages 1-4.', 'xref': '', 'provided_by': 'phenio.json', 'synonym': '', 'deprecated': '', 'iri': 'http://purl.obolibrary.org/obo/FBbt_00000054', 'same_as': '', 'subsets': 'deprecated'}
11:14:50  Adding node sources using kg_phenio/transform_utils/phenio/phenio_node_sources.yaml
11:14:50  Traceback (most recent call last):
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/run.py", line 100, in <module>
11:14:50      cli()
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
11:14:50      return self.main(*args, **kwargs)
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/click/core.py", line 1078, in main
11:14:50      rv = self.invoke(ctx)
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
11:14:50      return _process_result(sub_ctx.command.invoke(sub_ctx))
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
11:14:50      return ctx.invoke(self.callback, **ctx.params)
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/click/core.py", line 783, in invoke
11:14:50      return __callback(*args, **kwargs)
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/run.py", line 75, in transform
11:14:50      kg_transform(*args, **kwargs)
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/kg_phenio/transform.py", line 36, in transform
11:14:50      t.run()
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/kg_phenio/transform_utils/phenio/phenio_transform.py", line 62, in run
11:14:50      self.parse(k, data_file, k)
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/kg_phenio/transform_utils/phenio/phenio_transform.py", line 153, in parse
11:14:50      transform_source(
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/koza/cli_runner.py", line 85, in transform_source
11:14:50      source_koza.process_sources()
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/koza/app.py", line 117, in process_sources
11:14:50      raise ve
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/venv/lib/python3.9/site-packages/koza/app.py", line 107, in process_sources
11:14:50      transform_module = importlib.import_module(transform_code)
11:14:50    File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
11:14:50      return _bootstrap._gcd_import(name[level:], package, level)
11:14:50    File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
11:14:50    File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
11:14:50    File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
11:14:50    File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
11:14:50    File "<frozen importlib._bootstrap_external>", line 855, in exec_module
11:14:50    File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
11:14:50    File "/var/lib/jenkins/workspace/ledge-graph-hub_kg-phenio_master/gitrepo/kg_phenio/transform_utils/phenio/phenio_node_sources.py", line 161, in <module>
11:14:50      node.has_attribute = (attribute,)
11:14:50    File "pydantic/main.py", line 384, in pydantic.main.BaseModel.__setattr__
11:14:50  pydantic.error_wrappers.ValidationError: 1 validation error for NamedThing
11:14:50  has_attribute -> 0
11:14:50    str type expected (type=type_error.str)

The transform tries to set the new deprecated attribute but it's reading the empty string from the deprecated column in the input. Fix this in the phenio_node_sources transform.

caufieldjh commented 10 months ago

Actually, modelling deprecated as a slot just needs to account for the subsets field like before