A repository of examples of what can be done with Caselaw Access Project data.
Table of Contents
- Contributing instructions
- Download bulk data
- Using the API
- Installation Instructions - install this repo to run examples on your own machine
- Bulk Case Extract - Get cases from our api's /bulk endpoint. Extract cases into a dataframe.
- Full Text Search - Get all cases that include a keyword.
- Full Text Search with Context - Like full text search, only this time using your API key to get the context around the word.
- Ngrams – Use the open Arkansas bulk cases to explore interesting words.
- Bulk Exploration: ngrams and Justice Cartwright – Use the open Illinois bulk cases to explore interesting words, and look at a Judge's opinion publishing history.
- Map Courts - Map all the courts on a U.S. map.
- Python Wrapper - Python wrapper for searching cases, downloading to CSV, etc.
- Get Judges - Get judges and return CourtListener Person urls
- API to CSV - Command line Python3 script with no external dependencies, fetching search results from the cases endpoint and writing to a CSV.
- Labelling case parties and summarizing cases - Using some basic machine learning to label who the parties in each case were, and then summarizing the case text.
Interested in contributing your own examples?
- Fork this repository
- Add your work
- Make sure to add any requirements your project needs to requirements.in
pip-compile --output-file requirements.txt requirements.in
- Add a link in the Examples section
- Create a pull request
- Receive gratitude (thank you so much!!)
Downloading bulk data
Helper methods to download whitelisted bulk data
Download the Illinois dataset
(capexamples) $ fab get_cases_from_bulk:Illinois
Or, download the Arkansas dataset
(capexamples) $ fab get_cases_from_bulk:Arkansas
Download a dataset with casebody format as xml
(capexamples) $ fab get_cases_from_bulk:Illinois,data_format=xml
Using the API
Once you have your API key, copy and paste it into your secret keys file settings.py.
3.5.4 is the python version we're currently using on CAP, so to keep things simple, we'll be using the same version for these examples.
We recommend installing pyenv — follow instructions to install here.
Install your python version using pyenv and activate your virtual environment:
$ pyenv install 3.5.4 $ pyenv virtualenv 3.5.4 capexamples $ pyenv activate capexamples (capexamples) $
(capexamples) $ pip install -r requirements.txt (capexamples) $ fab setup
To run jupyter notebook examples (i.e. any file ending in .ipynb):
(capexamples) $ jupyter notebook