Courts-DB is an open source repository to organize a database of all courts current and historical. It was built for use in CourtListener.com.
Its main goal is to interface with CourtListener to identify historical and current courts by string. It includes mechanisms to filter results based on dates and/or whether it is a bankruptcy court.
Further development is intended and all contributors, corrections and additions are welcome.
Free Law Project built this database using the metadata (case names, dates etc.) of over 16 millions data points. This data represents hundreds of hours of research and testing. We believe this to be the most extensive open dataset of its kind.
You can feed in a CourtListener Court Identifier or string to find a court.
from courts_db import find_court, find_court_by_id find_court_by_id("mass") returns: [{ "regex": [ "${sjc} ${ma}?", "${ma} ${sjc}", "Supreme Court Of ${ma}", "State Of ${ma} Supreme Court" ], "name_abbreviation": "Mass. Sup. Jud. Ct.", "dates": [ { "start": "1692-01-01", "end": null } ], "name": "Massachusetts Supreme Judicial Court", "level": "colr", "case_types": ["All"], "system": "state", "examples": [ "Supreme Court Of Massachusetts", "Supreme Judicial Court Of Massachusetts", "Massachusetts Supreme Judicial Court" ], "court_url": "http://www.mass.gov/courts/sjc/", "type": "appellate", "id": "mass", "location": "Massachusetts", "citation_string": "Mass." }]
from courts_db import find_court mass_sjc = find_court(u"Massachusetts Supreme Judicial Court") returns: ["mass"]
Filtering on less unique strings is built in.
Feed a date string or bankruptcy flag to filter on those parameters. For example District of Massachusetts is non unique and returns both the Federal District Court of Massachusetts and its Bankruptcy Court.
from datetime import datetime as dt courts_db.find_court( u"District of Massachusetts", ) returns ==> ["mad", "mab"] courts_db.find_court( u"District of Massachusetts", bankruptcy=True, ) returns ==> ["mab"] courts_db.find_court( u"District of Massachusetts", date_found=dt.strptime("10/02/1975", "%m/%d/%Y"), ) returns ==> ["mad"]
Some things to keep in mind as you are reviewing the data:
- The data is divided into two files
courts.json
andvariables.json
. courts.json
holds the bulk of the information.variables.json
holds templates for large numbers of regexes.
id
— string; CourtListener Court Identifiercourt_url
— string; url for court websiteregex
— array; regexes patterns to find courtsexamples
— array; regexes patterns to find courtsname
— string; full name of the courtname_abbreviation
— string; court name abbreviationsdates
— Array; contains start date, end date and notes on date rangesystem
— string; defines main jurisdiction, ex. State, Federal, Triballevel
— string; code defining where court is in system structure, ex. COLR (Court of Last Resort), IAC (Intermediate Appellate Court), GJC (General Jurisdiction Court), LJC (Limited Jurisdiction Court)location
— string; refers to the physical location of the main courttype
— string; identifies kind of cases handled (Trial, Appellate, Bankruptcy, AG)citation_string
— string; identifies the string used in a citation to refer to the courtnotes
— string; a place to put notes about a court
Installing Courts-DB is easy.
pip install courts_db
Or install the latest development version from GitHub.
pip install git+https://github.com/freelawproject/courts-db.git@master
- Continue to improve and expand the dataset.
- Add filtering mechanisms by state, reporters, citation(s), judges, counties and cities.
If you wish to create a new version, the process is:
- Update version info in
setup.py
and commit it. - Tag the commit with the version number.
- Push your commit. CI (Continuous Integration) should take care of the rest.
Install the requirements in
requirements_dev.txt
.Set up a config file at
~/.pypirc
.Generate a universal distribution that works in Python 2 and Python 3 (see
setup.cfg
).python setup.py sdist bdist_wheel
Upload the distributions.
twine upload dist/* -r pypi # (or pypitest)
This repository is available under the permissive BSD license, making it easy and safe to incorporate in your own libraries.
Pull and feature requests welcome. Online editing in GitHub is possible (and easy!)