Skip to main content

Courts-DB

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.

Background

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.

Quickstart

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 Notes on the Data

Some things to keep in mind as you are reviewing the data:

  1. The data is divided into two files courts.json and variables.json.

  2. courts.json holds the bulk of the information.

  3. variables.json holds templates for large numbers of regexes.

Fields

  1. id — string; CourtListener Court Identifier

  2. court_url — string; url for court website

  3. regex — array; regexes patterns to find courts

  4. examples — array; regexes patterns to find courts

  5. name — string; full name of the court

  6. name_abbreviation — string; court name abbreviations

  7. dates — Array; contains start date, end date and notes on date range

  8. system — string; defines main jurisdiction, ex. State, Federal, Tribal

  9. level — 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)

  10. location — string; refers to the physical location of the main court

  11. type — string; identifies kind of cases handled (Trial, Appellate, Bankruptcy, AG)

  12. citation_string — string; identifies the string used in a citation to refer to the court

  13. notes — string; a place to put notes about a court

Installation

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

Future

  1. Continue to improve and expand the dataset.

  2. Add filtering mechanisms by state, reporters, citation(s), judges, counties and cities.

Deployment

If you wish to create a new version, the process is:

  1. Update version info in setup.py and commit it.

  2. Tag the commit with the version number.

To proceed manually

  1. Push your commit. CI (Continuous Integration) should take care of the rest.

To proceed manually

  1. Install the requirements in requirements_dev.txt.

  2. Set up a config file at ~/.pypirc.

  3. Generate a universal distribution that works in Python 2 and Python 3 (see setup.cfg).

    python setup.py sdist bdist_wheel
  4. Upload the distributions.

    twine upload dist/* -r pypi # (or pypitest)

License

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!)

Metadata

Release files for courts-db 0.10.27

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for courts-db 0.10.27
File Size Uploaded
courts_db-0.10.27.tar.gz 139.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for courts-db 0.10.27
File Interpreter ABI Platform
courts_db-0.10.27-py3-none-any.whl Python 3 none any Details

Total release size: 288.3 kB

Release files / courts_db-0.10.27.tar.gz

Download URL courts_db-0.10.27.tar.gz
Size 139.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0562bff60ad2267d5aea7a1acf327af4b00fdd893783612135372101a45e313e
BLAKE2b-256 checksum
How to use checksums
f9b567faa4ae8e273708256a08e71e9173f4671dbe274a35256c10ec054e446c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / courts_db-0.10.27-py3-none-any.whl

Download URL courts_db-0.10.27-py3-none-any.whl
Size 148.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b47638caeaa30222231e754af3472273dfe8056d0fbd73da7f5d6857b99f27c
BLAKE2b-256 checksum
How to use checksums
4c79c0c10e34711f13258ab0f4299b1cd1eef4253298bb1e9f9131650a08ab87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.10.27 This release

2 release files

0.10.9

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.46

2 release files

0.9.45

2 release files

0.9.44

2 release files

0.9.43

2 release files

0.9.42

2 release files

0.9.33

2 release files

0.9.32

2 release files

0.9.31

2 release files

0.9.30

2 release files

0.9.28

2 release files

0.9.27

2 release files

0.9.26

2 release files

0.9.25

2 release files

0.9.24

2 release files

0.9.17

2 release files

0.9.16

2 release files

0.9.15

2 release files

0.9.14

2 release files

0.9.11

2 release files

0.9.10

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page