PHSKC-APDE / claims_data

Process and analyze WA State Medicaid, Medicare, and All-Payer Claims Database eligibility and claims data
21 stars 4 forks source link

claims_elig() examples do not run #139

Closed dcolombara closed 2 years ago

dcolombara commented 2 years ago

Example given in helpful for claims_elig does not work on fresh install of R 4.2.1 with claims package version 0.1.11.

Here is the code that I tried and the error message:

rm(list=ls())

library(data.table)
library(claims)
library(odbc)
library(DBI)

db.claims51 <- dbConnect(odbc(), "PHClaims51")

mytest <- claims_elig(conn = db.claims51, # example in help file
                      source = "mcaid", 
                      from_date = "2017-01-01", 
                      to_date = "2017-06-30")

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'statement' in selecting a method for function 'dbGetQuery': object 'tbl_rac' not found

Daniel Casey replicated the error on 4.2.1 on 7/18/2022.

The following custom query returned the same error code:

hh = claims_elig(
  conn = db.claims51,
  server = 'phclaims',
  source = c("mcaid"),
  from_date = '2022-05-01',
  to_date = '2022-05-31',
  cov_min = 100,
  show_query = T
)

But it works on HHSAW, so maybe it's just an issue of documentation needing to be updated?

  test1 = setDT(claims::claims_elig(
    conn = hhsaw16,
    server = 'hhsaw',
    source = c("mcaid"),
    from_date = '2022-05-01',
    to_date = '2022-05-31',
    cov_min = 100,
    show_query = T
  ))
alastairmatheson commented 2 years ago

Thanks Danny. I just overhauled the two elig functions to better work in HHSAW and may have broken the PHClaims connection in the process. I'll take a look next week if you're ok hitting HHSAW in the mean time.

dcolombara commented 2 years ago

Zero urgency to work on this. I just wanted to flag it for rainy day! Thanks.