lemeryfertitta / Climbdex

Search engine for training board climbs
https://climbdex.com
MIT License
42 stars 10 forks source link

Filter on handhold distance #56

Open btmccord opened 5 months ago

btmccord commented 5 months ago

As a user it would be awesome to have two additional filters that would enable looking for climbs of a specific nature (ie. long/short, big moves/small moves etc) I think two additional filters would enable this pretty well.

lemeryfertitta commented 5 months ago

Thanks for the ideas! Both are possible but non-trivial.

Filter by number of hand holds

This requires parsing the frame string to find the roles of each hold, and then counting the number of placements that have a role designated for hands. This would likely have to be done in Python instead of the SQLite query, so it will probably be a bit slower, but I'd imagine it should still be performant enough, especially on smaller queries.

Filter by hand hold distance

This would be on top of the previous (first identify all of the hand holds), then map the placements to the x y coordinates of the board (holes table), then some algorithm to score overall "distance" - maybe something like finding the min distance between each point and every other point, and then summing that min distance for each point. It would be interesting to see if an algorithm like that actually captures the spirit of the filter, given that you do not always move between the closest hand holds in a climb.

btmccord commented 5 months ago

I am not very familiar with SQLite but it seems like something like this would work for the number of hand holds?

SELECT frames, (length(frames) - length(replace(frames, 'r13', ''))) / 3 AS holdCount FROM climbs WHERE holdCount BETWEEN 5 and 10

lemeryfertitta commented 3 months ago

Filtering on hold count has been deployed. Leaving the issue open for the the idea of filtering on distance.