blazer 2.4.2 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of blazer might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +19 -3
- data/app/assets/javascripts/blazer/Chart.js +14000 -13979
- data/app/assets/stylesheets/blazer/application.css +4 -0
- data/lib/blazer/data_source.rb +5 -3
- data/lib/blazer/result.rb +13 -1
- data/lib/blazer/version.rb +1 -1
- data/lib/generators/blazer/templates/config.yml.tt +2 -2
- metadata +3 -3
data/lib/blazer/data_source.rb
CHANGED
@@ -144,6 +144,7 @@ module Blazer
|
|
144
144
|
|
145
145
|
def adapter_instance
|
146
146
|
@adapter_instance ||= begin
|
147
|
+
# TODO add required settings to adapters
|
147
148
|
unless settings["url"] || Rails.env.development? || ["bigquery", "athena", "snowflake", "salesforce"].include?(settings["adapter"])
|
148
149
|
raise Blazer::Error, "Empty url for data source: #{id}"
|
149
150
|
end
|
@@ -182,11 +183,12 @@ module Blazer
|
|
182
183
|
Blazer::Result.new(self, columns, rows, error, nil, cache && !cache_data.nil?)
|
183
184
|
end
|
184
185
|
|
186
|
+
# TODO check for adapter with same name, default to sql
|
185
187
|
def detect_adapter
|
186
|
-
|
187
|
-
case
|
188
|
+
scheme = settings["url"].to_s.split("://").first
|
189
|
+
case scheme
|
188
190
|
when "mongodb", "presto", "cassandra", "ignite"
|
189
|
-
|
191
|
+
scheme
|
190
192
|
else
|
191
193
|
"sql"
|
192
194
|
end
|
data/lib/blazer/result.rb
CHANGED
@@ -174,7 +174,19 @@ module Blazer
|
|
174
174
|
def anomaly?(series)
|
175
175
|
series = series.reject { |v| v[0].nil? }.sort_by { |v| v[0] }
|
176
176
|
|
177
|
-
|
177
|
+
case Blazer.anomaly_checks
|
178
|
+
when "prophet"
|
179
|
+
df = Rover::DataFrame.new(series[0..-2].map { |v| {"ds" => v[0], "y" => v[1]} })
|
180
|
+
m = Prophet.new(interval_width: 0.99)
|
181
|
+
m.logger.level = ::Logger::FATAL # no logging
|
182
|
+
m.fit(df)
|
183
|
+
future = Rover::DataFrame.new(series[-1..-1].map { |v| {"ds" => v[0]} })
|
184
|
+
forecast = m.predict(future).to_a[0]
|
185
|
+
lower = forecast["yhat_lower"]
|
186
|
+
upper = forecast["yhat_upper"]
|
187
|
+
value = series.last[1]
|
188
|
+
value < lower || value > upper
|
189
|
+
when "trend"
|
178
190
|
anomalies = Trend.anomalies(Hash[series])
|
179
191
|
anomalies.include?(series.last[0])
|
180
192
|
else
|
data/lib/blazer/version.rb
CHANGED
@@ -63,11 +63,11 @@ check_schedules:
|
|
63
63
|
|
64
64
|
# enable anomaly detection
|
65
65
|
# note: with trend, time series are sent to https://trendapi.org
|
66
|
-
# anomaly_checks: trend / r
|
66
|
+
# anomaly_checks: prophet / trend / r
|
67
67
|
|
68
68
|
# enable forecasting
|
69
69
|
# note: with trend, time series are sent to https://trendapi.org
|
70
|
-
# forecasting:
|
70
|
+
# forecasting: prophet / trend
|
71
71
|
|
72
72
|
# enable map
|
73
73
|
# mapbox_access_token: <%%= ENV["MAPBOX_ACCESS_TOKEN"] %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blazer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
225
|
- !ruby/object:Gem::Version
|
226
226
|
version: '0'
|
227
227
|
requirements: []
|
228
|
-
rubygems_version: 3.2.
|
228
|
+
rubygems_version: 3.2.22
|
229
229
|
signing_key:
|
230
230
|
specification_version: 4
|
231
231
|
summary: Explore your data with SQL. Easily create charts and dashboards, and share
|