nexosis_api 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,22 @@
1
- module NexosisApi
2
- # Class to parse the metric results of an impact analysis
3
- class ImpactMetric
4
- def initialize(metricHash)
5
- metricHash.each do |k,v|
6
- instance_variable_set("@#{k}", v) unless v.nil?
7
- end
8
- end
9
-
10
- # Statistical value used to determine the significance of the impact.
11
- # @return [Float]
12
- attr_accessor :pValue
13
-
14
- # Total absolute effect of the event on the dataset.
15
- # @return [Float]
16
- attr_accessor :absoluteEffect
17
-
18
- # Percentage impact of the event on the dataset.
19
- # @return [Float]
20
- attr_accessor :relativeEffect
21
- end
22
- end
1
+ module NexosisApi
2
+ # Class to parse the metric results of an impact analysis
3
+ class ImpactMetric
4
+ def initialize(metric_hash)
5
+ metric_hash.each do |k, v|
6
+ instance_variable_set("@#{k}", v) unless v.nil?
7
+ end
8
+ end
9
+
10
+ # Statistical value used to determine the significance of the impact.
11
+ # @return [Float]
12
+ attr_accessor :pValue
13
+
14
+ # Total absolute effect of the event on the dataset.
15
+ # @return [Float]
16
+ attr_accessor :absoluteEffect
17
+
18
+ # Percentage impact of the event on the dataset.
19
+ # @return [Float]
20
+ attr_accessor :relativeEffect
21
+ end
22
+ end
@@ -1,66 +1,66 @@
1
- module NexosisApi
2
- # class to parse results from an imports call
3
- class ImportsResponse
4
- def initialize(response_hash)
5
- response_hash.each do |k,v|
6
- if(k == "importId")
7
- @import_id = v
8
- elsif(k == "requestedDate")
9
- @requested_date = v
10
- elsif(k == "columns")
11
- columns = []
12
- next if v.nil?
13
- v.keys.each do |col_key|
14
- columns << NexosisApi::DatasetColumn.new(col_key, v[col_key])
15
- end
16
- @column_metadata = columns
17
- elsif(k == "links")
18
- links = Array.new
19
- v.each do |l| links << NexosisApi::Link.new(l) end
20
- instance_variable_set("@#{k}", links) unless v.nil?
21
- else
22
- instance_variable_set("@#{k}", v) unless v.nil?
23
- end
24
- end
25
- end
26
-
27
- # The unique identifier for this import request
28
- # @return [String]
29
- attr_accessor :import_id
30
-
31
- # Currently always s3
32
- # @return [String]
33
- attr_accessor :type, :s3
34
-
35
- # The current status of the import request
36
- # @return [String]
37
- # @note The import will be performed in a FIFO queue. Check back on status before attempting to start a session using the dataset.
38
- attr_accessor :status
39
-
40
- # echo back the dataset name provided
41
- # @return [String]
42
- attr_accessor :dataSetName
43
-
44
- # The S3 parameters used to import a dataset
45
- # @return [Hash]
46
- # For an S3 response the keys of this hash should be 'bucket', 'path', and 'region'
47
- attr_accessor :parameters
48
-
49
- # The date of the import request
50
- # @return [DateTime]
51
- attr_accessor :requested_date
52
-
53
- # Additional details. Normally empty.
54
- # @return [Array]
55
- attr_accessor :messages
56
-
57
- # The column descriptors for the data in this session
58
- # will reflect either the metadata sent in, defaults form dataset, or inferred values
59
- # @return[Array of NexosisApi::DatasetColumn]
60
- attr_accessor :column_metadata
61
-
62
- # associated hypermedia
63
- # @return [Array of NexosisApi::Link]
64
- attr_accessor :links
65
- end
66
- end
1
+ module NexosisApi
2
+ # class to parse results from an imports call
3
+ class ImportsResponse
4
+ def initialize(response_hash)
5
+ response_hash.each do |k, v|
6
+ if(k == 'importId')
7
+ @import_id = v
8
+ elsif(k == 'requestedDate')
9
+ @requested_date = v
10
+ elsif(k == 'columns')
11
+ columns = []
12
+ next if v.nil?
13
+ v.keys.each do |col_key|
14
+ columns << NexosisApi::Column.new(col_key, v[col_key])
15
+ end
16
+ @column_metadata = columns
17
+ elsif(k == 'links')
18
+ links = []
19
+ v.each { |l| links << NexosisApi::Link.new(l) }
20
+ instance_variable_set("@#{k}", links) unless v.nil?
21
+ else
22
+ instance_variable_set("@#{k}", v) unless v.nil?
23
+ end
24
+ end
25
+ end
26
+
27
+ # The unique identifier for this import request
28
+ # @return [String]
29
+ attr_accessor :import_id
30
+
31
+ # Currently always s3
32
+ # @return [String]
33
+ attr_accessor :type, :s3
34
+
35
+ # The current status of the import request
36
+ # @return [String]
37
+ # @note The import will be performed in a FIFO queue. Check back on status before attempting to start a session using the dataset.
38
+ attr_accessor :status
39
+
40
+ # echo back the dataset name provided
41
+ # @return [String]
42
+ attr_accessor :dataSetName
43
+
44
+ # The S3 parameters used to import a dataset
45
+ # @return [Hash]
46
+ # For an S3 response the keys of this hash should be 'bucket', 'path', and 'region'
47
+ attr_accessor :parameters
48
+
49
+ # The date of the import request
50
+ # @return [DateTime]
51
+ attr_accessor :requested_date
52
+
53
+ # Additional details. Normally empty.
54
+ # @return [Array]
55
+ attr_accessor :messages
56
+
57
+ # The column descriptors for the data in this session
58
+ # will reflect either the metadata sent in, defaults form dataset, or inferred values
59
+ # @return[Array of NexosisApi::Column]
60
+ attr_accessor :column_metadata
61
+
62
+ # associated hypermedia
63
+ # @return [Array of NexosisApi::Link]
64
+ attr_accessor :links
65
+ end
66
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NexosisApi
4
+ # class to hold a join defintion initialized by a hash of join values
5
+ class Join
6
+ def initialize(join_hash)
7
+ join_hash.each do |k, v|
8
+ if k == 'dataSet'
9
+ @dataset_name = v['name'] unless v.nil?
10
+ elsif k == 'columnOptions'
11
+ @column_options = v unless v.nil?
12
+ elsif k == 'joins'
13
+ joins = []
14
+ next if v.nil?
15
+ v.each do |join|
16
+ joins << NexosisApi::Join.new(join)
17
+ @joins = joins
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ # The name of the dataset that will be participating in the join
24
+ # @return [String] name of the dataset provided for this join
25
+ attr_accessor :dataset_name
26
+
27
+ # The optional column definition for the join which
28
+ # defines how columns should be used from the joined dataset
29
+ # @return [Array of NexosisApi::ColumnOptions] column options definition
30
+ attr_accessor :column_options
31
+
32
+ # Optional additional data source to be joined to this data source
33
+ # @return [Array of NexosisApi::Join] zero or more additional joins
34
+ attr_accessor :joins
35
+
36
+ def to_hash
37
+ hash = {}
38
+ hash['dataSet'] = { name: dataset_name }
39
+ if column_options.nil? == false
40
+ hash['columns'] = {}
41
+ column_options.each do |column|
42
+ hash['columns'].merge!(column.to_hash)
43
+ end
44
+ end
45
+ if joins.nil? == false
46
+ hash['joins'] = []
47
+ joins.each do |join|
48
+ hash['joins'] << join.to_hash
49
+ end
50
+ end
51
+ hash
52
+ end
53
+
54
+ def to_json
55
+ to_hash.to_json
56
+ end
57
+ end
58
+ end
@@ -1,18 +1,18 @@
1
- module NexosisApi
2
- # Class to parse hypermedia resutls
3
- class Link
4
- def initialize(linkHash)
5
- linkHash.each do |k,v|
6
- instance_variable_set("@#{k}", v) unless v.nil?
7
- end
8
- end
9
-
10
- # relation type of the link
11
- # @return [String]
12
- attr_accessor :rel
13
-
14
- # resource url
15
- # @return [String]
16
- attr_accessor :href
17
- end
18
- end
1
+ module NexosisApi
2
+ # Class to parse hypermedia resutls
3
+ class Link
4
+ def initialize(link_hash)
5
+ link_hash.each do |k, v|
6
+ instance_variable_set("@#{k}", v) unless v.nil?
7
+ end
8
+ end
9
+
10
+ # relation type of the link
11
+ # @return [String]
12
+ attr_accessor :rel
13
+
14
+ # resource url
15
+ # @return [String]
16
+ attr_accessor :href
17
+ end
18
+ end
@@ -1,22 +1,22 @@
1
- module NexosisApi
2
- # Class to parse algorithm metrics from model results
3
- class Metric
4
- def initialize(metricHash)
5
- metricHash.each do |k,v|
6
- instance_variable_set("@#{k}", v) unless v.nil?
7
- end
8
- end
9
-
10
- # Friendly name of the metric
11
- # @return [String]
12
- attr_accessor :name
13
-
14
- # Identifier for metric type
15
- # @return [String]
16
- attr_accessor :code
17
-
18
- # Calculated metric
19
- # @return [Float]
20
- attr_accessor :value
21
- end
1
+ module NexosisApi
2
+ # Class to parse algorithm metrics from model results
3
+ class Metric
4
+ def initialize(metric_hash)
5
+ metric_hash.each do |k, v|
6
+ instance_variable_set("@#{k}", v) unless v.nil?
7
+ end
8
+ end
9
+
10
+ # Friendly name of the metric
11
+ # @return [String]
12
+ attr_accessor :name
13
+
14
+ # Identifier for metric type
15
+ # @return [String]
16
+ attr_accessor :code
17
+
18
+ # Calculated metric
19
+ # @return [Float]
20
+ attr_accessor :value
21
+ end
22
22
  end
@@ -1,80 +1,88 @@
1
- module NexosisApi
2
- # Class for parsing the results of a session based request
3
- class Session
4
- def initialize(sessionHash)
5
- sessionHash.each do |k,v|
6
- if(k == "links")
7
- links = Array.new
8
- v.each do |l| links << NexosisApi::Link.new(l) end
9
- instance_variable_set("@#{k}", links) unless v.nil?
10
- elsif(k == "isEstimate")
11
- instance_variable_set("@is_estimate", v) unless v.nil?
12
- elsif(k == "columns")
13
- columns = []
14
- next if v.nil?
15
- v.keys.each do |col_key|
16
- columns << NexosisApi::DatasetColumn.new(col_key, v[col_key])
17
- end
18
- @column_metadata = columns
19
- elsif(k == "resultInterval")
20
- @result_interval = v
21
- else
22
- instance_variable_set("@#{k}", v) unless v.nil?
23
- end
24
- end
25
- end
26
-
27
- # identifier for this sesssion
28
- # @return [String]
29
- attr_accessor :sessionId
30
-
31
- # What type of analysis was run during this session
32
- # @return [String]
33
- attr_accessor :type
34
-
35
- # Is this session requested, estimated, started, or completed
36
- # @return [String]
37
- attr_accessor :status
38
-
39
- # Date and status of each status this session has entered
40
- # @return [Hash]
41
- attr_accessor :statusHistory
42
-
43
- # reserved for future extensions
44
- # @return [Hash]
45
- attr_accessor :extraParameters
46
-
47
- # the dataset used in this session
48
- # @return [String]
49
- attr_accessor :dataSetName
50
-
51
- # The column in the dataset for which this session ran predictions
52
- # @return [String]
53
- attr_accessor :targetColumn
54
-
55
- # The start date of analysis in this session
56
- # @return [DateTime]
57
- attr_accessor :startDate
58
-
59
- # The end date of analysis in this session
60
- # @return [DateTime]
61
- attr_accessor :endDate
62
-
63
- # associated hypermedia
64
- # @return [Array of NexosisApi::Link]
65
- attr_accessor :links
66
-
67
- # Is this session an estimate only session
68
- # @return [Boolean]
69
- attr_accessor :is_estimate
70
-
71
- # The column descriptors for the data in this session
72
- # will reflect either the metadata sent in, defaults form dataset, or inferred values
73
- # @return[Array of NexosisApi::DatasetColumn]
74
- attr_accessor :column_metadata
75
-
76
- # The requested result interval. Default is DAY if none was requested during session creation.
77
- # @return [NexosisApi::TimeInterval]
78
- attr_accessor :result_interval
79
- end
80
- end
1
+ module NexosisApi
2
+ # Class for parsing the results of a session based request
3
+ class Session
4
+ def initialize(sessionHash)
5
+ sessionHash.each do |k,v|
6
+ if(k == 'links')
7
+ links = Array.new
8
+ v.each do |l| links << NexosisApi::Link.new(l) end
9
+ instance_variable_set("@#{k}", links) unless v.nil?
10
+ elsif(k == 'isEstimate')
11
+ instance_variable_set('@is_estimate', v) unless v.nil?
12
+ elsif(k == 'columns')
13
+ columns = []
14
+ next if v.nil?
15
+ v.keys.each do |col_key|
16
+ columns << NexosisApi::Column.new(col_key, v[col_key])
17
+ end
18
+ @column_metadata = columns
19
+ elsif(k == 'resultInterval')
20
+ @result_interval = v
21
+ elsif (k == 'dataSourceName')
22
+ @datasource_name = v
23
+ else
24
+ instance_variable_set("@#{k}", v) unless v.nil?
25
+ end
26
+ end
27
+ end
28
+
29
+ # identifier for this sesssion
30
+ # @return [String]
31
+ attr_accessor :sessionId
32
+
33
+ # What type of analysis was run during this session
34
+ # @return [String]
35
+ attr_accessor :type
36
+
37
+ # Is this session requested, estimated, started, or completed
38
+ # @return [String]
39
+ attr_accessor :status
40
+
41
+ # Date and status of each status this session has entered
42
+ # @return [Hash]
43
+ attr_accessor :statusHistory
44
+
45
+ # reserved for future extensions
46
+ # @return [Hash]
47
+ attr_accessor :extraParameters
48
+
49
+ # the dataset used in this session
50
+ # @return [String]
51
+ # @deprecated - Use the @data_source_name property instead
52
+ attr_accessor :dataSetName
53
+
54
+ # The column in the dataset for which this session ran predictions
55
+ # @return [String]
56
+ attr_accessor :targetColumn
57
+
58
+ # The start date of analysis in this session
59
+ # @return [DateTime]
60
+ attr_accessor :startDate
61
+
62
+ # The end date of analysis in this session
63
+ # @return [DateTime]
64
+ attr_accessor :endDate
65
+
66
+ # associated hypermedia
67
+ # @return [Array of NexosisApi::Link]
68
+ attr_accessor :links
69
+
70
+ # Is this session an estimate only session
71
+ # @return [Boolean]
72
+ attr_accessor :is_estimate
73
+
74
+ # The column descriptors for the data in this session
75
+ # will reflect either the metadata sent in, defaults form dataset, or inferred values
76
+ # @return[Array of NexosisApi::Column]
77
+ attr_accessor :column_metadata
78
+
79
+ # The requested result interval. Default is DAY if none was requested during session creation.
80
+ # @return [NexosisApi::TimeInterval]
81
+ attr_accessor :result_interval
82
+
83
+ # The name of the datasource used to run this session
84
+ # @return [String] - the dataset or view name
85
+ # @since v1.2
86
+ attr_accessor :datasource_name
87
+ end
88
+ end