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 2020/02/10 16:24:29 UTC

[GitHub] [incubator-superset] mistercrunch opened a new pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz

mistercrunch opened a new pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107
 
 
   ### CATEGORY
   
   ### SUMMARY
   Add support for rolling windows to the 'Big Number with Trendline' viz.
   
   - refactoring out `apply_rolling`
   - add unit test
   - some minor label changes
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <img width="574" alt="Screen Shot 2020-02-10 at 8 23 57 AM" src="https://user-images.githubusercontent.com/487433/74168504-b6357100-4bde-11ea-9254-5f8707e2cb36.png">
   
   
   ### TEST PLAN
   Added a unit test
   
   
   ### REVIEWERS
   

----------------------------------------------------------------
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


[GitHub] [incubator-superset] villebro commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#discussion_r389347376
 
 

 ##########
 File path: superset/examples/world_bank.py
 ##########
 @@ -97,31 +97,32 @@ def load_world_bank_health_n_pop(
     db.session.commit()
     tbl.fetch_metadata()
 
+    metric = "sum__SP_POP_TOTL"
+    metrics = ["sum__SP_POP_TOTL"]
+    secondary_metric = {
+        "aggregate": "SUM",
+        "column": {
+            "column_name": "SP_RUR_TOTL",
+            "optionName": "_col_SP_RUR_TOTL",
+            "type": "DOUBLE",
+        },
+        "expressionType": "SIMPLE",
+        "hasCustomLabel": True,
+        "label": "Rural Population",
+    }
 
 Review comment:
   For readability later on in the code, calling this `rural_population_metric` or similar would be preferable.

----------------------------------------------------------------
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


[GitHub] [incubator-superset] mistercrunch commented on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
mistercrunch commented on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#issuecomment-597180704
 
 
   @villebro thank you for the review, addressed your comment!

----------------------------------------------------------------
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


[GitHub] [incubator-superset] villebro commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#discussion_r389347251
 
 

 ##########
 File path: superset/examples/world_bank.py
 ##########
 @@ -97,31 +97,32 @@ def load_world_bank_health_n_pop(
     db.session.commit()
     tbl.fetch_metadata()
 
+    metric = "sum__SP_POP_TOTL"
+    metrics = ["sum__SP_POP_TOTL"]
 
 Review comment:
   This is more a general comment relating to the current structure of examples, not specifically this PR. But given the fact that `metrics` is already defined above (line 80), it might be a good idea to disambiguate here. For example `default_metrics`, `total_population_metrics` or similar.
   
   Another option, which I personally would prefer, would be to remove the legacy metrics above, and replace both `metric` and `metrics` here with adhoc metrics. Something like
   
   ```python
   total_population_metric = {
       ...
   }
   ```
   and later on where a `metrics` list is expected, just passing a `[total_population_metric]` to highlight that it's a single value list.

----------------------------------------------------------------
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


[GitHub] [incubator-superset] mistercrunch merged pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
mistercrunch merged pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107
 
 
   

----------------------------------------------------------------
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


[GitHub] [incubator-superset] mistercrunch commented on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
mistercrunch commented on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#issuecomment-596145255
 
 
   @willbarrett can you take another look?

----------------------------------------------------------------
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


[GitHub] [incubator-superset] mistercrunch commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
mistercrunch commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#discussion_r390441796
 
 

 ##########
 File path: superset/examples/birth_names.py
 ##########
 @@ -144,14 +145,17 @@ def load_birth_names(only_metadata=False, force=False):
                 granularity_sqla="ds",
                 compare_lag="5",
                 compare_suffix="over 5Y",
+                metric=metric,
             ),
         ),
         Slice(
             slice_name="Genders",
             viz_type="pie",
             datasource_type="table",
             datasource_id=tbl.id,
-            params=get_slice_json(defaults, viz_type="pie", groupby=["gender"]),
+            params=get_slice_json(
+                defaults, viz_type="pie", groupby=["gender"], metrics=metrics
 
 Review comment:
   good catch, thanks for deep testing this

----------------------------------------------------------------
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


[GitHub] [incubator-superset] mistercrunch commented on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
mistercrunch commented on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#issuecomment-591226972
 
 
   Comments have been addressed

----------------------------------------------------------------
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


[GitHub] [incubator-superset] mistercrunch commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
mistercrunch commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#discussion_r377399726
 
 

 ##########
 File path: tests/viz_tests.py
 ##########
 @@ -1163,3 +1163,26 @@ def test_process_data_resample(self):
             .tolist(),
             [1.0, 2.0, np.nan, np.nan, 5.0, np.nan, 7.0],
         )
+
+    def test_apply_roling(self):
+        datasource = self.get_datasource_mock()
+        df = pd.DataFrame(
+            index=pd.to_datetime(
+                ["2019-01-01", "2019-01-02", "2019-01-05", "2019-01-07"]
+            ),
+            data={"y": [1.0, 1.0, 1.0, 1.0]},
+        )
+        self.assertEqual(
+            viz.BigNumberViz(
+                datasource,
+                {
+                    "metrics": ["y"],
+                    "rolling_type": "cumsum",
 
 Review comment:
   Agreed, that was the plan to fast follow once I manage to get `tox` working locally. Somehow it's really hard to install python3.6 on a new Mac.

----------------------------------------------------------------
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


[GitHub] [incubator-superset] willbarrett commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
willbarrett commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#discussion_r377218500
 
 

 ##########
 File path: tests/viz_tests.py
 ##########
 @@ -1163,3 +1163,26 @@ def test_process_data_resample(self):
             .tolist(),
             [1.0, 2.0, np.nan, np.nan, 5.0, np.nan, 7.0],
         )
+
+    def test_apply_roling(self):
+        datasource = self.get_datasource_mock()
+        df = pd.DataFrame(
+            index=pd.to_datetime(
+                ["2019-01-01", "2019-01-02", "2019-01-05", "2019-01-07"]
+            ),
+            data={"y": [1.0, 1.0, 1.0, 1.0]},
+        )
+        self.assertEqual(
+            viz.BigNumberViz(
+                datasource,
+                {
+                    "metrics": ["y"],
+                    "rolling_type": "cumsum",
 
 Review comment:
   It would be good to test the other `rolling_type` values - this is only testing one branch of a nested `if` statement.

----------------------------------------------------------------
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


[GitHub] [incubator-superset] codecov-io edited a comment on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#issuecomment-591234934
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=h1) Report
   > Merging [#9107](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/89109a16c68919d9c1688d0777351125adec9210?src=pr&el=desc) will **decrease** coverage by `0.02%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9107/graphs/tree.svg?width=650&token=KsB0fHcx6l&height=150&src=pr)](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff            @@
   ##           master   #9107      +/-   ##
   =========================================
   - Coverage   58.92%   58.9%   -0.03%     
   =========================================
     Files         373     373              
     Lines       12016   12026      +10     
     Branches     2948    2953       +5     
   =========================================
   + Hits         7081    7084       +3     
   - Misses       4756    4763       +7     
     Partials      179     179
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...et-frontend/src/explore/controlPanels/sections.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29udHJvbFBhbmVscy9zZWN0aW9ucy5qc3g=) | `100% <ø> (ø)` | :arrow_up: |
   | [superset-frontend/src/explore/controls.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29udHJvbHMuanN4) | `40.14% <ø> (ø)` | :arrow_up: |
   | [...t-frontend/src/dashboard/actions/dashboardState.js](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL2Rhc2hib2FyZFN0YXRlLmpz) | `30.66% <0%> (-1.06%)` | :arrow_down: |
   | [superset-frontend/src/chart/Chart.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0LmpzeA==) | `10.41% <0%> (ø)` | :arrow_up: |
   | [...erset-frontend/src/dashboard/components/Header.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL0hlYWRlci5qc3g=) | `41.79% <0%> (ø)` | :arrow_up: |
   | [...erset-frontend/src/datasource/DatasourceEditor.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2RhdGFzb3VyY2UvRGF0YXNvdXJjZUVkaXRvci5qc3g=) | `61.25% <0%> (ø)` | :arrow_up: |
   | [...d/src/dashboard/components/SliceHeaderControls.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyQ29udHJvbHMuanN4) | `11.62% <0%> (ø)` | :arrow_up: |
   | [.../src/dashboard/components/gridComponents/Chart.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0NoYXJ0LmpzeA==) | `67.41% <0%> (ø)` | :arrow_up: |
   | [...-frontend/src/dashboard/components/SliceHeader.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NsaWNlSGVhZGVyLmpzeA==) | `24% <0%> (ø)` | :arrow_up: |
   | [...nd/src/dashboard/containers/DashboardComponent.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL0Rhc2hib2FyZENvbXBvbmVudC5qc3g=) | `92% <0%> (ø)` | :arrow_up: |
   | ... and [2 more](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=footer). Last update [89109a1...fe24126](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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


[GitHub] [incubator-superset] villebro commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#discussion_r389383605
 
 

 ##########
 File path: superset/examples/birth_names.py
 ##########
 @@ -144,14 +145,17 @@ def load_birth_names(only_metadata=False, force=False):
                 granularity_sqla="ds",
                 compare_lag="5",
                 compare_suffix="over 5Y",
+                metric=metric,
             ),
         ),
         Slice(
             slice_name="Genders",
             viz_type="pie",
             datasource_type="table",
             datasource_id=tbl.id,
-            params=get_slice_json(defaults, viz_type="pie", groupby=["gender"]),
+            params=get_slice_json(
+                defaults, viz_type="pie", groupby=["gender"], metrics=metrics
 
 Review comment:
   During testing I noticed that the Gender chart wasn't rendering correctly:
   ![image](https://user-images.githubusercontent.com/33317356/76166582-3ca28b80-6168-11ea-8c93-7d17f5876a83.png)
   As the pie chart wants the singular `metric`, you need to change `metrics=metrics` to `metric=metric` here.

----------------------------------------------------------------
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


[GitHub] [incubator-superset] codecov-io commented on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#issuecomment-591234934
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=h1) Report
   > Merging [#9107](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/8c16ff089bb7c1d26570ab9573557c8c112c313e?src=pr&el=desc) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9107/graphs/tree.svg?width=650&token=KsB0fHcx6l&height=150&src=pr)](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master    #9107   +/-   ##
   =======================================
     Coverage   58.91%   58.91%           
   =======================================
     Files         372      372           
     Lines       11992    11992           
     Branches     2936     2936           
   =======================================
     Hits         7065     7065           
     Misses       4749     4749           
     Partials      178      178
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...et-frontend/src/explore/controlPanels/sections.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29udHJvbFBhbmVscy9zZWN0aW9ucy5qc3g=) | `100% <ø> (ø)` | :arrow_up: |
   | [superset-frontend/src/explore/controls.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29udHJvbHMuanN4) | `40.14% <ø> (ø)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=footer). Last update [8c16ff0...af51356](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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


[GitHub] [incubator-superset] codecov-io edited a comment on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#issuecomment-591234934
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=h1) Report
   > Merging [#9107](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/89109a16c68919d9c1688d0777351125adec9210?src=pr&el=desc) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9107/graphs/tree.svg?width=650&token=KsB0fHcx6l&height=150&src=pr)](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=tree)
   
   ```diff
   @@           Coverage Diff           @@
   ##           master    #9107   +/-   ##
   =======================================
     Coverage   58.92%   58.92%           
   =======================================
     Files         373      373           
     Lines       12016    12016           
     Branches     2948     2948           
   =======================================
     Hits         7081     7081           
     Misses       4756     4756           
     Partials      179      179
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...et-frontend/src/explore/controlPanels/sections.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29udHJvbFBhbmVscy9zZWN0aW9ucy5qc3g=) | `100% <ø> (ø)` | :arrow_up: |
   | [superset-frontend/src/explore/controls.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9107/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29udHJvbHMuanN4) | `40.14% <ø> (ø)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=footer). Last update [89109a1...0e2f471](https://codecov.io/gh/apache/incubator-superset/pull/9107?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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


[GitHub] [incubator-superset] willbarrett commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
willbarrett commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#discussion_r377215997
 
 

 ##########
 File path: tests/viz_tests.py
 ##########
 @@ -1163,3 +1163,26 @@ def test_process_data_resample(self):
             .tolist(),
             [1.0, 2.0, np.nan, np.nan, 5.0, np.nan, 7.0],
         )
+
+    def test_apply_roling(self):
 
 Review comment:
   Nit: 2 `l`s in `rolling`

----------------------------------------------------------------
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


[GitHub] [incubator-superset] villebro commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz

Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #9107: feat: add rolling window support to 'Big Number with Trendline' viz
URL: https://github.com/apache/incubator-superset/pull/9107#discussion_r389347683
 
 

 ##########
 File path: superset/viz.py
 ##########
 @@ -178,6 +178,26 @@ def run_extra_queries(self):
         """
         pass
 
+    def apply_rolling(self, df):
+        fd = self.form_data
+        rolling_type = fd.get("rolling_type")
+        rolling_periods = int(fd.get("rolling_periods") or 0)
+        min_periods = int(fd.get("min_periods") or 0)
+
+        if rolling_type in ("mean", "std", "sum") and rolling_periods:
+            kwargs = dict(window=rolling_periods, min_periods=min_periods)
+            if rolling_type == "mean":
+                df = df.rolling(**kwargs).mean()
+            elif rolling_type == "std":
+                df = df.rolling(**kwargs).std()
+            elif rolling_type == "sum":
+                df = df.rolling(**kwargs).sum()
+        elif rolling_type == "cumsum":
+            df = df.cumsum()
+        if min_periods:
+            df = df[min_periods:]
+        return df
 
 Review comment:
   👍

----------------------------------------------------------------
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