OHDSI Home | Forums | Wiki | Github

Failure to run MethodEvaluation package

Hi again,

I am trying to use the computeMdrr function of the MethodEvaluation R package.

I can connect to my PostgreSQL server: I can list all tables in the database schema with the getTableNames function.

I am using the following script

library(DatabaseConnector)
connectionDetails<-createConnectionDetails(dbms = “postgresql”,
user = “test”,
password = “test”,
server = “10.2.4.148/postgres”,
schema = “alcapone”)

cdmDatabaseSchema<-“alcapone”

RefSet =read.table("/Users/thurin/Documents/R/Alcapone/Reference_set/R_ref_set_v0.4.csv", sep = “;”, header = TRUE)

cdmVersion<-“5”

library(MethodEvaluation)
MDRR<- computeMdrr(connectionDetails, cdmDatabaseSchema, exposureOutcomePairs=RefSet,
exposureDatabaseSchema = cdmDatabaseSchema, exposureTable = “drug_era”,
outcomeDatabaseSchema = cdmDatabaseSchema, outcomeTable = “cohort”,
cdmVersion = cdmVersion)

and I get this message:

Connecting using PostgreSQL driver
Computing minimumum detectable relative risks. This could take a while
|========== | 9%Error executing SQL: Error in .local(conn, statement, …): execute JDBC update query failed in dbSendUpdate (ERROR: syntax error at or near “)”
Position : 389)

An error report has been created at /Users/thurin/Documents/R/Alcapone/errorReport.txt
Error in value[3L] : no loop for break/next, jumping to top level

with this error report

DBMS:
postgresql

Error:
execute JDBC update query failed in dbSendUpdate (ERROR: syntax error at or near “)”
Position : 389)

SQL:
CREATE TEMP TABLE drug_prev_count

AS
SELECT
drug_concept_id AS drug_concept_id,
FLOOR((EXTRACT(YEAR FROM drug_era_start_date) - year_of_birth) / 10) AS age_group,
gender_concept_id,
COUNT(person.person_id) AS person_count

FROM
(
SELECT person_id AS person_id,
drug_concept_id,
MIN(drug_era_start_date) AS drug_era_start_date
FROM alcapone.drug_era
WHERE drug_concept_id IN ()
GROUP BY person_id,
drug_concept_id
) persons_with_drug
INNER JOIN person person
ON persons_with_drug.person_id = person.person_id
GROUP BY drug_concept_id,
FLOOR((EXTRACT(YEAR FROM drug_era_start_date) - year_of_birth) / 10),
gender_concept_id

R version:
R version 3.3.2 (2016-10-31)

Platform:
x86_64-apple-darwin13.4.0

Attached base packages:

  • stats
  • graphics
  • grDevices
  • utils
  • datasets
  • methods
  • base

Other attached packages:

  • MethodEvaluation (0.0.3)
  • Cyclops (1.2.3)
  • FeatureExtraction (1.0.2)
  • DatabaseConnector (1.9.2)
  • RJDBC (0.2-5)
  • rJava (0.9-8)
  • DBI (0.5-1)

Does someone know what is going wrong ?
Thank you for you help

I’m not sure where drug_concept_id list is being passed into the method call, but it appears to be an empty list, resulting in an empty IN () clause (which is invalid).

If you can figure out where drug_concept_id is being passed in, just make sure you have a non-zero length list.

-Chris

Hi @nthurin!

Please make sure that your RefSet data frame has columns exposureConceptId and outcomeConceptId (both names are case-sensitive). I’ve cleaned up the code a bit for this function, you might want to use the latest version now in Github. This new version should also give a clear error when it can’t find those columns.

Note that this MDRR calculation uses the rather crude method employed in the OMOP experiment. If you are looking at more precise MDRR calculations, the CohortMethod and CaseControl have functions for computing MDRR tailored to those study designs. (We’re still implementing the MDRR function for SCCS).

I think that the issue comes from the fact that we are trying to use ATC code (varchar) in drug_concept_id / exposureConceptId. I will re-try with integer.

t