Repository navigation
Conversation
The drug era example script on the SQL Scripts page now lives in inst/sql/sql_server/OMOP_CDM_drug_era.sql, unchanged, and the page includes it from there (engine: knitr, so the page renders the sql chunk without Jupyter). buildDrugEra() renders that script for a CDM schema, translates it with SqlRender and runs it with DatabaseConnector, like executeDdl(). The tests run it on a SQLite CDM for every supported CDM version with the scenarios from OHDSI#761 and check the era dates and exposure counts. docs/sqlScripts.html only has the changes from re-rendering the page.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of the two stacked PRs @MaximMoinat asked for in #822. This one only moves code and adds a function; the SQL is unchanged. The #761 fix goes on top of it in #822.
Change
inst/sql/sql_server/OMOP_CDM_drug_era.sql: the drug era script from the SQL Scripts page, byte for byte the block that was insite/sqlScripts.qmd.site/sqlScripts.qmd: the "Drug Eras" section includes that file with a non-evaluatedsqlchunk. The page also getsengine: knitr, because otherwise Quarto picks Jupyter for a page whose only chunk issql.R/buildDrugEra.R: new exportedbuildDrugEra(connectionDetails, cdmDatabaseSchema, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), ...), modelled onexecuteDdl(). It renders the script for the CDM schema, translates it toconnectionDetails$dbmsand runs it withDatabaseConnector::executeSql.tempEmulationSchemais there because the script uses a temp table (#tmp_de).man/buildDrugEra.Rdand theNAMESPACEexport come from roxygen2 8.1.0, the version inDESCRIPTION.tests/testthat/test-buildDrugEra.R: runsbuildDrugEra()on a SQLite CDM (tables fromcreateDdl()) for CDM 5.3, 5.4 and 5.5, with the two scenarios from Drug era calculation gap_days calculation #761 plus one that checks a gap of more than 30 days starts a new era and that persons are kept apart. It checks era dates and exposure counts. It doesn't checkgap_days, since that's the value Drug era calculation gap_days calculation #761 changes; Fix off-by-one in drug era gap_days calculation (#761) #822 adds those assertions.docs/sqlScripts.html: only the changes from re-rendering the page with Quarto 1.10.19, applied as the diff between renders ofmainand this branch. They're the knitr code block wrapper and shifted line ids; the visible text is the same.docs/search.jsonis left for the next full render.The script inserts into DRUG_ERA without deleting anything first, and
buildDrugEra()keeps that, so the docs say DRUG_ERA is expected to be empty.Testing