Harvest CSV Export

I am new to FarmOS and I am playing around V2 to see how things are going to work for my operation.

We have berry orchards and I like to keep track of harvests. To make this a bit easier I will make this in point form:

  • added an asset called ‘berries’ under materials
  • added a ‘Harvest’ log and in the log quantity section selected to increase the ‘berries’ asset by the amount harvested
  • check the Quantities - Material record shows no logs created
  • check the Asset ‘berries’ under the tab inventory it shows the harvest log and amount correctly

Am I missing something or is the Quantities - Material not linked?
Also can an Export CSV function be added to the Inventory tab for Assets?


Hi @berrycw - welcome to the community! :smiley:

Am I missing something or is the Quantities - Material not linked?

Ah this is a great question - and probably points to something we just need to clarify better in the UI perhaps. The word “Material” is used in a few different places, and I think that’s the cause of the confusion…

The TL;DR (summary) is basically this: There are two different ways you can work with “materials” in farmOS v2… 1) tracking actual material assets (including their inventory levels), and/or 2) simply referencing what types of materials were used in quantities.

The former allows for very granular tracking of actual materials, and was introduced as a new feature in v2. The latter was a simple (less granular) way of referencing material types used on Input logs specifically, which was the only option available in v1.

I’ll try to explain the recent history that led to this:

  • In farmOS v1, before we had a “Material” asset type, we only had a taxonomy called “Materials”, which allowed you to create a list of the different types of materials you use as inputs, primarily. The “Input” log type had a “Material” field for referencing terms in this vocabulary (as a way to “tag” input logs with the material that was used, essentially).
  • In farmOS v2, we added a new “Material” asset type, so you could track ACTUAL materials you are managing, and we renamed the “Materials” taxonomy to “Material type” to better differentiate it and clarify that it was for “types” of materials, not your “actual” materials.
    • Notably, Material assets have their own “Material type” field, for specifying what type of material it is (by referencing a term in the “Material types” vocabulary).
  • At that time we removed the “Material” term reference field from Input logs, and created a new “Material Quantity” type (alongside the old “Standard Quantity” type), which has a “Material” term reference field. So basically: the field moved from the Input log level to the Material Quantity level. This served two purposes:
    1. It maintained the ability to reference material types, so that people migrating from v1 to v2 would not lose that valuable information. (The automated migration logic copies data from the log to a new quantity in v2.) This is important for data preservation, but also because not everyone needs to track granular material assets (eg: someone using farmOS for organic certification record keeping only needs to show what type of material was applied - certifiers don’t care about inventory). Different operations use farmOS for different levels of granularity.
    2. It made it possible for a single Input log to reference multiple Material types (which was possible in v1) AND tie them directly to specific quantities that were used for each (which was not possible in v1).

Here is one of the relevant threads in the issue queue where this was all discussed/decided upon: https://www.drupal.org/project/farm/issues/3196834

Getting back to your use-case specifically…

It sounds like you want to track inventory of your berries via harvest logs. So the way you recorded this (via a Standard quantity on a Harvest log, incrementing the inventory of your Material asset) is the right way to do it! You don’t need to use Material Quantities for this at all, you can just use Standard Quantities.

(To be clear, you could use a Material quantity, but then you would be referencing the Material Type in BOTH the Asset AND the Quantity, which would be redundant.)

The only thing that was confusing is you expected that these quantities would show up under Records > Quantities > Material - and that’s understandable! The labeling is confusing - we should think about ways to make this more clear, if possible. At the very least we can add some help text at the top of the Records > Quantities > Material page to describe exactly what it is a list of, and similarly on the Records > Assets >Material page.

I hope I explained this well enough - and if not maybe someone else will chime in and do a better job. :sweat_smile:

Also can an Export CSV function be added to the Inventory tab for Assets?

Great idea! And probably not too difficult… I will add the “feature request” tag to this topic. (See: How things get built... (from ideas to code))

I also just created this feature request idea you may be interested in: Interest in an inventory adjustment quick form?

Thanks Mike.

1 Like

Can the Quantity field in the Harvest CSV Export be fixed?

1 Like

In my quantity overview the exported quantity is working.
Not the exact same fields, but could maybe help?

1 Like

Thanks for the bug report @berrycw - I’m seeing that too. It looks like the quantity information is being included, but it has a bunch of newlines in it:

I’ve opened a bug report: Quantities include newlines in Log CSV exports · Issue #497 · farmOS/farmOS · GitHub

If you are specifically trying to export quantity data to CSVs, I would recommend using the Records > Quantities “Export CSV” (filtered by log type) instead of Records > Logs. This will show one quantity per row, rather than one log per row. So if a log has multiple quantities, you will see multiple rows with the same log name. It also separates the quantity measure, value, units, and label out to separate columns which is better for working with in CSV/spreadsheet format.

The path to try is: /quantities?log_type=harvest

Hi Mike,

Just working with this again as I have some time to figure out how this is going to work for me. Anyway I setup an Material Asset called Frozen Haskap Berries and then added to this asset with harvest records and removed berries using activities. So the overview looks like this:

If I click on the Frozen Haskap Berry asset link and then select the Inventory tab I get all of the activities rather than a list of current assets and their quantities:

The other thing that I have noticed is that I have one asset item listed as Berry Blue Haskap and it has a parent of Frozen Haskap Berries, but for some reason that does not show up under Frozen Haskap Berries. Is this a bug?

1 Like

@berrycw The “Inventory” tab on assets is just a list of inventory adjustments for that specific asset. Sorry if that is unclear - perhaps we need to add a bit of help text to the top.

Ultimately, I think general purpose “Inventory Report” would be a good place to summarize current inventory levels for all assets!

Also related perhaps:

I think the best next step in this regard would be to create some inventory management quick forms, which can serve as the “canonical” place to go to adjust inventories - with a simple set of input questions and it automatically creates the necessary logs/quantities/references when submitted.

(from Maintenance Log (v2) - #14 by mstenta)

Dedicated forum topic for that: Interest in an inventory adjustment quick form?

The other thing that I have noticed is that I have one asset item listed as Berry Blue Haskap and it has a parent of Frozen Haskap Berries, but for some reason that does not show up under Frozen Haskap Berries. Is this a bug?

Hmm I might need to better understand what you’re trying to achieve?

Asset parent relationships can be used in two different ways in farmOS:

  1. “Location” assets use parent relationships to represent hierarchies.
  2. Non-location assets use parent relationships to represent genetic lineage.

If you are looking at a location asset, you should see a “Locations” tab at the top, which will show a page that displays the hierarchy of child locations.

If you are looking at a non-location asset, you should see a “Children” tab at the top, which will show a list of assets that reference the current asset as a parent.

Does that makes sense?

This is exactly what I am looking for. Otherwise it is going to be very painful for me to keep track of what we have in stock and what we do not have in stock.

As for the non-location asset I was thinking is to make one asset such as ‘frozen berries’ and then I could have children from that asset such as ‘frozen blackberries’, ‘frozen raspberries’, etc and then I could just look at the asset ‘frozen berries’ and it would give me a breakdown of quantities that make up the parent asset.

1 Like