Skip to content

tee8z/noaa-oracle

Repository files navigation

NOAA Oracle

A data pipeline system that fetches weather data from NOAA and serves it via a REST API with DLC (Discreet Log Contract) attestation support.

  • Live site: 4casttruth.win
  • Feel free to pull the parquet files and use in your own data analysis

Architecture

[NOAA API] <- [daemon] -> parquet files -> [oracle] <- parquet files <- [browser DuckDB]

Components:

  • daemon - Background process that pulls data from NOAA, transforms it into parquet files, and pushes to the oracle
  • oracle - REST API that stores parquet files, serves them via browser UI, and provides DLC attestation
  • ui - Browser interface using DuckDB-WASM for client-side querying of parquet files
  • core - Shared library for configuration loading and utilities

Quick Start

Using Nix (Recommended)

# Enter development shell
nix develop

# Build both binaries
cargo build --workspace

# Or use just commands
just build

Running the Services

# Run daemon (fetches NOAA data)
just run-daemon

# Run oracle (serves data and API)
just run-oracle

# Run oracle with pre-existing weather data
just run-oracle-standalone /path/to/weather/data

Configuration

Configuration follows XDG Base Directory Specification. Files are searched in order:

  1. Environment variable (ORACLE_CONFIG / DAEMON_CONFIG)
  2. Current directory (./oracle.toml / ./daemon.toml)
  3. XDG config (~/.config/noaa-oracle/oracle.toml)
  4. System config (/etc/noaa-oracle/oracle.toml)

Example configurations are in the config/ directory:

  • config/oracle.example.toml
  • config/daemon.example.toml

Oracle Configuration

[oracle]
host = "127.0.0.1"
port = "9800"
log_level = "info"

# Path to weather data (parquet files)
weather_dir = "/var/lib/noaa-oracle/weather"

# Path to UI files
ui_path = "/var/lib/noaa-oracle/ui"

# Oracle private key for DLC attestation
oracle_private_key = "/etc/noaa-oracle/oracle.pem"

Daemon Configuration

[daemon]
log_level = "info"

# Where to store downloaded parquet files
data_path = "/var/lib/noaa-oracle/data"

# Oracle endpoint to push files to
oracle_url = "http://localhost:9800"

# Fetch interval in seconds (default: 3600 = 1 hour)
fetch_interval = 3600

NixOS Deployment

Add to your NixOS configuration:

{
  inputs.noaa-oracle.url = "github:tee8z/noaa-oracle";

  outputs = { self, nixpkgs, noaa-oracle, ... }: {
    nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
      modules = [
        noaa-oracle.nixosModules.default
        {
          services.noaa-oracle = {
            enable = true;
            oracle = {
              enable = true;
              host = "0.0.0.0";
              port = 9800;
            };
            daemon = {
              enable = true;
              fetchInterval = 3600;
            };
          };
        }
      ];
    };
  };
}

Development

# Enter dev shell
nix develop

# Format code
just fmt

# Run clippy
just clippy

# Run tests
just test

# Build release
just release

Data Sources

Data is updated hourly by NOAA; the daemon respects this by fetching once per hour.

Why This Architecture?

  • No remote database needed - just a file server, cheap to run
  • Client-side querying via DuckDB-WASM for flexible analysis
  • Simple, decoupled components that scale independently
  • Immutable data model (snapshots over time)

License

MIT

About

NOAA data oracle, queryable from the browser and can attest to events for a Bitcoin DLC in dlctix style

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published