项目作者: davesag

项目描述 :
Command-line tool that extracts structured data about all of the US Supreme Court Cases since 2000
高级语言: JavaScript
项目地址: git://github.com/davesag/wikiscores.git
创建时间: 2018-11-28T00:41:53Z
项目社区:https://github.com/davesag/wikiscores

开源协议:MIT License

下载


wikiscores

A Command-line tool that extracts structured data about all of the US Supreme Court Cases since 2000. Developed for my brother to use to harvest some data.

Prerequisites

  • Node JS brew install node or brew install nvm then nvm install 14.15.0 (or whatever is the most recent LTS version)

Installation

Install wikiscores as a global module as follows:

  1. npm i -g wikiscores

Simple Usage

From a Terminal run

  1. wikiscores

This will go to the Lists_of_United_States_Supreme_Court_cases page in wikipedia and get a list of all of the ‘Term Opinions’. And for Each ‘Term Opinion’ it grabs the ‘Cases’, and for each Case it grabs some statistical data.

Options

  1. By default it will write it to a file output.csv but you can specify the relative file path via the -o flag.
  2. You can rate limit it with the -r option to specify the max number of requests per second.
  3. You can limit the concurrency with the -c option to restrict the number of simultaneous requests.
  4. You can filer for a specific case name with the -f option. (replace spaces with _)
  1. wikiscores -o some/other/output.csv -r 10 -c 2 -f Bush_v._Palm_Beach_County

See

  1. wikiscores --help

for more info.

Development

Fork this repo and use the forked-git-flow process as outlined in the Contributing notes.

Branches

Branch Tests Code Coverage Audit Comments
develop CircleCI codecov Vulnerabilities Latest Staging Release
master CircleCI codecov Vulnerabilities Latest Production Release

Functional Requirements

Scrape a list of Term Opinions from a list of US Supreme Court Cases, and from each one grab a list of individual cases. For each case grab data in the form:

  1. {
  2. "term": 2002, // the term year
  3. "title": "Some title",
  4. "defaultSort": "Some default sort title",
  5. "length": 100, // the length of the article in bytes
  6. "articleId": 12345, // the numeric article id
  7. "contentModel": "wikitext",
  8. "watchers": 33, // The number of watchers, or the phrase 'Fewer than 30 watchers'
  9. "edits": 22, //number of edits
  10. "recentEdits": 20, // number of recent edits
  11. "monthCount": 55, // number of reads in the last month
  12. "createdAt": '2010-12-28T19:35:00.000Z', // date created in Zulu Time format"
  13. "creator": "The username of the original editor",
  14. }

Test it

  • npm test — runs the unit tests (quick, runs offline)
  • npm test:unit:cov — runs the unit tests with code coverage

Lint it

  1. npm run lint

Contributing

Please see the contributing notes.