Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Ethan Jewett
@esjewett
Universe and Reductio have kind of different philosophies about things, so maybe best to think of them seperately.
What are you struggling with?
Cole Harper
@charperpdx
1- In crossfilter I had the crossfilter.groupAll(); I can't seem to find a way to groupall in universe, it looks like its implemented in Reductio but I am not sure how to untilize it.
Ethan Jewett
@esjewett
What are you trying to use groupAll to do?
Cole Harper
@charperpdx
I used groupAll to have access to the full filtered dataset which is then processed into geojson to display on a map
2- Can you apply a filter to multiple columns like an 'Or' for example: column1 'or' column2 $eq "blue"
Ethan Jewett
@esjewett
Ok. I’m not sure I’d really recommend that, but neither here nor there. With Reductio, you’d just do what you are doing. You have access to the Crossfilter. Reductio just creates group reducer functions for you. With Universe, I’m not sure if you can get the Crossfilter back out.
On 2, I’m not sure. I think not. You would have to do a custom filter function in Universe.
Cole Harper
@charperpdx
For 1 I was mistaken, I am not using groupAll but just the dimension like so: var allDim = ndx.dimension(function(d) {return d;});
^in crossfilter of course.... Does universe allow to you create a query that returns all the values?
This message was deleted
Ethan Jewett
@esjewett
I would think so, if you group by a unique identifer?
It also sends back the crossfilter, group, and dimension after a query, so you could probably just call dimension.top on that returned dimension object.
Cole Harper
@charperpdx
In Universe query I am grouping by a unique identifyier but it just sets it as the "key", Do i have to explicitly define the columns I want it to return? There isn't any examples for that I have found.
columnName - Creates a nested column with the name provided
from the docs says it just creates a column.. lol I am lost with this... Thanks for the help
Ethan Jewett
@esjewett
Yeah, I'm not the one The really help with Universe unfortunately. Not sure if Tanner is around these days or not.
I do believe you need to explicitly tell it both the aggregates and columns you want back. Not sure though.
Cole Harper
@charperpdx
@esjewett Thanks the help last week. For issue 1 (getting the whole filtered dataset) After the universe query was returned (groupBy uniqueId) I used:
 allData = this.universe.column.find('ID').dimension.top(Infinity);
and then I setup the onfilter listener to update allData based on the same dimension.top(Infinity)
I have no idea if its correct but I found this method from : http://codepen.io/christophe-g/pen/ALqvQZ
Ethan Jewett
@esjewett
@charperpdx Hey - thanks for coming back and sharing what you figured out! That sounds like a reasonable approach to me!
Timmy O'Mahony
@timmyomahony
Hey guys, has any one got any experience integrating universe with Ember.js?
Cole Harper
@charperpdx
@timmyomahony not with Ember but I am using it with Vue.js and webpack so there might be some similarities
James Tindall
@atomless
Hello all. Something I'm missing and I can't find mention of in the various docs for crossfilter, reductio or universe is how to handle sorting on specific column value. If I pre-sort my data, the sorting appears to be undone by crossfilter when I access it via a dimension that is then grouped and the all method invoked. Can anyone point me to docs on this or relieve my confusion somehow ?
I understand the order method on a group in crossfilter but the data only comes back ordered via the top(k) method. How do you sort the entire data along a single column value?
Ethan Jewett
@esjewett
If you want a sorted group, then use order and top. Dimensions will be sorted based on their accessor if you call dimension.top, IIRC. If neither of those accomplishes what you want, can you share an example that illustrates what you are after?
James Tindall
@atomless
Thanks @esjewett it was calling top(Infinity) on the group that did the trick.
Also I was thrown by the fact that in the order function the arg is the value so :return d not return d.value
Ethan Jewett
@esjewett
Excellent!
Anthony Petiot
@tonyper
Hey all, I'm using universe and I struggle getting multiple aggregation from a single query. I've created a small pen to make it easier: https://codepen.io/anon/pen/VWBoOB?editors=0011
This piece of code works fine as is but if I uncomment the "total" line, I don't get any aggregation: it works either for tip or total but I can't get both
Can anyone tell me what I'm doing wrong ?
Anthony Petiot
@tonyper
I figured it out, it was a bug in Universe, a PR is created to fix it
Ishmael Hallin
@it290_twitter
Wondering if anyone can help me out with an issue I'm having. I have a function that looks like this:
async function spendByMonth(parent, level) {

  //parent = 'Spine';
  //level = 1;

  console.log(parent);
  console.log(level);

  var levelKey = hierarchyLevels[level+1];

  var monthlySpend = await allData.query({ 
     groupBy: function(d) {
       return [d.month, d[levelKey]];
     },
    select: {
      $count: true,
      total_spend: {
        $sum: 'spend'
      }
    }
  });

  console.log(monthlySpend);

  if ( parent != 'root') {
    await allData.filter(hierarchyLevels[level], parent, false, true);
  }

      var filteredSpend = monthlySpend.data.filter(function(d) {
        return Math.floor(d.value.total_spend.sum) > 0; 
      });
      var pivotedSpend = pivotArray(filteredSpend);
  console.log(pivotedSpend);
  return pivotedSpend;   

}
I call this function whenever the user interacts with the UI — they're drilling up and down through a hierarchy, and I want to render a chart that shows spend by month at each level of the hierarchy.
The parameters that the function takes are the identifier of the parent (the thing they clicked on), and the level, which represents the column of the data that I want to group by. Each level has a distinct column.
Ishmael Hallin
@it290_twitter
The problem I'm having is that if I hardcode the parameters (like you can see commented out at the top), monthlySpend returns as I would expect it.
However, if I pass in the exact same parameters dynamically via the UI, monthlySpend returns the correct values for total_spend, but not at the appropriate level of the hierarchy.
I'm calling filterAll on allData before I call this function each time.
But I suspect something isn't being reset properly on subsequent runs of the function. Do I need to do something differently in order to make each run's query unique?
Ishmael Hallin
@it290_twitter
Ok, I figured it out. I think it has something to do with the hashes universe/crossfilter use internally. If I alter the query each time so that total_spend is called something else, it works properly. Not sure if this is a bug or if I'm just Doing It Wrong.
christophe geiser
@christophe-g
Hey all - any hint to help handle data changes ? My naive approach would be to clear a column (where data changes happened) and add it back. But there might be mode efficient ways.
Will
@willbonde
newb question - after running query, is there a way to get the complete objects from the universe that remain after filtering? I see in the result of the query that query.data is a list of key/values and values contains the count (in my case it appears count of 1 if it should be included, 0 if not). i was unclear if the appropriate way to get the set is to iterate on that object or if there was an automagic way
Jefferson
@jefferson
Hello! Is there a query parse for create filters in universe?
Peter
@phpeter
What @willbonde said
Ilan Diamond
@ilibilibom
anyone here ?