Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can β€” learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company πŸ‘‡

fix(monitor/collectors/gdelt): GDELT 'value' field is float64 not int (caught in live verify)

CarterPerez-dev2f0c019f201d
diff --git a/PROJECTS/advanced/monitor-the-situation-dashboard/backend/internal/collectors/gdelt/client.go b/PROJECTS/advanced/monitor-the-situation-dashboard/backend/internal/collectors/gdelt/client.go
index ec2bd0ff..745a3742 100644
--- a/PROJECTS/advanced/monitor-the-situation-dashboard/backend/internal/collectors/gdelt/client.go
+++ b/PROJECTS/advanced/monitor-the-situation-dashboard/backend/internal/collectors/gdelt/client.go
@@ -68,8 +68,8 @@ type ThemeBucket struct {
type rawTimeline struct {
Timeline []struct {
Data []struct {
- Date string `json:"date"`
- Value int `json:"value"`
+ Date string `json:"date"`
+ Value float64 `json:"value"`
} `json:"data"`
} `json:"timeline"`
}
@@ -116,7 +116,7 @@ func (c *Client) FetchTheme(ctx context.Context, theme string) ([]ThemeBucket, e
out = append(out, ThemeBucket{
Theme: theme,
Time: ts.UTC(),
- Count: d.Value,
+ Count: int(d.Value),
})
}
return out, nil