source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
app/models/thermostat_schedule_rule.rb
Ruby
mit
45
master
750
class ThermostatScheduleRule < ApplicationRecord belongs_to :thermostat_schedule, dependent: :destroy scope :active_on_any_day, -> { where( [ "sunday = ? OR monday = ? or tuesday = ? or wednesday = ? or thursday = ? or friday = ? or saturday = ?", true, true, true, true, true, true, true ] ) } scope :act...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
config/routes.rb
Ruby
mit
45
master
897
Rails.application.routes.draw do devise_for :users, path: 'auth' resource :thermostat, only: [:new, :create, :edit, :update] do member do post :migrate_settings end end post '/im_hot' => "thermostats#im_hot", as: :im_hot post '/im_cold' => "thermostats#im_cold", as: :im_cold post '/rese...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
config/application.rb
Ruby
mit
45
master
799
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module PiThermostat class Application < Rails::Application # Initialize configuration defaults for originally generated Ra...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
config/deploy.rb
Ruby
mit
45
master
3,831
# config valid for current version and patch releases of Capistrano lock "~> 3.16.0" set :application, 'thermostat' set :repo_url, 'git@github.com:jeffmcfadden/PiThermostat.git' # Default branch is :master set :branch, ENV.fetch('REVISION', 'master') # Default deploy_to directory is /var/www/my_app_name set :deploy_...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
config/puma.rb
Ruby
mit
45
master
1,658
# Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
config/initializers/devise.rb
Ruby
mit
45
master
14,457
# frozen_string_literal: true # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render inv...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
config/initializers/assets.rb
Ruby
mit
45
master
694
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path # Add Yarn node_modules ...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
config/environments/production.rb
Ruby
mit
45
master
5,014
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
config/environments/development.rb
Ruby
mit
45
master
2,366
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web serv...
github
jeffmcfadden/PiThermostat
https://github.com/jeffmcfadden/PiThermostat
config/deploy/staging.rb
Ruby
mit
45
master
2,088
# server-based syntax # ====================== # Defines a single server with a list of roles and multiple properties. # You can define all roles on a single server, or split them: # server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value # server "example.com", user: "deploy", roles: %w{ap...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
Gemfile
Ruby
mit
45
master
3,075
source 'https://rubygems.org' ruby '2.5.8' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '5.1.7' # Use postgresql as the database for Active Record gem 'pg', '0.20.0' # Use Puma as the app server gem 'puma' # Use SCSS for stylesheets gem 'sassc-rails', '~> 2.1.0' # Use Uglifier as compr...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/jobs/extract_related_papers_job_test.rb
Ruby
mit
45
master
15,853
require 'test_helper' class ExtractRelatedPapersJobTest < ActiveSupport::TestCase test 'in der Kleinen Anfrage "Großraubtiermanagement in Hessen" (Drucksache 19/1767)' do text = 'Unklarheiten in der Kleinen Anfrage "Großraubtiermanagement in Hessen" (Drucksache 19/1767) und' references = ExtractRelatedPapers...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/jobs/extract_text_from_paper_job_test.rb
Ruby
mit
45
master
553
require 'test_helper' class ExtractTextFromPaperJobTest < ActiveSupport::TestCase test 'keep hyphen at wordwrap if it is a name' do text = "Beate Walter-\n" + 'Rosenheimer' # result = "Beate Walter-Rosenheimer\n" result_text = ExtractTextFromPaperJob.clean_text(text) assert_equal text, res...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/rheinland_pfalz_landtag_scraper_detail_test.rb
Ruby
mit
45
master
13,470
require 'test_helper' class RheinlandPfalzLandtagScraperDetailTest < ActiveSupport::TestCase def setup @scraper = RheinlandPfalzLandtagScraper end test 'extract complete paper of legislative_term 17' do @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/rp/detail_17.html'))) record = @s...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/schleswig_holstein_landtag_scraper_overview_test.rb
Ruby
mit
45
master
6,041
require 'test_helper' class SchleswigHolsteinLandtagScraperOverviewTest < ActiveSupport::TestCase def setup @scraper = SchleswigHolsteinLandtagScraper @html = Nokogiri::HTML( File.read( Rails.root.join('test/fixtures/sh/overview.html') ).force_encoding('WINDOWS-1252') ) @table = @...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/sachsen_anhalt_landtag_scraper_overview_test.rb
Ruby
mit
45
master
3,053
require 'test_helper' class SachsenAnhaltLandtagScraperOverviewTest < ActiveSupport::TestCase def setup @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/st/overview.html'))) @scraper = SachsenAnhaltLandtagScraper end test 'extract blocks from search result page' do blocks = @scraper.e...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/baden_wuerttemberg_landtag_scraper_test.rb
Ruby
mit
45
master
7,129
require 'test_helper' class BadenWuerttembergLandtagScraperTest < ActiveSupport::TestCase def setup @scraper = BadenWuerttembergLandtagScraper @legislative_page = Mechanize.new.get('file://' + Rails.root.join('test/fixtures/bw/legislative_term_page.html').to_s) @overview_page = Nokogiri::HTML(File.read(R...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/bayern_landtag_scraper_detail_test.rb
Ruby
mit
45
master
1,369
require 'test_helper' class BayernLandtagScraperDetailTest < ActiveSupport::TestCase def setup @scraper = BayernLandtagScraper end test 'extract detail info' do @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/by/detail.html'))) block = @scraper.extract_first_rows(@html).first pap...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/nordrhein_westfalen_landtag_scraper_test.rb
Ruby
mit
45
master
4,127
require 'test_helper' class NordrheinWestfalenLandtagScraperTest < ActiveSupport::TestCase def setup @scraper = NordrheinWestfalenLandtagScraper @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/nw/overview.html'))) end test 'extract complete paper' do block = @scraper.extract_blocks(@...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/thueringen_landtag_scraper_detail_test.rb
Ruby
mit
45
master
816
require 'test_helper' class ThueringenLandtagScraperDetailTest < ActiveSupport::TestCase def setup @scraper = ThueringenLandtagScraper @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/th/detail_minor.html'))) end test 'extract detail info' do originators = @scraper.extract_paper_detai...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/saarland_scraper_test.rb
Ruby
mit
45
master
2,231
require 'test_helper' class SaarlandScraperTest < ActiveSupport::TestCase def setup @scraper = SaarlandScraper @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/sl/overview.html'))) end test 'read json from resultpage' do entries = @scraper.extract_entries(@html) assert_equal 2786,...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/berlin_agh_scraper_overview_test.rb
Ruby
mit
45
master
12,710
require 'test_helper' class BerlinAghScraperOverviewTest < ActiveSupport::TestCase def setup @scraper = BerlinAghScraper @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/be/overview.html'))) end def paper_from_fixture(reference) html = Nokogiri::HTML(File.read(Rails.root.join("test/fi...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/niedersachsen_landtag_scraper_detail_test.rb
Ruby
mit
45
master
4,792
require 'test_helper' class NiedersachsenLandtagScraperDetailTest < ActiveSupport::TestCase def setup @scraper = NiedersachsenLandtagScraper end test 'extract detail info' do @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/ni/detail.html'))) block = @scraper.extract_detail_block(@htm...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/sachsen_anhalt_landtag_scraper_detail_test.rb
Ruby
mit
45
master
1,160
require 'test_helper' class SachsenAnhaltLandtagScraperDetailTest < ActiveSupport::TestCase def setup @scraper = SachsenAnhaltLandtagScraper @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/st/detail.html'))) end test 'extract detail info' do item = @scraper.extract_detail_block(@html...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/sachsen_scraper_overview_test.rb
Ruby
mit
45
master
3,197
require 'test_helper' class SachsenScraperOverviewTest < ActiveSupport::TestCase def setup @scraper = SachsenScraper @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/sn/overview.html'))) end test 'extract meta data for minor interpellation' do text = 'KlAnfr Vorname Nachname PARTEI 29...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/bundestag_scraper_test.rb
Ruby
mit
45
master
9,590
require 'test_helper' class BundestagScraperTest < ActiveSupport::TestCase def setup @scraper = BundestagScraper @content = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/bt/detail.html')).force_encoding('windows-1252')).to_s @content_xml = @scraper.extract_doc(@content) end test 'extract d...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/hessen_test.rb
Ruby
mit
45
master
7,128
require 'test_helper' class HessenTest < ActiveSupport::TestCase def setup @scraper = HessenScraper @overview = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/he/overview.html'))) @detail_minor = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/he/detail_minor.html'))) @detail_major =...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/bayern_landtag_scraper_overview_test.rb
Ruby
mit
45
master
2,908
require 'test_helper' class BayernLandtagScraperOverviewTest < ActiveSupport::TestCase def setup @scraper = BayernLandtagScraper @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/by/overview.html'))) end test 'extract first rows from search result page' do first_rows = @scraper.extract...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/bremen_buergerschaft_scraper_detail_test.rb
Ruby
mit
45
master
1,144
require 'test_helper' class BremenBuergerschaftScraperDetailTest < ActiveSupport::TestCase def setup @scraper = BremenBuergerschaftScraper end test 'extract whole major paper' do @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/hb/detail_96.html'))) items = @scraper.extract_records(@h...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/meck_pomm_landtag_scraper_detail_test.rb
Ruby
mit
45
master
5,600
require 'test_helper' class MeckPommLandtagScraperDetailTest < ActiveSupport::TestCase def setup @scraper = MeckPommLandtagScraper end test 'extract details' do html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/mv/detail.html'))) body = html.search("//table[@id = 'parldokresult']") ...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/bremen_buergerschaft_scraper_overview_test.rb
Ruby
mit
45
master
2,936
require 'test_helper' class BremenBuergerschaftScraperOverviewTest < ActiveSupport::TestCase def setup @scraper = BremenBuergerschaftScraper @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/hb/overview.html'))) end test 'get search results from resultpage' do items = @scraper.extract_...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/thueringen_landtag_scraper_overview_test.rb
Ruby
mit
45
master
3,847
require 'test_helper' class ThueringenLandtagScraperTest < ActiveSupport::TestCase def setup @scraper = ThueringenLandtagScraper @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/th/overview.html'))) end test 'get search results from resultpage' do results = @scraper.extract_results(@h...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/niedersachsen_landtag_scraper_overview_test.rb
Ruby
mit
45
master
6,870
require 'test_helper' class NiedersachsenLandtagScraperOverviewTest < ActiveSupport::TestCase def setup @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/ni/overview.html'))) @scraper = NiedersachsenLandtagScraper end test 'extract blocks from search result page' do blocks = @scraper.e...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/sachsen_export_scraper_test.rb
Ruby
mit
45
master
2,108
require 'test_helper' class SachsenExportScraperTest < ActiveSupport::TestCase def setup @scraper = SachsenExportScraper @file = File.open(Rails.root.join('test/fixtures/sn/klanfrde_2016-02-29-short.xml')) end test 'it uses yesterdays date for the export filename' do travel_to Date.parse('2016-04-03...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/sachsen_scraper_detail_test.rb
Ruby
mit
45
master
1,995
require 'test_helper' class SachsenScraperDetailTest < ActiveSupport::TestCase def setup @scraper = SachsenScraper end test 'extract detail first page' do content = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/sn/detail_search.html'))) item = @scraper.extract_overview_items(content).firs...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/brandenburg_scraper_test.rb
Ruby
mit
45
master
5,848
require 'test_helper' class BrandenburgScraperTest < ActiveSupport::TestCase def setup @scraper = BrandenburgLandtagScraper @overview = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/bb/overview.html')).force_encoding('windows-1252')) @detail = Nokogiri::HTML(File.read(Rails.root.join('test/fixt...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/rheinland_pfalz_landtag_scraper_overview_test.rb
Ruby
mit
45
master
4,206
require 'test_helper' class RheinlandPfalzLandtagScraperOverviewTest < ActiveSupport::TestCase def setup @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/rp/overview_17.html'))) @scraper = RheinlandPfalzLandtagScraper end test 'extract blocks from search result page' do blocks = @scra...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/berlin_agh_scraper_detail_test.rb
Ruby
mit
45
master
2,167
require 'test_helper' class BerlinAghScraperDetailTest < ActiveSupport::TestCase def setup @scraper = BerlinAghScraper end test 'extract complete paper, written interpellation' do html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/be/detail.html'))) body = @scraper.extract_body(html) ...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/hamburg_buergerschaft_scraper_test.rb
Ruby
mit
45
master
3,475
require 'test_helper' class HamburgBuergerschaftScraperTest < ActiveSupport::TestCase def setup @scraper = HamburgBuergerschaftScraper end test 'extract minor paper' do @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/hh/result.html'))) paper = @scraper.extract(@html.css('.title').fir...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/scraper/meck_pomm_landtag_scraper_overview_test.rb
Ruby
mit
45
master
2,819
require 'test_helper' class MeckPommOverviewScraperTest < ActiveSupport::TestCase def setup @scraper = MeckPommLandtagScraper @html = Nokogiri::HTML(File.read(Rails.root.join('test/fixtures/mv/overview.html'))) @body = @html.search("//table[@id = 'parldokresult']") end # webpage states that it shows...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/controllers/organization_controller_test.rb
Ruby
mit
45
master
425
require 'test_helper' class OrganizationControllerTest < ActionController::TestCase test 'should get show' do papers(:paper_be_17_1000).originator_organizations << organizations(:someparty) get :show, params: { 'body' => 'berlin', 'organization' => 'someparty' } assert_response :success assert_not_n...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/controllers/body_controller_test.rb
Ruby
mit
45
master
259
require 'test_helper' class BodyControllerTest < ActionController::TestCase test 'should get show' do get :show, params: { 'body' => 'bayern' } assert_response :success assert_not_nil assigns(:body) assert_not_nil assigns(:terms) end end
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/controllers/ministry_controller_test.rb
Ruby
mit
45
master
371
require 'test_helper' class MinistryControllerTest < ActionController::TestCase test 'should get show' do get :show, params: { 'body' => 'bayern', 'ministry' => 'staatsministerium-fuer-umwelt-und-verbraucherschutz' } assert_response :success assert_not_nil assigns(:body) assert_not_nil assigns(:minis...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/controllers/site_controller_test.rb
Ruby
mit
45
master
232
require 'test_helper' class SiteControllerTest < ActionController::TestCase test 'should get index' do get :index assert_response :success assert_not_nil assigns(:bodies) assert_not_nil assigns(:papers) end end
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/controllers/paper_controller_test.rb
Ruby
mit
45
master
989
require 'test_helper' class PaperControllerTest < ActionController::TestCase test 'should get show' do get :show, params: { 'body' => 'bayern', 'legislative_term' => 17, 'paper' => '2000-noch-nicht-erfolgter-bericht-zur-aufklaerung-ueber-das-ausmass-und-die-handhabung-des-einsatzes-derivativer' } assert_resp...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/controllers/info_controller_test.rb
Ruby
mit
45
master
244
require 'test_helper' class InfoControllerTest < ActionController::TestCase test 'should get daten' do get :daten assert_response :success end test 'should get kontakt' do get :kontakt assert_response :success end end
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/controllers/search_controller_test.rb
Ruby
mit
45
master
768
require 'test_helper' class SearchControllerTest < ActionController::TestCase test 'should parse query' do query = 'single body:BY "quoted string" doctype:major' search = SearchController.parse_query(query) assert_equal 'single "quoted string"', search.term assert_equal({ body: ['BY'], doctype: ['m...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/controllers/legislative_term_controller_test.rb
Ruby
mit
45
master
343
require 'test_helper' class LegislativeTermControllerTest < ActionController::TestCase test 'should get show' do get :show, params: { 'body' => 'bayern', 'legislative_term' => 17 } assert_response :success assert_not_nil assigns(:body) assert_not_nil assigns(:legislative_term) assert_not_nil assi...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/saarland_pdf_extractor_doctype_test.rb
Ruby
mit
45
master
779
require 'test_helper' class SaarlandPDFExtractorDoctypeTest < ActiveSupport::TestCase test 'written interpellation' do paper = Struct.new(:contents).new( "\nA N T W O R T \n \n\nzu der \n \n\nAnfrage der Abgeordneten" + " Dr. Simone Peter (B90/Grüne) \n \n \nbetr.:") doctype = SaarlandPDFExtrac...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/bayern_pdf_extractor_originators_test.rb
Ruby
mit
45
master
9,928
require 'test_helper' class BayernPDFExtractorOriginatorsTest < ActiveSupport::TestCase # testcases: ## # der Abgeordneten Ruth Müller SPD test 'one person, single line' do paper = Struct.new(:contents).new('der Abgeordneten Ruth Müller SPD') originators = BayernPDFExtractor.new(paper).extract_origina...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/hessen_pdf_extractor_test.rb
Ruby
mit
45
master
3,763
require 'test_helper' class HessenPDFExtractorTest < ActiveSupport::TestCase # testcases: PREFIX = "\nund \n\nAntwort \n\n " SUFFIX = "\n \n \n Vorbemerkung des Fragestellers: " test 'normal ministry' do paper = Struct.new(:contents).new( PREFIX + 'des Ministers der Finanzen' + SUFFIX) answer...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/meck_pomm_pdf_extractor_test.rb
Ruby
mit
45
master
2,700
require 'test_helper' class MeckPommPDFExtractorTest < ActiveSupport::TestCase test 'normal ministry' do paper = Struct.new(:contents).new( "Der Minister für Bildung, Wissenschaft und Kultur hat namens der Landesregierung die Kleine Anfrage mit\n\nSchreiben vom 16. November 2015 beantwortet." ) an...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/mv_pdf_has_answer_test.rb
Ruby
mit
45
master
624
require 'test_helper' class MvPDFHasAnswerTest < ActiveSupport::TestCase ## # (Termin zur Beantwortung # gemäß 64 Absatz 1 GO LT: # 07.01.2015) test 'has a due date attatched' do paper = Struct.new(:contents).new( " (Termin zur Beantwortung \n" + " gemäß 64 Absatz 1 GO LT: \n" + " ...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/name_party_extractor_test.rb
Ruby
mit
45
master
16,394
require 'test_helper' class NamePartyExtractorTest < ActiveSupport::TestCase # Danny Freymark (CDU) test 'one person, one party, single line' do pair = NamePartyExtractor.new('Danny Freymark (CDU)').extract assert_equal 1, pair[:people].size assert_equal 'Danny Freymark', pair[:people].first asser...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/schleswig_holstein_pdf_extractor_test.rb
Ruby
mit
45
master
1,847
require 'test_helper' class SchleswigHolsteinPDFExtractorTest < ActiveSupport::TestCase PREFIX = "und \n \n\nAntwort \n \nder Landesregierung - " SUFFIX = " \n \n\n" def paper_with_contents(contents) Struct.new(:contents).new(contents) end test 'one ministry (he)' do paper = paper_with_contents(PRE...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/thueringen_pdf_extractor_test.rb
Ruby
mit
45
master
492
require 'test_helper' class ThueringenPDFExtractorTest < ActiveSupport::TestCase def paper_with_contents(contents) Struct.new(:contents).new(contents) end test 'one party' do paper = paper_with_contents("K\n l e i n e A n f r a g e\n\ndes Abgeordneten Kießling (AfD)\nund\n\nA n t w o r t") origina...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/bundestag_pdf_extractor_test.rb
Ruby
mit
45
master
11,500
require 'test_helper' class BundestagPDFExtractorTest < ActiveSupport::TestCase # testcases: PREFIX = "Antwort\nder Bundesregierung\n\nauf die Kleine Anfrage der Abgeordneten " ## # Antwort # der Bundesregierung # # auf die Kleine Anfrage der Abgeordneten Oliver Krischer, Bärbel Höhn, Britta # Haßelma...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/sachsen_pdf_extractor_test.rb
Ruby
mit
45
master
5,122
require 'test_helper' class SachsenPDFExtractorTest < ActiveSupport::TestCase # Extracted from real ocr results: # papers = Paper.find_by_sql(["SELECT p.* FROM papers p LEFT OUTER JOIN paper_answerers o ON (o.paper_id = p.id AND o.answerer_type = 'Ministry') WHERE p.body_id = ? AND o.id IS NULL AND p.contents IS N...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/bremen_pdf_extractor_test.rb
Ruby
mit
45
master
4,993
require 'test_helper' class BremenPDFExtractorTest < ActiveSupport::TestCase PREFIX = "9. Letzte Frage?\n\n" SUFFIX = "\n\n\n— 2 —\n\n\nD a z u\n\nAntwort des Senats vom" def paper_with_contents(contents) paper_with_contents_and_title(contents, 'some title') end def paper_with_contents_and_title(conten...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/berlin_pdf_extractor_test.rb
Ruby
mit
45
master
3,258
require 'test_helper' class BerlinPDFExtractorTest < ActiveSupport::TestCase # testcases: PREFIX_DOT = "\n.................................\n" PREFIX_LINE = "\n_____________________________\n" SUFFIX = "\n \n \n (Eingang beim Abgeordnetenhaus" test 'normal ministry' do paper = Struct.new(:contents).new(...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/baden_wuerttemberg_pdf_extractor_test.rb
Ruby
mit
45
master
11,188
require 'test_helper' class BadenWuerttembergPDFExtractorTest < ActiveSupport::TestCase def paper(type, contents) paper_with_title(type, contents, 'some title') end def paper_with_title(type, contents, title) Struct.new(:doctype, :contents, :title).new(type, contents, title) end test 'minor interpe...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/rheinland_pfalz_pdf_extractor_test.rb
Ruby
mit
45
master
1,368
require 'test_helper' class RheinlandPfalzPDFExtractorTest < ActiveSupport::TestCase def paper(type, contents) paper_with_title(type, contents, 'some title') end def paper_with_title(type, contents, title) Struct.new(:doctype, :contents, :title).new(type, contents, title) end test 'minor interpella...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/hamburg_pdf_has_answer_test.rb
Ruby
mit
45
master
963
require 'test_helper' class HamburgPDFHasAnswerTest < ActiveSupport::TestCase ## # (Termin zur Beantwortung # gemäß 64 Absatz 1 GO LT: # 07.01.2015) test 'answered' do paper = Struct.new(:contents).new( " und Antwort des Senats \n" + " \n" + ' Betr.:' ) assert HamburgPDFHasAn...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/brandenburg_pdf_extractor_test.rb
Ruby
mit
45
master
5,161
require 'test_helper' class BrandenburgPDFExtractorTest < ActiveSupport::TestCase # testcases: PREFIX = 'Namens der Landesregierung beantwortet ' SUFFIX = ' die Kleine Anfrage wie folgt:' test 'normal ministry' do paper = Struct.new(:contents).new( PREFIX + 'die Ministerin für Wissenschaft, Forschun...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/nordrhein_westfalen_pdf_extractor_test.rb
Ruby
mit
45
master
1,320
require 'test_helper' class NordrheinWestfalenPDFExtractorTest < ActiveSupport::TestCase PREFIX = "Antwort \n \nder Landesregierung \n\nauf die Kleine Anfrage 1234 vom 12. März 2015 \n" SUFFIX = "\nDrucksache 16/1234" def paper_with_contents(contents) Struct.new(:contents).new(contents) end test 'one p...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/pdf_extractor_test.rb
Ruby
mit
45
master
1,682
require 'test_helper' class PDFExtractorTest < ActiveSupport::TestCase test 'one ministry' do ministries = PDFExtractor.split_ministries("Ministerium für XLändlichen Raum") assert_equal 1, ministries.size assert_equal 'Ministerium für XLändlichen Raum', ministries.first end test 'two ministries, s...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/saarland_pdf_extractor_originators_test.rb
Ruby
mit
45
master
3,357
require 'test_helper' class SaarlandPDFExtractorOriginatorsTest < ActiveSupport::TestCase test 'one person, single line' do paper = Struct.new(:contents).new(" Anfrage des Abgeordneten Michael Neyses (PIRATEN) \n") originators = SaarlandPDFExtractor.new(paper).extract_originators assert_eq...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/extractors/bayern_pdf_extractor_answerers_test.rb
Ruby
mit
45
master
14,291
require 'test_helper' class BayernPDFExtractorAnswerersTest < ActiveSupport::TestCase def paper_with_answerer(answerer, wrap: true) answerer = "Antwort\n#{answerer} vom" if wrap Struct.new(:contents).new(answerer) end test 'Staatsministeriums des Innern, für Bau und Verkehr' do paper = paper_with_an...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/models/person_test.rb
Ruby
mit
45
master
4,628
require 'test_helper' class PersonTest < ActiveSupport::TestCase setup do Searchkick.disable_callbacks ENV['NOMENKLATURA_HOST'] = 'localhost' ENV['NOMENKLATURA_APIKEY'] = 'dummy' end test 'nk_dataset: throws exception when in multiple bodies' do p = people(:multi_body_person) assert_equal 2,...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/models/paper_test.rb
Ruby
mit
45
master
2,014
require 'test_helper' class PaperTest < ActiveSupport::TestCase test 'it fixes shuffled years in published_at date' do travel_to Date.parse('2015-10-10') do paper = Paper.new paper.published_at = Date.parse('2105-10-10') paper.run_callbacks(:validation) assert_equal Date.parse('2015-10-10...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/models/organization_test.rb
Ruby
mit
45
master
210
require 'test_helper' class OrganizationTest < ActiveSupport::TestCase test 'it uses the right nomenklatura dataset name' do assert_equal 'ka-parties', organizations(:one).nomenklatura_dataset end end
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/models/classified_recognizer_test.rb
Ruby
mit
45
master
2,387
require 'test_helper' class ClassifiedRecognizerTest < ActiveSupport::TestCase def assert_classified(text) result = ClassifiedRecognizer.new(text).recognize assert_operator result[:probability], :>=, 1 end def assert_not_classified(text) result = ClassifiedRecognizer.new(text, debug: true).recogniz...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/models/table_recognizer_test.rb
Ruby
mit
45
master
3,171
require 'test_helper' class TableRecognizerTest < ActiveSupport::TestCase def assert_table(text) result = TableRecognizer.new(text).recognize assert_operator result[:probability], :>=, 1 end def assert_no_table(text) result = TableRecognizer.new(text, debug: true).recognize assert_equal 0, resu...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/models/es_query_parser_test.rb
Ruby
mit
45
master
2,733
require 'test_helper' class EsQueryParserTest < ActiveSupport::TestCase CONVERT_RANGE_TEST_CASES = { 'number as string' => ['1', 1], 'number' => [1, 1], 'gt 1' => ['>1', { gt: 1 }], 'lt 1' => ['<1', { lt: 1 }], 'gte 1' => ['>=1', { gte: 1 }], 'lte 1' => ['<=1', { lte: 1 }], 'range incl 1 ...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
test/models/search_terms_test.rb
Ruby
mit
45
master
2,457
require 'test_helper' class SearchTermsTest < ActiveSupport::TestCase TEST_CASES = { 'simple' => ['foo', 'foo', {}], 'simple_field' => ['one:two', '', { 'one' => 'two' }], 'quotes' => [%(foo:"quoted value"), '', { 'foo' => 'quoted value' }], 'term_with_period' => ['1.5', '1.5', {}], 'multiple_fie...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/detail_scraper.rb
Ruby
mit
45
master
247
class DetailScraper < Scraper def initialize(legislative_term, reference) @legislative_term = legislative_term @reference = reference @sleep = 1 end def full_reference @legislative_term.to_s + '/' + @reference.to_s end end
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/brandenburg_landtag_scraper.rb
Ruby
mit
45
master
8,224
require 'date' module BrandenburgLandtagScraper BASE_URL = 'https://www.parlamentsdokumentation.brandenburg.de' START_URL = BASE_URL + '/starweb/LBB/ELVIS/index.html' # smaller searches or brandenburg times out # search five years for every half month SEARCH_PARTS = 5 def self.get_daterange(options) ...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/bremen_buergerschaft_scraper.rb
Ruby
mit
45
master
6,048
require 'date' module BremenBuergerschaftScraper BASE_URL = 'https://paris.bremische-buergerschaft.de' SEARCH_URL = BASE_URL + '/starweb/paris/servlet.starweb?path=paris/LISSH.web' TYPES = [ 'KLEINE ANFRAGE UND ANTWORT DES SENATS', 'MITTEILUNG DES SENATS (ANTWORT AUF GROẞE ANFRAGEN)', 'MITTEILUNG DES...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/bundestag_scraper.rb
Ruby
mit
45
master
9,729
require 'date' module BundestagScraper BASE_URL = 'http://dipbt.bundestag.de' OVERVIEW_URL = BASE_URL + '/extrakt/ba' START_URL = BASE_URL + '/dip21.web/bt' class Overview < Scraper TYPES = ['Kleine Anfrage', 'Große Anfrage'] def supports_streaming? true end def scrape streaming ...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/sachsen_scraper.rb
Ruby
mit
45
master
9,752
module SachsenScraper BASE_URL = 'http://edas.landtag.sachsen.de' SEARCH_FIELD = 'ctl00$masterContentCallback$content$suchmaske$tblSearch$tabSuche$panelUmSuchmaskeEinfach$suchmaskeEinfachCallback' SEARCH_FIELD2 = 'ctl00_masterContentCallback_content_suchmaske_tblSearch_tabSuche_panelUmSuchmaskeEinfach_suchmas...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/nordrhein_westfalen_landtag_scraper.rb
Ruby
mit
45
master
5,551
module NordrheinWestfalenLandtagScraper BASE_URL = 'https://www.landtag.nrw.de/portal/WWW' def self.extract_blocks(mp) table = mp.search("//div[@id='content']//table").first table.search('.//tr/td[3]') end def self.extract_meta(text) meta = text.match(/Antwort\s+(.+)\s+zu\s+(.+)\s+\d+(\s+.+)?\s+Dr...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/meck_pomm_landtag_scraper.rb
Ruby
mit
45
master
4,302
require 'date' module MeckPommLandtagScraper BASE_URL = 'http://www.dokumentation.landtag-mv.de' class Overview < Scraper SEARCH_URL = BASE_URL + '/Parldok/formalkriterien' TYPES = ['Kleine Anfrage und Antwort', 'Große Anfrage und Antwort'] def supports_streaming? true end def scrape ...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/sachsen_anhalt_landtag_scraper.rb
Ruby
mit
45
master
8,261
require 'date' module SachsenAnhaltLandtagScraper BASE_URL = 'http://padoka.landtag.sachsen-anhalt.de' SEARCH_URL = BASE_URL + '/starweb/PADOKA/servlet.starweb?path=PADOKA/LISSH.web&AdvancedSuche=yes' def self.extract_blocks(mp) mp.search('//div[@id="PrintContainer"]//li[@name="RecordRepeater"]') end d...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/rheinland_pfalz_landtag_scraper.rb
Ruby
mit
45
master
8,323
module RheinlandPfalzLandtagScraper BASE_URL = 'http://opal.rlp.de' def self.extract_records(page) page.search('//tbody[@name="RecordRepeater"]') end def self.extract_detail_block(page) page.search('./tr[@name="Repeat_Fund"]/td[3]').first || page.search('./tr[@name="Repeat_D_Fund"]/td[3]').first ...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/bayern_landtag_scraper.rb
Ruby
mit
45
master
5,217
require 'date' module BayernLandtagScraper BASE_URL = 'https://www1.bayern.landtag.de' class Overview < Scraper SEARCH_URL = BASE_URL + '/webangebot1/dokumente.suche.maske.jsp?DOKUMENT_TYPE=EXTENDED&STATE=SHOW_MASK' def supports_pagination? true end def supports_streaming? true e...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/schleswig_holstein_landtag_scraper.rb
Ruby
mit
45
master
7,839
module SchleswigHolsteinLandtagScraper BASE_URL = 'http://lissh.lvn.parlanet.de' def self.extract_table(page) page.search('//center')[0].try(:next).try(:next).try(:next) end def self.extract_blocks(table) table.search('//tr[contains(@class, "tabcol")][not(@class="tabcol2")]') end def self.extract...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/thueringen_landtag_scraper.rb
Ruby
mit
45
master
5,741
require 'date' module ThueringenLandtagScraper BASE_URL = 'http://www.parldok.thueringen.de/ParlDok' TYPES = ['Antwort auf Große Anfrage', 'Antwort auf Kleine Anfrage'] def self.extract_results(page) page.css('.title') end def self.extract_next_row(title_el) title_el.parent.next_element end de...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/hessen_scraper.rb
Ruby
mit
45
master
6,439
module HessenScraper BASE_URL = 'http://starweb.hessen.de' def self.extract_blocks(page) page.search('//*[@id="container"]/form/div/div/div/table/tbody') end def self.extract_detail_block(detail_page) detail_page.at_css('#listTable pre') end def self.extract_reference(block) block.at_css('spa...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/scraper.rb
Ruby
mit
45
master
1,047
require 'mechanize' class Scraper def initialize(legislative_term) @legislative_term = legislative_term.to_i @per_page = 50 @sleep = 1 end def logger=(logger) @logger = logger end def logger @logger ||= Rails.logger end def supports_pagination? false end def supports_typed...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/baden_wuerttemberg_landtag_scraper.rb
Ruby
mit
45
master
8,451
require 'date' module BadenWuerttembergLandtagScraper BASE_URL = 'http://www.landtag-bw.de' DETAIL_URL = 'http://www.statistik-bw.de/OPAL' SEARCH_URL = 'https://parlis.landtag-bw.de' def self.extract_result_links(page) page.search('//a[@class="doclist__item-link"]') end def self.extract_overview_meta...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/saarland_scraper.rb
Ruby
mit
45
master
2,856
require 'date' # # Saarland is based on SharePoint. (No idea why anyone thinks thats a sane idea) # # Get Version: https://www.landtag-saar.de/_vti_pvt/service.cnf # # vti_extenderversion:SR|15.0.0.4797 # # An request to https://www.landtag-saar.de/_vti_bin/ brings us the following header: # # MicrosoftSharePointTeamS...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/niedersachsen_landtag_scraper.rb
Ruby
mit
45
master
6,149
module NiedersachsenLandtagScraper BASE_URL = 'http://www.nilas.niedersachsen.de' def self.extract_blocks(page) page.search('//table[@id="listTable"]/tr[2]/td[2]/table[@id="listTable"]/preceding-sibling::table[1]') end def self.extract_references_block(block) block.try(:next_element) end def self...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/hamburg_buergerschaft_scraper.rb
Ruby
mit
45
master
4,031
require 'date' module HamburgBuergerschaftScraper BASE_URL = 'https://www.buergerschaft-hh.de/ParlDok' TYPES = ['Schriftliche Kleine Anfrage', 'Große Anfrage'] # because hamburg has a limit of displayed documents, we need to split the date range search # when scraping fails because of too much documents, incre...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/sachsen_export_scraper.rb
Ruby
mit
45
master
4,528
require 'zip' module SachsenExportScraper EXPORT_BASE = 'http://edas.landtag.sachsen.de/KlAnfrDe/' def self.create_export_url(date = nil) date = Date.current - 1 if date.nil? # yesterday EXPORT_BASE + export_filename(date) + ".zip" end def self.export_filename(date = nil) date = Date.current - 1 ...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/scrapers/berlin_agh_scraper.rb
Ruby
mit
45
master
8,359
require 'date' module BerlinAghScraper BASE_URL = 'http://pardok.parlament-berlin.de' def self.extract_body(page) page.search("//table[contains(@class, 'tabcol')]").last end def self.extract_seperators(body) body.search('.//td[contains(@colspan, 3)]/..')[0...-1] end def self.extract_title(sepera...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/api/oparl/routes.rb
Ruby
mit
45
master
1,217
module OParl # move named route methods in own class # support _url in addition to _path # No longer needed when https://github.com/reprah/grape-route-helpers/issues/2 gets resolved class Routes class << self include GrapeRouteHelpers::NamedRouteMatcher def root_url Rails.application.ro...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/api/oparl/loggers.rb
Ruby
mit
45
master
470
module OParl module Loggers class RequestId < GrapeLogging::Loggers::Base def parameters(request, _) { request_id: request.env["action_dispatch.request_id"] } end end class Format < GrapeLogging::Loggers::Base def parameters(request, _) { formats: ['json'] } end ...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/api/oparl/filter.rb
Ruby
mit
45
master
1,068
# # Filter modeled after OParl Spec. # module OParl module Filter def self.included(base) base.class_eval do helpers do def filter(collection) a = collection.arel_table collection = collection.where(a[:created_at].gt(params[:created_since])) unless params[:created_s...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/api/oparl/pagination.rb
Ruby
mit
45
master
1,480
# # Pagination modeled after OParl Spec. # Loosly based on grape-kaminari # module OParl module Pagination def self.included(base) base.class_eval do helpers do def paginate(collection) collection.page(params[:page]).per(params[:limit]).tap do |data| present :pagi...
github
robbi5/kleineanfragen
https://github.com/robbi5/kleineanfragen
app/api/oparl/api.rb
Ruby
mit
45
master
4,998
# # Implementation of OParl 1.0 for kleineAnfragen # Spec: https://oparl.org/spezifikation/ # module OParl class API < Grape::API use GrapeLogging::Middleware::RequestLogger, instrumentation_key: 'process_action.grape', include: [ OParl::Loggers::RequestId.new, OParl::Loggers::Format....