{"id":14036592,"url":"https://github.com/harvard-lil/cap-examples","last_synced_at":"2025-07-27T03:32:23.051Z","repository":{"id":47546605,"uuid":"154377563","full_name":"harvard-lil/cap-examples","owner":"harvard-lil","description":"Examples for getting started using https://case.law","archived":true,"fork":false,"pushed_at":"2022-09-13T19:32:42.000Z","size":8312,"stargazers_count":64,"open_issues_count":1,"forks_count":24,"subscribers_count":9,"default_branch":"develop","last_synced_at":"2024-12-02T15:48:59.529Z","etag":null,"topics":["api","bulk","caselaw","court","python"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harvard-lil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-23T18:27:27.000Z","updated_at":"2024-10-03T14:47:33.000Z","dependencies_parsed_at":"2023-01-18T06:30:56.238Z","dependency_job_id":null,"html_url":"https://github.com/harvard-lil/cap-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/harvard-lil/cap-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harvard-lil%2Fcap-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harvard-lil%2Fcap-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harvard-lil%2Fcap-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harvard-lil%2Fcap-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harvard-lil","download_url":"https://codeload.github.com/harvard-lil/cap-examples/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harvard-lil%2Fcap-examples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267294180,"owners_count":24065343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bulk","caselaw","court","python"],"created_at":"2024-08-12T03:02:04.159Z","updated_at":"2025-07-27T03:32:19.791Z","avatar_url":"https://github.com/harvard-lil.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"# CAP examples\n\n[![CircleCI](https://circleci.com/gh/harvard-lil/cap-examples.svg?style=svg)](https://circleci.com/gh/harvard-lil/cap-examples)\n\nA repository of examples of what can be done with Caselaw Access Project data.\n- [CAP Github repo](https://github.com/harvard-lil/capstone)\n- [CAP homepage](https://case.law/)\n\n## Table of Contents\n- [Introduction](#start-here!)\n- [Examples](#more-examples)\n- [Contributing instructions](#interested-in-contributing-your-own-examples)\n- [Using the API](#using-the-api)\n- [Download bulk data](#downloading-bulk-data)\n- [Installation Instructions](#install) - install this repo to run examples on your own machine\n\n## Start here!\n- [Introduction](introduction/introduction.ipynb)\n\n## More examples\n- [Bulk Case Extract](bulk_extract/extract_cases.ipynb) - Get cases from our api's /bulk endpoint. Extract cases into a dataframe.\n- [Full Text Search](full_text_search/full_text_search.ipynb) - Get all cases that include a keyword.\n- [Full Text Search with Context](api_text_search/api_text_search.py) - Like full text search, only this time using your API key to get the context around the word.\n- [Ngrams](ngrams/ngrams.ipynb) – Use the open Arkansas bulk cases to explore interesting words.\n- [Bulk Exploration: ngrams and Justice Cartwright](bulk_exploration/cartwright.ipynb) – Use the open Illinois bulk cases to explore interesting words, and look at a Judge's opinion publishing history.\n- [Map Courts](map_courts/map_courts.ipynb) - Map all the courts on a U.S. map.\n- [Python Wrapper](python_wrapper/cap.py) - Python wrapper for searching cases, downloading to CSV, etc.\n- [Get Judges](get_judges/get_judges.ipynb) - Get judges and return [CourtListener Person urls](https://www.courtlistener.com/api/rest/v3/people/?name_last=Pregerson\u0026name_first=Harry)\n- [API to CSV](api_to_csv/api_to_csv.py) - Command line Python3 script with no external dependencies, fetching search results from the cases endpoint and writing to a CSV.\n- [Labelling case parties and summarizing cases](labelling_summarizing/labelling_summarizing.ipynb) - Using some basic machine learning to label who the parties in each case were, and then summarizing the case text.\n\n## Interested in contributing your own examples?\n1. Fork this repository\n2. [Install dependencies](#install)\n3. Add your work\n4. Make sure to add any requirements your project needs to [requirements.in](requirements.in)\n5. Run ```pip-compile --output-file requirements.txt requirements.in```\n6. Add a link in the [Examples section](#examples)\n7. Create a [pull request](https://github.com/harvard-lil/cap-examples/compare)\n8. Receive gratitude (thank you so much!!)\n\n\n## Using the API\n[Read our API documentation.](https://case.law/api/)\n\nIn order to download [non-whitelisted](https://case.law/api/#limits) cases, you must [register for an API key](https://case.law/user/register/).\n\nOnce you have your API key, copy and paste it into your secret keys file [settings.py](config/settings.py).\n\n## Downloading bulk data\n\n#### Helper methods to download whitelisted bulk data\nThese example require the existence of an API key in settings.py.\nFollow the instructions above in the [Using the API](#using-the-api) section to obtain one.  \n\nDownload the Illinois dataset\n```\n(capexamples) $ fab get_cases_from_bulk:Illinois\n```\n\nOr, download the Arkansas dataset\n```\n(capexamples) $ fab get_cases_from_bulk:Arkansas\n```\n\nDownload a dataset with casebody format as xml\n```\n(capexamples) $ fab get_cases_from_bulk:Illinois,data_format=xml\n```\n\n## Install\nThese examples assume some python knowledge. We will be using `python3`.\nThis code has been tested using Python `3.9.10`.\nWe will also be installing all our dependencies and working in a [virtual environment](https://docs.python.org/3/library/venv.html).\n\n```\n$ python3 -mvenv venv\n$ source venv/bin/activate\n$ (venv) pip install -r requirements.txt\n```\n\nSet up!\n```\n(venv) $ pip install -r requirements.txt\n(venv) $ fab setup\n```\n\nTo run jupyter notebook examples (i.e. any file ending in .ipynb):\n```\n(venv) $ jupyter notebook\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharvard-lil%2Fcap-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharvard-lil%2Fcap-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharvard-lil%2Fcap-examples/lists"}