freelawproject / courts-db

A database of courts, tests and other experiments
BSD 2-Clause "Simplified" License
57 stars 14 forks source link

Lookups fail on courts' own citation strings #61

Open anseljh opened 1 year ago

anseljh commented 1 year ago

For example, looking up "W.D. Wash." fails to find wawd, even though "W.D. Wash." is that court's citation_string.

When I add the exact same value as the court's own citation_string to the test examples, that test fails. A line with "W.D. Wash." is inserted as an example:

    {
        "case_types": [],
        "citation_string": "W.D. Wash.",
        "court_url": "http://www.wawd.uscourts.gov/",
        [...]
        "examples": [
            "W.D. Wash.",
            "United States District Court Western Distict of Washington At Seattle",
            "United States District Court For The Western Division of Washington",
            "United States District Court Westhern District"
        ],
        "id": "wawd",
        [...]
}
Testing Supreme Court of the Territory of Washington ... √
F...F.......
======================================================================
FAIL: test_all_example (__main__.DataTest)
Can we extract the correct court id from string and date?
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/anseljh/Code/courts-db/tests.py", line 56, in test_all_example
    self.assertIn(
AssertionError: 'wawd' not found in [] : Failure to find wawd in W.D. Wash.

======================================================================
FAIL: test_all_non_bankruptcy_examples (__main__.ExamplesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/anseljh/Code/courts-db/tests.py", line 135, in test_all_non_bankruptcy_examples
    self.assertIn(court["id"], results, msg=f"Failed {example}")
AssertionError: 'wawd' not found in [] : Failed W.D. Wash.

----------------------------------------------------------------------
Ran 12 tests in 26.630s

FAILED (failures=2)
Testing W.D. Wash. ... %                                                          

I ran into this trying to convert Brad Heath's format (e.g., here) to a courts-db id.

mlissner commented 1 year ago

Yeah, this seems like a fairly easy fix.

anseljh commented 1 year ago

Eh, don't merge this yet. I'm making some changes.