You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/05/16 21:26:07 UTC

[GitHub] [incubator-superset] 1AB9502 opened a new issue #7530: WIP [SIP] Proposal for Implementing Chart Level Custom Calculations

1AB9502 opened a new issue #7530: WIP [SIP] Proposal for Implementing Chart Level Custom Calculations
URL: https://github.com/apache/incubator-superset/issues/7530
 
 
   Currently at Spotx we are working on adding chart level custom calculations (aka custom formulas). The purpose of this SIP is to gauge the interest in the feature and whether we should push it upstream
   
   ### Motivation
   
   A subset of Superset users at SpotX has requested the ability to make chart level calculations.
   By chart level we mean in contrast to postagg calculations that are already supported to an extent by Druid. While postaggs are fine for some purposes, they add overhead to the druid cluster and are created via JSON that general users don’t have access to. The users also might be interested in creating one off calculations that do not warrant creating a dedicated postagg field. 
   
   ### Proposed Change
   
   While researching possible solutions, we came across formulas.py library https://pypi.org/project/formulas/ 
   which implements an interpreter for Excel style formulas. 
   As an example of how this works, during chart creation we select clicks impressions as metrics,  add an excel like formula ( example =SUM(clicks/impressions*100) ). Once the results are sent from druid and pandas lib creates a df, we can perform the requested calculation and append a new column to the df.  
   
   ### New or Changed Public Interfaces
   
   The proposed changes are the following:
   
   - Integrate formulas.py library into Superset
   - Implement formula validation endpoint
   - Expose Custom Formulas React Component in the chart creation page where users are able to select predefined formulas or enter a new custom formula  
   - Add new custom_formulas table
   - Add new link under the Manage tab in order to allow custom formulas to be added on an individual datasource basis
   
   ### New dependencies
   
   Formulas.py PyPI package has been actively maintained since Feb 2017 https://pypi.org/project/formulas/#history
   The library is currently under EUPL text (1.1 & 1.2) license and its compatible with the Apache License https://joinup.ec.europa.eu/collection/eupl/eupl-compatible-open-source-licences
   
   ### Migration Plan and Compatibility
   
   The feature will require a database migration (new table will be added)
   
   Some screenshots:
   ![Screen Shot 2019-05-16 at 12 17 37 PM (2)](https://user-images.githubusercontent.com/22640110/57886745-2e573d80-77eb-11e9-8e91-efc73cae066e.png)
   
   ![Screen Shot 2019-05-16 at 12 32 23 PM (2)](https://user-images.githubusercontent.com/22640110/57886748-31522e00-77eb-11e9-9e9e-661bb7d55ef4.png)
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org