freelawproject / courts-db

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

JSON Schema #10

Open anseljh opened 4 years ago

anseljh commented 4 years ago

This PR adds a JSON Schema. It also adds a unit test to tests.py that tries to validate the courts data file against that schema.

I fixed a few typos, and updated some bits of the court data so they would conform to the schema. For example, there were many empty strings that I turned into nulls and other small things like that. You scan see these all in commit a7297bc.

Some things I did not fix yet, because I wasn't sure whether the data or the schema should change. Those are:

Those three issues should be the last things remaining before the courts file validates.

I did not understand what is supposed to go in the jurisdiction and case_types items, so I left them mostly blank except for a description of "TODO".

Closes #2

mlissner commented 4 years ago

I also just noticed that black is failing you. You should be able to install it pretty easily, and then once you have it, you just do black . in your code directory, and it should do the right thing.

anseljh commented 4 years ago

Tests are all green now, which is weird because I expected the validation test to fail with something like this because of #8:

AssertionError: JSON failed validation against schema: 'non-trial' is not one of [None, 'ag', 'appellate', 'bankruptcy', 'international', 'special', 'trial']

Failed validating 'enum' in schema['items']['properties']['type']:
    {'description': 'What kind of court it is, e.g., "appellate"',
     'enum': [None,
              'ag',
              'appellate',
              'bankruptcy',
              'international',
              'special',
              'trial'],
     'type': ['string', 'null']}

On instance[85]['type']:
    'non-trial'

----------------------------------------------------------------------
Ran 5 tests in 3.797s

FAILED (failures=1)

Looks like the culprit is the CI test configuration here, which isn't running that test: https://github.com/freelawproject/courts-db/blob/master/.github/workflows/tests.yml#L25

Is there a reason to limit what tests are run, or can we just make that bit:

    - name: Run tests
      run: |
        python tests.py
mlissner commented 4 years ago

No reason, @anseljh. Want to fix the tests too?

mlissner commented 4 years ago

(Or rather, fix the CI test config, is what I meant to say.)

anseljh commented 4 years ago

Ok, I updated the CI config. Now the test I expect to fail is failing. Once we decide how to resolve #7, #8, and #9, it should be all green.

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

mlissner commented 2 years ago

Huh. I just turned on the CLA bot, but didn't realize it'd spam an actual IP lawyer. Ansel, maybe you have thoughts about it. I'm playing with it for this and a couple other smaller repos atm.

We should get this merged too. I thought it was merged ages ago!

anseljh commented 2 years ago

Huh. I just turned on the CLA bot, but didn't realize it'd spam an actual IP lawyer. Ansel, maybe you have thoughts about it. I'm playing with it for this and a couple other smaller repos atm.

That's kind of awesome and funny. Happy to have a look at the CLA, but you'll probably need to remind me.

We should get this merged too. I thought it was merged ages ago!

Sure. We'll need to re-run the tests.

mlissner commented 2 years ago

That's kind of awesome and funny. Happy to have a look at the CLA, but you'll probably need to remind me.

Take a look up thread, there's a link where you can agree to it.

brianwc commented 2 years ago

Wow. Didn't know there was a CLA-bot. I love it!

On Wed, Jan 19, 2022, 4:26 PM Mike Lissner @.***> wrote:

That's kind of awesome and funny. Happy to have a look at the CLA, but you'll probably need to remind me.

Take a look up thread, there's a link where you can agree to it.

— Reply to this email directly, view it on GitHub https://github.com/freelawproject/courts-db/pull/10#issuecomment-1016993585, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACPKOOSEMHIXM6RMCBPWB3UW5JBHANCNFSM4NVWL43A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

mlissner commented 2 years ago

It's new. I thought I flagged it for you, since I knew how you'd feel. It seems to be working well and uses the cla you provided in 2009 or so.

On Wed, Jan 19, 2022, 21:29 Brian Carver @.***> wrote:

Wow. Didn't know there was a CLA-bot. I love it!

On Wed, Jan 19, 2022, 4:26 PM Mike Lissner @.***> wrote:

That's kind of awesome and funny. Happy to have a look at the CLA, but you'll probably need to remind me.

Take a look up thread, there's a link where you can agree to it.

— Reply to this email directly, view it on GitHub < https://github.com/freelawproject/courts-db/pull/10#issuecomment-1016993585 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AACPKOOSEMHIXM6RMCBPWB3UW5JBHANCNFSM4NVWL43A

. Triage notifications on the go with GitHub Mobile for iOS < https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675

or Android < https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/freelawproject/courts-db/pull/10#issuecomment-1017134257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABZ3KRTPO6N2NOHY6H6EFDUW6MVHANCNFSM4NVWL43A . You are receiving this because you commented.Message ID: @.***>