Class: NexosisApi::DatasetSummary
- Inherits:
-
Object
- Object
- NexosisApi::DatasetSummary
- Defined in:
- lib/nexosis_api/dataset_summary.rb
Overview
class to hold the parsed results of a dataset
Instance Attribute Summary collapse
-
#column_metadata ⇒ Array of NexosisApi::Column
Descriptive information about the columns.
-
#dataset_name ⇒ String
The name of the dataset uploaded and saved.
Instance Method Summary collapse
-
#initialize(data_hash) ⇒ DatasetSummary
constructor
A new instance of DatasetSummary.
-
#timeseries? ⇒ Boolean
Helper method which tells you whether or not this dataset has a column with timestamp role.
Constructor Details
#initialize(data_hash) ⇒ DatasetSummary
Returns a new instance of DatasetSummary.
4 5 6 7 8 9 10 11 12 13 14 15 |
# 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 end end end |
Instance Attribute Details
#column_metadata ⇒ Array of NexosisApi::Column
Descriptive information about the columns
23 24 25 |
# File 'lib/nexosis_api/dataset_summary.rb', line 23 def @column_metadata end |
#dataset_name ⇒ String
The name of the dataset uploaded and saved
19 20 21 |
# File 'lib/nexosis_api/dataset_summary.rb', line 19 def dataset_name @dataset_name 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
29 30 31 |
# File 'lib/nexosis_api/dataset_summary.rb', line 29 def timeseries? !@column_metadata.select { |dc| dc.role == NexosisApi::ColumnRole::TIMESTAMP }.empty? end |