cancerDHC/ccdhmodel

Add support for storing and emiting Decimals in the CRDC-H instance data

gaurav opened this issue · 0 comments

CRDC-H defines a decimal type based on Python's Decimal type. Unfortunately, this doesn't work correctly at present:

  1. Trying to create a crdch_model.Decimal() with a Python Decimal works, but when you try writing it out as YAML, results in the following error: yaml.representer.RepresenterError: ('cannot represent an object', Decimal('20653'))
  2. Trying to use the trick of manually setting the value doesn't work, because you can either set this value as a string (in which case it fails JSON validation, which expected a decimal), as a float (which would incorrectly mess up decimals), or as an integer (which truncates non-integral decimals).

You can see these errors in PR cancerDHC/example-data#22, but we should move some examples into this repo and then try to fix them, probably in LinkML.

There might be a solution to this problem here: https://stackoverflow.com/a/47346704/27310