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

2 Likes

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

Merry Christmas all.
I was going to make a topic around this, but of course @Farmer-Ed got ahead of me this time too :rofl:
Never thought I’d find much use in the animal part of FarmOS. I could’nt be more wrong…
For everything I learn, 2 new ideas comes to mind.

I’m putting up a flow to let the vet fill out the medical data into a Node-Red form.
I came across upon the same problem as you, @Farmer-Ed with the withholding period.

I was thinking of using the “monitoring” flag, and let Node-Red remove it.
I find the features discussed above interesting.

2 Likes

I just tried out the new calendar module farmOS Calendar module (v2) and it made me think maybe I need to work on finishing this module. (which may or may not need to depend on a calendar module?)

The Google Calendar option works, it’s easy to see if there are animals in the herd are restricted but I’d prefer for this to work within farmOS without the need to access a cloud service. I thought maybe the farmOS Calendar module might be suitable, I see the Calendar view module supports recurring dates, but it probably be too messy to just populate the same calendar as other logs unless filter options are added.

I guess the same logic is needed for Medical Logs and possibly Spray/other Logs

So my current ideas.
With a Calendar:

  • A separate calendar view for “Restricted Assets”
  • A Calendar view on each restrictable Asset (that’s only relevant to that Asset)

Without a Calendar:

  • Back to the Flags and whatever logic that will entail.
  • A new Dashboard widget similar to upcoming / late tasks called “Restricted Assets”

Or just some combination of the above.

Any thoughts on the above are welcome.

2 Likes

Spinning on high speed here… A possibility for the user to add several calendar widgets on the dashboard would be awesome.
The user could make the widget show relevant data e.g. withdrawal periods in one widget and other stuff in another.
In other words : a calendar widget with custom filter settings.

I think that would be a good idea, and maybe something to have in mind.

2 Likes

Probably need to figure out layout and grouping a bit better, but I managed to add a new block to the dashboard for Restricted Assets

3 Likes

Multiple calendars with different filters available on the Dashboard should be possible, but I’m not sure it’s practical for withdrawal periods, multiple animals wouldn’t be long cluttering up the Calendar to the point it is unusable.

Perhaps Adding a Calendar to the Asset View screen may make better sense, then mark withdrawal dates there, that way each animal gets its own calendar and it can be combined with a restricted asset list on the dashboard?

2 Likes

Makes sense :+1:

That would be like an asset timeline?
So if you open a seed or field asset, you would see what’s been done, and when?

2 Likes

Hmm… That could be interesting, I’d planned on having it filtered to logs with withdrawals / or other restrictions like after spraying. But it could be anything I guess :thinking:.

2 Likes

Propably different needs for different assets…

2 Likes