Rothamsted-Ecoinformatics / farm_rothamsted

Custom farmOS features for Rothamsted Research.
GNU General Public License v2.0
6 stars 1 forks source link

Automatically archive plot assets associated with an experiment plan #68

Open aislinnpearson opened 2 years ago

aislinnpearson commented 2 years ago

Following on from the comments in #38 the first implementation of the experiment module does not automatically archive the plot assets associated with an experiment plan. Currently this would be a manual process that can be done in bulk, but still a manual step. This addresses that issue

The "Experiment Surrounds" Land assets that are being generated alongside the plots would ideally be archived at the same time, but to do this they need to be added to the Asset reference field on Experiment plans currently. This needs to be considered in the same issue.

paul121 commented 2 years ago

To answer @mstenta question in https://github.com/Rothamsted-Ecoinformatics/farm_rothamsted/issues/38#issuecomment-996722050:

One missing piece with the asset archiving, however, is the new "Experiment Surrounds" Land assets that are being generated. @paul121 @barnabynorman are these being added to the Asset reference field on Experiment plans currently? Or are they just created and not referenced? If they are not referenced, then in order to ensure they also get archived, they either should be referenced (but will that mess up any other logic I wonder?), or there would need to be some custom logic to archive them automatically when the plan is archived. This should be considered in the same issue I think.

Yes, these "Experiment Surrounds" are being referenced in the experiment plans plan.asset field! There isn't an issue with logic right now - our views of plots filter to only include plot assets. Maybe this will need to change in the future, in which case we might want a dedicated plan.surrounds reference fields.

But as is, all we need to do for this archive feature is to loop through and archive all assets reference by the plan.

aislinnpearson commented 2 years ago

I've just realised that this issue is linked to https://github.com/Rothamsted-Ecoinformatics/farm_rothamsted/issues/54#issuecomment-985571590

In summary, we agreed that any action which is applied to all plots at the same time, in the same way (e.g. all plots are ploughed where ploughing is not a treatment) should be assigned to the Experiment Surrounds to avoid creating thousands of records where there is a large number of plots.

This makes m think maybe we should have two assets: plan.surrounds (literally the grass between the plots) and plan.area which is the area of the experiment and can be used specifically for management actions which are applied to the plots but are not treatments? These areas would also have different geometries - the plan area would be a compulsory geometry, but the plan surrounds would be optional (you'd only really need to load this for long term experiments, or where your surrounds are grouped by management type - for example the fallow areas on the LSRE vs the grass verges).