def archived_attribute_by_day(attribute,start_time = DEFAULT_DAYS_START.ago, end_time = DEFAULT_DAYS_END.ago)
      #     hsh = archive_attributes_utc(attribute, start_time, end_time)
      hsh = archive_attributes_utc(attribute, nil, nil)
      # NOTE: hsh essentially contains EVERYTHING so that we can interpolate

      # remove any nil values
      hsh.delete_if{ |k, v| k.nil? || v.nil?}

      ## This is where we limit what's actually returned
      time_x = Time.at( [start_time.to_i, hsh.keys.first.to_i].max).beginning_of_day 
      time_y = Time.at( [(end_time || Time.now).to_i , hsh.keys.last.to_i].min    ).beginning_of_day 
      time_range = time_x..time_y

      days = RailsDateRange(time_range, {days: 1})
      interpolation = Interpolate::Points.new(hsh)

      interpolated_arr = if block_given? 
        yield days, interpolation
      else
        days.map{|d| [Time.at(d).strftime('%Y-%m-%d'), interpolation.at(d.to_i) ] }
      end

      return Hash[interpolated_arr]
    end
def archived_attribute_by_day(attribute,start_time = DEFAULT_DAYS_START.ago, end_time = DEFAULT_DAYS_END.ago)
      #     hsh = archive_attributes_utc(attribute, start_time, end_time)
      hsh = archive_attributes_utc(attribute, nil, nil)
      # NOTE: hsh essentially contains EVERYTHING so that we can interpolate

      # remove any nil values
      hsh.delete_if{ |k, v| k.nil? || v.nil?}

      ## This is where we limit what's actually returned
      time_x = Time.at( [start_time.to_i, hsh.keys.first.to_i].max).beginning_of_day 
      time_y = Time.at( [(end_time || Time.now).to_i , hsh.keys.last.to_i].min    ).beginning_of_day 
      time_range = time_x..time_y

      days = RailsDateRange(time_range, {days: 1})
      interpolation = Interpolate::Points.new(hsh)

      interpolated_arr = if block_given? 
        yield days, interpolation
      else
        days.map{|d| [Time.at(d).strftime('%Y-%m-%d'), interpolation.at(d.to_i) ] }
      end

      return Hash[interpolated_arr]
    end
NO
 def archived_attribute_with_filled_days(attribute, start_time = DEFAULT_DAYS_START.ago, end_time = DEFAULT_DAYS_END.ago)
   hsh = archived_attribute(attribute, start_time, end_time)
   # if start_time or end_time is nil, then we have to set them to what hsh found
   unless hsh.empty? # unconfident code?
     start_time = Time.parse hsh.keys.first if start_time.nil?
     end_time = Time.parse hsh.keys.last if end_time.nil?
   end
   nhsh = {}
   # contains the entire date range, as the archived_attribute may be missing some days
   RailsDateRange(start_time..end_time, {days: 1}) do |val|
     day_val = val.strftime '%Y-%m-%d'
     nhsh[day_val] = hsh[day_val]
   end
   return nhsh
 end