34 lines
760 B
Go
34 lines
760 B
Go
|
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)
|
||
|
}
|
||
|
}
|