top_causes | R Documentation |
top_causes
identifies the top N causes for a given set of visits.
top_causes(
conn,
source = c("apcd", "mcaid", "mcaid_mcare", "mcare"),
cohort,
cohort_id = NULL,
renew_ids = T,
from_date = NULL,
to_date = NULL,
ind_dates = F,
ind_from_date = NULL,
ind_to_date = NULL,
top = 15,
catch_all = F,
primary_dx = T,
type = c("ed", "ed_avoid_ny", "ed_avoid_ca", "inpatient", "all"),
override_all = F
)
conn |
SQL server connection created using |
source |
Which claims data source do you want to pull from? |
cohort |
The group of individuals of interest. Note: it is possible to generate a cohort on the fly
using |
cohort_id |
The field that contains the ID in the cohort data. Defaults to id_apde. |
renew_ids |
Option to avoid reloading ID fields to temp table. |
from_date |
Begin date for claims period, "YYYY-MM-DD", defaults to start of the previous calendar year. |
to_date |
End date for claims period, "YYYY-MM-DD", defaults to end of the previous calendar year or 6 months prior to today's date, whichever is earlier. |
ind_dates |
Flag to indicate that individualized dates are used to narrow the default date window. |
ind_from_date |
Field in the cohort data that contains an individual from date. |
ind_to_date |
Field in the cohort data that contains an individual to date. |
top |
The maximum number of condition groups that will be returned, default is 15. |
catch_all |
Determines whether or not catch_all codes are included in the list, default is no. |
primary_dx |
Whether or not to only look at the primary diagnosis field, default is TRUE. |
type |
Which types of visits to include. Choose from the following: ed (any ED visit), ed_avoid_ny (any avoidable ED visit (based on NYU classification)) ed_avoid_ca (any avoidable ED visit (based on CA classification)) inpatient (any inpatient visit) all (all claims, must be paired with override_all option) |
override_all |
Override the warning message about pulling all claims, default is FALSE. |
This function builds a temp table with the IDs of a cohort of interest. It then creates a SQL query to find claims for that cohort made in a given time frame The top N categories are selected and a count of the claims in each category given. There are optional flags for the following: 1) To limit categories to just the primary dx vs. all dx. 2) To restrict to certain visit types (e.g., ED visits, hospitalizations)
## Not run:
top_15 <- top_causes_f(cohort = focus_pop, cohort_id = id, conn = db.claims51)
top_15_dynamic <- top_causes_f(cohort = mcaid_elig_f(conn = db.claims51,
from_date = "2017-01-01", to_date = "2017-12-31", korean = 1, zip = "98103"), top = 3)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.