hubverse-org / schemas

JSON schemas for modeling hubs
Creative Commons Zero v1.0 Universal
4 stars 2 forks source link

Is limiting specification of maximum and minimum values for mean and median output types to integers to restrictive? #32

Closed annakrystalli closed 1 year ago

annakrystalli commented 1 year ago

I noticed that in the schema, specifying output_type mean minimum and maximum values in a config file is restricted to "integer":

https://github.com/Infectious-Disease-Modeling-Hubs/schemas/blob/19f40344655064dff9fc8e78f7a10eacb5894cea/v0.0.1/tasks-schema.json#L474-L480

Same in median:

https://github.com/Infectious-Disease-Modeling-Hubs/schemas/blob/19f40344655064dff9fc8e78f7a10eacb5894cea/v0.0.1/tasks-schema.json#L568-L575

Although these are optional properties, Is this unnecessarily restrictive? I can imagine someone perhaps wanting to use a decimal number to specify ranges. Should I change the schema to ["integer", "number"].

nickreich commented 1 year ago

Yes, I agree. I think changing this to a more generic "numeric" format would be appropriate.

annakrystalli commented 1 year ago

OK great. Now that I've been working on https://github.com/Infectious-Disease-Modeling-Hubs/hubAdmin/issues/7 & https://github.com/Infectious-Disease-Modeling-Hubs/hubUtils/issues/40, it's become apparent that, for both loading data and validation, it's better to restrict to actual R data types returned by typeof() which would be "integer" or "double". Numeric is too generic and never retunred by typeof(). So I suggest using an array of ["integer", "double"] and removing any reference to "numeric" in the schema. I can likely make this backwards compatible though.