Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@result_database_schema in ROhdsiWebApi::getCohortSql() output #225

Open
jreps opened this issue Jul 28, 2021 · 3 comments
Open

@result_database_schema in ROhdsiWebApi::getCohortSql() output #225

jreps opened this issue Jul 28, 2021 · 3 comments

Comments

@jreps
Copy link

jreps commented Jul 28, 2021

When executing:

ROhdsiWebApi::getCohortSql() with the public ATLAS webApi - it is adding the line:

"delete from @results_database_schema.cohort_censor_stats where cohort_definition_id = @target_cohort_id;"

which requires that the table 'cohort_censor_stats' exists - but if you just want to convert a json cohort into sql and execute it, you don't need the 'cohort_censor_stats' table and creating it is annoying.

I managed to remove the problematic line using gsub - but I'm wondering whether it is a bug that there is a @results_database_schema added?

@anthonysena
Copy link
Collaborator

@jreps - when calling getCohortSql() are you specifying generateStats = FALSE? By default, this parameter is set to TRUE which is why the cohort_censor_stats table is generated per Circe: https://github.com/OHDSI/circe-be/blob/master/src/main/resources/resources/cohortdefinition/sql/generateCohort.sql#L121-L127

@azimov
Copy link
Collaborator

azimov commented Oct 20, 2021

As @anthonysena has said, this is resolved by setting generateStats to false.

However, in my opinion most users of this package will not want to generate the cohort stats because it requires creating additional tables. I think the boilerplate sql for these tables must live somewhere so I propose one of three solutions:

  1. Default behaviour of ROhdsiWebApi is to set generateStats = False
  2. Include the boilerplate sql to create the stats tables (including censor stats table)
  3. Both of the above.

@gowthamrao
Copy link
Member

@target_database_schema and @results_database_schema

Would use of #cohort_censor_stats instead of @results_database_schema.cohort_censor_stats made more sense?
also add 'if exists table' logic here

@chrisknoll

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants