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

Create function for exporting dqdashboard_results table to a json file #497

Merged
merged 3 commits into from
Oct 21, 2023

Conversation

jshoughtaling
Copy link
Contributor

@jshoughtaling jshoughtaling commented Oct 18, 2023

Following up on a discussion with @katy-sadowski and in response to Issue #367:

This PR adds a function, writeDBResultsToJson that extracts data from the dqdashboard_results database table and exports it to a json file for use with other OHDSI tools like AresIndexer or the shiny dashboard viewer.

The added functionality enhances the recently updated SQLOnly execution use case, where users can incrementally fill a database table with output of SQL checks executed with custom orchestration schemes.

Note that the exported json file may require a case change for use with AresIndexer depending on the version of that package.

Copy link
Collaborator

@katy-sadowski katy-sadowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested minor changes.

Also, want to update this doc to use your function? https://ohdsi.github.io/DataQualityDashboard/articles/SqlOnly.html

R/writeDBResultsTo.R Outdated Show resolved Hide resolved
R/writeDBResultsTo.R Outdated Show resolved Hide resolved
R/writeDBResultsTo.R Outdated Show resolved Hide resolved
R/writeDBResultsTo.R Outdated Show resolved Hide resolved
R/writeDBResultsTo.R Outdated Show resolved Hide resolved
tests/testthat/test-writeDBResultsTo.R Outdated Show resolved Hide resolved
tests/testthat/test-writeDBResultsTo.R Show resolved Hide resolved
@jshoughtaling
Copy link
Contributor Author

Suggested minor changes.

Also, want to update this doc to use your function? https://ohdsi.github.io/DataQualityDashboard/articles/SqlOnly.html

@katy-sadowski - thanks so much for the quick review!

I've implemented all changes as suggested, included the additional test of check rows, and modified the SQLOnly vignette to reference the new function prior to viewing json results.

Copy link
Collaborator

@katy-sadowski katy-sadowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 more minor change

@@ -36,43 +36,27 @@ writeDBResultsToJson <- function(connection,
outputFile) {
startTime <- Sys.time()
Copy link
Collaborator

@katy-sadowski katy-sadowski Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove start and end time, and the delta variable now we're not using it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

)
# Extract results table to JSON file for viewing or secondary use

DataQualityDashboard::writeDBResultsToJson(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤩 love to see those lines of code slashed!

@codecov
Copy link

codecov bot commented Oct 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cd5bd33) 86.00% compared to head (24bee1b) 86.03%.
Report is 2 commits behind head on develop.

❗ Current head 24bee1b differs from pull request most recent head 4aa1dde. Consider uploading reports for the commit 4aa1dde to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #497      +/-   ##
===========================================
+ Coverage    86.00%   86.03%   +0.03%     
===========================================
  Files           15       16       +1     
  Lines          850      881      +31     
===========================================
+ Hits           731      758      +27     
- Misses         119      123       +4     
Files Coverage Δ
R/convertResultsCase.R 100.00% <ø> (ø)
R/executeDqChecks.R 89.71% <ø> (-1.72%) ⬇️
R/listChecks.R 100.00% <ø> (ø)
R/writeDBResultsTo.R 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@katy-sadowski katy-sadowski merged commit ef06bfc into OHDSI:develop Oct 21, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants