Schedule a log based on a quantity value

I was playing with Equipment assets today. Specifically in the use case of a Tractor. It would cool if you could automatically “schedule” a maintenance task in the future, once a tractor has reached X amount of hours.

Here’s the idea: you might not be able to accurately schedule the oil change task just guessing the date. But lets say you weekly or monthly record the hours/mileage/etc on the tractor - once you get close to this “target” value for the maintenance task, a log could automatically be created and assigned to a user.

I don’t imagine this is possible right now, but is interesting to think about. I think the general use case comes down to linking “log creation” to a “log quantity” value. Another use case might be: once 500 pounds of X are harvested, create a log to do XYZ…

Thinking even further, “once the hay field is cut” (an activity/harvest log marked as “done”), create a task to “bale the field” two weeks later. (and create the task sooner if its forecast to rain…)

2 Likes

I’m wondering if we could create some kind a of system to add this capability. Using hooks after logs are updated/created, fire off checks to see if a “rule” has been created for that circumstance

1 Like

Could also make a little checker bot in python (other programming languages are available) that reads through the logs and checks

2 Likes

Using hooks after logs are updated/created, fire off checks to see if a “rule” has been created for that circumstance

This would be pretty simple in a custom module. Not much code needed. Making it more flexible would be the challenging part… but…

There’s a module for that! And it’s called “Rules”! :slight_smile:

I’ve held off including it in farmOS for a couple of reasons, but I’ve always thought it could be a really useful tool, especially for advanced users. It let’s you configure “rules” via the UI, that happen on specific “events/triggers”, are limited by “conditions”, and then execute specific “actions”.

It’s low-hanging fruit for someone who is hosting farmOS themselves to drop in and play around with.

One of the biggest reasons I haven’t added it “officially” to farmOS is that the Drupal 8 upgrade path has been a question mark. I haven’t looked at it in a while, though, so maybe worth investigating. I think Rules was being refactored from the ground up for Drupal 8, so I figured we’d just wait until we’re on D8 to look at it again. I don’t know if a D7->D8 migration path is being worked on.

So in summary: Rules would make it really easy for advanced farmOS users (but not necessarily programmers) to configure triggered actions in the UI. But if you are comfortable with a bit of programming, writing a custom module to do exactly what you want might be simpler (and provide more options).

3 Likes

Wow!! Awesome. I’ll have to try and “drop it in” and play around. I’m interested in what the UI is like! Seems like a complicated thing to map out, but maybe it’s a bit simpler than I imagine.

@mstenta what else are you hiding from us?? :smiley:

1 Like

Haha the question is: what is the Drupal community hiding? :wink:

Re: UI - yes this is probably the weakest part of Rules in Drupal 7, and why I say it might only be usable by “advanced” users. It assumes an understanding of Drupal entity types and systems, and is very generalized for that purpose. It is not designed for farm management specifically by any means.

I would be curious, though, if in Drupal 8 they’ve made any headway on the UI piece. I would love to see the Rules module become more flexible in how it gets integrated into more specific Drupal workflows. eg: wouldn’t it be cool if we could embed a simplified version of the Rules UI somewhere in farmOS, tailored for our purposes?

3 Likes