I-GUIDE / catalog

The I-GUIDE Catalog is part of the I-GUIDE Platform and provides search, discovery, and dynamic interaction with resources created by or used by I-GUIDE researchers.
https://i-guide.io/platform/
BSD 3-Clause "New" or "Revised" License
1 stars 5 forks source link

What units should contentSize be expressed as? #111

Open Castronova opened 2 years ago

Castronova commented 2 years ago

According to SchemaOrg contentSize is:

File size in (mega/kilo) bytes."

This will be strange for small or very large files:

256 TB ~= 2.56e+8 MB
256 B ~= 0.256 KB

Moreover, if we round to the nearest integer the becomes even worse: 256 B = 0 KB or 1KB

One solution is to recommend that all contentSize values simply contain units, e.g. Bytes (B), Kilobytes (KB), Megabytes (MB), Gigabytes (GB), Terabytes (TB).

pkdash commented 4 months ago

@Castronova This shows currently what size units are allowed for contentSize. https://github.com/I-GUIDE/catalogapi/blob/develop/api/models/schema.py#L425

Here is a unit test where we have used different size units: https://github.com/I-GUIDE/catalogapi/blob/develop/tests/test_core_schema.py#L336