1.80 Predictors

A predictor allows you to generate data values based on an expression. This can be used to generate targets, thresholds and estimated values. You can interact with predictors through the /api/26/predictors resource.

/api/26/predictors

1.80.1 Creating a predictor

You can create a predictor with a POST request to the predictors resource:

POST /api/26/predictors

A sample payload looks like this:

{
    "id": "AG10KUJCrRk",
    "name": "Malaria Outbreak Threshold Predictor",
    "shortName": "Malaria Outbreak Predictor",
    "description": "Computes the threshold for potential malaria outbreaks based on the mean plus 1.5x the std dev",
    "output": {
        "id": "nXJJZNVAy0Y"
    },
    "generator": {
        "expression": "AVG(#{r6nrJANOqMw})+1.5*STDDEV(#{r6nrJANOqMw})",
        "dataElements": [],
        "sampleElements": [{
            "id": "r6nrJANOqMw"
        }]
    },
    "periodType": "Monthly",
    "sequentialSampleCount": 4,
    "sequentialSkipCount": 1,
    "annualSampleCount": 3,
    "organisationUnitLevels": [4]
}

The output element refers to the identifier of the data element for which to saved predicted data values. The generator element refers to the expression to use when calculating the predicted values.

1.80.2 Generating predicted values

To run all predictors (generating predicted values) you can make a POST request to the run resource:

POST /api/26/predictors/run

To run a single predictor you can make a POST request to the run resource for a predictor:

POST /api/26/predictors/AG10KUJCrRk/run