MedCATTrainer docker-compose sqlite3.OperationalError no such table error


I’m currently in the process of installing MedCATTrainer v2.12.3 via Dockerhub. While running docker-compose up, I encountered an sqlite3.OperationalError. The issue seems to be related to the RESUBMIT_ALL_ON_STARTUP environment variable, which is set to 1 by default in the env file. The problem appears to be resolved when I set this variable to 0. However, as a relative newcomer to Docker, I’m unsure if this is a safe change. Should I keep it as 0 and look into modifying it later, or are there alternative solutions to address this issue?

log message for reference:

medcattrainer | INFO 2023-11-07 12:06:32,072 l:17:Found env var RESUBMIT_ALL_ON_STARTUP is True. Attempting to resubmit all currently submitted state documents
medcattrainer | Traceback (most recent call last):
medcattrainer | File “/usr/local/lib/python3.11/site-packages/django/db/backends/”, line 84, in _execute
medcattrainer | return self.cursor.execute(sql, params)
medcattrainer | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
medcattrainer | File “/usr/local/lib/python3.11/site-packages/django/db/backends/sqlite3/”, line 383, in execute
medcattrainer | return Database.Cursor.execute(self, query, params)
medcattrainer | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
medcattrainer | sqlite3.OperationalError: no such table: api_projectannotateentities

Thanks for the assistance

I’ll prefix this with the fact that I’m not intimately familiar with entire codebase.

However, as far as I know, the RESUBMIT_ALL_ON_STARTUP environmental variable is only really applicable for existing deployments of the trainer. The idea is to re-submit all the documents that have been annotated when the service starts up.

As such, turning it off (to 0) should not really have any adverse effects. Especially on a first time run. The only thing that should change is that the user would need to manually re-submit the annotated documents if they wish to do so.

With that said, by the sound of it, you should be able to change this back to 1 after you’ve initially run the container since that should ensure that the table already exists.
Though you may need to define some projects or even annotate a document to make sure the table exists.

But again, take this as a word of guidance from someone with tangential knowledge of this piece of software.

1 Like

Thank you very much!
I’ll turn it off for now and change it back after annotation of the first document.

hi @tapak - yes - this is safe to remove on initial startup, I’ll fix this in the next release.