nexosis_api 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nexosis_api/algorithm_run.rb +3 -3
- data/lib/nexosis_api/client.rb +3 -0
- data/lib/nexosis_api/client/datasets.rb +10 -10
- data/lib/nexosis_api/client/sessions.rb +11 -4
- data/lib/nexosis_api/column_role.rb +13 -0
- data/lib/nexosis_api/column_type.rb +13 -0
- data/lib/nexosis_api/dataset_column.rb +24 -0
- data/lib/nexosis_api/dataset_summary.rb +11 -0
- data/nexosisapi.gemspec +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8033e80ad77a8aaef047705b4226f4cf35004d53
|
4
|
+
data.tar.gz: b6d345887506671863f2f663add52ef4d5204363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea20e9e26d1454e9a32ff6a00bb6fd0a735c98e53571cebaa4db1a8fe285b205cebdc710f887e07ecb8303effbf5bc0f3084892eda224799eedd1c671742bcc3
|
7
|
+
data.tar.gz: e84c69d46be15bef19aeed3728b9b559c45877739cd152136124a1754b91eb22e66202b70c44aa6dce93cf63fa25cdcdb2f759da5cb25f91cdbc9a975be869be
|
@@ -18,15 +18,15 @@ module NexosisApi
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# Identifier of algorithm run
|
21
|
-
#
|
21
|
+
# @return [NexosisApi::Algorithm]
|
22
22
|
attr_accessor :algorithm
|
23
23
|
|
24
24
|
# Set of {NexosisApi::Metric} on algorithm
|
25
|
-
#
|
25
|
+
# @return [Array]
|
26
26
|
attr_accessor :metrics
|
27
27
|
|
28
28
|
# Relevant hypermedia as {NexosisApi::Link}
|
29
|
-
#
|
29
|
+
# @return [Array]
|
30
30
|
attr_accessor :links
|
31
31
|
end
|
32
32
|
end
|
data/lib/nexosis_api/client.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'nexosis_api/algorithm_run'
|
2
2
|
require 'nexosis_api/algorithm_selection'
|
3
3
|
require 'nexosis_api/algorithm'
|
4
|
+
require 'nexosis_api/column_role'
|
5
|
+
require 'nexosis_api/column_type'
|
6
|
+
require 'nexosis_api/dataset_column'
|
4
7
|
require 'nexosis_api/dataset_data'
|
5
8
|
require 'nexosis_api/dataset_model'
|
6
9
|
require 'nexosis_api/dataset_summary'
|
@@ -84,14 +84,14 @@ module NexosisApi
|
|
84
84
|
|
85
85
|
# Remove data from a data set or the entire set.
|
86
86
|
#
|
87
|
-
# @param
|
87
|
+
# @param dataset_name [String] the name of the dataset from which to remove data
|
88
88
|
# @param filter_options [Hash] filtering which data to remove
|
89
|
-
# @Options
|
90
|
-
# start_date - the first date on which to start removing data
|
91
|
-
# end_date - the last date on which to finish removing data
|
92
|
-
# cascade_forecast - will cascade deletes to all related forecasts
|
93
|
-
# cascade_sessions - will cascade deletes to all related sessions
|
94
|
-
# cascade - will cascade deletes to all related forecasts and sessions
|
89
|
+
# @note Options: start_date, end_date, cascade_forecast, cascade_sessions, cascade
|
90
|
+
# - start_date - the first date on which to start removing data
|
91
|
+
# - end_date - the last date on which to finish removing data
|
92
|
+
# - cascade_forecast - will cascade deletes to all related forecasts
|
93
|
+
# - cascade_sessions - will cascade deletes to all related sessions
|
94
|
+
# - cascade - will cascade deletes to all related forecasts and sessions
|
95
95
|
# @example - request delete with cascade forecast
|
96
96
|
# NexosisApi.client.remove_dataset('mydataset', {:cascade_forecast => true})
|
97
97
|
def remove_dataset(dataset_name, filter_options = {})
|
@@ -155,11 +155,11 @@ module NexosisApi
|
|
155
155
|
"startDate" => options[:start_date].to_s,
|
156
156
|
"endDate" => options[:end_date].to_s,
|
157
157
|
"page" => options[:page_number],
|
158
|
-
"pageSize" => options[:page_size]
|
159
|
-
"include" => options[:include].to_s
|
158
|
+
"pageSize" => options[:page_size]
|
160
159
|
}
|
160
|
+
query["include"] = options[:include].to_s unless options[:include].nil?
|
161
|
+
query
|
161
162
|
end
|
162
|
-
|
163
163
|
end
|
164
164
|
end
|
165
165
|
end
|
@@ -11,13 +11,20 @@ module NexosisApi
|
|
11
11
|
#
|
12
12
|
# @param query_options [Hash] optionally provide query parameters to limit the search of sessions.
|
13
13
|
# @return[Array of NexosisApi::SessionResponse] with all sessions matching the query or all if no query
|
14
|
-
# @note query parameters hash members are dataset_name, event_name,
|
15
|
-
#
|
14
|
+
# @note query parameters hash members are dataset_name, event_name, requested_before_date, and requested_after_date.
|
15
|
+
# After and before dates refer to the session requested date.
|
16
16
|
# @example query for just one dataset
|
17
17
|
# sessions = NexosisApi.client.list_sessions :dataset_name => 'MyDataset'
|
18
18
|
def list_sessions(query_options = {})
|
19
19
|
sessions_url = '/sessions'
|
20
|
-
|
20
|
+
query = {
|
21
|
+
"dataSetName" => query_options[:dataset_name],
|
22
|
+
"eventName" => query_options[:event_name],
|
23
|
+
"requestedAfterDate" => query_options[:requested_after_date],
|
24
|
+
"requestedBeforeDate" => query_options[:requested_before_date],
|
25
|
+
"type" => query_options[:type]
|
26
|
+
}
|
27
|
+
response = self.class.get(sessions_url, :headers => @headers, :query => query)
|
21
28
|
if(response.success?)
|
22
29
|
all_responses = []
|
23
30
|
response.parsed_response["items"].each do |session_hash|
|
@@ -188,12 +195,12 @@ module NexosisApi
|
|
188
195
|
def create_session(dataset_name, target_column, start_date, end_date, is_estimate=false, event_name = nil, type = "forecast", content = nil, content_type = "text/csv")
|
189
196
|
session_url = "/sessions/#{type}"
|
190
197
|
query = {
|
191
|
-
"dataSetName" => dataset_name,
|
192
198
|
"targetColumn" => target_column,
|
193
199
|
"startDate" => start_date.to_s,
|
194
200
|
"endDate" => end_date.to_s,
|
195
201
|
"isestimate" => is_estimate.to_s
|
196
202
|
}
|
203
|
+
query["dataSetName"] = dataset_name.to_s unless dataset_name.to_s.empty?
|
197
204
|
if(event_name.nil? == false)
|
198
205
|
query["eventName"] = event_name
|
199
206
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module NexosisApi
|
2
|
+
# Constants for dataset column role
|
3
|
+
module ColumnRole
|
4
|
+
# No specific role, additional data which could be identified as target in a session
|
5
|
+
NONE = :none
|
6
|
+
# The timestamp column to use as the basis for a time-series session request
|
7
|
+
TIMESTAMP = :timestamp
|
8
|
+
# The target column for which to make predictions
|
9
|
+
TARGET = :target
|
10
|
+
# A feature to be included in analysis
|
11
|
+
FEATURE = :feature
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module NexosisApi
|
2
|
+
# Constants for column data type
|
3
|
+
module ColumnType
|
4
|
+
# contains string data
|
5
|
+
STRING = :string
|
6
|
+
# contains numeric data
|
7
|
+
NUMERIC = :numeric
|
8
|
+
# contains boolean logical data (i.e. 1 and 0, true and false, etc.)
|
9
|
+
LOGICAL = :logical
|
10
|
+
# contains ISO-8601 compatible date
|
11
|
+
DATE = :date
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module NexosisApi
|
2
|
+
# class to hold the parsed results of a dataset column
|
3
|
+
class DatasetColumn
|
4
|
+
def initialize(column_name, value_hash)
|
5
|
+
@name = column_name
|
6
|
+
@type = NexosisApi::ColumnType.const_get(value_hash["dataType"].upcase)
|
7
|
+
@role = NexosisApi::ColumnRole.const_get(value_hash["role"].upcase)
|
8
|
+
end
|
9
|
+
# The column header, label, or name
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :name
|
12
|
+
|
13
|
+
|
14
|
+
# The data type of this column
|
15
|
+
# @note Either string, numeric, logical, or date
|
16
|
+
# @return [NexosisApi::ColumnType]
|
17
|
+
attr_accessor :type
|
18
|
+
|
19
|
+
# The role of this column
|
20
|
+
# @note Either none, timestamp, target, or feature
|
21
|
+
# @return [NexosisApi::ColumnRole]
|
22
|
+
attr_accessor :role
|
23
|
+
end
|
24
|
+
end
|
@@ -5,11 +5,22 @@ module NexosisApi
|
|
5
5
|
data_hash.each do |k,v|
|
6
6
|
if(k == "dataSetName")
|
7
7
|
@dataset_name = v unless v.nil?
|
8
|
+
elsif(k == "columns")
|
9
|
+
columns = []
|
10
|
+
next if v.nil?
|
11
|
+
v.keys.each do |col_key|
|
12
|
+
columns << NexosisApi::DatasetColumn.new(col_key, v[col_key])
|
13
|
+
end
|
14
|
+
@column_metadata = columns
|
8
15
|
end
|
9
16
|
end
|
10
17
|
end
|
11
18
|
|
12
19
|
# The name of the dataset uploaded and saved
|
13
20
|
attr_accessor :dataset_name
|
21
|
+
|
22
|
+
# Descriptive information about the columns
|
23
|
+
# @return [Array of NexosisApi::DatasetColumn]
|
24
|
+
attr_accessor :column_metadata
|
14
25
|
end
|
15
26
|
end
|
data/nexosisapi.gemspec
CHANGED
@@ -16,6 +16,6 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.require_paths = ['lib']
|
17
17
|
spec.required_ruby_version = '>= 2.0.0'
|
18
18
|
spec.summary = "Ruby client for working with the Nexosis API"
|
19
|
-
spec.version = '1.0.
|
19
|
+
spec.version = '1.0.1'
|
20
20
|
spec.metadata["yard.run"] = "yri"
|
21
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexosis_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nexosis,Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,9 @@ files:
|
|
52
52
|
- lib/nexosis_api/client.rb
|
53
53
|
- lib/nexosis_api/client/datasets.rb
|
54
54
|
- lib/nexosis_api/client/sessions.rb
|
55
|
+
- lib/nexosis_api/column_role.rb
|
56
|
+
- lib/nexosis_api/column_type.rb
|
57
|
+
- lib/nexosis_api/dataset_column.rb
|
55
58
|
- lib/nexosis_api/dataset_data.rb
|
56
59
|
- lib/nexosis_api/dataset_model.rb
|
57
60
|
- lib/nexosis_api/dataset_summary.rb
|