linkml / schemasheets

Structure your data in a FAIR way using google sheets or TSVs. These are then converted to LinkML, and from there other formats
https://linkml.io/schemasheets/
41 stars 5 forks source link

the converter doesn't work with the gsheet example #107

Open djarecka opened 1 year ago

djarecka commented 1 year ago

I've tried to use the sheets2linkml with the example of gsheet you provide, but I get the error:

(models_linkml) MacBook-Pro-2:linkml dorota$ sheets2linkml --gsheet-id 1wVoaiFg47aT9YWNeRfTZ8tYHN8s8PAuDx5i2HUcDpvQ personinfo types prefixes -o personinfo_gsh.yaml
Traceback (most recent call last):
  File "/Users/dorota/miniconda3/envs/models_linkml/lib/python3.9/site-packages/schemasheets/schemamaker.py", line 110, in merge_sheet
    self.add_row(row, schemasheet.table_config)
  File "/Users/dorota/miniconda3/envs/models_linkml/lib/python3.9/site-packages/schemasheets/schemamaker.py", line 116, in add_row
    for element in self.row_focal_element(row, table_config):
  File "/Users/dorota/miniconda3/envs/models_linkml/lib/python3.9/site-packages/schemasheets/schemamaker.py", line 372, in row_focal_element
    raise ValueError(f'Could not find a focal element for {row}')
ValueError: Could not find a focal element for {'record': '', 'field': 'id', 'key': 'yes', 'multiplicity': '1', 'range': 'string', 'parents': '', 'desc': 'any identifier', 'schema.org': 'identifier', 'wikidata': '', 'belongs': '', 'status': '', 'special': '', 'special2': '', 'notes': ''}

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/dorota/miniconda3/envs/models_linkml/bin/sheets2linkml", line 8, in <module>
    sys.exit(convert())
  File "/Users/dorota/miniconda3/envs/models_linkml/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/dorota/miniconda3/envs/models_linkml/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/dorota/miniconda3/envs/models_linkml/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/dorota/miniconda3/envs/models_linkml/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/dorota/miniconda3/envs/models_linkml/lib/python3.9/site-packages/schemasheets/schemamaker.py", line 651, in convert
    schema = sm.create_schema(list(tsv_files))
  File "/Users/dorota/miniconda3/envs/models_linkml/lib/python3.9/site-packages/schemasheets/schemamaker.py", line 64, in create_schema
    self.merge_sheet(f, **kwargs)
  File "/Users/dorota/miniconda3/envs/models_linkml/lib/python3.9/site-packages/schemasheets/schemamaker.py", line 113, in merge_sheet
    raise SchemaSheetRowException(f'Error in line {line_num}, row={row}') from e
schemasheets.schemamaker.SchemaSheetRowException: Error in line 3, row={'record': '', 'field': 'id', 'key': 'yes', 'multiplicity': '1', 'range': 'string', 'parents': '', 'desc': 'any identifier', 'schema.org': 'identifier', 'wikidata': '', 'belongs': '', 'status': '', 'special': '', 'special2': '', 'notes': ''}

I've installed your package from pip, v0.1.21, python3.9, OSX.