cproctor / qualitative-coding

Qualitative coding for computer scientists
Other
12 stars 3 forks source link

Erased codes? #60

Closed cmaimone closed 2 months ago

cmaimone commented 3 months ago

I tried coding a file. I think I accidentally entered some line breaks. When I closed the file, I got this error:

Expected the codes file to have the same number of lines as the document being coded (879), but it has 885.

Since the error didn't explicitly tell me what to do, I tried to code the same file again to fix the issue, but when codes.txt was opened again, it was blank - it had deleted my codes. That would be really frustrating if you coded a whole file and then made a mistake to have the file deleted.

cproctor commented 3 months ago

Hmm, let me look into this. You are correct in your interpretation, but I could be clearer in the error message, and what to do next.

The expected behavior is that you can't start a new coding session until the previous session has been resolved using --abandon or --resolve. If you wanted to fix the problem, you could open the coding file and the corpus file, update the line breaks, and then run --resolve.

I'll add clarity to the error message, add a few additional tests to confirm the program's behavior and update here when it's complete. Thanks for sticking with this :)

cproctor commented 2 months ago

Thank you for identifying this issue. I completely agree with you on its severity: users must not lose their coding work, even if something goes wrong. In release 1.4.2, I have taken several steps to address the issue:

I believe this issue can now be closed. If you would like to test these workflows, I suggest:

  1. Code a file using invalid codes (codes must be alphanumeric, so try adding special characters). Save and close the files in the editor.
  2. Add extra lines to the codes file.
  3. Do a bit of coding in the editor, save the file, and then crash the editor (e.g. force quit).

In all cases, you'll land in an incomplete coding state, and can either recover or abandon.