NAVADMC / ADSM

A simulation of disease spread in livestock populations. Includes detection and containment simulation.
Other
10 stars 5 forks source link

Status code fail #453

Closed missyschoenbaum closed 9 years ago

missyschoenbaum commented 9 years ago

This is from an old xml file that appears to pass a status that is no longer valid. Infectious clinical Can the app manage an unknown status better?

@ndh2 - how many times in the past have we changed our status options?

This came from one of Barbara's examples.

Exception at /app/ImportScenario/ Infectious clinical is not a valid state Request Method: POST Request URL: http://127.0.0.1:8000/app/ImportScenario/ Django Version: 1.7.1 Exception Type: Exception Exception Value:
Infectious clinical is not a valid state Exception Location: C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src\ADSMSettings\xml2sqlite.py in readPopulation, line 318 Python Executable: C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\ADSM.exe Python Version: 3.4.2 Python Path:
['C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\ADSM.exe', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\ADSM.zip', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\library.zip', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\DLLs', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\Lib', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\Lib\plat-win', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\Lib\lib-tk', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\Lib\site-packages', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\bin', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\Scripts', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\Lib\site-packages\cx_Freeze-4.3.4-py3.4-win-amd64.egg', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\Lib\site-packages\numpy-1.9.1-py3.4-win-amd64.egg', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\Lib\site-packages\pip-1.5.6-py3.4.egg', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\Lib\site-packages\pywin32-219-py3.4-win-amd64.egg', 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src'] Server time: Mon, 16 Mar 2015 14:13:05 +0000 Traceback Switch to copy-and-paste view

C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\Lib\site-packages\django\core\handlers\base.py in get_response response = wrapped_callback(request, _callback_args, *_callback_kwargs) ... ▶ Local vars C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src\ADSMSettings\views.py in import_naadsm_scenario return run_importer(request) ... ▶ Local vars C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src\ADSMSettings\views.py in run_importer import_naadsm_xml(popul_path, param_path) # puts all the data in activeSession ... ▶ Local vars C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src\ADSMSettings\xml2sqlite.py in import_naadsm_xml readPopulation(populationFileName) ... ▶ Local vars C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src\ADSMSettings\xml2sqlite.py in readPopulation raise Exception( '%s is not a valid state' % state ) ... ▶ Local vars Request information

GET No GET data POST No POST data FILES Variable Value parameters_xml
<TemporaryUploadedFile: v3xml.xml (text/xml)> population_xml
<TemporaryUploadedFile: BarbaraNCPop.xml (text/xml)> COOKIES No cookie data META Variable Value REMOTE_ADDR '127.0.0.1' HTTP_CACHE_CONTROL
'max-age=0' QUERY_STRING
'' SERVER_NAME '127.0.0.1' wsgi.version
(1, 0) wsgi.run_once
False HTTP_ACCEPT_LANGUAGE
'en-us,en;q=0.8' HTTP_REFERER
'http://127.0.0.1:8000/app/ImportScenario/' REQUEST_URI '/app/ImportScenario/' PATH_INFO
'/app/ImportScenario/' HTTP_HOST
'127.0.0.1:8000' wsgi.multiprocess
False REQUEST_METHOD
'POST' SERVER_PORT '8001' HTTP_ORIGIN 'http://127.0.0.1:8000' ACTUAL_SERVER_PROTOCOL
'HTTP/1.1' wsgi.errors

<_io.TextIOWrapper name='' mode='w' encoding='cp437'> wsgi.url_scheme 'http' SERVER_PROTOCOL 'HTTP/1.0' HTTP_ACCEPT 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,_/_;q=0.8' SERVER_SOFTWARE 'CherryPy/3.6.0 Server' HTTP_X_REAL_IP '127.0.0.1' CONTENT_TYPE 'multipart/form-data; boundary=----WebKitFormBoundaryURV4qLVUidgDvBfo' HTTP_ACCEPT_ENCODING 'gzip,deflate' HTTP_CONNECTION 'close' wsgi.input wsgi.multithread True SCRIPT_NAME '' HTTP_X_FORWARDED_FOR '127.0.0.1' CONTENT_LENGTH '10676179' REMOTE_PORT '49277' HTTP_USER_AGENT 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like ' 'Gecko) Chrome/37.0.2062.94 Safari/537.36' Settings Using settings module ADSM.settings Setting Value DEFAULT_FROM_EMAIL 'webmaster@localhost' DATETIME_FORMAT 'N j, Y, P' MIGRATION_MODULES {} LOCALE_PATHS () EMAIL_BACKEND 'django.core.mail.backends.smtp.EmailBackend' FILE_UPLOAD_TEMP_DIR None STATICFILES_FINDERS ('django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder') FILE_UPLOAD_DIRECTORY_PERMISSIONS None SECRET_KEY '*******************_' EMAIL_HOST_USER '' SERVER_EMAIL 'root@localhost' LOGGING {} CSRF_COOKIE_PATH '/' LANGUAGES_BIDI ('he', 'ar', 'fa', 'ur') LOGGING_CONFIG 'logging.config.dictConfig' DISALLOWED_USER_AGENTS () STATICFILES_STORAGE 'django.contrib.staticfiles.storage.StaticFilesStorage' USE_ETAGS False DATABASES {'default': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': 'C:\Users\meschoenbaum\Documents\ADSM ' 'Workspace\settings\settings.sqlite3', 'OPTIONS': {}, 'PASSWORD': '**_****************_', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIRROR': None, 'NAME': 'C:\Users\meschoenbaum\Documents\ADSM ' 'Workspace\settings\test_settings.sqlite3'}, 'TIME_ZONE': 'UTC', 'USER': ''}, 'scenario_db': {'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME': 'C:\Users\meschoenbaum\Documents\ADSM ' 'Workspace\settings\activeSession.sqlite3', 'OPTIONS': {'timeout': 300}, 'PASSWORD': '**_****************_', 'PORT': '', 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIRROR': None, 'NAME': 'C:\Users\meschoenbaum\Documents\ADSM ' 'Workspace\settings\test_activeSession.sqlite3'}, 'TIME_ZONE': 'UTC', 'USER': ''}} MIDDLEWARE_CLASSES ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'ADSMSettings.disable.DisableCSRF') WSGI_APPLICATION 'ADSM.wsgi.application' MONTH_DAY_FORMAT 'F j' FIRST_DAY_OF_WEEK 0 DEBUG True USE_TZ True DEFAULT_FILE_STORAGE 'django.core.files.storage.FileSystemStorage' AUTHENTICATION_BACKENDS ('django.contrib.auth.backends.ModelBackend',) SESSION_COOKIE_DOMAIN None LANGUAGES (('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmal'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-cn', 'Simplified Chinese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese'), ('zh-tw', 'Traditional Chinese')) MEDIA_ROOT 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src\media' USE_I18N True FILE_CHARSET 'utf-8' NUMBER_GROUPING 0 X_FRAME_OPTIONS 'SAMEORIGIN' SESSION_COOKIE_SECURE False FORMAT_MODULE_PATH None SHORT_DATETIME_FORMAT 'm/d/Y P' DEFAULT_EXCEPTION_REPORTER_FILTER 'django.views.debug.SafeExceptionReporterFilter' CSIDL_PERSONAL 5 FORCE_SCRIPT_NAME None DB_BASE_DIR 'C:\Users\meschoenbaum\Documents\ADSM Workspace\settings' IGNORABLE_404_URLS () SHGFP_TYPE_CURRENT 0 MEDIA_URL '/media/' CACHE_MIDDLEWARE_SECONDS 600 SESSION_FILE_PATH None LANGUAGE_COOKIE_NAME 'django_language' SILENCED_SYSTEM_CHECKS [] SESSION_COOKIE_PATH '/' CRISPY_TEMPLATE_PACK 'bootstrap' DATABASE_ROUTERS ['ScenarioCreator.router.ScenarioRouter'] SHORT_DATE_FORMAT 'm/d/Y' SESSION_COOKIE_NAME 'sessionid' BASE_DIR 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src' EMAIL_USE_SSL False LOGIN_REDIRECT_URL '/accounts/profile/' ROOT_URLCONF 'ADSM.urls' SESSION_SERIALIZER 'django.contrib.sessions.serializers.JSONSerializer' PREPEND_WWW False INSTALLED_APPS ('ScenarioCreator', 'Results', 'ADSMSettings', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.humanize', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'floppyforms', 'crispy_forms', 'productionserver') TIME_ZONE 'UTC' FILE_UPLOAD_MAX_MEMORY_SIZE 2621440 SESSION_SAVE_EVERY_REQUEST False PASSWORD_HASHERS '**_****************_' MANAGERS () SIGNING_BACKEND 'django.core.signing.TimestampSigner' EMAIL_USE_TLS False TEST_NON_SERIALIZED_APPS [] THOUSAND_SEPARATOR ',' TEMPLATE_DIRS ('C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src\templates',) DATE_FORMAT 'N j, Y' DEFAULT_CHARSET 'utf-8' PASSWORD_RESET_TIMEOUT_DAYS '**_****************_' CACHES {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} TEMPLATE_LOADERS ('django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader') LOGOUT_URL '/accounts/logout/' FIXTURE_DIRS () STATIC_URL '/static/' ADMIN_FOR () CACHE_MIDDLEWARE_KEY_PREFIX '**_****************_' CACHE_MIDDLEWARE_ALIAS 'default' EMAIL_HOST_PASSWORD '**_****************_' APPEND_SLASH True SESSION_COOKIE_AGE 1209600 DEFAULT_CONTENT_TYPE 'text/html' SESSION_COOKIE_HTTPONLY True DATE_INPUT_FORMATS ('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y') LANGUAGE_COOKIE_DOMAIN None CSRF_COOKIE_AGE 31449600 EMAIL_SUBJECT_PREFIX '[Django] ' DEBUG_PROPAGATE_EXCEPTIONS False TEMPLATE_DEBUG True FILE_UPLOAD_HANDLERS ('django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler') STATICFILES_DIRS ('C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src\ADSM\static',) LANGUAGE_COOKIE_AGE None SESSION_EXPIRE_AT_BROWSER_CLOSE False CSRF_FAILURE_VIEW 'django.views.csrf.csrf_failure' TEST_RUNNER 'django.test.runner.DiscoverRunner' ABSOLUTE_URL_OVERRIDES {} AUTH_USER_MODEL 'auth.User' DEFAULT_INDEX_TABLESPACE '' LANGUAGE_CODE 'en-us' TIME_FORMAT 'P' CSRF_COOKIE_NAME 'csrftoken' SECURE_PROXY_SSL_HEADER None DEFAULT_TABLESPACE '' USE_THOUSAND_SEPARATOR False SEND_BROKEN_LINK_EMAILS False CSRF_COOKIE_DOMAIN None TEMPLATE_CONTEXT_PROCESSORS ('django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'django.core.context_processors.static', 'django.core.context_processors.tz', 'django.contrib.messages.context_processors.messages', 'django.core.context_processors.request', 'ADSMSettings.context_processor.adsm_context', 'ScenarioCreator.context_processor.basic_context', 'Results.context_processor.results_context') USE_L10N True YEAR_MONTH_FORMAT 'F Y' INTERNAL_IPS () ALLOWED_HOSTS [] SESSION_CACHE_ALIAS 'default' EMAIL_HOST 'localhost' TRANSACTIONS_MANAGED False EMAIL_PORT 25 PROFANITIES_LIST '**_*****************' ALLOWED_INCLUDE_ROOTS () STATIC_ROOT 'C:\Users\meschoenbaum\Desktop\ADSM_3_12\ADSM_3.4.44-RC5\src\static' TEMPLATE_STRING_IF_INVALID '' DECIMAL_SEPARATOR '.' ADMINS () LOGIN_URL '/accounts/login/' USE_X_FORWARDED_HOST False MESSAGE_STORAGE 'django.contrib.messages.storage.fallback.FallbackStorage' SESSION_ENGINE 'django.contrib.sessions.backends.db' CSRF_COOKIE_SECURE False CSRF_COOKIE_HTTPONLY False DATETIME_INPUT_FORMATS ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y') TIME_INPUT_FORMATS ('%H:%M:%S', '%H:%M:%S.%f', '%H:%M') FILE_UPLOAD_PERMISSIONS None SETTINGS_MODULE 'ADSM.settings' COMMENTS_ALLOW_PROFANITIES False LANGUAGE_COOKIE_PATH '/'
ndh2 commented 9 years ago

It took a while for state names to settle down in really early versions. We weren't picky about capitalization or spaces ("infectiousclinical" considered the same as "Infectious Clinical"). We also allowed "Incubating" instead of "Latent" and "Inapparent Shedding" instead of "Infectious Subclinical".

missyschoenbaum commented 9 years ago

Actually, I am not sure where the option of Infectious clinical came from. It is not in the source database lookup, and the status in the population (dynherd) only show the codes, C,L and S. I had to export the population from this database as I didn't have it in XML already.

\ Magic happens here **

ndh2 commented 9 years ago

It will be a quick fix to make the xml-to-sqlite routine "normalize" some of those cases to the now-accepted names.

missyschoenbaum commented 9 years ago

@ndh2 - OK, but I still think @josiahseaman needs to make the app behave nice when someone does something stupid that is beyond our speculation. I don't think we implemented constraints at the database level, which is how my brain manages these problems.

sarahjgarza commented 9 years ago

@josiahseaman there are still constraints at the database level where you cannot import the csv population file with the initial states already assigned; they all become "Susceptible" inside ADSM and you have to change them manually

josiahseaman commented 9 years ago

Hi Sarah, the fix for this issue 5e8800c was just now pushed to production. Please try it again after updating. Thanks!