Skip to content

Commit

Permalink
feat(regexes): Update regex patterns
Browse files Browse the repository at this point in the history
By default use name as a regex pattern
Merge a few duplicates
  • Loading branch information
flooie committed Jan 5, 2024
1 parent b2a3018 commit f122f5b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 108 deletions.
121 changes: 14 additions & 107 deletions courts_db/data/courts.json
Original file line number Diff line number Diff line change
Expand Up @@ -29513,7 +29513,8 @@
"parent": "nyfamct",
"regex": [
"New York City Family Court",
"Family Court, New York County"
"Family Court, New York County",
"Fam Ct, NY County"
],
"system": "state",
"type": "trial"
Expand Down Expand Up @@ -29920,29 +29921,6 @@
"system": "state",
"type": "trial"
},
{
"citation_string": "",
"dates": [
{
"end": null,
"start": null
}
],
"examples": [
"Family Court, New York County"
],
"id": "nyfamctny",
"level": "trial",
"location": "New York",
"name": "New York Family Court, New York County",
"parent": "nyfamct",
"regex": [
"Family Court, New York County",
"Fam Ct, NY County"
],
"system": "state",
"type": "trial"
},
{
"citation_string": "",
"dates": [
Expand Down Expand Up @@ -30771,32 +30749,6 @@
"system": "state",
"type": "trial"
},
{
"case_types": [],
"citation_string": "N.Y. Sup. Ct., Onondaga Cty.",
"court_url": "http://www.nycourts.gov/courts/cts-outside-nyc-SUPREME.shtml",
"dates": [
{
"end": null,
"start": "1896-01-01"
}
],
"examples": [
"New York Supreme Court Onondaga Special Term"
],
"id": "nysupctnndg",
"level": "gjc",
"location": "New York",
"name": "New York Supreme Court Onondaga Special Term",
"parent": "nysupct",
"regex": [
"New York Supreme Court Onondaga Special Term",
"New York Supreme Court, Onondaga County",
"Sup Ct, Onondaga County"
],
"system": "state",
"type": "trial"
},
{
"case_types": [],
"citation_string": "N.Y. Sup. Ct., St. Lawrence Cty.",
Expand Down Expand Up @@ -31786,7 +31738,10 @@
"Sup Ct, Onondaga",
"Integrated Domestic Violence Ct, Onondaga County",
"Sup Ct. Onondaga County",
"Integrated Domestic Violence Part, Sup Ct, Onondaga County"
"Integrated Domestic Violence Part, Sup Ct, Onondaga County",
"New York Supreme Court Onondaga Special Term",
"New York Supreme Court, Onondaga County",
"Sup Ct, Onondaga County"
],
"system": "state",
"type": "trial"
Expand Down Expand Up @@ -34528,7 +34483,7 @@
},
{
"case_types": [],
"citation_string": "",
"citation_string": "N.Y. Just. Court, Bedford",
"court_url": "https://www.nycourts.gov/courts/townandvillage/",
"dates": [
{
Expand All @@ -34537,15 +34492,17 @@
}
],
"examples": [
"Justice Court Of The Town Of Bedford, Westchester County"
"Justice Court of Town of Bedford"
],
"id": "nyjustctbedford",
"id": "nybedfordjustct",
"jurisdiction": "N.Y.",
"level": "trial",
"location": "New York",
"name": "Justice Court of The Town Of Bedford",
"name": "Bedford Justice Court",
"notes": "",
"parent": "nyjustct",
"regex": [
"Justice Court of Town of Bedford",
"Justice Court Of The Town Of Bedford, Westchester County",
"Just Ct Town Bedford, Westchester County"
],
Expand All @@ -34569,7 +34526,7 @@
"jurisdiction": "N.Y.",
"level": "trial",
"location": "New York",
"name": "Aurora Justice Court",
"name": "Bethlehem Justice Court",
"parent": "nyjustct",
"regex": [
"Bethlehem Justice Court",
Expand Down Expand Up @@ -35547,31 +35504,7 @@
"Hunter Justice Court",
"Justice Court of Town of Hunter",
"Just Ct Hunter, Greene County",
"Hunter Town Ct"
],
"system": "state",
"type": "trial"
},
{
"case_types": [],
"citation_string": "",
"court_url": "https://www.nycourts.gov/courts/townandvillage/",
"dates": [
{
"end": null,
"start": null
}
],
"examples": [
"Justice Court Town of Hunter"
],
"id": "nyjustcthunter",
"jurisdiction": "N.Y.",
"level": "trial",
"location": "New York",
"name": "Justice Court Town of Hunter",
"parent": "nyjustct",
"regex": [
"Hunter Town Ct",
"Just Ct Town Hunter, Greene County",
"Justice Court Town of Hunter"
],
Expand Down Expand Up @@ -35936,32 +35869,6 @@
"system": "state",
"type": "trial"
},
{
"case_types": [],
"citation_string": "N.Y. Just. Court, Bedford",
"court_url": "https://www.nycourts.gov/courts/townandvillage/",
"dates": [
{
"end": null,
"start": null
}
],
"examples": [
"Justice Court of Town of Bedford"
],
"id": "nybedfordjustct",
"jurisdiction": "N.Y.",
"level": "trial",
"location": "New York",
"name": "Justice Court of Town of Bedford",
"notes": "",
"parent": "nyjustct",
"regex": [
"Justice Court of Town of Bedford"
],
"system": "state",
"type": "trial"
},
{
"case_types": [],
"citation_string": "",
Expand Down
3 changes: 2 additions & 1 deletion courts_db/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def gather_regexes(courts):
"""
regexes = []
for court in courts:
for reg_str in court["regex"]:
court_regexes = court["regex"] + [court['name']]
for reg_str in court_regexes:
# Unwind the extra gruff in regexes
reg_str = reg_str.replace("\\\\", "\\")
regex = re.compile(reg_str, (re.I | re.U))
Expand Down

0 comments on commit f122f5b

Please sign in to comment.