Open annakrystalli opened 3 hours ago
I'm totally onboard with this! 💯
The non-interlanguage compatibility of NA
is something that's been brought up in the past, especially by @LucieContamin, discussed, but somewhat shelved until the bridge needed crossing. I agree this seems like a very good opportunity to cross that bridge.
I think we could easily even go one step cleaner and rather than a [null]
array, just go for a null
property all together (i.e. required: null
. In terms of implementation, expand_model_out_grid()
already has functionality to convert task ID optional
and required
properties which are both null
(used for task IDs which are relevant to one modeling task but might not be to another in the same round) to NA
s so I think it would be straightforward to apply that to output_type_id
s too.
Other areas that would require work would be:
Overall, I think it's much cleaner, clearer and would make it much easier to communicate and explain the expectations for point estimate output type ids so worth the effort!
@zkamvar posted the following note on #103
Something that was brought up in response to https://github.com/reichlab/variant-nowcast-hub/pull/117#issuecomment-2423170370 is that the
"NA"
is a bit confusing because it sure looks like a character, but when we expand the grid theoutput_type_id
columns becomeNA
(which is an intentional move by Ooms described in section 2.1.1 of the JSONlite package paper)Now that we are using
is_required
for point estimate types, we might be able to take this opportunity to set therequired
property to a single elementnull
array. This will have exactly the same result as the"NA"
array, but with the following advantages:null
is a concept that even JSON can understandThis is what I think it would look like in the schema:
Demo
Here's a demo that shows that
["NA"]
and[null]
are equivalent by modifying a tasks.json file and reading them in with jsonliteCreated on 2024-10-18 with reprex v2.1.1
Originally posted by @zkamvar in https://github.com/hubverse-org/schemas/issues/103#issuecomment-2423356765