Bug #1688
KeyError in kp_variant_log
90%
Description
kp_variant_log is a dictionary that keeps track of the variant with which the KP was linked/tagged. The key of the dictionary follows the format of KP"#"+doc_id+"#"+depth. The dictionary lookup is done to add subsection header info to the annotated file at the time of tagging.
E.g.
math.sqrt(-1) BR2PPPP 328 ^&* math.sqrt ^&* 1.0
In the similar-doc string "328 ^&* math.sqrt ^&* 1.0", "math.sqrt" was fetched and added after look-up in the dictionary kp_variant_log. This information is added to the annotated file so that KP can be directly linked to the linked/similar subsection instead of the beginning of the document.
However, we have been a lot of KeyError hits in the log for the lookup in kp_variant_log. The KeyErrors are logged in the main.log file. We need to investigate and fix this error.
Intuition to solve it
1) Check if the header variant is actually present in the given doc_id or not,
2) Check if the depth value of the header variant is correct or not.
For (2), -1 is the header depth for subsections. Otherwise document header.
Screenshot of the Error added in attachments.
For testing, please use C-API & Library Reference
Files