I am managing a farm ijn north africa and i did go acorss this great project. I did implement it to manage my farm (corp & live stock) but what i am missing is to be able to have a custom report for exconomic analysis. Below a simple use case
Given Cow A:logs :
-300$ food for the month
-100$ medical care for the month
-Did produce 100L of milk per day
=>I wan to have an analysis view to see the cost per L of milk for a specific Month
Is there any way or module to help me do this kind of “simple” computation or i can only relay on exporting data and then using excel to compute an analysis view
The first step is to establish your “standard convention” for recording the data you will need to compute those reports. Are you logging those records already, or do you need help thinking though the best way to do it?
Once you have the data, there are a few options:
Export to CSV and analyze in a spreadsheet (as you described) - This is the easiest because it doesn’t require any programming.
Build a custom farmOS module to add a custom report directly to the farmOS UI. This requires knowledge of Drupal module development (PHP), but provides the ultimate experience because you can view your reports directly in farmOS.
Since farmOS v2 was just released (on Jan 1) there aren’t any “built-in” reports yet - but I think it’s just a matter of time (and contributors!) before we see more reporting modules available to install.
For example, the “Animal Weight Report” module that was included with farmOS v1 is currently in development here: farmOS Animal Weight | Drupal.org
Thank you @mstenta for this clear and fast response.
I will defently have to establish the data “standard convention”.
For the report i think i will try with python using jupyterLite as a strater.
Great! If you make something useful with JupyterLite please share in that thread! It’s an exciting option and offers the ability for “shareable” notebooks!
I’m working on querying data with Jupyter notebook from FarmOS logs and need some guidance on retrieving the quantities associated with specific logs (e.g., harvest quantities, input quantities, etc.).
I’ve been exploring the API and the different ways to access logs but can’t seem to figure out how to specifically query the quantities stored within the logs. Does anyone have experience with this? Is there a particular method or query format I should be using to extract these quantities?
Any tips or examples would be greatly appreciated!
One “trick” you can use with the API is to add ?include=quantity to your /api/log/[type] query (eg: /api/log/harvest?include=quantity). This will add a new section at the bottom of the JSON called included which contains all of the quantity records that are referenced by the log records.
Quantities are technically their own “objects” that are attached to logs, which is why you don’t see all of their data in the log API. You can query quantities separately via their own endpoints like /api/quantity/standard. Logs reference quantities by their UUID in the log’s relationships.quantity property.
That’s how you do it via the JSON API. If you are interested in building a report directly in farmOS, you can do so by writing a module (with PHP) that utilizes Drupal’s Entity API or Views to query the data you want. You can also write raw SQL queries, but that isn’t generally recommended. Drupal manages the database tables/relationships behind the scenes and provides APIs on top for fetching data in standard ways.