From 0ccce1a823c01ff0092e6f1bed30651cd76535b9 Mon Sep 17 00:00:00 2001 From: Nick Jackson Date: Wed, 18 Sep 2024 15:03:44 +0100 Subject: [PATCH] Add a script to build a list of courts This spits out a nice set of tables for easy viewing of basic court information. --- .pre-commit-config.yaml | 11 ++++ courts.md | 103 ++++++++++++++++++++++++++++++++++++++ scripts/build_courts_list | 48 ++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 courts.md create mode 100755 scripts/build_courts_list diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 679f6e7..aa13ef7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/courts.md b/courts.md new file mode 100644 index 0000000..0cd78df --- /dev/null +++ b/courts.md @@ -0,0 +1,103 @@ +# Courts in configuration file + + + + +## 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 | diff --git a/scripts/build_courts_list b/scripts/build_courts_list new file mode 100755 index 0000000..a17798e --- /dev/null +++ b/scripts/build_courts_list @@ -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( + "\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")