Class: NexosisApi::DatasetSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/nexosis_api/dataset_summary.rb

Overview

class to hold the parsed results of a dataset

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_hash) ⇒ DatasetSummary

Returns a new instance of DatasetSummary.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/nexosis_api/dataset_summary.rb', line 4

def initialize(data_hash)
  data_hash.each do |k, v|
    if (k == 'dataSetName')
      @dataset_name = v unless v.nil?
    elsif (k == 'columns')
      @column_metadata = v.reject { |_key, value| value.nil? }
                          .map do |col_key, col_val|
                            NexosisApi::Column.new(col_key, col_val)
                          end
    elsif (k == 'dataSetSize')
      @dataset_size = v.to_i
    elsif (k == 'links')
      @links = v.reject(&:nil?).map { |l| NexosisApi::Link.new(l) }
    end
  end
end

Instance Attribute Details

#column_metadataArray of NexosisApi::Column

Descriptive information about the columns

Returns:



27
28
29
# File 'lib/nexosis_api/dataset_summary.rb', line 27

def 
  @column_metadata
end

#dataset_nameString

The name of the dataset uploaded and saved

Returns:

  • (String)


23
24
25
# File 'lib/nexosis_api/dataset_summary.rb', line 23

def dataset_name
  @dataset_name
end

#dataset_sizeInteger (readonly)

number of estimated bytes required to store the dataset

Returns:

  • (Integer)

Since:

  • 2.3.0



32
33
34
# File 'lib/nexosis_api/dataset_summary.rb', line 32

def dataset_size
  @dataset_size
end

Helpful links to more information about this dataset

Returns:

Since:

  • 2.3.0



37
38
39
# File 'lib/nexosis_api/dataset_summary.rb', line 37

def links
  @links
end

Instance Method Details

#timeseries?Boolean

Note:

Often helpful for implmenters as non-timeseries datasets

Helper method which tells you whether or not this dataset has a column with timestamp role. cannot be sent to forecast or impact sessions

Returns:

  • (Boolean)

Since:

  • 1.3.0



43
44
45
# File 'lib/nexosis_api/dataset_summary.rb', line 43

def timeseries?
  !@column_metadata.select { |dc| dc.role == NexosisApi::ColumnRole::TIMESTAMP }.empty?
end