timetable-extension #1

Open
fred.boniface wants to merge 160 commits from timetable-extension into main
6 changed files with 42 additions and 4 deletions
Showing only changes of commit 74813e2fb0 - Show all commits

4
src/cif/check.go Normal file
View File

@ -0,0 +1,4 @@
package cif
// Check if CIF Data needs updating
// Run update if required

4
src/corpus/check.go Normal file
View File

@ -0,0 +1,4 @@
package corpus
// Check if corpus data needs updating.
// Run update if needed.

22
src/corpus/stations.go Normal file
View File

@ -0,0 +1,22 @@
package corpus
import "git.fjla.uk/owlboard/go-types/pkg/database"
func createStationEntries(corpusData []database.CorpusEntry) []database.StationEntry {
var stationEntries []database.StationEntry
for _, entry := range corpusData {
if entry.CRS != "" {
stationEntry := database.StationEntry{
CRS: entry.CRS,
TIPLOC: entry.TIPLOC,
NLCDESC: entry.NLCDESC,
STANOX: entry.STANOX,
}
stationEntries = append(stationEntries, stationEntry)
}
}
return stationEntries
}

View File

@ -19,15 +19,21 @@ func RunCorpusUpdate(cfg *helpers.Configuration) {
log.Msg.Error("Error extracting Corpus data", zap.Error(err)) log.Msg.Error("Error extracting Corpus data", zap.Error(err))
} }
corpusData, err := parseCorpusData(datastring) unsortedCorpusData, err := parseCorpusData(datastring)
if err != nil { if err != nil {
log.Msg.Error("Error parsing Corpus data", zap.Error(err)) log.Msg.Error("Error parsing Corpus data", zap.Error(err))
} }
prunedCorpusData := pruneCorpusEntries(corpusData) corpusData := pruneCorpusEntries(unsortedCorpusData)
stationData := createStationEntries(corpusData)
for _, entry := range prunedCorpusData { for _, entry := range corpusData {
fmt.Printf("DESC: %s, NLC: %d, CRS: '%s'\n", fmt.Printf("DESC: %s, NLC: %d, CRS: '%s'\n",
entry.NLCDESC, entry.NLC, entry.CRS) entry.NLCDESC, entry.NLC, entry.CRS)
} }
for _, entry := range stationData {
fmt.Printf("NAME: %s, CRS: %s, TIPLOC: %s\n",
entry.NLCDESC, entry.CRS, entry.TIPLOC)
}
} }

View File

@ -3,7 +3,7 @@ module git.fjla.uk/owlboard/timetable-mgr
go 1.21 go 1.21
require ( require (
git.fjla.uk/owlboard/go-types v0.0.0-20240326151548-5491671b8bb4 git.fjla.uk/owlboard/go-types v0.0.0-20240326154559-f85646ac1a58
github.com/go-stomp/stomp/v3 v3.0.5 github.com/go-stomp/stomp/v3 v3.0.5
go.mongodb.org/mongo-driver v1.12.0 go.mongodb.org/mongo-driver v1.12.0
go.uber.org/zap v1.24.0 go.uber.org/zap v1.24.0

View File

@ -4,6 +4,8 @@ git.fjla.uk/owlboard/go-types v0.0.0-20240326142657-0fc57cb903e6 h1:p3m0gpFqsyBR
git.fjla.uk/owlboard/go-types v0.0.0-20240326142657-0fc57cb903e6/go.mod h1:kG+BX9UF+yJaAVnln/QSKlTdrtKRRReezMeSk1ZLMzY= git.fjla.uk/owlboard/go-types v0.0.0-20240326142657-0fc57cb903e6/go.mod h1:kG+BX9UF+yJaAVnln/QSKlTdrtKRRReezMeSk1ZLMzY=
git.fjla.uk/owlboard/go-types v0.0.0-20240326151548-5491671b8bb4 h1:FqDR2uRWVpZjwyEUHrsHSBXcnRgUmoRlF/lGojL7KcE= git.fjla.uk/owlboard/go-types v0.0.0-20240326151548-5491671b8bb4 h1:FqDR2uRWVpZjwyEUHrsHSBXcnRgUmoRlF/lGojL7KcE=
git.fjla.uk/owlboard/go-types v0.0.0-20240326151548-5491671b8bb4/go.mod h1:kG+BX9UF+yJaAVnln/QSKlTdrtKRRReezMeSk1ZLMzY= git.fjla.uk/owlboard/go-types v0.0.0-20240326151548-5491671b8bb4/go.mod h1:kG+BX9UF+yJaAVnln/QSKlTdrtKRRReezMeSk1ZLMzY=
git.fjla.uk/owlboard/go-types v0.0.0-20240326154559-f85646ac1a58 h1:8r1oGpD1yG4Jk9B9vKe2KNbngmbCxP+S3ISNxL/P3xc=
git.fjla.uk/owlboard/go-types v0.0.0-20240326154559-f85646ac1a58/go.mod h1:kG+BX9UF+yJaAVnln/QSKlTdrtKRRReezMeSk1ZLMzY=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=