Any way for one activity to trigger another?

So, often in farming things happen in a sequence, right? We know that seeding a tray will later lead to transplanting which will later lead to weeding which will later lead to harvesting etc etc you get the idea.

My example is that when a lamb is born, I know that I will want to eartag and castrate 3 days after birth. Is there a way to make it so that one activity triggers the next in a sequence? Ideally filling out the birth quick form could create a pending log for eartagging and castration with a date three days following the birth.

4 Likes

If you take benefit of the farmOS API, you can do that.
For example a python script, or Node-Red.

I use Node-Red and find it easy to do such things. It’s a little learning curve, but well worth the time. It gives so much possibilities.

@Farmer-Ed has made some great nodes for interatcing with farmOS, and there’s a few topics with examples on this in the forum.

Edit: But not possible directly in farmOS as far as I know.

2 Likes

It would be possible with a custom module to add the functionality. Drupal has some handy listeners that could be leveraged with a little PHP knowledge.

2 Likes

Yea nothing existing in farmOS itself, but as @pat and @Farmer-Ed said there’s lots of potential to build things using the API. That said, it might be fun to brainstorm what something in farmOS would look like. It feels like it could be pretty open-ended, though. I wonder what a minimum first step might look like. :thinking:

Perhaps the first thing to figure out is: what “triggers” the new log to be created? When another log is saved? When it is marked completed? What happens if those things change (eg: the log is edited again), or happen multiple times? How do we define what the “next” log includes?

Building something that is super general might be tough, but maybe there’s a clever idea out there!

On the other hand, building more specific planning tools is easier to envision. For example, the Planting quick form lets you create a Plant asset with a Seeding log, Transplanting log, and Harvest log all in one step. It’s not exactly the same, but if you know that all of these things are going to happen then you can create them in advance. Some parts of that are trickier, of course… you don’t necessarily know how many times you’ll weed, for instance. But maybe just creating one is enough to start, and you can then clone that one as needed.

@gbathree has also been giving some more general thought to “plan templates” aka patterns of logs like this. I don’t think there’s a dedicated forum topic for it yet (unless I’m forgetting - morning coffee still settling in here). Seems like a logical next step!

1 Like

Would be great to make as General as possible.
I wonder could it tie in with some of the concepts we discussed in the past around timing and automation.

Like adding and removing a meat/milk/eggs withdrawal flag after giving drugs like in this discussion Medical Logs, withdrawal flags - #6 by Farmer-Ed

You had mentioned the possibility of adding timers to farmOS core which could be a great first start. With some foundations built into core it could really pave the way for lots of potential custom modules

2 Likes