timetable-mgr/src/corpus/update.go

34 lines
760 B
Go
Raw Normal View History

2024-03-26 15:40:15 +00:00
package corpus
import (
"fmt"
"git.fjla.uk/owlboard/timetable-mgr/helpers"
"git.fjla.uk/owlboard/timetable-mgr/log"
"go.uber.org/zap"
)
func RunCorpusUpdate(cfg *helpers.Configuration) {
resp, err := fetchCorpus(cfg)
if err != nil {
log.Msg.Error("Failed to update Corpus data", zap.Error(err))
}
datastring, err := extractCorpusResponse(resp)
if err != nil {
log.Msg.Error("Error extracting Corpus data", zap.Error(err))
}
corpusData, err := parseCorpusData(datastring)
if err != nil {
log.Msg.Error("Error parsing Corpus data", zap.Error(err))
}
prunedCorpusData := pruneCorpusEntries(corpusData)
for _, entry := range prunedCorpusData {
fmt.Printf("DESC: %s, NLC: %d, CRS: '%s'\n",
entry.NLCDESC, entry.NLC, entry.CRS)
}
}