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

Add event-flow visualization #3102

Merged
merged 12 commits into from Jul 21, 2017
Merged

Conversation

williaster
Copy link
Contributor

@williaster williaster commented Jul 10, 2017

@mistercrunch @graceguo-supercat

This PR adds an event flow visualization for analysis of event sequences. The vis is mostly built in @data-ui with @vx and there is a light wrapper for Superset integration.

Overall the vis supports the following:

  • Takes raw user (or more generically 'entity') event sequences and computes aggregate paths (shown in top panel of vis)
  • Allows alignment of event sequences by an arbitrary event index and event type (e.g., the 2nd click event)
  • Allows selection of arbitrary subtrees of the aggregated graph; this filters to the selected subtree in the aggregate panel and shows the corresponding/selected raw event sequences in a bottom panel
  • Gives a breakdown of event type counts in the right panel; by clicking on the legend you can filter to / filter out specific types of events.
  • X-axis: by default aggregate nodes are positioned according to the mean elapsed time from the previous node, for closely-spaced events you can also position by sequence number (1st, 2nd, 3rd, etc)
  • Node sorting: by default nodes are ordered top -> bottom based on high -> low event count meaning most common nodes appear at the top; you can also order by short -> long elapsed time to the next event.

event-flow-demo

note that builds, etc. will fail until the @data-ui/event-flow package is published (which I should get to later today), I just wanted to get some 👀 s on the PR

@williaster
Copy link
Contributor Author

williaster commented Jul 10, 2017

and here are some pics in Superset:

Explore controls

Dashboard

@mistercrunch
Copy link
Member

The image should be square, ideally 1024*1024 to render well

@mistercrunch
Copy link
Member

This is awesome btw! I'll try to review soon but I'm a little swamped at the moment.

TS,
EVENT_NAME,
ENTITY_ID,
} from '@data-ui/event-flow';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does '@%' do? where does the event-flow code live?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's just a name-spaced package on npm, under the "@data-ui" user but mainly so all the @data-ui packages are in the same repo.

it will live at https://github.com/williaster/data-ui/packages/event-flow but I haven't quite merged the chart into the master @data-ui repo, adding one more feature. this is the (massive 🙈) PR

@williaster
Copy link
Contributor Author

The package is published now so the build should be fixed (you can demo it here).

For visual clarity + performance, with larger number of events expected with use in Superset (10,000s) I also added functionality to "trim" nodes in the visualization based on a minimum event count threshold. This means that sequences are aggregated together but "leaf" nodes are hidden from view.

Before / after trimming
event-flow-event-filter

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay on the review, but this is really amazing and the kind of visualization that is a key "selling" point for Superset. I have a few notes for otherwise LGTM!

I'm curious about your CSS in your module and want to confirm that it's namespace alright so it doesn't spill on other visualization (the same way treemap did on yours).

@@ -1273,5 +1273,11 @@ export const controls = {
hidden: true,
description: 'The number of seconds before expiring the cache',
},

generic_checkbox: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the name that will be use in the saved slice's json. Having something generic here will make it harder if/when trying to generate slice dynamically, and harder to read the json and understand what that maps to. Also references in the backend/frontend code won't be as explicit. Let's use a name that describe the actual feature this triggers.

@@ -56,7 +57,7 @@
"jquery": "^3.2.1",
"jsdom": "9.12.0",
"lodash.throttle": "^4.1.1",
"mapbox-gl": "^0.26.0",
"mapbox-gl": "^0.27.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this was an attempt at fixing the npm install bug. It's been fixed on master by using yarn instead of npm install so this is probably not needed anymore. Though if you've tested that the mapbox viz renders alright I'm not against the bump here even though it would belong in another PR ideally.

const hasData = json.data && json.data.length > 0;

// the slice container overflows ~80px in explorer, so we have to correct for this
const isExplorer = (/explore/).test(window.location.pathname);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if I understand why, but I'm wondering if using slice.width() and slice.height() would address the 80px issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this to begin with but it doesn't seem to work/couldn't come up with any fix for the css. The panel dom looks like:

<div class="panel">
  <div class="panel-heading">...</div>
  <div class="panel-body">...</div>
</div>

panel-body is what the slice is in and it seems to have the same height as the parent panel. that means it overflows by the height of panel-heading :/

@williaster
Copy link
Contributor Author

williaster commented Jul 17, 2017

@mistercrunch I made the following changes

  • removed mapbox version bumps (these broke the build for a while, looks good now 👌)
  • updated the thumbnail png to 1024 x 1024
  • made the checkbox more specific to event-flow
  • added one more control that determines the initial min event count for graph trimming

@mistercrunch
Copy link
Member

I fixed the coveralls token in master, please rebase+push

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 69.195% when pulling 4aef4eb on williaster:chris--event-flow into d7e4191 on apache:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 69.195% when pulling 4aef4eb on williaster:chris--event-flow into d7e4191 on apache:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 69.195% when pulling 4aef4eb on williaster:chris--event-flow into d7e4191 on apache:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 69.195% when pulling 4aef4eb on williaster:chris--event-flow into d7e4191 on apache:master.

@williaster
Copy link
Contributor Author

@mistercrunch done

@williaster
Copy link
Contributor Author

let me know if I should add a test for the coverage.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.09%) to 69.175% when pulling 4550d06 on williaster:chris--event-flow into d7e4191 on apache:master.

@mistercrunch mistercrunch merged commit 40d9e15 into apache:master Jul 21, 2017
@williaster williaster deleted the chris--event-flow branch July 24, 2017 16:25
@vnnw
Copy link
Contributor

vnnw commented Nov 24, 2017

Can you add a demo into Superset distribution?

@williaster
Copy link
Contributor Author

@vnnw yes this would be a good addition to get people up and going a little more easily.

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.19.0 labels Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.19.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants