Generalizing vs disabling/hiding vs extending the "Is Castrated" field

Making a place to continue this discussion:

1 Like

To summarize the points here:

  • @paul121 was following up on a feature request to hide the field for non-male animals.
  • @mstenta was proposing a follow-up where the state could be modeled via logs - instead of a boolean on the asset.
  • @Symbioquine [I] was arguing that semantically “is castrated” doesn’t make sense for non-male animals, but the concept is still relevant - I think spaying/neutering/sterilizing female animals is relevant in some animal operations such as horses or dogs. We shouldn’t remove the field for female animals, but we should maybe improve the verbiage to make it clearer that it means neutering/sterilization in the more general sense.
2 Likes

I don’t think it should be hidden all together, and agree with @Symbioquine that maybe it just needs a language change.

Maybe this points back to the concept of asset attributes. I think this was @Symbioquine Idea a while ago but a quick a quick search I could not find the discussion. The concept being that assets can have custom assigned attributes that can be set with logs. Animals can be castrated or intact, gates can be open or closed, Fence sections can be energized or off, the possibilities are endless across all assets.

2 Likes

I remember that and think about it often. I would love to come up with a generalized solution to this! And migrate is_castrated to that…

Also wonder if location, inventory, and group computed field logic could be integrated too… since it works similarly (although different data types for each).

2 Likes

I suppose at a minimum we would need some kind of key/value field on logs, along with a new is_attribute_assignment checkbox… or something.

Then it could work similar to is_movement and is_group_assignment.

I think it might be better for it to work a bit more like inventory adjustments - where the log has 0..N - asset_attribute_operations which in turn have 1..N - asset references - along with the data describing the “attribute operation”. e.g. roughly;

{
  "type": "log--activity",
  "id": "...",
  "attributes": {
    "drupal_internal__id": 100,
    "name": "Neuter 2024 Goats",
    "timestamp": "2024-03-30T23:00:00+00:00"
    ...
  },
  "relationships": {
    "asset_attribute_operations": {
        "data": [
            {
              "type": "asset_attribute_operation--asset_attribute_operation",
              "id": "8dee5028-ea58-4a82-973a-b631a8771edc",
            }
        ]
    }
  }
}
{
  "type": "asset_attribute_operation--asset_attribute_operation",
  "id": "8dee5028-ea58-4a82-973a-b631a8771edc",
  "attributes": {
    "drupal_internal__id": 200,
    "operation": "set_boolean",
    "operand_value_0": "is_neutered",
    "operand_value_1": true,
    ...
  },
  "relationships": {
    "asset": {
        "data": [
            {
              "type": "asset--animal",
              "id": "df0e26d5-6b3b-4fe7-976c-2114e1942991",
            },
            {
              "type": "asset--animal",
              "id": "0637d633-d171-474f-b6c6-8b91af4eeeff",
            }
        ]
    }
  }
}
2 Likes