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

Dynamically determine bucket size for histograms #107

Merged
merged 3 commits into from
Jul 24, 2018
Merged

Conversation

melissachang
Copy link
Contributor

This is for NHS. Note that I don't want to put too much effort into this, because all this will go away after elastic/elasticsearch#31828 is fixed.

@melissachang melissachang requested a review from alahwa July 23, 2018 23:55
@@ -14,6 +14,7 @@
from elasticsearch_dsl import HistogramFacet
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine as a patch for some of the data we currently have, however it won't address numbers much larger than 100, and won't take into account the distribution of the data.

# is fixed, use AutoHistogramFacet instead. Will no longer need 2
# steps.
# Step 1: Get max value
response = Search(
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you write a test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it were easy to test, I would. But it's not easy, and this is throw-away code, so I'd rather not add a test...

# Elasticsearch won't do this for us
# (https://github.com/elastic/elasticsearch/issues/9572). Make the
# ranges easy to read (10-19,20-29 instead of 10-17,18-25).
# Creating this facet is a two-step process.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this function is getting pretty long and has substeps and sub-documentation, split out to helper methods _get_max_value and _get_bucket_size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@alahwa alahwa left a comment

Choose a reason for hiding this comment

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

Thanks!

@melissachang melissachang merged commit a3d7cb1 into master Jul 24, 2018
@melissachang melissachang deleted the mc/nhs branch July 24, 2018 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants