Add near-term report identity
This commit is contained in:
37
internal/report/near_term_report.go
Normal file
37
internal/report/near_term_report.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/eric/weatherreporter/internal/module"
|
||||
"gitea.maximumdirect.net/eric/weatherreporter/internal/timeutil"
|
||||
)
|
||||
|
||||
const nearTermHours = 6
|
||||
|
||||
func nearTermDefinition() Definition {
|
||||
return Definition{
|
||||
ID: NearTerm,
|
||||
Name: "Near-Term Report",
|
||||
PromptID: "weather.near_term_report",
|
||||
ComparisonStrategy: CompareRollingWindow,
|
||||
ArtifactGroup: "near-term",
|
||||
BatchOutputName: "near-term.md",
|
||||
Generated: true,
|
||||
CompatiblePriorIDs: []ID{NearTerm},
|
||||
Modules: nearTermModules(),
|
||||
resolve: resolveNearTerm,
|
||||
}
|
||||
}
|
||||
|
||||
func nearTermModules() []module.ConfigItem {
|
||||
return nil
|
||||
}
|
||||
|
||||
func resolveNearTerm(req ResolveRequest) (timeutil.Period, error) {
|
||||
localNow := req.Now.In(req.Location)
|
||||
return timeutil.Period{
|
||||
Start: localNow,
|
||||
End: localNow.Add(nearTermHours * time.Hour),
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user