The analysistools module provides a toolkit to standardize interaction with external modeling/analysis software.
Eventually this will include:
Note
Why call it analysistools instead of simply analysis? That namespace conflicts with some other third party projects and we strive to play nice with existing software.
If your feature does not take a user-input geometry (only input parameters) and/or requires some significant processing on the server in order to populate certain fields (geometry or otherwise), then you could probably benefit from the analysistools goodies.
Here is a barebones Analysis feature. Notice that the input_ and output_ field names are significant; the user will provide the inputs and the run() method (called when the feature save() method is fired off) which will take the input parameters and populate the output fields:
from madrona.analysistools.models import Analysis
class SumABAnalysis(Analysis):
input_a = models.IntegerField()
input_b = models.IntegerField()
output_sum = models.IntegerField(blank=True, null=True)
def run(self):
self.output_sum = self.input_a + self.input_b
The save() method takes a rerun=True/False boolean kwarg so you can override the save() method to only call run() when appropriate.
There is also a .done property (is the async process completed?) and kml_working and kml_done properties to specify the kml representation in the case that the async process is still running or is completed.