Plantings Reports both planned and current

I am using v. 2 and would like to be able to create a report that shows what crops I have, in what locations and what sizes. Ideally I would want to be able to select which growing season as well.

I am not very experienced at php, but do use quite a bit of mysql on vb .net platform.

If there is not something within the current structure that can give this sort of report is there a template I can follow to create it ?

Thanks for your help

Oliver

2 Likes

@oliverp44 If you are willing to write some Python you can probably build a custom report to include whatever you like by pulling data from the farmOS API.

We have a farmOS.py library for Python to help with this: Introduction | farmOS - there are some basic examples on that page and this one: Client methods for farmOS 2.x | farmOS

We also have a farmOS.js library for performing similar API requests using JavaScript: Introduction | farmOS

a report that shows what crops I have, in what locations and what sizes

This API endpoint will give you all your Plant assets: /api/asset/plant

The location field on each asset will summarize where it is currently located.

As for size, that will depend on how/where you are tracking that.

The nice thing about a Python script is it allows for quick experimentation. If you end up making something that’s generally useful, a next step might be to build a module that does the same thing directly in the farmOS UI (via PHP/JS).

Worth noting (in case you or anyone else who finds this thread weren’t aware) that you can also get a lot of the same information directly in the farmOS UI already by going to Records > Assets > Plant (or directly to this path: /assets/plant). This page lists all Plant assets, along with their current location, and has options to filter by crop/variety, season, and more. You can also export the results to CSV.

Thanks - I will try that.

I was interested how other people do this sort of thing as producing lists of current crops and planning seems a fairly fundamental requirement for farming. As the information is all within farmOS it seems a shame to run a tandem spreadsheet.

1 Like

(Although at the time of this writing, there’s a bug with the CSV exports not respecting filter choices… we’re working on that here: https://www.drupal.org/project/farm/issues/3224663)

That sounds great - would it include the location size ?

1 Like

Do you mean the acres/hectares/ft2/m2 of the field they are planted in?

This is not currently included in the /assets/plant list, but I could see that being a useful feature to add!

You can see this information by clicking through to the Plant asset record itself though… The map will display the area of the asset’s polygon.

One thing this does not currently cover is the location of future plantings. The “Location” column will only show current location.

However, this is essentially what the Crop Plan module in v1 provided:

I am eager to get that module ported to v2. All help is welcome! :slight_smile:

I’ve been thinking about a favorite filter or quickfilter if you like…
Very often it’s the same filter beeing used, so a quick way to slecte a saved filter would be nice

2 Likes

That would be a nice feature! In the meantime, a quick tip/shortcut is to save your filtered results as a bookmark in your browser. The filter options are stored in the URL string, so that works!

3 Likes

Where is there best place to post ideas to be included going forward ? the size of the fields in ha would be really useful for the planting asset page. Also to have the site version number next to ‘Powered by FarmOS’ would be useful when comparing what version you are on.

2 Likes

Would help if I could… But I beleve this is above kindergarden level… :stuck_out_tongue:
I’m looking alot forward to this.

1 Like

Where is there best place to post ideas to be included going forward ?

This (the forum) is the best place for general discussions/ideas currently. If someone wants to take on the work to implement something specific, they can work on it in a branch and open a pull request to propose including it. Or they can build it in a separate module that others can download (this has the most freedom for experimentation because it doesn’t need to go through the farmOS core review process/considerations/testing).

Also to have the site version number next to ‘Powered by FarmOS’ would be useful when comparing what version you are on.

Fun fact: we actually did have this in v1 for a short period of time. I ended up deciding to remove it because it felt a bit like a security risk (if someone knew you were running a very old version that had a known security issue they might be able to exploit it). However that’s a pretty low risk I think. And anyway, a bit moot in v2 because…

In v2 we actually DO make the version visible publicly in the /api endpoint in the meta.farm section of the JSON.

That looks similar to what would after. I am guessing that each planting must be specific to one field / bed otherwise it will show up as too many locations.

My coding is not up to much at the moment but if there was something basic and specific……

1 Like

I am guessing that each planting must be specific to one field / bed otherwise it will show up as too many locations.

Actually it handles multiple plants per location - this is a common requirement for interplantings, or splitting a bed up into multiple subsections with multiple crops. The module also had a toggle to organize the timeline “by area” or “by planting”. The screenshot above is “by planting”. Here is what “by area” looks like: