Skip to content

Commit

Permalink
Include traffic offenses in district court data
Browse files Browse the repository at this point in the history
  • Loading branch information
rebecca-draben committed Apr 25, 2023
1 parent 511c839 commit cc71d6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
9 changes: 4 additions & 5 deletions ciprs_reader/parser/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ def clean(self, matches):
data = {}
fileno = self.report["General"].get("File No", "")
if fileno:
if "CR" in fileno:
if "CRS" in fileno:
data["Superior"] = "Yes"
else:
data["District"] = "Yes"
if "CRS" in fileno:
data["Superior"] = "Yes"
elif "CR" in fileno or "IF" in fileno:
data["District"] = "Yes"
return data

def extract(self, matches, report):
Expand Down
11 changes: 10 additions & 1 deletion tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_defendent_dob(report, state):


def test_court_type_other(report, state):
report = {"General": {"File No": "11IF777777"}}
report = {"General": {"File No": "11XX777777"}}
matches = parsers.DistrictSuperiorCourt(report, state).match("")
assert matches is not None, "Regex match failed"
assert matches == {}
Expand All @@ -26,6 +26,15 @@ def test_court_type_cr(report, state):
assert report["General"]["District"] == "Yes"


def test_court_type_if(report, state):
report = {"General": {"File No": "11IF777777"}}
parser = parsers.DistrictSuperiorCourt(report, state)
parser.find("")
assert parser.matches is not None, "Regex match failed"
assert parser.matches == {"District": "Yes"}
assert report["General"]["District"] == "Yes"


def test_court_type_crs(report, state):
report = {"General": {"File No": "11CRS777777"}}
parser = parsers.DistrictSuperiorCourt(report, state)
Expand Down

0 comments on commit cc71d6c

Please sign in to comment.