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

Potential improvements to Capr #99

Open
guuswilmink opened this issue Aug 5, 2024 · 1 comment
Open

Potential improvements to Capr #99

guuswilmink opened this issue Aug 5, 2024 · 1 comment

Comments

@guuswilmink
Copy link

Hi,

For a project I have been involved in, I have come up with a few enhancements to Capr whilst working with it. Please see the forked repo here and the basic descriptions below:

  • isStandard.R: Given a path to CSV files with at least fields "sourceCode" and "conceptId", along with a database connection with a CDM and vocabulary schema, return a tibble of non-standard concepts. Allows for export of results for all concepts included (including standard). This function can help in quickly identifying non-standard concepts from tables of concept ids.
  • isStandardCS.R: Same return as isStandard.R, but performs the check given a Capr ConceptSet class object rather than CSV files.
  • countOccurrences.R: Given a vector of concept IDs, count the number of occurrences of: 1) persons with concept 'x'; 2) records with concept 'x'; 3) persons with concept 'x' or descendants of 'x'; 4) records with concept 'x' or descendants of 'x'

I hope this is useful to you. I would be happy to talk about/discuss these enhancements as well.

@mdlavallee92
Copy link
Collaborator

First off thanks for your interest in contributing to Capr! Excellent work! Particularly the first two commands, are aspects that have needed to be added to the package but have not had the time to contribute them.

The countOccurrences command, I am not totally clear on yet. Could you provide an example of how to use it? I believe this is something already possible within Capr but want to confirm with what you have in mind.

To begin the process of a PR. Let's go through a few things.

  1. Add both is.Standard.R and is.StandardCS.R into the conceptSet.R folder of.
  2. Remove library references at the top of each file and use the :: namespace command on the commands you are sourcing from. For example dplyr::filter
  3. Convert to base R pipe |> instead of magrittr pipe %>%. Note this is something I need to update across the package.
  4. add unit tests for the is.Standard commands.
  5. Adjust dbQuery commands to use DatabaseConnector. This is for general consistency across the HADES stack. When pinging the backend dbms use the DatabaseConnector package.
  6. Convert all sql rendering to SqlRender see examples here. Let me know if you have any questions I can help you
  7. Once the above is done make a pull request targeting the develop branch on OHDSI/Capr.

Happy to support you through this @guuswilmink

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

No branches or pull requests

2 participants