Template module

Happy to share that the Template module we have been working on is ready for review and testing! :smile:

Note: This module is not ready for production! Please do not install it on your production farmOS instances. I expect there to be a few more breaking changes as we test things out.

  • Iā€™ve prepared some documentation (still a wip): Farm Template
  • To test, you can use the farmOS demo site. First enable the farm_template module from the setup page and then go to Setup ā†’ Templates to get started

This module provides a new concept of templates for use within farmOS. Templates make it faster and easier to create consistent Asset and Log records that follow a standard data convention. The goal is that no code is required - you can build templates via the UI specific to your data needs and use-case. In some ways this is also like ā€œbuilding a quick formā€ for simple asset + log records.

Iā€™ve put a lot of thought into the structure of this base template config entity. You can use the template by itself to create records but things get more exciting as you use the same template in other placesā€¦ for this scope of work we have two things in the works:

  • Create quick forms from a template and further configure the quick form with overridden default values for that specified template. This allows you to re-use templates multiple times but hard-code specific values to make quick forms even more streamlined. This is done and needs to be tested!
  • Use templates in plans. The idea is that you want to configure a plan at the beginning of the year with various templates for the actions to take throughout the year, perhaps on a recurring schedule. The plan will house the templates/logs and track progress. Templates can be re-used across plans. Some of this is implemented but needs more work

Iā€™m excited and curious to hear about other ways that templates can be usedā€¦ a couple I have in mind:

  • Use templates via the API to build mobile frontends for very quick, custom data entry
  • Create a data stream notification plugin that submits a template when certain conditions are met. Eg: auto-create an activity log when the weather gets bad

Iā€™ll use this thread to post updates over the next few weeks as I continue to work through these last features. Let me know if you are able to test and have any feedback. Iā€™m also tracking issues and tasks for this module on the drupal project page: https://www.drupal.org/project/farm_template

5 Likes

Sound brilliant @paul121, will definitly take a look when I get some free time.

2 Likes

Okay, this issue is resolved. Testing should be available on the farmOS demo site

3 Likes

WOW. At a quick first test this is amazingly powerful. I need to spend more time playing with it.

I was able to very quickly throw together a health check log that I have been wanting to make for years!

Some first notes on first testing:

When saving a prefilled date for a timestamp it gives an error " The Default value date is invalid. Enter a date in the correct format."

Would be nice if the units in quantities would auto populate from existing taxonomies.

This is really cool, thanks for working on it!

3 Likes

This was awesome and most welcome. Very cool!!
Looking forward to explore this on my real data.

@mstenta Here is the common question: :upside_down_face:
Can I have this on my Farmier instance, or too early?

It could be a nice feature to combine fields in Title and Note field.
For example this Title: ā€œShed 1, harvested 20 eggsā€

4 Likes

Thanks for testing @BOTLFarm @pat ! Iā€™ll make another release with various bug fixes and minor improvements this week.

Yes that would be niceā€¦ quantities just are a little tricky because they are an entity with their own set of fields. Iā€™ll need to figure out something similar for inventory quantities so you can select an existing asset to update inventory for.

Weā€™re still too early! Please donā€™t use this in production yet! (Iā€™ll update the thread above. Module releases say this too!)

Very interestingā€¦ I agree that would be nice. I had thought of something similar but donā€™t think we can do it in this first version. Nice to know it would be useful!

Drupal has a concept of ā€œTokensā€ that act as placeholders you can place within text strings. When the text strings are processed the tokens get replaced with their respective values. For example:

title = ":asset:name , harvested :harvest_quantity:value eggs"

I think this could be a nice way to implement this kind of feature. There is often a little UI that shows the tokens ā€œavailable for replacementā€ but still, it definitely requires some advanced understanding of what is going on.

3 Likes

Iā€™ve been playing some more with this. Only on demo-instance so no real testing. But Iā€™d say itā€™s one of the most important module for farmOS ever. It really makes farmOS alot better for entering data.

Really looking forward to using it in production.

:ok_hand:

3 Likes

This will make data entry in the field so much easier and more streamlined for my specific farm needs! Iā€™ve been excited about this for a while and enjoyed checking it out - it looks great. Canā€™t wait to use it for real! -Jess

2 Likes