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

Feature/202 aql function #223

Merged
merged 7 commits into from
Apr 29, 2020
Merged

Conversation

chevalleyc
Copy link
Contributor

Function Support

A number of postgresql functions are now supported. The following list the functions currently supported by EHRbase AQL engine. More functions will likely be added later on.

The functions below essentially deal with scalar values passed as argument, that is passing a canonical json as argument yields unpredictable results (this should be addressed with better error handling later on).

For example, the count function expect a scalar argument (nb. '*' is not supported in this implementation):

{
  "q": "SELECT count(e/ehr_id/value)  FROM EHR e"
}

NB. This is an initial implementation, further tests and enhancements are expected.

Aggregate & Statistical Functions

See https://www.postgresql.org/docs/current/functions-aggregate.html for more details on parameters.

COUNT, AVG, BOOL_AND, BOOL_OR, EVERY, MAX, MIN, SUM

Statistics Functions

correlation

CORR

covariance

COVAR_POP, COVAR_SAMP

regression

REGR_AVGX, REGR_AVGY, REGR_COUNT, REGR_INTERCEPT, REGR_R2, REGR_SLOPE, REGR_SXX, REGR_SXY, REGR_SYY

standard deviation

STDDEV, STDDEV_POP, STDDEV_SAMP, VARIANCE, VAR_POP, VAR_SAM

See https://www.postgresql.org/docs/current/static/functions-aggregate.html for more details

String Functions

SUBSTR, STRPOS, SPLIT_PART, BTRIM, CONCAT, CONCAT_WS, DECODE, ENCODE, FORMAT, INITCAP, LEFT, LENGTH, LPAD LTRIM, REGEXP_MATCH, REGEXP_REPLACE, REGEXP_SPLIT_TO_ARRAY, REGEXP_SPLIT_TO_TABLE, REPEAT, REPLACE, REVERSE RIGHT, RPAD, RTRIM, TRANSLATE

See https://www.postgresql.org/docs/current/static/functions-string.html for more details.

Limitations

Embedded expressions or embedded functions are not yet supported.

Related issue

Closes: https://github.com/ehrbase/project_management/issues/202

Additional information and checks

  • Pull request linked in changelog

@birgerhaarbrandt birgerhaarbrandt merged commit e372f26 into develop Apr 29, 2020
@birgerhaarbrandt birgerhaarbrandt deleted the feature/202_AQL_function branch April 29, 2020 11:18
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