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

Rename 'exception' to 'unique'? #15

Open
esjewett opened this issue Mar 16, 2015 · 4 comments
Open

Rename 'exception' to 'unique'? #15

esjewett opened this issue Mar 16, 2015 · 4 comments

Comments

@esjewett
Copy link
Member

Might be a little more clear regarding what it does.

@gordonwoodhull
Copy link

I'm not an active user... yet... but indeed this name trips me up when I read about reductio. The association with the programming construct is strong for me.

The documentation states:

For our purposes, this means only aggregating once for each unique value that the exception accessor returns.

Are there other purposes, i.e. can "exception aggregation" also do other things besides act on unique values?

I'll just do a mental substitution for now. :-)

It also seems like this operation might be dangerous if the reduction value is not always the same for the exception/unique key.

@esjewett
Copy link
Member Author

Yeah, I think it's originally an SAP datawarehousing term. Probably came from German. The idea of exception aggregation is more than just counting unique values, but it's similar. It pretty much means that you define a key (or compound key) secondary to the current displayed dimensions, and you define an aggregation on that key. So say we are viewing revenue by country in our report. But in addition to revenue we also want to display the number of unique products that account for the revenue in each country:

var dimension = crossfilter.dimension(function(d) { return d.country; });
var group = dimension.group(reductio().exception(function(d) { return d.product; }).exceptionCount(true));

Note that it's OK if a product appears in more than one country. It counts against each country, but it only counts at most once for each country.

Ok, but what if we don't just want to count? We want to display the value of the most recent transaction in each country? Then our exception aggregation key would be Date rather than product, and our aggregation strategy would no longer be "just take one" (i.e, unique), but would rather be, take the one with the highest value of Date.

I'm not sure this kind of flexibility is really necessary, but I could certainly see it being useful.

Anyway, yes, renaming to unique or uniqueBy would make a lot of sense, at least until I have a more complete approach to the whole problem.

@Fil
Copy link

Fil commented May 17, 2016

similar discussion in #29

@esjewett
Copy link
Member Author

Cool - thanks for the feedback. I think I'm leaning in this direction as well (distinct, that is). A bunch of updates to Reductio I want make including reworking the API structure, but no time at the moment :-/ If anyone wants to send a pull request to alias this to distinct and add to the documentation, I'd be game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants