adewg / ICAR

Standard messages and specifications for animal data exchange in livestock.
https://icar.org/
Apache License 2.0
47 stars 26 forks source link

Fraction property in the icarBreedFractionsType model #410

Closed AlexeyHardCode closed 1 year ago

AlexeyHardCode commented 1 year ago

Is it wise to make the 'fraction' property mandatory, NOT NULL within the 'BreedFractions' type of fractions list? We have a suspicion that if a breed has been specified in the 'BreedFractions' list, the fraction value must be set. Otherwise, why would it be left null or empty?

 "fractions": [
    {
        "breed": {
            "id": "09",
            "scheme": "breedcode"
        },
        "fraction": 100
    },
    {
        "breed": {
            "id": "12",
            "scheme": "breedcode"
        },
        "fraction": NULL
    }   
]

Suggestion:

  1. Create new FractionValue type "icarBreedFractionValueType".
    {      
        "type": "object",
        "required": [
                           "breed",
                           "fraction"
                          ]
        "properties": {
          "breed": {
            "$ref": "icarBreedIdentifierType.json"
          },
          "fraction": {
            "type": "number",
            "nullable": false,
            "format": "double",
            "description": "The proportion of the denominator that this breed comprises."
          }        
    }
  2. Include a reference to the newly created type within the 'fractions' array of the 'icarBreedFractionsType'.
cookeac commented 1 year ago

We've discussed and think there is a case where fraction could be null (if breed was known but not fractions). Therefore decided not to make this change for the moment.

We encourage everyone to fill this in if available.