awesome-python/farm-aggregator/README.md
Claude db1ba75274
feat(farm-aggregator): standalone farm data aggregator service
Node.js service for the farm server that replaces the Chrome extension concept.
Pulls from AG-Refine REST API and Dropbox (DairyComp/FeedLync logs), synthesises
with Claude Haiku on a cron schedule, pushes summaries back to Dropbox and WhatsApp.

- Hourly pulse, daily digest (Haiku), weekly summary (Sonnet)
- TomTom geofence webhook receiver — entry/exit events → WhatsApp + Dropbox log
- WhatsApp Business API send (gracefully disabled if no credentials)
- Express HTTP server with /health, /status, manual /run/* trigger endpoints
- Windows start.bat for farm server deployment
- .env.example documents all credentials (none committed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KBD2dN2KEjzz3UQFa9hEpu
2026-06-28 03:51:49 +00:00

2.3 KiB

Farm Aggregator

A lightweight Node.js service that runs on the farm server. It pulls data from AG-Refine and Dropbox, synthesises it with Claude Haiku, and pushes summaries back to Dropbox and WhatsApp on a schedule.

Data flow

AG-Refine (Render) ─┐
DairyComp logs     ──┤  Dropbox  ──→  farm-aggregator  ──→  Haiku  ──→  Dropbox /Summaries
FeedLync files     ──┘                      │                              WhatsApp
                                            │
TomTom geofence webhooks  ────────────────→─┘

Setup

1. Install Node.js 20+

Download from https://nodejs.org/

2. Clone the repo and install dependencies

cd farm-aggregator
npm install

3. Create your .env file

copy .env.example .env
notepad .env

Fill in:

  • ANTHROPIC_API_KEY — your Anthropic key
  • DROPBOX_* — see Dropbox section below
  • WHATSAPP_* — optional, leave blank to skip

4. Dropbox OAuth setup

  1. Go to https://www.dropbox.com/developers/apps and create an app
  2. Set permissions: files.content.read, files.content.write
  3. Generate an access token OR set up the refresh token flow
  4. Copy App Key, App Secret, and Refresh Token into .env

5. Start the service

start.bat

Or to run as a Windows service (stays running after logout):

npm install -g node-windows
node install-service.js

Schedules

Job Default What it does
Pulse Hourly Quick snapshot — tickets, lab flags, ops
Daily 06:00 Full daily digest pushed to Dropbox + WhatsApp
Weekly Mon 06:00 Weekly summary (Sonnet, deeper analysis)

Change schedules in .env using cron syntax.

TomTom geofencing

  1. In TomTom Geofencing API, create fences for each field boundary
  2. Set webhook URL to http://YOUR_SERVER_IP:3001/webhook/tomtom
  3. Entry/exit events are logged to Dropbox and sent to WhatsApp

Manual triggers (testing)

curl -X POST http://localhost:3001/run/pulse
curl -X POST http://localhost:3001/run/daily
curl -X POST http://localhost:3001/run/weekly

Planned integrations

  • iyohtah / nTELL AI — herd health data once API access is confirmed
  • Daitrix — AI camera feed events (scale automation, pen detection)
  • Oracle Cloud — heavy data processing offload