mapping-commons / sssom-py

Python toolkit for SSSOM mapping format
https://mapping-commons.github.io/sssom-py/index.html#
MIT License
49 stars 12 forks source link

`sssom parse`: `license` field not found, even though it's in metadata `.yml` #227

Closed joeflack4 closed 2 years ago

joeflack4 commented 2 years ago

Description

I have a license field in my .yml file, and I'm passing it to sssom parse, but I get a warning message saying that it can't find license.

Command I'm running sssom parse omim.json -I obographs-json -m data/metadata.sssom.yml -o omim.sssom.tsv

metadata.sssom.yml:

mapping_set_id: http://example.org
license: http://w3id.org/sssom/license/unspecified
creator_id: https://orcid.org/0000-0002-2906-7319
curie_map:
  HGNC: "https://identifiers.org/hgnc:"
  HGNC_symbol: https://www.genenames.org/data/gene-symbol-report/#!/hgnc_id/
  OMIM: https://omim.org/entry/
  UMLS: http://linkedlifedata.com/resource/umls/id/
  ORPHA: http://www.orpha.net/ORDO/Orphanet_

Error/warnings

WARNING:root:No License provided, using http://w3id.org/sssom/license/unspecified

What I've tried

I looked at sssom/context.py to see if I could find anything wrong, but I don't see an obvious issue.

def set_default_license(meta: Metadata) -> Metadata:
    if ("license" not in meta.metadata) or (meta.metadata["license"] is None):
        meta.metadata["license"] = DEFAULT_LICENSE
        logging.warning(f"No License provided, using {DEFAULT_LICENSE}")
    return meta

I'm assuming that the contents of meta.metadata should be equivalent to the root of my metadata .yml file. If that's the case, I don't know why there's an issue here. Perhaps when it reads the .yml file, something happens where the value of the license does not get set correctly in meta.metadata?

I can probably figure this out on my own using the debugger, but just wanted to report it first.

matentzn commented 2 years ago

Thank you @joeflack4 fixing this is important, alongside getting this to work:

sssom parse omim.json -I obographs-json -o omim.sssom.tsv

(w/o metadata file, just using defaults)

joeflack4 commented 2 years ago

@hrshdhgd Nice!