Code Monkey home page Code Monkey logo

cap-examples's Introduction

CAP examples

CircleCI

A repository of examples of what can be done with Caselaw Access Project data.

Table of Contents

Start here!

More examples

Interested in contributing your own examples?

  1. Fork this repository
  2. Install dependencies
  3. Add your work
  4. Make sure to add any requirements your project needs to requirements.in
  5. Run pip-compile --output-file requirements.txt requirements.in
  6. Add a link in the Examples section
  7. Create a pull request
  8. Receive gratitude (thank you so much!!)

Using the API

Read our API documentation.

In order to download non-whitelisted cases, you must register for an API key.

Once you have your API key, copy and paste it into your secret keys file settings.py.

Downloading bulk data

Helper methods to download whitelisted bulk data

These example require the existence of an API key in settings.py. Follow the instructions above in the Using the API section to obtain one.

Download the Illinois dataset

(capexamples) $ fab get_cases_from_bulk:Illinois

Or, download the Arkansas dataset

(capexamples) $ fab get_cases_from_bulk:Arkansas

Download a dataset with casebody format as xml

(capexamples) $ fab get_cases_from_bulk:Illinois,data_format=xml

Install

These examples assume some python knowledge. We will be using python3. This code has been tested using Python 3.9.10. We will also be installing all our dependencies and working in a virtual environment.

$ python3 -mvenv venv
$ source venv/bin/activate
$ (venv) pip install -r requirements.txt

Set up!

(venv) $ pip install -r requirements.txt
(venv) $ fab setup

To run jupyter notebook examples (i.e. any file ending in .ipynb):

(venv) $ jupyter notebook

cap-examples's People

Contributors

abziegler avatar anastasia avatar bensteinberg avatar chefandy avatar jcushman avatar john-bowers avatar niharikasingh avatar robaleman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cap-examples's Issues

zipfile.BadZipFile error running fab get_cases_from_bulk for non-whitelisted data

I can download the whitelisted data fine, however after copying config/settings.example.py to config/settings.py and adding my API key, on other states such as fab get_cases_from_bulk:Alaska I get this error: zipfile.BadZipFile: File is not a zip file. See below for the full stacktrace.

If there were a problem with my API key I would hope to get an error accordingly.

When I run fab get_cases_from_bulk:alaska or something I know does not exist fab get_cases_from_bulk:notajurisdiction I get the error Exception: Jurisdiction not found. Please check spelling. so it seems the fab get_cases_from_bulk:Alaska is found, but there's a problem downloading.

I forked your repo here: https://github.com/aculich/cap-examples

And modified the requirements.txt to try running on binder (since there was a failure with the specific certifi dependency):

https://mybinder.org/v2/gh/aculich/cap-examples/master

I'm using Python 3.6 (instead of the 3.5.4 mentioned your docs).

Full Stacktrace:

Traceback (most recent call last):
  File "/srv/conda/lib/python3.6/site-packages/fabric/main.py", line 763, in main
    *args, **kwargs
  File "/srv/conda/lib/python3.6/site-packages/fabric/tasks.py", line 427, in execute
    results['<local-only>'] = task.run(*args, **new_kwargs)
  File "/srv/conda/lib/python3.6/site-packages/fabric/tasks.py", line 174, in run
    return self.wrapped(*args, **kwargs)
  File "/home/jovyan/fabfile.py", line 33, in get_cases_from_bulk
    utils.get_cases_from_bulk(jurisdiction)
  File "/home/jovyan/utils.py", line 50, in get_cases_from_bulk
    z = zipfile.ZipFile(io.BytesIO(r.content))
  File "/srv/conda/lib/python3.6/zipfile.py", line 1108, in __init__
    self._RealGetContents()
  File "/srv/conda/lib/python3.6/zipfile.py", line 1175, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.