Skip to content

Commit

Permalink
Add a script to build a list of courts
Browse files Browse the repository at this point in the history
This spits out a nice set of tables for easy viewing of basic court information.
  • Loading branch information
jacksonj04 committed Sep 18, 2024
1 parent 3f064bb commit 0ccce1a
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,19 @@ repos:
"src/ds_caselaw_utils/data/schema/courts.schema.json",
]

- repo: local
hooks:
- id: check_courts_list
name: build_courts_list
entry: scripts/build_courts_list
language: python
additional_dependencies: [pyyaml]
always_run: true
pass_filenames: false

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [yaml, json, xml, markdown, scss, javascript]
exclude: courts\.md
103 changes: 103 additions & 0 deletions courts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Courts in configuration file

<!-- This file is automatically generated from scripts/build_courts_list. You shouldn't edit it manually. -->


## supreme_court

| Name | Code | Param | Start | End |
| --- | --- | --- | --- | --- |
| United Kingdom Supreme Court | UKSC | uksc | 2014 | 2022 |

## privy_council

| Name | Code | Param | Start | End |
| --- | --- | --- | --- | --- |
| Privy Council | UKPC | ukpc | 2014 | 2022 |

## Court of Appeal (court_of_appeal)

| Name | Code | Param | Start | End |
| --- | --- | --- | --- | --- |
| Civil Division | EWCA-Civil | ewca/civ | 2003 | 2022 |
| Criminal Division | EWCA-Criminal | ewca/crim | 2003 | 2022 |

## High Court (England & Wales) (high_court)

| Name | Code | Param | Start | End |
| --- | --- | --- | --- | --- |
| Administrative Court | EWHC-QBD-Admin | ewhc/admin | 2003 | 2022 |
| Administrative Court | EWHC-KBD-Admin | ewhc/admin | 2022 | 2022 |
| Admiralty Court | EWHC-QBD-Admiralty | ewhc/admlty | 2003 | 2022 |
| Admiralty Court | EWHC-KBD-Admiralty | ewhc/admlty | 2022 | 2022 |
| Business and Property Courts | EWHC-QBD-BusinessAndProperty ||||
| Business and Property Courts | EWHC-KBD-BusinessAndProperty ||||
| Business and Property Courts | EWHC-Chancery-BusinessAndProperty ||||
| Business List | EWHC-Chancery-Business ||||
| High Court (Chancery Appeals) | EWHC-Chancery-Appeals ||||
| Chancery Division | EWHC-Chancery | ewhc/ch | 2003 | 2022 |
| Circuit Commercial Court | EWHC-QBD-Commercial-Circuit ||||
| Circuit Commercial Court | EWHC-KBD-Commercial-Circuit ||||
| Commercial Court | EWHC-QBD-Commercial | ewhc/comm | 2003 | 2022 |
| Commercial Court | EWHC-KBD-Commercial | ewhc/comm | 2022 | 2022 |
| Family Division | EWHC-Family | ewhc/fam | 2003 | 2022 |
| Financial List | EWHC-QBD-Commercial-Financial ||||
| Financial List | EWHC-KBD-Commercial-Financial ||||
| Financial List | EWHC-Chancery-Financial ||||
| Insolvency and Companies List | EWHC-Chancery-InsolvencyAndCompanies ||||
| Intellectual Property Enterprise Court | EWHC-Chancery-IPEC | ewhc/ipec | 2003 | 2022 |
| Intellectual Property List | EWHC-Chancery-IntellectualProperty ||||
| King's / Queen's Bench Division | EWHC-KBD | ewhc/kb | 2003 | 2022 |
| King's Bench Division | EWHC-KBD | ewhc/kb | 2022 | 2022 |
| Mercantile Court | EWHC-Mercantile | ewhc/mercantile | 2008 | 2014 |
| Patents Court | EWHC-Chancery-Patents | ewhc/pat | 2003 | 2022 |
| Queen's Bench Division | EWHC-QBD | ewhc/qb | 2003 | 2022 |
| Planning Court | EWHC-QBD-Planning ||||
| Planning Court | EWHC-KBD-Planning ||||
| Property, Trusts and Probate List | EWHC-Chancery-PropertyTrustsProbate ||||
| Senior Courts Costs Office | EWHC-SeniorCourtsCosts | ewhc/scco | 2003 | 2022 |
| Technology and Construction Court | EWHC-QBD-TCC | ewhc/tcc | 2003 | 2022 |
| Technology and Construction Court | EWHC-KBD-TCC | ewhc/tcc | 2022 | 2022 |

## Other Courts (lower_courts)

| Name | Code | Param | Start | End |
| --- | --- | --- | --- | --- |
| Crown Court | EWCR | ewcr | 2024 | 2024 |
| County Court | EWCC | ewcc | 2024 | 2024 |
| Family Court | EWFC | ewfc | 2009 | 2022 |
| Family Court (B - district and circuit judges) | EWFC-B | ewfc/b | 2009 | 2022 |
| Court of Protection | EWCOP | ewcop | 2009 | 2022 |
| Court of Protection (Tier 1 - district judges) | EWCOP-T1 | ewcop/t1 | 2009 | 2022 |
| Court of Protection (Tier 2 - circuit judges) | EWCOP-T2 | ewcop/t2 | 2009 | 2022 |
| Court of Protection (Tier 3 - high court judges) | EWCOP-T3 | ewcop/t3 | 2009 | 2022 |

## investigatory_powers_tribunal

| Name | Code | Param | Start | End |
| --- | --- | --- | --- | --- |
| Investigatory Powers Tribunal | UKIPT | ukiptrib | 2024 | 2024 |

## employment_appeal_tribunal

| Name | Code | Param | Start | End |
| --- | --- | --- | --- | --- |
| Employment Appeal Tribunal | EAT | eat | 2021 | 2022 |

## Upper Tribunals (upper_tribunals)

| Name | Code | Param | Start | End |
| --- | --- | --- | --- | --- |
| Administrative Appeals Chamber | UKUT-AAC | ukut/aac | 2022 | 2022 |
| Immigration and Asylum Chamber | UKUT-IAC | ukut/iac | 2003 | 2022 |
| Asylum & Immigration Tribunal | UKAIT | ukait | 2003 | 2010 |
| Lands Chamber | UKUT-LC | ukut/lc | 2015 | 2022 |
| Tax and Chancery Chamber | UKUT-TCC | ukut/tcc | 2017 | 2022 |

## First-tier Tribunals (first_tier_tribunals)

| Name | Code | Param | Start | End |
| --- | --- | --- | --- | --- |
| Employment Tribunal | ET || 2022 | 2022 |
| General Regulatory Chamber | UKFTT-GRC | ukftt/grc | 2022 | 2022 |
| Tax Chamber | UKFTT-TC | ukftt/tc | 2022 | 2022 |
48 changes: 48 additions & 0 deletions scripts/build_courts_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python

from pathlib import Path
import yaml

print("Loading courts...")

with open("src/ds_caselaw_utils/data/court_names.yaml", "r") as stream:
groups = yaml.safe_load(stream)

print("Building list of courts...")

with Path("courts.md").open("w") as f:
f.write("# Courts in configuration file\n")
f.write("\n")
f.write(
"<!-- This file is automatically generated from scripts/build_courts_list. You shouldn't edit it manually. -->\n",
)
f.write("\n")

for group in groups:
if group["display_name"]:
f.write(f"\n## {group['display_name']} ({group['name']})\n")
else:
f.write(f"\n## {group['name']}\n")

f.write(
"\n| Name | Code | Param | Start | End |\n",
)
f.write("| --- | --- | --- | --- | --- |\n")

for court in group["courts"]:
f.write("| ")
f.write(court["grouped_name"] if "grouped_name" in court else court["name"])

f.write(" | ")
f.write(court["code"])

f.write(" | ")
f.write(court["param"] if "param" in court else "–")

f.write(" | ")
f.write(str(court["start_year"]) if "start_year" in court else "–")

f.write(" | ")
f.write(str(court["end_year"]) if "end_year" in court else "–")

f.write(" |\n")

0 comments on commit 0ccce1a

Please sign in to comment.