npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@terra-oracle/terra-oracle

v1.1.18

Published

A stateless NPM package for hyper-local, crop-specific climate analysis using satellite weather data and biological thermal thresholds.

Readme

@terra-oracle/terra-oracle

A stateless NPM package for hyper-local climate analysis for Plants and Animals using real-time satellite weather data, historical archives, and 7-day thermal forecasts.

Part of the Agri-Oracle: Decentralized Climate Adaptation Protocol.


What It Does

  1. Dual-Category Analysis: Specialized thermal analysis for both Plants (Crops) and Animals (Livestock/Poultry).
  2. Auto-Location: Resolves position using a GPS-first hybrid strategy (Browser GPS → Reverse Geocoding → IP Fallback).
  3. Heatwave Forecasting: Provides 7-day thermal forecasts (Max/Min Temps + Humidity) to predict heatwaves.
  4. Historical Comparison: Fetches seasonal averages (Q1-Q4) and comparison data from previous years.
  5. AI-Ready: Generates a structured Fact Sheet JSON optimized for interpretation by Generative AI (like Google Gemini).

⚠️ Security First: This package does NOT accept or use an AI API key. The key must live securely in your frontend application.


Installation

npm install @terra-oracle/terra-oracle

Basic Usage

The package automatically detects whether you are analyzing a plant or an animal.

1. Plant Analysis (Default)

import { analyzeField } from '@terra-oracle/terra-oracle';

const factSheet = await analyzeField({
  subject: 'Oil Palm',
  category: 'PLANT' 
});

2. Animal Analysis (Heatwave Focus)

For animals, the SDK automatically includes humidity and a 7-day forecast to help detect heat stress.

const factSheet = await analyzeField({
  subject: 'Broiler Chicken',
  category: 'ANIMAL' 
});

Extended Data Configuration

You can configure the depth of analysis using the config object:

const factSheet = await analyzeField({
  subject: 'Cassava',
  config: {
    includeForecast: true,   // 7-day thermal trend
    includeSeasonal: true,   // Q1-Q4 averages for the previous year
    includeHistory: true,    // Comparison with the same month in past 3 years
    includeProjections: true // Future climate estimates (1-5 years)
  }
});

Precision Mode (Manual Coordinates)

If your app already has GPS coordinates (e.g. from a mobile GPS or map pin), you can skip auto-detection:

const factSheet = await analyzeField({
  subject: 'Maize',
  manualCoords: { lat: 6.5244, lon: 3.3792 }
});

Integration with Gemini AI

Use the "Fact Sheet" to get expert climate advice:

import { analyzeField } from '@terra-oracle/terra-oracle';
import { GoogleGenerativeAI } from '@google/generative-ai';

async function getClimateAdvice(subject: string, type: 'PLANT' | 'ANIMAL') {
  // 1. Get the Data Layer Fact Sheet
  const factSheet = await analyzeField({ 
    subject, 
    category: type 
  });

  // 2. Initialize Gemini
  const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
  const model = genAI.getGenerativeModel({ model: 'gemini-1.5-flash' });

  const prompt = `
    You are an expert ${type === 'PLANT' ? 'agronomist' : 'veterinarian'}. 
    FIELD CONDITIONS: ${JSON.stringify(factSheet)}
    Provide immediate actions to mitigate thermal stress for ${subject}.
  `;

  const result = await model.generateContent(prompt);
  return result.response.text();
}

Output Format (Animal Example)

{
  "subject_name": "Poultry",
  "subject_category": "ANIMAL",
  "environmental_snapshot": {
    "location": "Cotonou, Benin",
    "city": "Cotonou",
    "country": "Benin",
    "latitude": 6.3654,
    "longitude": 2.4183,
    "temp_c": 32.5,
    "humidity": 78,
    "source": "Open-Meteo Satellite",
    "timestamp": "2026-04-18T12:00:00Z",
    "forecast": {
      "days": ["2026-04-18", ...],
      "max_temps": [34.2, 35.5, ...],
      "min_temps": [24.1, 25.0, ...],
      "avg_humidity": [75, 80, ...]
    }
  },
  "alerts": [
    {
      "type": "HEAT_WAVE_MODERATE",
      "level": "WARNING",
      "message": "ORACLE MODERATE: High heat detected at 32.5°C."
    }
  ]
}

Geolocation Strategy

The package uses a robust three-tier system:

  1. Manual: Priority coordinates provided by the caller.
  2. GPS + Reverse Geocode: High-precision navigator.geolocation paired with BigDataCloud for accurate city/country names (avoids IP routing errors).
  3. IP Geolocation: Reliable fallback via ipapi.co.

License

MIT