Overview

Packages

  • LegiScan
    • API
    • Cache
    • Common
    • Exceptions
    • Utility
  • PHP

Classes

  • LegiScan
  • LegiScan_CommandLine
  • LegiScan_Endpoint
  • LegiScan_Import
  • LegiScan_WebTest
  • LegiScan_Worker
  • Overview
  • Package
  • Class

Class LegiScan_Worker

A daemon process that will import and keep bills up to date

The legiscand.php script provides a daemon process that can use four different methods, controlled by the update_type setting, to keep a local database synchronized via LegiScan Pull API.

Monitor

This mode will use the ls_monitor table to keep a specific bill_id list updated. This list can be managed with legiscan-cli.php, though determining the bill_id is an exercise for the reader and would require additional scripting, though a likely source would be through the search engine.

php legiscan-cli.php --monitor 823882
php legiscan-cli.php --unmonitor 823882

State

This mode will synchronize the entire master list from one or more states. To set the state list edit config.php and add each state to the states[] setting.

For example to track all legislation in California and US Congress:

states[] = CA
states[] = US

NOTE: It is HIGHLY recommended pre-loading the current state datasets with legiscan-bulk.php prior to the first run to minimize the on-boarding queries.

Search (National)

This mode will synchronize the results of searches ran against the national database. To specify the searches edit the config.php and add each search to the searches[] setting.

The searches will also be filtered by the global relevance cutoff setting, which can be overridden on a per search basis by prepending a different score and the pipe | character. In addition a state abbreviations can also be prefixed to override either national or state search. When used with a relevance override the state should appear first separated by a comma ,.

Also notice that the entire search string should be quoted, and any internal quotes should be escaped as \".

searches[] = "gender AND bathroom"
searches[] = "\"national popular vote\""
searches[] = "42|hemp OR cannabis OR marijuana"
searches[] = "NY|charter ADJ schools"
searches[] = "CA,60|vaccination AND status:passed"

State Search

This mode combines both of the other methods such that the searches[] are only ran against the states[] list, unless a search specific state is used.

Package: LegiScan\Utility
Copyright: 2010-2020 LegiScan LLC
License: https://opensource.org/licenses/BSD-2-Clause
Author: LegiScan API Team api@legiscan.com
See: LegiScan_Process
See: LegiScan_Pull
Link: https://api.legiscan.com/dl/
Located at legiscand.php
Methods summary
public
# worker( integer $daemon )

Worker loop that generates a bill_id list then imports / updates via LegiScan_Pull::importBillList

Worker loop that generates a bill_id list then imports / updates via LegiScan_Pull::importBillList

Parameters

$daemon
If non-zero the worker will loop forever
LegiScan API Client API documentation generated by ApiGen