drivendataorg / concept-to-clinic

ALCF Concept to Clinic Challenge
https://concepttoclinic.drivendata.org/
MIT License
367 stars 147 forks source link

Error importing CaseFactory() #238

Closed louisgv closed 6 years ago

louisgv commented 7 years ago

I'm trying to importing some nodule data to test with the interface. Following this guide: https://github.com/concept-to-clinic/concept-to-clinic/issues/149#issuecomment-335625985

Expected Behavior

I should be able to run this in the console:

from backend.cases.factories import *
case = CaseFactory()

Without seeing any error

Current Behavior

The following error was thrown:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: relation "images_imageseries" does not exist
LINE 1: INSERT INTO "images_imageseries" ("patient_id", "series_inst...
                    ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/factory/base.py", line 69, in __call__
    return cls.create(**kwargs)
  File "/usr/local/lib/python3.6/dist-packages/factory/base.py", line 622, in create
    attrs = cls.attributes(create=True, extra=kwargs)
  File "/usr/local/lib/python3.6/dist-packages/factory/base.py", line 453, in attributes
    force_sequence=force_sequence,
  File "/usr/local/lib/python3.6/dist-packages/factory/containers.py", line 324, in build
    return stub.__fill__()
  File "/usr/local/lib/python3.6/dist-packages/factory/containers.py", line 83, in __fill__
    res[attr] = getattr(self, attr)
  File "/usr/local/lib/python3.6/dist-packages/factory/containers.py", line 108, in __getattr__
    val = val.evaluate(self, self.__containers)
  File "/usr/local/lib/python3.6/dist-packages/factory/containers.py", line 227, in evaluate
    containers=containers,
  File "/usr/local/lib/python3.6/dist-packages/factory/declarations.py", line 324, in evaluate
    return self.generate(sequence, obj, create, defaults)
  File "/usr/local/lib/python3.6/dist-packages/factory/declarations.py", line 412, in generate
    return subfactory.simple_generate(create, **params)
  File "/usr/local/lib/python3.6/dist-packages/factory/base.py", line 709, in simple_generate
    return cls.generate(strategy, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/factory/base.py", line 676, in generate
    return action(**kwargs)
  File "/usr/local/lib/python3.6/dist-packages/factory/base.py", line 623, in create
    return cls._generate(True, attrs)
  File "/usr/local/lib/python3.6/dist-packages/factory/base.py", line 548, in _generate
    obj = cls._prepare(create, **attrs)
  File "/usr/local/lib/python3.6/dist-packages/factory/base.py", line 523, in _prepare
    return cls._create(model_class, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/factory/django.py", line 181, in _create
    return manager.create(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 394, in create
    obj.save(force_insert=True, using=self.db)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/base.py", line 807, in save
    force_update=force_update, update_fields=update_fields)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/base.py", line 837, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/base.py", line 923, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/base.py", line 962, in _do_insert
    using=using, raw=raw)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 1076, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/sql/compiler.py", line 1099, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py", line 80, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.6/dist-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python3.6/dist-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "images_imageseries" does not exist
LINE 1: INSERT INTO "images_imageseries" ("patient_id", "series_inst...
                    ^

Possible Solution

Steps to Reproduce

  1. Following the instruction in this guide https://github.com/concept-to-clinic/concept-to-clinic/issues/149#issuecomment-335625985

Context (Environment)

Detailed Description

Possible Implementation

Checklist before submitting

reubano commented 7 years ago

Not able to replicate your error. What os and docker version?

isms commented 7 years ago

@louisgv Seeing relation "images_imageseries" does not exist indicates to me that this table is not found at all, which means that the command which migrates the database up to the present schema (python manage.py migrate) was not run.

What were the exact commands you ran to get an interactive shell?

musale commented 6 years ago

@isms I came across a similar error doing the steps and I fixed it with

$ docker-compose -f local.yml run interface python manage.py makemigrations $ docker-compose -f local.yml run interface python manage.py migrate

louisgv commented 6 years ago

@isms sorry for the late respond. Finals' been drowning me lately :p... I'm pretty sure I used the exact command in the tutorial. I did it before and it worked, but after several pull, it just stopped working.

@musale I will give that a try

reubano commented 6 years ago

@louisgv any luck?

isms commented 6 years ago

Closing as norepro