stored_procedure: Produces strings for stored procedure calls

Description Usage Arguments Examples

View source: R/stored_procedure.R

Description

Every argument defaults to "0" for all. (Except date which defaults to "2008-01-01".) Arguments will be coerced to character, so plain sequences are fine.

Arguments described above as "matches" will be matched if a partial arg is given. For example, setting parameter sp = "dis" will be enough to find the discharge_exit_over_time stored procedure.

Vector arguments will be handled appropriately, so if you want to make a query for all 39 counties just use county = 1:39. Character counties will be converted to numerics, so specifying county = "Kitsap" or county = c("king, pierce") will also work (capitalization is ignored).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
stored_procedure(sp = c("ia_trends_counts", "ia_trends_rates", "ia_safety",
  "ooh_pit_counts", "ooh_pit_rates", "ooh_flow_entries_counts",
  "ooh_flow_entries_rates", "ooh_flow_exits", "ooh_reentry", "ooh_outcomes",
  "ooh_outcomes_12m", "ooh_outcomes_24m", "ooh_outcomes_3m",
  "ooh_wb_familysettings", "ooh_wb_siblings", "ooh_wb_siblings_pvt",
  "ooh_wb_siblings_uncensored", "population_household", "population_person"),
  db = c("mysql", "sqlserver", "poc", "test_annie"), date = 0, age = 0,
  ethnicity = 0, county = 0, IHS = 0, reporter = 0, access = 0,
  allegation = 0, finding = 0, gender = 0, initial_placement = 0,
  longest_placement = 0, length_of_stay = 0, number_of_placements = 0,
  dependency = 0, year = 0)

Arguments

sp

(matches) Name of stored procedure (sans any "sp_" prefix or suffix such as "counts").

db

(matches) Database to use. Defaults to "mysql" (equivalent to "test_annie"), the other option is "sqlserver" (equivalent to "poc").

date

Point-in-time or cohort entry/exit date(s) here. (See also seq.Date.)

age

age/age group code, see details.

ethnicity

?? hopefully a synonym for race??

county

County code(s) OR character vectors with county names!

IHS

IHS Service Codes

reporter

code

access

entry point (aka access type) code

allegation

allegation code, 0: all, 1: PA, 2: SA, 3: Neglect, 4: any

finding

code, 0: all, 1: PA, 2: SA, 3: Neglect, 4: any

gender

1 for Female, 2 for Male (0 for all).

initial_placement

Initial placement setting, see details.

longest_placement

longest placement setting, see details.

length_of_stay

LOS code, 0: all, 1: > 7 days, 2: > 60 days, 3: > 1 year, 4: > 2 years

number_of_placements

code

dependency

Court Involvement/Dependency code

year

Shouldn't matter to the database, but you can specify if you'd like

Examples

1
2
3
## Not run: stored_procedure("poc1ab", date = seq(as.Date("2006-01-01"),
    as.Date("2009-01-01"), by = "year"), age = 1:3)
## End(Not run)

pocdata/pocr documentation built on Jan. 5, 2022, 9:54 a.m.