oscn_scrape_remaining <- function(courts, casetypes, years) {
for (i in courts) {
for (j in casetypes) {
for (k in years) {
connect_ojo()
got <- dbGetQuery(ojo_db,
paste0("SELECT court, casetype, file_year, casenum
FROM oscn_caseinfo
WHERE court = '", i, "'
AND casetype = '", j, "'
AND file_year = ", k)) %>%
mutate(case_seq = str_sub(casenum, 9, 13) %>%
as.numeric)
disconnect_ojo()
print(paste("Checking", i, j, "cases in", k, max(got$case_seq)))
lastgot <- if (nrow(got) > 0) {max(got$case_seq)} else {1}
lastcase <- oscn_lastcase(i, j, k)
print(paste("Last case sequence", lastgot, "scraping to", lastcase))
oscn_scrape(i, j, k, lastgot:lastcase, updatedb = TRUE)
}
}
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.