Medical Logs, withdrawal flags

It’s fluke dosing time and something I notice missing from medical logs is fields for milk/meat (and maybe eggs for poultry) withdrawal period.

I intend on using custom flags, but they should have an automatic expiry, I can probably achieve this using a combination of a custom field and Node Red but should probably explore if farmOS/Drupal can handle this as I think it could be a useful contrib module. Any thoughts?

This reminds me of @paul121’s REI module (Restricted Entry Interval): GitHub - paul121/farm_rei: Adds restricted-entry interval (REI) fields to Input Logs and Materials.

It basically allows certain Material assets to specify a number of days that entry to the field should be restricted after application. Same basic concept, but this would be for animals. Does that sound right @Farmer-Ed @paul121 ?

1 Like

If there is something similar already in development that would be great, I’ll certainly give it a look when I have time later.

1 Like

Yes that seems similar to the REI concept. Eventually this module will display a “warning” message banner at the top of an asset or log page when it has an “active” restricted entry. The message would be provided by this contextual info plugin concept I’ve started here, I’d love to finally formalize that into a PR next week: Display plans associated with a log or asset [#3255507] | Drupal.org

It seems you would want to display a similar message when viewing these animal assets, correct? If so, adding a field to the medical log makes sense considering we need both a timestamp + duration for this “withdrawal period”. Regarding what to name the field… do you think there is language that could be abstracted to cover any type of animal? A quick sketch: " Specify a withdrawal interval if this medical event impacts goods this animal produces." It would be interesting if you could allow a custom message as well, but maybe the log name and other attributes are sufficient for this?

Thanks for sharing this use case though. I’m curious if we could abstract some of this into helpers provided by farmOS core so that you could generate this “interval” contextual message for any asset + log type combo that has a custom “interval” type of field. Just thinking out loud, maybe that could simply be a new field type (the REI stores a simple integer for the # of days, but we’ve thought next steps would be to store this as # of seconds, with an improved UI to select hours/days/weeks, etc)? Another thought that comes to mind is that this could perhaps be tackled thinking of this as “semantic” information about the asset. I wonder if the contextual info should support sprinkling in semantic contexts here.

2 Likes

Oh this reminds me of the farm_plan_consideration module in v1: farmOS/modules/farm/farm_plan/farm_plan_consideration at 7.x-1.x · farmOS/farmOS · GitHub

It added a database table to track “plan considerations” in a general way. It came out of the original grazing module work, which had a “Considerations” tab in the grazing plan UI. The basic idea was you could add things like “Flooded from March to May” associated with certain areas, with a date range. This would then get displayed in the grazing plan’s timeline visualization as a colored area, to make it visible to planners.

I could almost see a unified system for handling these kinds of “time period considerations” provided by farmOS core. Maybe farm_rei (and farm_medical?) could then just depend on this, and add whatever specifics they need on top.

One of the ideas that floated around earlier was using standard “repeating event” calendar behavior/rules to define the time periods. That would allow, for example, adding considerations that repeat yearly - like ground water cycles, pest pressures, weather patterns, etc etc - in addition to more specific things that are triggered by farm management activities - like inputs to land and animals.

1 Like

It’s a step beyond what I was thinking but it sounds ideal.
There are 2 withdrawal periods to consider with animals.

  1. Meat Withdrawal Period: I think this is universal enough to cover all animals.
  2. Milk or Egg Withdrawal Period: Probably don’t want to word it so it sounds like cows produce eggs or poultry produce milk so perhaps Other Produce Withdrawal?

Making these types of timers part of core would be fantastic, there are probably loads of use cases and having helpers for them sounds great especially for us greenhorns.

1 Like

I’m going to go with All Produce Withdrawal and Meat Withdrawal I think that should cover everything as if milk or eggs need to be kept from food chain then meat most certainly will too.


I also had a look at @paul121’s code for REI module and started modifying it to work with medical logs. I’ll definitely be watching out for the display plans/ warning message PR too.

I think I can achieve what I want with Node-Red for now, Basically check logs for the withdrawal integers and add/remove flags from the asset as necessary, probably as a batch job once a day will do. Maybe create a google calendar for this too and mark animals withdrawal periods.

More long term I’d like to make this into a proper module, but I still need to figure out some of the mechanics of Drupal, will be following the projects above with some interest as I think there will be lot of commonality.

2 Likes

Thanks for the help yesterday @paul121, the withdrawal value now passes as expected from the taxonomy term to the log.

1 Like

I’m still chipping away at this module and created a repo for it, GitHub - Farmer-Eds-Shed/farm_withdrawal. It still has a long way to go but at least I’m starting to get my head around the event subscribers.

Any suggestions on this bit? Think I will be still using Node-Red for some of this logic in the short term but would be interested in exploring a proper Drupal/PHP solution.

Edit:
Maybe I’m looking at it wrong…
I could just use the data I have now and use it to populate a Google Calendar, maybe even import that calendar as an Iframe somewhere.
Or
add flags to the assets, with the data I have now and run a nightly cron job to remove flags which are no longer relevant
Or
Possibly both

i7cSPk4ObH

1 Like

No concrete ideas @Farmer-Ed - just thinking out loud about possible ways to generalize. :slight_smile: I’d have to refresh on farm_rei and review your module in more detail. Just “feels” like similar problems, so my mind always wants to generalize. :smile:

1 Like

Well they are very similar, like I copied the smart kids homework :rofl:

1 Like