Closed hunnguye closed 1 month ago
The error message hints towards an unexisting keyerror.
This codeblock iterates through each document and uses the document name to look up a value in nested dictionary the type_counts. However, it probably does not find the key, hence the error message.
But why is that so? PR #53 added logging capabilities and also outputs the typ_counts dictionary when it is generated.
The below screenshot was taken after following the instructions described in this issue:
It appears, that within the dictionary, the corrresponding nested dictionary "Token.documents" , only contains documents, which have been opened (?) once and does not consider other documents. I can only guess, that it has something to do with how the exportedproject.json is generated, from which, I assume, the tokens are counted.
This however can create the situation, where the number of real documents might be greater than the number of "reported" documents in the type_counts dictionary, hence the key error
The problem was checking for the json files (corresponding to each annotator) containing the annotations. For that, we looking for all json files in a document annotation folder EXCEPT for the INITIAL_CAS.json. However, if the document hasn't been opened before, then it won't have other json files in the folder, and thus it gets skipped.
I added a failover to the INTIAL_CAS.json file in case there are no others. The problem should be solved now.
Describe the bug The dashboard is not able to be generated, through either manual or api import
To Reproduce Steps to reproduce the behavior:
Expected behavior A dashboard is created
Error message KeyError
Please complete the following information:
Additional context If you start annotating the document, and reimport the project, the error disappears