Skip to main content

Database of Courts

Project description

Courts-DB

Courts-DB is an open source repository to organize a db of all courts current and historical. It was built for use in Courtlistener.com.

Its main goal is to interface with CL to identify historical and current courts by string. It incldues 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 to be the most extensive open dataset of its kind.

Quickstart

You can feed in a courtlistener Court_ID 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

Somethings to keep in mind as you are reviewing the data.

  1. The data is devided 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

Installation

Installing courts-db is easy.

pip install courts_db

Or install the latest dev 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.

  1. Tag the commit with the version number.

To proceed manually

  1. Push your commit. CI should take care of the rest.

To proceed manually

  1. Install the requirements in requirements_dev.txt

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

  1. Generate a universal distribution that worksin py2 and py3 (see setup.cfg)

    python setup.py sdist bdist_wheel
  1. 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!)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

courts-db-0.9.41.tar.gz (82.9 kB view details)

Uploaded Source

Built Distribution

courts_db-0.9.41-py2.py3-none-any.whl (91.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file courts-db-0.9.41.tar.gz.

File metadata

  • Download URL: courts-db-0.9.41.tar.gz
  • Upload date:
  • Size: 82.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for courts-db-0.9.41.tar.gz
Algorithm Hash digest
SHA256 960b8ac8671d5006bb7da49039b19f7c1613c7926660f7eed8353234e6568251
MD5 1df7a6d0d0aa7a6cde6d435b0629cc33
BLAKE2b-256 243569a9d8fb63ddce0bcc3b582ff3008911bc340ee8c29df69b2e5111cadab3

See more details on using hashes here.

File details

Details for the file courts_db-0.9.41-py2.py3-none-any.whl.

File metadata

  • Download URL: courts_db-0.9.41-py2.py3-none-any.whl
  • Upload date:
  • Size: 91.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for courts_db-0.9.41-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 40395b51193580ac1257854f6d94da02b40d25a4dbc470930a7991df5b8e4827
MD5 3f9f2d37f3463471b57351ed5828561a
BLAKE2b-256 56357a01e8048e9ba9ed0e60e605bc149f3f89b32f4a7712d6a17362f4942c0a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page