0.7.0b2 won't import new studies

Issue #244 resolved
David Platten created an issue

None of the imports work:

c:\Python27\Lib\site-packages\openrem\scripts>python openrem_dx.py c:\Conquest\data\temp\dx\1.2.392.200046.100.2.1.20017
0.157474.20150619134951.1.2_0002_000001_14347196490003.dcm
Traceback (most recent call last):
  File "openrem_dx.py", line 23, in <module>
    dx(filename)
  File "C:\Python27\Lib\site-packages\celery\local.py", line 167, in <lambda>
    __call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
  File "C:\Python27\Lib\site-packages\celery\app\task.py", line 420, in __call__
    return self.run(*args, **kwargs)
  File "C:\Python27\Lib\site-packages\openrem\remapp\extractors\dx.py", line 571, in dx
    _dx2db(dataset)
  File "C:\Python27\Lib\site-packages\openrem\remapp\extractors\dx.py", line 524, in _dx2db
    inst_in_db = check_uid.check_uid(event_uid,'Event')
  File "C:\Python27\Lib\site-packages\openrem\remapp\tools\check_uid.py", line 45, in check_uid
    existing = GeneralStudyModuleAttr.objects.filter(projectionxrayradiationdose__irradeventxraydata__irradiation_event_
uid__exact = uid)
  File "C:\Python27\Lib\site-packages\django\db\models\manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "C:\Python27\Lib\site-packages\django\db\models\query.py", line 679, in filter
    return self._filter_or_exclude(False, *args, **kwargs)
  File "C:\Python27\Lib\site-packages\django\db\models\query.py", line 697, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))
  File "C:\Python27\Lib\site-packages\django\db\models\sql\query.py", line 1304, in add_q
    clause, require_inner = self._add_q(where_part, self.used_aliases)
  File "C:\Python27\Lib\site-packages\django\db\models\sql\query.py", line 1332, in _add_q
    allow_joins=allow_joins, split_subq=split_subq,
  File "C:\Python27\Lib\site-packages\django\db\models\sql\query.py", line 1144, in build_filter
    lookups, parts, reffed_aggregate = self.solve_lookup_type(arg)
  File "C:\Python27\Lib\site-packages\django\db\models\sql\query.py", line 1030, in solve_lookup_type
    _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
  File "C:\Python27\Lib\site-packages\django\db\models\sql\query.py", line 1388, in names_to_path
    field_names = list(get_field_names_from_opts(opts))
  File "C:\Python27\Lib\site-packages\django\db\models\sql\query.py", line 43, in get_field_names_from_opts
    for f in opts.get_fields()
  File "C:\Python27\Lib\site-packages\django\db\models\options.py", line 740, in get_fields
    return self._get_fields(include_parents=include_parents, include_hidden=include_hidden)
  File "C:\Python27\Lib\site-packages\django\db\models\options.py", line 802, in _get_fields
    all_fields = self._relation_tree
  File "C:\Python27\Lib\site-packages\django\utils\functional.py", line 60, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Python27\Lib\site-packages\django\db\models\options.py", line 709, in _relation_tree
    return self._populate_directed_relation_graph()
  File "C:\Python27\Lib\site-packages\django\db\models\options.py", line 681, in _populate_directed_relation_graph
    all_models = self.apps.get_models(include_auto_created=True)
  File "C:\Python27\Lib\site-packages\django\utils\lru_cache.py", line 101, in wrapper
    result = user_function(*args, **kwds)
  File "C:\Python27\Lib\site-packages\django\apps\registry.py", line 168, in get_models
    self.check_models_ready()
  File "C:\Python27\Lib\site-packages\django\apps\registry.py", line 131, in check_models_ready
    raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.

Comments (6)

  1. David Platten reporter

    Hi @edmcdonagh - good idea. I think the storescp.py file is likely to need the import django and django.setup() lines adding because the structure of the code in that file looks very similar to the code in the extractor files. I haven't checked this.

    I have just checked the export of CT and radiographic data to csv and xls, as I thought the code behind these may be affected. There was a problem with the radiographic csv export (issue #245, now resolved), but it was unrelated to the problem in this issue.

  2. Log in to comment