fix(computation): use exact match in cpu lookup consumption profile function#415
Conversation
85f5a4f to
89988e4
Compare
|
Hi @jonperron, I agree with your assessment of the problem. In the example given, where However, I'm not sure changing to exact match is the correct solution for two reasons:
Instead, I propose we modify the fuzzy matching for looking up consumption profiles to match the existing CSV fuzzy-matching we do on the This happens in the attributes_from_cpu_name function, where we have a scoring system to determine whether there is a match. In the example above, this scoring system would rate |
|
I agree with you @Shillaker, changing at one place is not the best solution. I proposed a solution which is matching the current behaviour of the API, i.e. to send only one expected result. I will look at implementing a utils function derived from the algorithm you pointed out in the attributes_from_cpu_name. To be honest, I would rework the error handling of the API here. Indeed, it is ok, and normal, that fuzzy matching can return several results. But then, the API should return an error, or at least an indication that several values are available, rather than failing silently. |
055949f to
bc1954f
Compare
|
@Shillaker I thought about your proposition, and as the issue was happening with a call on Instead, I kept the original fuzzy match and if multiple results were returned, I added an exact match filter (so |
bc1954f to
9717bfb
Compare
…n one result Changelog * Add exact match when fuzzy returns more than one result * Add tests 397
9717bfb to
64fbb63
Compare
In some cases, fuzzy match returns more than a single row. In this case, an exact match is run
to try to retrieve the correct consumption profile. It also align this comparison with the rest of the project,
which uses widely exact match. In addition, only one function depends on the look_up_consumption method, and it
expects a single value, not several.
Fix #397