From d622b2642900d78a7c45d1874082eedd88c39cd1 Mon Sep 17 00:00:00 2001 From: sreeder Date: Wed, 22 Jun 2016 13:16:13 -0600 Subject: [PATCH 1/7] rearrange data value and series catalog tables --- odmtools/odmdata/series.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/odmtools/odmdata/series.py b/odmtools/odmdata/series.py index cae849c..37b9aa6 100644 --- a/odmtools/odmdata/series.py +++ b/odmtools/odmdata/series.py @@ -51,6 +51,9 @@ class Series(Base): variable_id = Column('VariableID', Integer, ForeignKey('Variables.VariableID'), nullable=False) variable_code = Column('VariableCode', String) variable_name = Column('VariableName', String) + quality_control_level_id = Column('QualityControlLevelID', Integer, + ForeignKey('QualityControlLevels.QualityControlLevelID'), nullable=False) + quality_control_level_code = Column('QualityControlLevelCode', String) speciation = Column('Speciation', String) variable_units_id = Column('VariableUnitsID', Integer) variable_units_name = Column('VariableUnitsName', String) @@ -67,9 +70,7 @@ class Series(Base): source_description = Column('SourceDescription', String) organization = Column('Organization', String) citation = Column('Citation', String) - quality_control_level_id = Column('QualityControlLevelID', Integer, - ForeignKey('QualityControlLevels.QualityControlLevelID'), nullable=False) - quality_control_level_code = Column('QualityControlLevelCode', String) + begin_date_time = Column('BeginDateTime', DateTime) end_date_time = Column('EndDateTime', DateTime) begin_date_time_utc = Column('BeginDateTimeUTC', DateTime) @@ -118,26 +119,29 @@ def get_table_columns(self): return self.__table__.columns.keys() def list_repr(self): - return [self.id, self.site_id, self.site_code, self.site_name, self.variable_id, self.variable_code, + return [self.id, self.variable_code, self.quality_control_level_code, + self.site_id, self.site_name, self.variable_id, self.variable_name, self.speciation, self.variable_units_id, self.variable_units_name, self.sample_medium, self.value_type, self.time_support, self.time_units_id, self.time_units_name, self.data_type, self.general_category, self.method_id, self.method_description, self.source_id, self.source_description, self.organization, self.citation, - self.quality_control_level_id, self.quality_control_level_code, self.begin_date_time, + self.quality_control_level_id, self.begin_date_time, self.end_date_time, self.begin_date_time_utc, self.end_date_time_utc, self.value_count] def returnDict(): - keys = ['SeriesID', 'SiteID', 'SiteCode', 'SiteName', 'VariableID', 'VariableCode', 'VariableName', 'Speciation', + keys = ['SeriesID', 'SiteCode','VariableCode','QualityControlLevelCode', + 'SiteID', 'SiteName', 'VariableID', 'VariableName', 'Speciation', 'VariableUnitsID', 'VariableUnitsName', 'SampleMedium', 'ValueType', 'TimeSupport', 'TimeUnitsID', 'TimeUnitsName', 'DataType', 'GeneralCategory', 'MethodID', 'MethodDescription', 'SourceID', - 'SourceDescription', 'Organization', 'Citation', 'QualityControlLevelID', 'QualityControlLevelCode', + 'SourceDescription', 'Organization', 'Citation', 'QualityControlLevelID', 'BeginDateTime', 'EndDateTime', 'BeginDateTimeUTC', 'EndDateTimeUTC', 'ValueCount' ] - values = ['id', 'site_id', 'site_code', 'site_name', 'variable_id', 'variable_code', 'variable_name', 'speciation', + values = ['id', 'site_code','variable_code','quality_control_level_code', + 'site_id', 'site_name', 'variable_id', 'variable_name', 'speciation', 'variable_units_id', 'variable_units_name', 'sample_medium', 'value_type', 'time_support', 'time_units_id', 'time_units_name', 'data_type', 'general_category', 'method_id', 'method_description', 'source_id', 'source_description', 'organization', 'citation', 'quality_control_level_id', - 'quality_control_level_code', 'begin_date_time', 'end_date_time', 'begin_date_time_utc', + 'begin_date_time', 'end_date_time', 'begin_date_time_utc', 'end_date_time_utc', 'value_count' ] return OrderedDict(zip(keys, values)) From 02bb1b88bf81756f799e80071e97d75e4c0940f7 Mon Sep 17 00:00:00 2001 From: stephanie Date: Wed, 22 Jun 2016 13:28:15 -0600 Subject: [PATCH 2/7] update travis.yml --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 50a96e8..218df80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,12 +65,12 @@ install: # now just our code # mariadb: '10.1' before_script: - - chmod +x ./tests/scripts/mysql_setup.sh -# - chmod +x ./tests/scripts/postgres_setup.sh - - chmod +x ./tests/scripts/freetds.sh - - ./tests/scripts/mysql_setup.sh -# - ./tests/scripts/postgres_setup.sh - - ./tests/scripts/freetds.sh + - chmod +x ./ci-helpers/travis/mysql_setup.sh +# - chmod +x ../ci-helpers/travis/postgres_setup.sh + - chmod +x ./ci-helpers/travis/freetds.sh + - ./ci-helpers/travis/mysql_setup.sh +# - ./ci-helpers/travis/postgres_setup.sh + - ./ci-helpers/travis/freetds.sh # command to run tests script: From d8c78df9048f286fbf7f4c89f5be56b04defd892 Mon Sep 17 00:00:00 2001 From: stephanie Date: Wed, 22 Jun 2016 13:35:58 -0600 Subject: [PATCH 3/7] fix missing series value --- odmtools/odmdata/series.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/odmtools/odmdata/series.py b/odmtools/odmdata/series.py index 37b9aa6..7688555 100644 --- a/odmtools/odmdata/series.py +++ b/odmtools/odmdata/series.py @@ -51,9 +51,7 @@ class Series(Base): variable_id = Column('VariableID', Integer, ForeignKey('Variables.VariableID'), nullable=False) variable_code = Column('VariableCode', String) variable_name = Column('VariableName', String) - quality_control_level_id = Column('QualityControlLevelID', Integer, - ForeignKey('QualityControlLevels.QualityControlLevelID'), nullable=False) - quality_control_level_code = Column('QualityControlLevelCode', String) + speciation = Column('Speciation', String) variable_units_id = Column('VariableUnitsID', Integer) variable_units_name = Column('VariableUnitsName', String) @@ -70,7 +68,9 @@ class Series(Base): source_description = Column('SourceDescription', String) organization = Column('Organization', String) citation = Column('Citation', String) - + quality_control_level_id = Column('QualityControlLevelID', Integer, + ForeignKey('QualityControlLevels.QualityControlLevelID'), nullable=False) + quality_control_level_code = Column('QualityControlLevelCode', String) begin_date_time = Column('BeginDateTime', DateTime) end_date_time = Column('EndDateTime', DateTime) begin_date_time_utc = Column('BeginDateTimeUTC', DateTime) @@ -119,7 +119,7 @@ def get_table_columns(self): return self.__table__.columns.keys() def list_repr(self): - return [self.id, self.variable_code, self.quality_control_level_code, + return [self.id, self.site_code, self.variable_code, self.quality_control_level_code, self.site_id, self.site_name, self.variable_id, self.variable_name, self.speciation, self.variable_units_id, self.variable_units_name, self.sample_medium, self.value_type, self.time_support, self.time_units_id, self.time_units_name, From b3662a0db4fa2803b2ed80138bb3117a932b83b8 Mon Sep 17 00:00:00 2001 From: stephanie Date: Wed, 22 Jun 2016 13:50:57 -0600 Subject: [PATCH 4/7] update travis path to scripts --- .travis.yml | 7 ++++--- requirements.txt | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 218df80..5e77111 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,9 +44,10 @@ addons: # mariadb: '10.1' before_script: - - ./ci-helpers/travis/mysql_setup.sh - - ./ci-helpers/travis/postgres_setup.sh - - ./ci-helpers/travis/freetds.sh + - ci-helpers/travis/mysql_setup.sh +# - ./ci-helpers/travis/mysql_setup.sh + - ci-helpers/travis/postgres_setup.sh + - ci-helpers/travis/freetds.sh before_install: diff --git a/requirements.txt b/requirements.txt index 1aaf9bf..0362f20 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ pyodbc pymysql numpy -#scipy sqlalchemy #matplotlib +#scipy #psycopg2 #pandas #geoalchemy2 From 4ac92d13136aa96554a4ee8689ad149865058d11 Mon Sep 17 00:00:00 2001 From: stephanie Date: Wed, 22 Jun 2016 14:04:42 -0600 Subject: [PATCH 5/7] update travis .sh scripts --- .travis.yml | 9 ++------- ci-helpers/travis/mysql_setup.sh | 4 ++-- ci-helpers/travis/postgres_setup.sh | 4 ++-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5e77111..e2b5565 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,12 +42,7 @@ addons: - wx2.8-i18n -# mariadb: '10.1' -before_script: - - ci-helpers/travis/mysql_setup.sh -# - ./ci-helpers/travis/mysql_setup.sh - - ci-helpers/travis/postgres_setup.sh - - ci-helpers/travis/freetds.sh + before_install: @@ -67,7 +62,7 @@ install: # now just our code # mariadb: '10.1' before_script: - chmod +x ./ci-helpers/travis/mysql_setup.sh -# - chmod +x ../ci-helpers/travis/postgres_setup.sh +# - chmod +x ./ci-helpers/travis/postgres_setup.sh - chmod +x ./ci-helpers/travis/freetds.sh - ./ci-helpers/travis/mysql_setup.sh # - ./ci-helpers/travis/postgres_setup.sh diff --git a/ci-helpers/travis/mysql_setup.sh b/ci-helpers/travis/mysql_setup.sh index d6c5a43..a32f650 100644 --- a/ci-helpers/travis/mysql_setup.sh +++ b/ci-helpers/travis/mysql_setup.sh @@ -21,8 +21,8 @@ mysql -e "create database IF NOT EXISTS odm2test;" --user=root ##### # install ##### -ls -al ./tests/scripts/sampledb/odm_mysql.sql ./tests/scripts/sampledb/odm_postgres.sql -mysql --user=ODM --password=odm odm < ./tests/scripts/sampledb/odm_mysql.sql +ls -al ./tests/data/sampledb/odm_mysql.sql ./tests/data/sampledb/odm_postgres.sql +mysql --user=ODM --password=odm odm < ./tests/data/sampledb/odm_mysql.sql mysql --user=root -e "show databases;" mysql --user=root -e "GRANT ALL PRIVILEGES ON odm.* TO 'ODM'@'localhost';FLUSH PRIVILEGES;" # these should produce results, if they don't the lower_case_table_names failed diff --git a/ci-helpers/travis/postgres_setup.sh b/ci-helpers/travis/postgres_setup.sh index 7874f5d..210f06a 100644 --- a/ci-helpers/travis/postgres_setup.sh +++ b/ci-helpers/travis/postgres_setup.sh @@ -2,9 +2,9 @@ psql -U postgres -c "create extension postgis" psql -c 'DROP DATABASE IF EXISTS odmtest;' -U postgres; psql -c 'create database odmtest;' -U postgres; -#psql -U postgres -d odmtest -a -f ./tests/scripts/sampledb/odm_postgres.sql +#psql -U postgres -d odmtest -a -f ./tests/data/sampledb/odm_postgres.sql psql -c 'DROP DATABASE IF EXISTS odm;' -U postgres; psql -c 'create database odm;' -U postgres; ## install # add -a to psql to see full log, -q is quiet -psql -U postgres -q -f ./tests/scripts/sampledb/odm_postgres.sql \ No newline at end of file +psql -U postgres -q -f ./tests/data/sampledb/odm_postgres.sql \ No newline at end of file From 66304c7a456a78c99686934a54f27137fa534195 Mon Sep 17 00:00:00 2001 From: stephanie Date: Wed, 6 Jul 2016 12:44:25 -0600 Subject: [PATCH 6/7] add dialog --- .travis.yml | 1 + appveyor.yml | 14 +++++++------- odmtools/gui/frmODMTools.py | 13 ++++++++++++- toolsenvironment.yml | 1 - 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index e2b5565..f405e08 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,6 +64,7 @@ before_script: - chmod +x ./ci-helpers/travis/mysql_setup.sh # - chmod +x ./ci-helpers/travis/postgres_setup.sh - chmod +x ./ci-helpers/travis/freetds.sh + - ./ci-helpers/travis/mysql_setup.sh # - ./ci-helpers/travis/postgres_setup.sh - ./ci-helpers/travis/freetds.sh diff --git a/appveyor.yml b/appveyor.yml index 7c426ab..b80ffc6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -93,7 +93,7 @@ install: # the parent CMD process). - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" # add databases - - "SET PATH=%POSTGRES_PATH%\bin;%MYSQL_PATH%\bin;%PATH%" + - "SET PATH=%POSTGRES_PATH%\\bin;%MYSQL_PATH%\\bin;%PATH%" - "activate test" # Check that we have the expected version and architecture for Python @@ -110,12 +110,12 @@ build_script: - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "CREATE DATABASE odm" -d "master" - sqlcmd -S localhost,1433 -U sa -P Password12! -i tests\data\sampledb\odm_mssql.sql -d "odm" - sqlcmd -S localhost,1433 -U sa -P Password12! -Q "select table_name from information_schema.tables" -d "odm" -# # postgres -# - psql createdb odm -# - psql -d odm -a -f tests\data\sampledb\odm_postgres.sql -# # mysql -# - mysql -e "drop database test; create database odm;" --user=root -# - mysql odm < tests\data\sampledb\odm_mysql.sql --user=root + # postgres + - psql createdb odm + - psql -d odm -a -f tests\data\sampledb\odm_postgres.sql + # mysql + - mysql -e "drop database test; create database odm;" --user=root + - mysql odm < tests\data\sampledb\odm_mysql.sql --user=root test_script: # Run the project tests diff --git a/odmtools/gui/frmODMTools.py b/odmtools/gui/frmODMTools.py index d3615df..67a3355 100755 --- a/odmtools/gui/frmODMTools.py +++ b/odmtools/gui/frmODMTools.py @@ -12,6 +12,7 @@ from odmtools.controller.frmDataTable import FrmDataTable import mnuRibbon import pnlPlot +import pnlPlot import pnlDataTable import wx.lib.agw.aui as aui import wx.py.crust @@ -55,6 +56,7 @@ def __init__(self, **kwargs): self.service_manager = ServiceManager() self.record_service = None + self.scriptcreate = False series_service = self._init_database() if series_service: @@ -384,7 +386,7 @@ def onSetScriptTitle(self, title): def addEdit(self, event): with wx.BusyInfo("Please wait for a moment while ODMTools fetches the data and stores it in our database", parent=self): - + self.scriptcreate = True isSelected, seriesID = self.pnlSelector.onReadyToEdit() logger.info("Beginning editing seriesID: %s"%str(seriesID)) @@ -496,6 +498,15 @@ def onClose(self, event): Closes ODMTools Python Closes AUI Manager then closes MainWindow """ + + #check to see if a script has been created + if self.scriptcreate: + msg = wx.MessageDialog(None, 'Would you like to save your editing script', + 'Save Script', wx.YES_NO | wx.ICON_QUESTION) + value = msg.ShowModal() + if value == wx.ID_YES: + pnlScript.OnSaveAs(event) + # deinitialize the frame manager self.pnlPlot.Close() try: diff --git a/toolsenvironment.yml b/toolsenvironment.yml index bfb1a59..da0934b 100644 --- a/toolsenvironment.yml +++ b/toolsenvironment.yml @@ -29,4 +29,3 @@ dependencies: - pyodbc==3.0.7 - python-dateutil==2.4.1 - wxpython-common==3.0.0.0 - From dc87919701ef2732e439c0c0e61adca5fe3ee138 Mon Sep 17 00:00:00 2001 From: stephanie Date: Wed, 6 Jul 2016 13:36:50 -0600 Subject: [PATCH 7/7] fix call to save dialog --- odmtools/gui/frmODMTools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odmtools/gui/frmODMTools.py b/odmtools/gui/frmODMTools.py index 67a3355..d48f642 100755 --- a/odmtools/gui/frmODMTools.py +++ b/odmtools/gui/frmODMTools.py @@ -501,11 +501,11 @@ def onClose(self, event): #check to see if a script has been created if self.scriptcreate: - msg = wx.MessageDialog(None, 'Would you like to save your editing script', + msg = wx.MessageDialog(None, 'Would you like to save your editing script?', 'Save Script', wx.YES_NO | wx.ICON_QUESTION) value = msg.ShowModal() if value == wx.ID_YES: - pnlScript.OnSaveAs(event) + self.txtPythonScript.OnSaveAs(event) # deinitialize the frame manager self.pnlPlot.Close()