Mercurial > gemma
diff pkg/imports/agm.go @ 1775:fcb0106ec510
Gauge measurement import: Added reference_code column.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 11 Jan 2019 12:10:23 +0100 |
parents | 70c4dc694d61 |
children | 164b46ebd60d |
line wrap: on
line diff
--- a/pkg/imports/agm.go Fri Jan 11 12:01:26 2019 +0100 +++ b/pkg/imports/agm.go Fri Jan 11 12:10:23 2019 +0100 @@ -22,6 +22,7 @@ "log" "os" "path/filepath" + "strings" "gemma.intevation.de/gemma/pkg/common" ) @@ -109,8 +110,34 @@ return nil, err } + headerIndices := map[string]int{} + for i, f := range headers { log.Printf("%d: %s\n", i, f) + headerIndices[strings.ToLower(strings.TrimSpace(f))] = i + } + + for _, m := range [...]string{ + "fk_gauge_id", + "measure_date", + "from", // "sender", + "language_code", + "country_code", + "date_issue", + "reference_code", + "water_level", + "predicted", + "is_waterlevel", + "value_min", + "value_max", + "date_info", + "originator", // "source_organization", + } { + idx, found := headerIndices[m] + if !found { + log.Printf("missing column '%s'\n", m) + } + _ = idx } return nil, errors.New("Not implemented, yet!")