Skip to content

Commit

Permalink
Merge branch 'miguelworking' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Leon authored Apr 24, 2017
2 parents d6b1628 + 43269ab commit e0d913b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 11 deletions.
Binary file modified ODM2AdminExamplePostgresqlDB
Binary file not shown.
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN apt-get update --fix-missing && apt-get install -y postgresql postgresql-cli

RUN git clone "https://github.com/miguelcleon/ODM2-Admin"


RUN cd ODM2-Admin && latest=$(git describe --tags) && git checkout ${latest}

RUN service postgresql start && su - postgres -c 'psql -U postgres -c "create database odm2_db"'
Expand Down
3 changes: 2 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Requirements to run [docker image](https://hub.docker.com/r/lsetiawan/odm2admin/
1. Docker installed on Linux, MacOS, or Windows.

To run:
$ docker run -d -p 8010:8010 --name odm2admintest lsetiawan/odm2admin:latest
$ docker run -d -p 8010:8010 --name odm2admintest lsetiawan/odm2admin:latest

2 changes: 2 additions & 0 deletions docker/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ source activate odm2adminenv
conda install --yes -c conda-forge pytz

echo "Building database..."

su - postgres -c 'pg_restore -d odm2_db -1 -v "/ODM2-Admin/ODM2AdminExamplePostgresqlDB"'

su - postgres -c "psql -U postgres -d postgres -c \"alter user postgres with password 'test';\""

echo "Running server..."
Expand Down
3 changes: 2 additions & 1 deletion odm2admin/management/commands/ProcessDataLoggerFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def handle(self, *args, **options): # (f,fileid, databeginson,columnheaderson,
for j in range(numCols):
# raise ValidationError(" in file " + row[j] + "
# in obj column label "+dloggerfileColumns.columnlabel)
if row[j] == dloggerfileColumns.columnlabel:
if row[j] == dloggerfileColumns.columnlabel \
and dloggerfileColumns.columndescription !="skip":
foundColumn = True
dloggerfileColumns.columnnum = j
rowColumnMap += [dloggerfileColumns]
Expand Down
26 changes: 19 additions & 7 deletions odm2admin/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,9 @@ class Dataloggerfilecolumns(models.Model):
verbose_name="instrument output variable",
db_column='instrumentoutputvariableid')
columnlabel = models.CharField(verbose_name="column label", max_length=50)
columndescription = models.CharField(verbose_name="column description", max_length=5000,
columndescription = models.CharField(verbose_name="column description",
help_text="To disble ingestion of a column type 'skip'",
max_length=5000,
blank=True)
measurementequation = models.CharField(verbose_name="measurement equation", max_length=255,
blank=True)
Expand Down Expand Up @@ -1054,7 +1056,7 @@ def save(self, *args, **kwargs):
fileid = self.dataloggerfileid.dataloggerfileid
management.call_command('ProcessDataLoggerFile', linkname,str(fileid)
, str(self.databeginson), str(self.columnheaderson),
False, False)
False, False, False)
super(ProcessDataloggerfile, self).save(*args, **kwargs)
# def get_actions(self, request):
# #Disable delete
Expand Down Expand Up @@ -2727,7 +2729,8 @@ def email_text(self):
return s

def csvheaderShort(self):
s = '\" {0} -unit-{1}-processing level-{2}\",'.format(
s = 'method,'
s += '\" {0} -unit-{1}-processing level-{2}\",'.format(
self.resultid.resultid.variableid.variablecode,
self.resultid.resultid.unitsid.unitsname,
self.resultid.resultid.processing_level.processinglevelcode)
Expand All @@ -2736,6 +2739,8 @@ def csvheaderShort(self):
return s

def csvoutputShort(self):
s = '\" {0}\",'.format(
self.resultid.resultid.featureactionid.action.method.methodcode)
s = '{0},'.format(self.datavalue)
s += '{0}'.format(self.qualitycodecv)
trvannotation = Timeseriesresultvalueannotations.objects.filter(valueid=self.valueid)
Expand Down Expand Up @@ -2807,7 +2812,8 @@ def email_text(self):
s += 'location- {0}'.format(self.samplingfeaturename)
return s
def csvheaderShort(self):
s = '\" {0} -unit-{1}-processing level-{2}\",'.format(
s = 'method,'
s += '\" {0} -unit-{1}-processing level-{2}\",'.format(
self.variablecode,
self.unitsabbreviation,
self.processinglevelcode)
Expand All @@ -2832,7 +2838,9 @@ def csvoutput(self):


def csvoutputShort(self):
s = '{0},'.format(self.datavalue)
s = '\" {0}\",'.format(
self.resultid.resultid.featureactionid.action.method.methodcode)
s += '{0},'.format(self.datavalue)
s += '{0},'.format(self.qualitycodecv)
return s

Expand Down Expand Up @@ -2906,7 +2914,8 @@ def email_text(self):
return s

def csvheaderShort(self):
s = '\" {0} -unit-{1}-processing level-{2}\",'.format(
s = 'method,'
s += '\" {0} -unit-{1}-processing level-{2}\",'.format(
self.variablecode,
self.unitsabbreviation,
self.processinglevelcode)
Expand All @@ -2915,7 +2924,10 @@ def csvheaderShort(self):
return s

def csvoutputShort(self):
s = '{0},'.format(self.datavalue)
result = Results.objects.get(resultid=self.resultid)
s = '\" {0}\",'.format(
result.featureactionid.action.method.methodcode)
s += '{0},'.format(self.datavalue)
s += '{0},'.format(self.qualitycodecv)
if self.annotationtext:
s += '\"{0} \",'.format(self.annotationtext)
Expand Down
2 changes: 0 additions & 2 deletions templatesAndSettings/templates/LocationDataInfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@


<tr ><th scope="col" class="section">Result Series</td>
<th scope="col" class="sortable column-resultid">id</th>
<th scope="col" class="sortable column-resultid">Variable</th>
<th scope="col" class="sortable column-resultid">Units</th>
<th scope="col" class="sortable column-resultid">Graph Data</th>
Expand All @@ -81,7 +80,6 @@
{% assign donut 1 %}
{% assign done 1 %}
<tr class="row1">
<td>{{ Result.feature_action }} </td>
<td >{{Result.resultid}}</td>
<td >{{Result.variableid.variablecode}}</td>
<td >{{Result.unitsid}}</td>
Expand Down

0 comments on commit e0d913b

Please sign in to comment.