tmain.go: add remarks and depth, rename ground level - ags-upload - Insert AGS files to a database
 (HTM) git clone git://src.adamsgaard.dk/ags-upload
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit d25fead8fb5625035f6205cc2a056e156fe99e46
 (DIR) parent b81873bfd2e96dfd41e851bc86c0203adb885e5f
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Wed,  8 Oct 2025 14:44:52 +0200
       
       main.go: add remarks and depth, rename ground level
       
       Diffstat:
         M cmd/main.go                         |      58 +++++++++++++++++--------------
       
       1 file changed, 32 insertions(+), 26 deletions(-)
       ---
 (DIR) diff --git a/cmd/main.go b/cmd/main.go
       t@@ -32,20 +32,22 @@ type CptInfo struct {
                TestReference string `gorm:"index:idx_loc_tesn,unique"` // SCPG_TESN
        
                // Selected LOCA fields for the site
       -        CoordRef string   // LOCA_LREF
       -        Datum    string   // LOCA_DATM
       -        GL       *float64 // LOCA_GL (m)
       -        LocX     *float64 // LOCA_LOCX (m)
       -        LocY     *float64 // LOCA_LOCY (m)
       -        LocZ     *float64 // LOCA_LOCZ (m)
       +        CoordRef    string   // LOCA_LREF
       +        Datum       string   // LOCA_DATM
       +        Remarks     string   // LOCA_REM
       +        Depth       *float64 // LOCA_FDEP (m)
       +        GroundLevel *float64 // LOCA_GL (m)
       +        LocX        *float64 // LOCA_LOCX (m)
       +        LocY        *float64 // LOCA_LOCY (m)
       +        LocZ        *float64 // LOCA_LOCZ (m)
        }
        
        // Per-depth CPT data (SCPT)
        type Cpt struct {
                ID            uint     `gorm:"primaryKey"`
       -        InfoId        uint     `gorm:"index"`   // FK -> CptInfo.ID
       -        LocationId    string   `gorm:"index"`   // LOCA_ID (redundant but handy)
       -        TestReference string   `gorm:"index"`   // SCPG_TESN (redundant but handy)
       +        InfoId        uint     `gorm:"index"` // FK -> CptInfo.ID
       +        LocationId    string   `gorm:"index"` // LOCA_ID (redundant but handy)
       +        TestReference string   `gorm:"index"` // SCPG_TESN (redundant but handy)
                Depth         *float64 // SCPT_DPTH
                Qc            *float64 // SCPT_RES (cone resistance)
                Fs            *float64 // SCPT_FRES (side friction)
       t@@ -79,8 +81,8 @@ func ParseAGSCptAll(r io.Reader) ([]CptInfo, []Cpt, error) {
        
                        // LOCA rows keyed by LOCA_ID
                        locas = map[string]struct {
       -                        LRef, Datum string
       -                        GL, X, Y, Z         *float64
       +                        LRef, Datum, Remarks        string
       +                        Depth, GroundLevel, X, Y, Z *float64
                        }{}
        
                        // CptInfo keyed by (LOCA_ID, SCPG_TESN)
       t@@ -168,15 +170,17 @@ func ParseAGSCptAll(r io.Reader) ([]CptInfo, []Cpt, error) {
                                                break
                                        }
                                        locas[lid] = struct {
       -                                        LRef, Datum string
       -                                        GL, X, Y, Z         *float64
       +                                        LRef, Datum, Remarks        string
       +                                        Depth, GroundLevel, X, Y, Z *float64
                                        }{
       -                                        LRef:   get("LOCA", row, "LOCA_LREF"),
       -                                        Datum:  get("LOCA", row, "LOCA_DATM"),
       -                                        GL:     fptr(get("LOCA", row, "LOCA_GL")),
       -                                        X:      fptr(get("LOCA", row, "LOCA_LOCX")),
       -                                        Y:      fptr(get("LOCA", row, "LOCA_LOCY")),
       -                                        Z:      fptr(get("LOCA", row, "LOCA_LOCZ")),
       +                                        LRef:        get("LOCA", row, "LOCA_LREF"),
       +                                        Datum:       get("LOCA", row, "LOCA_DATM"),
       +                                        Remarks:     get("LOCA", row, "LOCA_REM"),
       +                                        Depth:       fptr(get("LOCA", row, "LOCA_FDEP")),
       +                                        GroundLevel: fptr(get("LOCA", row, "LOCA_GL")),
       +                                        X:           fptr(get("LOCA", row, "LOCA_LOCX")),
       +                                        Y:           fptr(get("LOCA", row, "LOCA_LOCY")),
       +                                        Z:           fptr(get("LOCA", row, "LOCA_LOCZ")),
                                        }
        
                                case "SCPG":
       t@@ -185,7 +189,7 @@ func ParseAGSCptAll(r io.Reader) ([]CptInfo, []Cpt, error) {
                                        if locID == "" || tesn == "" {
                                                break
                                        }
       -                                li := locas[locID] // if missing, zero-value ok
       +                                li := locas[locID]
                                        infosByKey[mapKey(locID, tesn)] = CptInfo{
                                                ProjSourceId: proj.id,
                                                ProjName:     proj.name,
       t@@ -196,12 +200,14 @@ func ParseAGSCptAll(r io.Reader) ([]CptInfo, []Cpt, error) {
                                                LocationId:    locID,
                                                TestReference: tesn,
        
       -                                        CoordRef: li.LRef,
       -                                        Datum:    li.Datum,
       -                                        GL:       li.GL,
       -                                        LocX:     li.X,
       -                                        LocY:     li.Y,
       -                                        LocZ:     li.Z,
       +                                        CoordRef:    li.LRef,
       +                                        Datum:       li.Datum,
       +                                        Remarks:     li.Remarks,
       +                                        Depth:       li.Depth,
       +                                        GroundLevel: li.GroundLevel,
       +                                        LocX:        li.X,
       +                                        LocY:        li.Y,
       +                                        LocZ:        li.Z,
                                        }
        
                                case "SCPT":