A repository of examples of what can be done with Caselaw Access Project data.
- Introduction
- Examples
- Contributing instructions
- Using the API
- Download bulk data
- 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.
- Fork this repository
- Install dependencies
- Add your work
- Make sure to add any requirements your project needs to requirements.in
- Run
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!!)
In order to download non-whitelisted cases, you must register for an API key.
Once you have your API key, copy and paste it into your secret keys file settings.py.
These example require the existence of an API key in settings.py. Follow the instructions above in the Using the API section to obtain one.
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
These examples assume some python knowledge. We will be using python3
.
This code has been tested using Python 3.9.10
.
We will also be installing all our dependencies and working in a virtual environment.
$ python3 -mvenv venv
$ source venv/bin/activate
$ (venv) pip install -r requirements.txt
Set up!
(venv) $ pip install -r requirements.txt
(venv) $ fab setup
To run jupyter notebook examples (i.e. any file ending in .ipynb):
(venv) $ jupyter notebook