Skip to content

The default value of Survival time in days is ambiguous #422

@ielis

Description

@ielis

If the survival_time_in_days field of the VitalStatus element is set to 0, it is impossible to know if this was set explicitly or if the value represents the default value of the datatype.

The issue could be fixed by making the survival_time_in_days field optional. This is in line with Protobuf's recommendations Specifying Field Cardinality:

optional: (recommended) An optional field is in one of two possible states:

  • the field is set, and contains a value that was explicitly set or parsed from the wire. It will be serialized to the wire.
  • the field is unset, and will return the default value. It will not be serialized to the wire.

You can check to see if the value was explicitly set.

optional is recommended over implicit fields for maximum compatibility with protobuf editions and proto2.

Making the field optional would also correspond better to the Multiplicity of 0..1 in Phenopacket Schema's docs:

Image

I am not sure if this can be an issue in practice, i.e. if there are diseases/cases where the survival time in days would be zero. I think, however, that this is a bug that should be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions