Amazon Forecast Query Service

2019/08/21 - Amazon Forecast Query Service - 1 new api methods

Changes  Update forecastquery client to latest version

QueryForecast (new) Link ΒΆ

Retrieves a forecast filtered by the supplied criteria.

The criteria is a key-value pair. The key is either item_id (or the equivalent non-timestamp, non-target field) from the TARGET_TIME_SERIES dataset, or one of the forecast dimensions specified as part of the FeaturizationConfig object.

By default, the complete date range of the filtered forecast is returned. Optionally, you can request a specific date range within the forecast.

See also: AWS API Documentation

Request Syntax

client.query_forecast(
    ForecastArn='string',
    StartDate='string',
    EndDate='string',
    Filters={
        'string': 'string'
    },
    NextToken='string'
)
type ForecastArn:

string

param ForecastArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the forecast to query.

type StartDate:

string

param StartDate:

The start date for the forecast. Specify the date using this format: yyyy-MM-dd'T'HH:mm:ss'Z' (ISO 8601 format) For example, "1970-01-01T00:00:00Z."

type EndDate:

string

param EndDate:

The end date for the forecast. Specify the date using this format: yyyy-MM-dd'T'HH:mm:ss'Z' (ISO 8601 format). For example, "1970-01-01T00:00:00Z."

type Filters:

dict

param Filters:

[REQUIRED]

The filtering criteria to apply when retrieving the forecast. For example:

  • To get a forecast for a specific item specify the following: {"item_id" : "client_1"}

  • To get a forecast for a specific item sold in a specific location, specify the following: {"item_id" : "client_1", "location" : "ny"}

  • To get a forecast for all blue items sold in a specific location, specify the following: { "location" : "ny", "color":"blue"}

To get the full forecast, use the operation.

  • (string) --

    • (string) --

type NextToken:

string

param NextToken:

If the result of the previous request was truncated, the response includes a NextToken. To retrieve the next set of results, use the token in the next request. Tokens expire after 24 hours.

rtype:

dict

returns:

Response Syntax

{
    'Forecast': {
        'Predictions': {
            'string': [
                {
                    'Timestamp': 'string',
                    'Value': 123.0
                },
            ]
        }
    }
}

Response Structure

  • (dict) --

    • Forecast (dict) --

      The forecast.

      • Predictions (dict) --

        The forecast.

        The string of the string to array map is one of the following values:

        • mean

        • p10

        • p50

        • p90

        • (string) --

          • (list) --

            • (dict) --

              The forecast value for a specific date. Part of the Forecast object.

              • Timestamp (string) --

                The timestamp of the specific forecast.

              • Value (float) --

                The forecast value.