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

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

Open
gaurav opened this issue Oct 11, 2021 · 0 comments
Open

Comments

@gaurav
Copy link
Collaborator

gaurav commented Oct 11, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant