Mercurial > gemma
changeset 3278:831193935739
Avoid storing of NtS messages other than water level
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 15 May 2019 19:42:21 +0200 |
parents | 232fc90e6ee2 |
children | 215173f62900 |
files | pkg/imports/agm.go pkg/imports/gm.go schema/gemma.sql schema/geoserver_views.sql |
diffstat | 4 files changed, 6 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/agm.go Wed May 15 19:08:49 2019 +0200 +++ b/pkg/imports/agm.go Wed May 15 19:42:21 2019 +0200 @@ -174,7 +174,6 @@ water_level, date_info, source_organization, - is_waterlevel, staging_done ) VALUES( ($1::char(2), $2::char(3), $3::char(5), $4::char(5), $5::int), @@ -187,7 +186,6 @@ $12, $13, $14, - true, false ) RETURNING id`
--- a/pkg/imports/gm.go Wed May 15 19:08:49 2019 +0200 +++ b/pkg/imports/gm.go Wed May 15 19:42:21 2019 +0200 @@ -54,7 +54,6 @@ date_issue, reference_code, water_level, - is_waterlevel, date_info, source_organization, staging_done @@ -69,7 +68,6 @@ $12, $13, $14, - $15, true ) ON CONFLICT DO NOTHING @@ -86,7 +84,6 @@ date_issue, reference_code, water_level, - is_waterlevel, conf_interval, date_info, source_organization @@ -101,8 +98,7 @@ $12, $13, $14, - $15, - $16 + $15 ) ON CONFLICT DO NOTHING RETURNING 1 @@ -305,7 +301,11 @@ convert(measure.Value_min) convert(measure.Value_max) - isWaterlevel := *measure.Measure_code == nts.Measure_code_enumWAL + if *measure.Measure_code != nts.Measure_code_enumWAL { + feedback.Warn("Ignored message with measure_code %s", + *measure.Measure_code) + continue + } if measure.Predicted { var confInterval pgtype.Numrange @@ -335,7 +335,6 @@ msg.Identification.Date_issue, referenceCode, measure.Value, - isWaterlevel, &confInterval, msg.Identification.Date_issue, msg.Identification.Originator, @@ -363,7 +362,6 @@ msg.Identification.Date_issue, referenceCode, measure.Value, - isWaterlevel, msg.Identification.Date_issue, msg.Identification.Originator, ).Scan(&dummy)
--- a/schema/gemma.sql Wed May 15 19:08:49 2019 +0200 +++ b/schema/gemma.sql Wed May 15 19:42:21 2019 +0200 @@ -311,7 +311,6 @@ date_issue timestamp with time zone NOT NULL, reference_code varchar(4) NOT NULL REFERENCES depth_references, water_level double precision NOT NULL, - is_waterlevel boolean NOT NULL, date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, source_organization varchar NOT NULL, -- "originator" from NtS response staging_done boolean NOT NULL DEFAULT false, @@ -327,7 +326,6 @@ date_issue timestamp with time zone NOT NULL, reference_code varchar(4) NOT NULL REFERENCES depth_references, water_level double precision NOT NULL, - is_waterlevel boolean NOT NULL, conf_interval numrange CHECK (conf_interval @> CAST(water_level AS numeric)), date_info timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
--- a/schema/geoserver_views.sql Wed May 15 19:08:49 2019 +0200 +++ b/schema/geoserver_views.sql Wed May 15 19:42:21 2019 +0200 @@ -46,7 +46,6 @@ waterlevel_latest AS ( SELECT DISTINCT ON (fk_gauge_id) fk_gauge_id, water_level FROM waterway.gauge_measurements - WHERE is_waterlevel ORDER BY fk_gauge_id, measure_date DESC) SELECT b.id,