library(tibble) library(htmlTable)
The Oklahoma State Courts Network (OSCN) holds information on all types of criminal and civil cases filed in District Courts across Oklahoma. For 13 counties, including the 6 largest by population, the information available is extensive and structured consistently. Those 13 counties are:
The relative ease of using data collected from OSCN allows us to perform more reliable and granular analysis. For this reason, we will begin a new project using this data rather than from ODCR.
The oscn_scrape()
function, included in the ojo R package, collects data from a given case and stores it in the OJO database. The function visits a case page (example here) and attempts to recognize types of data in the tables it finds in the page's HTML, puts the data into a dataframe in R, then uploads it. See function documentation for further details.
Each case filed in a District Court is given a case number following a straightforward pattern:
[Two letter case type abbreviation]-[Year of filing]-[Sequential number of filing in District Court of filing]
For example, criminal misdemeanors are given the abbreviation "CM", so the first misdemeanor case filed in Adair County in 2020 is numbered CM-2020-1. The first misdemeanor case filed in Pushmataha County in 2020 is also numbered CM-2020-1.
In the OJO database, case numbers follow the same pattern, but we add filler zeroes to make all case numbers the same length. CM-2020-1 appears as CM-2020-00001 in the OJO database, for instance.
Certain case types and periods are updated regularly by scripts that run either on our computers or on Amazon Web Services EC2 instances, but most are updated manually.
Functions useful for collecting this data are:
oscn_scrape_all()
, which searches OSCN for the last case filed for the specified courts, case types, and years, then scrapes all numbers from 1 to the last case.oscn_scrape_remaining()
, which finds two numbers for each court, case type, and year: (1) the highest case number found in the OJO database, and (2) the last case filed that year. This is especially useful if you've started collecting data for a certain year with oscn_scrape_all()
but were interrupted or if you only want to scrape newly filed cases in the current year. Criminal cases are filed under three case types: felony ("CF"), misdemeanor ("CM"), and traffic ("TR"). OJO began continuous collection of felony and misdemeanor cases filed 2008-present in the 13 OSCN counties in the summer of 2019, but automatic collection was interrupted in March 2020.
The follow
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.