Code Monkey home page Code Monkey logo

phea's Introduction

phea

PHEnotyping Algebra

R package to perform electronic patient phenotyping using formulas and without using SQL joins.

Phea connects to any SQL table or query providing patient data in long form, that is, one row per event. At a minimum the data must have a patient identifier column and a time stamp column. From there, you can provide Phea with a formula such as body_mass_index = weight / (height * height), and it will produce the SQL query that computes that formula, or formulas.

Install with devtools:
devtools::install_github('fabkury/phea')
library(phea)

Learn how to use

The materials below showcase Phea's features and teach how to use. Not all features are depicted. Some features are only explained in the help pages within R (use the ?function_name command).

Compatibility with SQL dialects

Phea leverages the dbplyr framework in R but also extends it in some parts. Phea's SQL generation engine offers two modes: compatibility mode, and regular mode. Compatibility mode has less features but works on more SQL dialects. Regular mode has more features and produces queries that are more efficient. The table below gives the mode currently available for each SQL dialect.

Engine Current mode Expected final mode Notes
postgres regular Phea was developed using Postgres 15. Minimum required version is 11. Regular mode requires access rights to install user-defined functions (UDFs), which are already implemented.
mysql compatibility regular Regular mode requires access rights to install user-defined functions, which have not yet been implemented.
redshift compatibility compatibility Regular mode will not be possible until AWS Redshift supports RANGE clause for window functions.
databricks (spark SQL) regular
oracle not tested regular
bigquery not tested regular
sqlserver not tested unknown Testing could show that regular mode is not possible: "Depending on the ranking, aggregate, or analytic function used with the OVER clause, ORDER BY clause and/or the ROWS and RANGE clauses may not be supported." (https://learn.microsoft.com/en-us/sql/t-sql/queries/select-over-clause-transact-sql?view=sql-server-ver16)

By Fabrício Kury
Author contact: [email protected]

phea's People

Contributors

fabkury avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sandy4321

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.