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

Query suggestions for GroupByMetrics #1197

Merged
merged 6 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def top_fuzzy_matches(

Return scores from -1 -> 0 inclusive.
"""
# In the case of a tie in score, items will be returned in the order they were passed in.
# Sort candidate item inputs first for consistent results.
sorted_candidate_items = sorted(candidate_items)

scored_items = []

# Rank choices by edit distance score.
Expand All @@ -31,7 +35,7 @@ def top_fuzzy_matches(
rapidfuzz.process.extract(
# This scorer seems to return the best results.
item,
list(candidate_items),
sorted_candidate_items,
limit=max_matches,
scorer=rapidfuzz.fuzz.token_set_ratio,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Error #1:
[
"Dimension('listing__capacity_latest')",
"TimeDimension('listing__created_at', 'day')",
"TimeDimension('listing__ds', 'day')",
"Dimension('listing__is_lux_latest')",
"TimeDimension('listing__ds', 'day')",
"TimeDimension('user__created_at', 'day')",
"TimeDimension('user__ds_latest', 'day')",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Error #1:
[
"Dimension('listing__capacity_latest')",
"TimeDimension('listing__created_at', 'day')",
"TimeDimension('listing__ds', 'day')",
"Dimension('listing__is_lux_latest')",
"TimeDimension('listing__ds', 'day')",
"Dimension('listing__country_latest')",
"TimeDimension('user__created_at', 'day')",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Error #1:
The given input does not exactly match any known metrics.

Suggestions:
['bookings', 'booking_fees', 'booking_value', 'instant_bookings', 'booking_payments', 'max_booking_value']
['bookings', 'booking_fees', 'booking_value', 'booking_payments', 'instant_bookings', 'booking_value_p99']
Copy link
Contributor

Choose a reason for hiding this comment

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

So max_booking_value was tied with booking_value_p99 here and the sort pushed the latter into 6th place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well it's actually like a 7-way tie between a bunch of metrics.


Query Input:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Error #1:
'listing__lux_listing',
'listing__is_lux_latest',
'listing__country_latest',
'listing__created_at__day',
'listing__capacity_latest',
]

Query Input:
Expand Down
Loading