anchor.diff:  		{error, Reason} -> {{error,Reason}, wrq:set_resp_body("{\"error\":\""++ atom_to_list(Reason) ++ "\"}", ReqData), State};
   		{ok,JsonStruct} ->
   			DatapointsList = lib_json:get_field(JsonStruct, "facets.statistics.entries"),
  -			NewDatapoints = lists:map(fun(Json) -> 
  +			NewDatapoints = lists:map(fun(Json) ->
   											FinalDatapoint = lib_json:set_attrs([
   																				{"timestamp", list_to_atom(msToDate(lib_json:get_field(Json, "key")))},
   																				{"stream_id", VirtualStreamId},
  
positive.code: %% Returns: {[{Mediatype, Handler}], ReqData, State}
  %% @end
  -spec content_types_accepted(ReqData::term(),State::term()) -> {list(), term(), term()}.
  
  content_types_accepted(ReqData, State) ->
  	{[{"application/json", put_stream}], ReqData, State}.
  
  
  %% @doc
  %% Function: process_post/2
  %% Purpose: decodes a JSON object and creates a virtual stream that aggregates 
  %% streams using a function
  %% It is run automatically for POST requests
  %% Returns: {true, ReqData, State} || {{error, Reason}, ReqData, State}
  
negative.code: %%   [www.csproj13.student.it.uu.se]
  %% @version 1.0
  %% @copyright [Copyright information]
  %% This module will contain all functions needed to handle
  %% http requests done to the webmachine regarding virtual streams
  %%
  %% @end
  
  -module(virtual_streams).
  -export([init/1,
  		 allowed_methods/2,
  		 content_types_provided/2,
  		 content_types_accepted/2,
  		 process_post/2,
  		 process_search/3,
  		 put_stream/2,
  		 delete_resource/2,
  		 get_vstream/2]).
  
  -include_lib("erlastic_search.hrl").
  