coralnet
coralnet copied to clipboard
Ability to use multiple tables in a single calcification-rate export
At export time, provide a user interface to define rules specifying which rate tables get applied to which images.
This task would unlock the full potential of #388 (multiple custom tables), but the two tasks don't necessarily have to both be implemented. If this is implemented without #388, then you would still be able to specify the default Atlantic table for one image set and the default Indo-Pacific table for another image set, and that's already pretty useful.
I think for the best balance of simplicity and generality, we would define the rules using the 5 auxiliary image-metadata fields. Source owners can already use these 5 fields to filter images in the source in any way. For example, perhaps we have a source where the first auxiliary field (let's call it aux1) can take on two possible values, Atlantic or Indo-Pacific. Then the rules can be of the format: "If the image's aux1 value is Atlantic, use the Atlantic table. Otherwise, use the Indo-Pacific table."
In general, the rules would be of the format:
- Condition 1 on aux. metadata fields
- Table to use when condition 1 is met
- Condition 2 on aux. metadata fields
- Table to use when condition 2 (but not 1) is met
- ...
- Fallback table to use when none of the above conditions are met
These rules must be encoded/serialized somehow and then passed to the export procedure. Perhaps the rules should also be saved to the database so we can re-use the rules for future exports (and for #376, incremental summary updates). Designing that encoding/serialization can be a bit of a challenge.
There has to be a user interface for specifying the rules in the first place, which can also be a challenge. Each condition would probably comprise of a dropdown where you select aux1 through aux5, and a text field where you specify the value to match (like "Atlantic"). Then the table selection is also a dropdown, listing CoralNet's default tables and any user-defined tables. You'd be able to add an arbitrary number of pairs of condition + table fields, perhaps up to a reasonable limit though. Then the fallback table field is always there, another dropdown.
To make things even more general, each condition could potentially be a conjunction of values, such as "if aux1 = value1 AND aux2 = value2" - but I'm not sure how useful that would be, so maybe it's not worth the complexity.