ohdsi-studies / PioneerWatchfulWaiting

This study is part of the joint PIONEER - EHDEN - OHDSI studyathon in March 2021, and aims to advance understanding of clinical management and outcomes of watchful waiting in prostate cancer.
Apache License 2.0
7 stars 18 forks source link

Hardcoded table names #32

Closed marek05 closed 3 years ago

marek05 commented 3 years ago

There are some hardcoded tablenames in the code.

I got following error while I run the study part.

DBMS:
postgresql

Error:
org.postgresql.util.PSQLException: ERROR: relation "pioneer_sp_stg" does not exist
  Position: 326

SQL:
SELECT t.subject_id,
     t.cohort_start_date,
     coalesce(min(o.cohort_start_date), max(t.cohort_end_date)) AS event_date,
     CASE WHEN min(o.cohort_start_date) IS NULL THEN 0 ELSE 1 END AS event
FROM ohdsi_scratch.PIONEER_MAITT_stg t
LEFT JOIN (
        SELECT subject_id, min(cohort_start_date) AS cohort_start_date
        FROM pioneer_sp_stg
        WHERE cohort_definition_id IN (202, 201)
        GROUP BY subject_id
        ) o
  ON t.subject_id = o.subject_id
      AND o.cohort_start_date >= t.cohort_start_date
      AND o.cohort_start_date <= t.cohort_end_date
WHERE t.cohort_definition_id = 101
GROUP BY t.subject_id, t.cohort_start_date;

R version:
R version 4.0.3 (2020-10-10)

Platform:
x86_64-apple-darwin17.0

Attached base packages:
- stats
- graphics
- grDevices
- datasets
- utils
- methods
- base

Other attached packages:
- PioneerWatchfulWaiting (0.3.2)
- DatabaseConnector (3.0.0)

I found that following files have hardcoded pioneer_sp_stg table name

This is the file for which I got the error https://github.com/ohdsi-studies/PioneerWatchfulWaiting/blob/5e1b4f6f7bb468064d7546dae3c3f657ebc67421/inst/sql/sql_server/TimeToEventCombined.sql#L8

I found also this file with the hardcoded table name https://github.com/ohdsi-studies/PioneerWatchfulWaiting/blob/5e1b4f6f7bb468064d7546dae3c3f657ebc67421/inst/sql/sql_server/quartiles/PsaAtDiagnosis.sql#L4

scossin commented 3 years ago

There is also a "pioneer_sp" table that doesn't exist: https://github.com/ohdsi-studies/PioneerWatchfulWaiting/blob/5e1b4f6f7bb468064d7546dae3c3f657ebc67421/inst/sql/sql_server/quartiles/IQRComplementaryTables.sql#L234