anchor.diff:  %% @end
   -spec stop() -> crash.
   stop() ->
  -        eri:stop().
  +	eri:stop().
   
   
   %% @doc
  
positive.code: %% @end        
  -spec forecast(JSON::string(), Nr::integer()) -> JSON::string().
  forecast(Json, Nr) ->
      eri:eval("library(forecast)"),
      case get_time_series(Json) of
          no_values ->
              "{\"predictions\": []}";
          Values ->
              eri:eval("V <- " ++ Values),
              eri:eval("A <- auto.arima(V)"),
              eri:eval("pred <- forecast(A, "++ Nr ++ ")"),
              {ok, _, Mean} = eri:eval("data.frame(c(pred$mean))[[1]]"),
              {ok, _, Lo80} = eri:eval("head(data.frame(c(pred$lower))[[1]], " ++ Nr ++")"),
              {ok, _, Hi80} = eri:eval("head(data.frame(c(pred$upper))[[1]], " ++ Nr ++")"),
              {ok, _, Lo95} = eri:eval("tail(data.frame(c(pred$lower))[[1]], " ++ Nr ++")"),
              {ok, _, Hi95} = eri:eval("tail(data.frame(c(pred$upper))[[1]], " ++ Nr ++")"),
              %eri:eval("rm(list = ls())"),
              start_format_result({Mean, Lo80, Hi80, Lo95, Hi95})
      end.
  
  
  %% @doc
  
negative.code: 			end;
  		StreamId ->
  			NrValues = case wrq:get_qs_value("nr_values",ReqData) of
  								   undefined ->
  									   50;
  								   Values ->
  									   {Value,_} = string:to_integer(Values),
  									   if 
  										   Value > 500 ->
  											   500;
  										   Value < 3 ->
  											   3;
  										   true ->
  											   Value 
  									   end
  							   end,
  			NrPredictions = case wrq:get_qs_value("nr_preds",ReqData) of
  								undefined ->
  									"25";
  								Predictions ->
  									{Preds,_} = string:to_integer(Predictions),
  									if 
  										Preds > 500 ->
  											"500";
  										Preds < 1 ->
  											"1";
  										true ->
  											Predictions 
  									end
  							
  							end,
  			case erlastic_search:search_limit(?INDEX, "datapoint","stream_id:" ++ StreamId ++ "&sort=timestamp:desc", NrValues) of
  				%case erlastic_search:search_json(#erls_params{}, ?INDEX, "datapoint", create_json(StreamId), []) of
  