Mercurial > gemma
comparison pkg/imports/bn.go @ 3302:ec6163c6687d
'Historicise' gauges on import
Gauge data sets will be updated or a new version will be inserted
depending on temporal validity and a timestamp marking the last
update in the RIS-Index of a data set. The trigger on date_info is
removed because the value is actually an attribut coming from the
RIS-Index.
Gauge measurements and predictions are associated to the version with
matching temporal validity. Bottlenecks are always associated to the
actual version of the gauge, although this might change as soon as
bottlenecks are 'historicised', too.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 16 May 2019 18:41:43 +0200 |
parents | bfde4f8dd323 |
children | 6592396f5061 |
comparison
equal
deleted
inserted
replaced
3301:6514b943654e | 3302:ec6163c6687d |
---|---|
45 SELECT true FROM waterway.bottlenecks WHERE bottleneck_id = $1` | 45 SELECT true FROM waterway.bottlenecks WHERE bottleneck_id = $1` |
46 | 46 |
47 insertBottleneckSQL = ` | 47 insertBottleneckSQL = ` |
48 INSERT INTO waterway.bottlenecks ( | 48 INSERT INTO waterway.bottlenecks ( |
49 bottleneck_id, | 49 bottleneck_id, |
50 fk_g_fid, | 50 gauge_location, |
51 gauge_validity, | |
51 objnam, | 52 objnam, |
52 nobjnm, | 53 nobjnm, |
53 stretch, | 54 stretch, |
54 area, | 55 area, |
55 rb, | 56 rb, |
57 responsible_country, | 58 responsible_country, |
58 revisiting_time, | 59 revisiting_time, |
59 limiting, | 60 limiting, |
60 date_info, | 61 date_info, |
61 source_organization | 62 source_organization |
62 ) VALUES( | 63 ) VALUES ( |
63 $1, | 64 $1, |
64 isrs_fromText($2), | 65 isrs_fromText($2), |
66 (SELECT validity FROM waterway.gauges | |
67 WHERE location = isrs_fromText($2) AND NOT erased), | |
65 $3, | 68 $3, |
66 $4, | 69 $4, |
67 isrsrange(least(isrs_fromText($5), isrs_fromText($6)), | 70 isrsrange(least(isrs_fromText($5), isrs_fromText($6)), |
68 greatest(isrs_fromText($5), isrs_fromText($6))), | 71 greatest(isrs_fromText($5), isrs_fromText($6))), |
69 ISRSrange_area( | 72 ISRSrange_area( |