Schedule icon
Download icon
Query icon
If icon
Log icon
IonToCsv icon

Daily USGS earthquake digest with a magnitude 6 check

Pull the public USGS earthquake feed, list magnitude 4.5+ events in DuckDB, and log when any event reaches magnitude 6. No API key.

Categories
Data

A morning check for anyone who wants the last day of notable earthquakes without signing up for a feed. This blueprint downloads the public USGS GeoJSON API, uses DuckDB to turn each feature into a row, writes a CSV, and logs a different line when the strongest event is magnitude 6 or higher.

How it works

  1. A io.kestra.plugin.core.trigger.Schedule trigger runs every day at 08:00 UTC (cron: "0 8 * * *").
  2. download_quakes (io.kestra.plugin.core.http.Download) fetches events with minmagnitude=4.5 since yesterday from earthquake.usgs.gov. The feed is public and needs no key.
  3. list_events (io.kestra.plugin.jdbc.duckdb.Query) reads that file with read_json_auto and UNNESTs features. Each row has magnitude, place, time, title, and the USGS event URL. fetchType: STORE keeps the full list.
  4. strongest runs a second DuckDB query with fetchType: FETCH_ONE and returns quake_count and max_magnitude.
  5. flag_strong (io.kestra.plugin.core.flow.If) logs a strong-earthquake line when max_magnitude >= 6, and a quiet-day line otherwise.
  6. to_csv (io.kestra.plugin.serdes.csv.IonToCsv) converts the stored list into a CSV on the execution.

What you get

  • A CSV of the last day's magnitude 4.5+ earthquakes, strongest first.
  • A log line that says whether anything reached magnitude 6.
  • No account, no secret, and no database server. DuckDB runs in the task.

Who it's for

  • People who want a small, real feed in a flow they can re-run.
  • Anyone extending this into mail, Slack, or a warehouse later.

Why orchestrate this with Kestra

The USGS API is a request/response endpoint. It does not run tomorrow on its own, and it does not branch when a large event shows up. Kestra supplies the daily schedule, the download, the SQL, the magnitude check, and the CSV in one flow, with the execution history kept for each morning.

Prerequisites

  • A Kestra instance with the DuckDB and Serdes plugins available.
  • Outbound access to earthquake.usgs.gov.

Secrets

None. The USGS feed is public. DuckDB does not need a connection string.

Quick start

  1. Import this flow.
  2. Run it once from the UI. The schedule will also fire at 08:00 UTC.
  3. Open to_csv and download the CSV. Read log_strong or log_quiet for the magnitude 6 check.

How to extend

  • Change minmagnitude in the URL, or the >= 6 condition, to match what you care about.
  • Add a Slack or email task on the then branch.
  • Point starttime at a longer window if a daily file is too small.
  • Disable the schedule if you only want manual runs.

Links

Orchestrate with Kestra
Orchestrate DuckDB with Kestra
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.