datamade/la-metro-councilmatic

Name: la-metro-councilmatic

Owner: datamade

Description: :metro: An instance of councilmatic for LA Metro

Created: 2016-10-10 18:52:05.0

Updated: 2018-05-21 14:03:31.0

Pushed: 2018-05-21 16:51:27.0

Homepage:

Size: 36760

Language: HTML

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Metro Board Reports

Metro Board Reports helps the Los Angeles community understand the activities of the Los Angeles County Metropolitan Transportation Authority (Metro) ? a government agency that consists of several Board Members, who set policy, coordinate, plan, fund, build, and operate transit services and transportation programs throughout LA County.

The Metro Board Reports site monitors all things related to the Metro Board of Directors:

This site ultimately encourages greater public dialogue and increased awareness about transportation issues in LA County.

Metro Board Reports is a member of the Councilmatic family. Learn how to build your own Councilmatic site!

Setup

Install OS level dependencies:

Install app requirements

We recommend using virtualenv and virtualenvwrapper for working in a virtualized development environment. Read how to set up virtualenv.

Once you have virtualenvwrapper set up, run the following in your terminal:

rtualenv la-metro
clone git@github.com:datamade/la-metro-councilmatic.git
a-metro-councilmatic
install -r requirements.txt

Afterwards, whenever you want to use this virtual environment, run workon la-metro.

Special installation requirements

Metro runs a custom script that converts board-report attachments into plaintext. The script uses textract for conversions. Mac users can follow the instructions given by textract.

For Ubuntu users and on the server, the textract installation instructions require a little remediation. Follow these steps:

(1) Install all the dependencies.

(2) textract fails when installing pocketsphinx. Happily, textract does not need this dependency for converting PDFs or word documents into plain text. This issue offers a script that installs a “fake pocketsphinx”. Do as the issue instructs.

(3) You're ready! Inside your virtualenv execute: pip install textract==1.6.1.

Create your settings file

ouncilmatic/settings_deployment.py.example councilmatic/settings_deployment.py

Then edit councilmatic/settings_deployment.py:

Setup your database

Before we can run the website, we need to create a database.

tedb lametro

Then, run migrations:

on manage.py migrate

Create an admin user. Terminal will prompt you to provide a username, email, and password. This superuser has access to the Django admin backend.

on manage.py createsuperuser
Import data

Every hour, DataMade scrapes the Legistar Web API and makes the results available on the Open Civic Data API, which hosts standardized data patterns about government organizations, people, legislation, and events. Metro Board Reports relies upon this data.

The django-councilmatic app comes with an import_data management command, which populates your database with content loaded from the OCD API. You can explore the nitty-gritty of this code here.

Run the import_data command, which may take a few minutes, depending on volume:

on manage.py import_data

By default, the import_data command carefully looks at the OCD API; it is a smart management command. If you already have bills loaded, it will not look at everything on the API - it will look at the most recently updated bill in your database, see when that bill was last updated on the OCD API, and then look through everything on the API that was updated after that point. If you'd like to load things that are older than what you currently have loaded, you can run the import_data management command with a --delete option, which removes everything from your database before loading.

The import_data command has some more nuance than the description above, for the different types of data it loads. If you have any questions, open up an issue and pester us to write better documentation.

Once you've imported the data, create the cache, then you're all set!

on manage.py createcachetable
Run Metro Board Reports locally

Run the following in terminal:

on manage.py runserver

Then, navigate to http://localhost:8000/.

Setup Search

Install Open JDK or update Java

On Ubuntu:

do apt-get update
do apt-get install openjdk-7-jre-headless

On OS X:

  1. Download latest Java SE Development Kit from http://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html
  2. Follow normal install procedure

Download & setup Solr

 http://archive.apache.org/dist/lucene/solr/4.10.4/solr-4.10.4.tgz
-xvf solr-4.10.4.tgz
 cp -R solr-4.10.4/example /opt/solr

py schema.xml for this app to solr directory
 cp solr_scripts/schema.xml /opt/solr/solr/collection1/conf/schema.xml

Run Solr

xt, start the java application that runs solr
 this in another terminal window & keep it running
 you see error output, somethings wrong
opt/solr
 java -jar start.jar

Index the database

 this in the la-metro-councilmatic directory:
on manage.py rebuild_index

Regenerate Solr schema

While developing, if you need to make changes to the fields that are getting indexed or how they are getting indexed, you'll need to regenerate the schema.xml file that Solr uses to make its magic. Here's how that works:

on manage.py build_solr_schema > solr_scripts/schema.xml
olr_scripts/schema.xml /opt/solr/solr/collection1/conf/schema.xml

In order for Solr to use the new schema file, you'll need to restart it.

Using Solr for more than one Councilmatic on the same server

If you intend to run more than one instance of Councilmatic on the same server, you'll need to take a look at this README to make sure you're configuring things properly.

A note on tests

LA Metro Councilmatic has a basic test suite. If you need to run it, simply run:

st
Team
Errors / Bugs

If something is not behaving intuitively, it is a bug, and should be reported. Report it here: https://github.com/datamade/nyc-councilmatic/issues

Note on Patches/Pull Requests
Copyright

Copyright (c) 2017 DataMade. Released under the MIT License.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.