<commit_before>require 'sinatra/base'
require 'blocktrain'
require 'json'

Dotenv.load

module SirHandel
  class App < Sinatra::Base
    set :public_folder, 'public'

    get '/' do
      @content = '<h1>Hello from TubePi</h1>'
      @title = 'TubePi'
      erb :index, layout: :default
    end

    get '/signal' do
      protected!
      @signals = Blocktrain::Lookups.instance.lookups
      erb :weight, layout: :default
    end

    get '/signal.json' do
      protected!

      content_type :json
      headers 'Access-Control-Allow-Origin' => '*'

      search = {
        from: params.fetch('from', '2015-09-01 00:00:00Z'),
        to: params.fetch('to', '2015-09-02 00:00:00Z'),
        interval: params.fetch('interval', '1h'),
        signals: 'train_speed'<commit_msg>Get aliases rather than just lookups<commit_after>require 'sinatra/base'
require 'blocktrain'
require 'json'

Dotenv.load

module SirHandel
  class App < Sinatra::Base
    set :public_folder, 'public'

    get '/' do
      @content = '<h1>Hello from TubePi</h1>'
      @title = 'TubePi'
      erb :index, layout: :default
    end

    get '/signal' do
      protected!
      @signals = Blocktrain::Lookups.instance.aliases.delete_if {|k,v| v.nil? }
      erb :weight, layout: :default
    end

    get '/signal.json' do
      protected!

      content_type :json
      headers 'Access-Control-Allow-Origin' => '*'

      search = {
        from: params.fetch('from', '2015-09-01 00:00:00Z'),
        to: params.fetch('to', '2015-09-02 00:00:00Z'),
        interval: params.fetch('interval', '1h'),
        signals: 'train_speed'
{'fraction_non_alphanumeric': 0.1431238332296204, 'fraction_numerical': 0.038581207218419414, 'mean_word_length': 2.679633867276888, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1837707', 'n_tokens_mistral': 581, 'n_tokens_neox': 534, 'n_words': 128}