All Projects → legis-graph → legis-graph

legis-graph / legis-graph

Licence: MIT License
ETL scripts for loading US Congressional data from govtrack.us into Neo4j

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to legis-graph

Jetbrains Plugin Graph Database Support
Graph Databases support for JetBrains family IDEs.
Stars: ✭ 169 (+252.08%)
Mutual labels:  neo4j, cypher
neo4j-ml-procedures
This project provides procedures and functions to support machine learning applications with Neo4j.
Stars: ✭ 37 (-22.92%)
Mutual labels:  neo4j, cypher
Movies Python Bolt
Neo4j Movies Example application with Flask backend using the neo4j-python-driver
Stars: ✭ 197 (+310.42%)
Mutual labels:  neo4j, cypher
Movies Javascript Bolt
Neo4j Movies Example with webpack-in-browser app using the neo4j-javascript-driver
Stars: ✭ 123 (+156.25%)
Mutual labels:  neo4j, cypher
decypher
A handful of cypher utilities for Node.js
Stars: ✭ 34 (-29.17%)
Mutual labels:  neo4j, cypher
Neo4j 3d Force Graph
Experiments with Neo4j & 3d-force-graph https://github.com/vasturiano/3d-force-graph
Stars: ✭ 159 (+231.25%)
Mutual labels:  neo4j, cypher
angular-neo4j
Neo4j Bolt driver wrapper for Angular
Stars: ✭ 18 (-62.5%)
Mutual labels:  neo4j, cypher
Movies Java Bolt
Neo4j Movies Example application with SparkJava backend using the neo4j-java-driver
Stars: ✭ 66 (+37.5%)
Mutual labels:  neo4j, cypher
ml-models
Machine Learning Procedures and Functions for Neo4j
Stars: ✭ 63 (+31.25%)
Mutual labels:  neo4j, cypher
Public-Transport-SP-Graph-Database
Metropolitan Transport Network from São Paulo mapped in a NoSQL graph database.
Stars: ✭ 25 (-47.92%)
Mutual labels:  neo4j, cypher
Cypher Dsl
A Java DSL for the Cypher Query Language
Stars: ✭ 116 (+141.67%)
Mutual labels:  neo4j, cypher
NeoClient
🦉 Lightweight OGM for Neo4j which support transactions and BOLT protocol.
Stars: ✭ 21 (-56.25%)
Mutual labels:  neo4j, cypher
Neo4j
Graphs for Everyone
Stars: ✭ 9,582 (+19862.5%)
Mutual labels:  neo4j, cypher
Neo4j Etl
Data import from relational databases to Neo4j.
Stars: ✭ 165 (+243.75%)
Mutual labels:  neo4j, cypher
Stock Knowledge Graph
利用网络上公开的数据构建一个小型的证券知识图谱/知识库
Stars: ✭ 1,182 (+2362.5%)
Mutual labels:  neo4j, cypher
neo4j-faker
Use faker cypher functions to generate demo and test data with cypher
Stars: ✭ 30 (-37.5%)
Mutual labels:  neo4j, cypher
Neo4j Tableau
Neo4j Tableau Integration via WDC
Stars: ✭ 56 (+16.67%)
Mutual labels:  neo4j, cypher
Cypher Stream
Neo4j Cypher queries as Node.js object streams
Stars: ✭ 58 (+20.83%)
Mutual labels:  neo4j, cypher
OGMNeo
[No Maintenance] Neo4j nodeJS OGM(object-graph mapping) abstraction layer
Stars: ✭ 54 (+12.5%)
Mutual labels:  neo4j, cypher
neo4j-graphql-java
Pure JVM translation for GraphQL queries and mutations to Neo4j's Cypher
Stars: ✭ 94 (+95.83%)
Mutual labels:  neo4j, cypher

Legislative Graph

A set of scripts to easily download and import US legislative data into a Neo4j database. This is a work-in-progress, please submit an issue for any errors or feature requests.

Data Model

The data model incorporates a small amount of the data available from GovTrack. Please submit an issue to request any changes / updates. We're really interested in how the commmunity might want to use this data so please let us know!

Also, this file has more detailed information about the data model.

Quickstart

This Cypher script will load data from the 114th Congress. You can use the LazyWebCypher tool with this link.

Load Data

We're currently working to streamline the data loading process, but for now you can follow these steps to load data.

Install requirements

pip3 install -r requirements.txt

Download / update data

Sync a particular congress by its number (so, for instance, for the 112th congress, replace <num> with 112.

./sync.sh <num>

Parse data

Use the parse scripts to parse the raw data into CSV files that can be easily loaded into Neo4j.

$ python3 parse_legislators.py
...
$ python3 parse_bills.py
...
$ python3 parse_votes.py
...
$ python3 parse_committees.py
...
$ python3 parse_committee_members.py
...

The scripts require Python 3.

Insert into Neo4j

See the steps documented here for configuring neo4j-shell and pointing Neo4j to the CSV files generated in the previous step.

$ path/to/neo4j/bin/neo4j-shell < import.cypher

Queries

Once the data is loaded in Neo4j we can use queries written in Cypher to discover interesting things about Congress.

General Queries

Find all Legislators:

MATCH (n:Legislator) RETURN n LIMIT 100

Find Steve Daines:

MATCH (n:Legislator {firstName: "Steve", lastName: "Daines"}) RETURN n

What Bills did Steve Daines sponsor?

MATCH (n:Legislator {firstName: "Steve", lastName: "Daines"})<-[:SPONSORED_BY]-(b:Bill) RETURN b

For how many Bills did Steve Daines vote Yea?

MATCH (n:Legislator {firstName: "Steve", lastName: "Daines"})-[v:VOTED_ON]->(b:Bill)
WHERE v.vote = "Yea"
RETURN b

More advanced queries

Find the number of bills proposed during each congress in the database.

MATCH (c:Congress)<-[:PROPOSED_DURING]-(b:Bill)
RETURN c.number AS congress, count(b) as numProposed

Find the number of bills enacted in each congress in the database and the average number of sponsors bills had during that congress.

MATCH (c:Congress)<-[:PROPOSED_DURING]-(b:Bill)-[:SPONSORED_BY]->(l:Legislator)
WHERE b.enacted = 'True'
WITH c, b, count(l) AS numSponsors
RETURN c.number AS congress, count(b) AS numPassed, avg(numSponsors) AS avgSponsors

Articles

Authors

Terms

The software in this repository is provided "AS-IS" without warranties or guarantees of any kind. Data used by this software is provided by Govtrack.us and should be used under the terms specified by Govtrack.us here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].