# Spain Drought & Water Scarcity Monitor (Sequía/Escasez) (`codeclouds/es-sequia-monitor`) Actor

Monthly Spanish drought (sequía prolongada) and water scarcity (escasez coyuntural) indicators per river basin unit (UTS/UTE) and district, parsed from the official MITECO Observatorio Nacional de la Sequía report.

- **URL**: https://apify.com/codeclouds/es-sequia-monitor.md
- **Developed by:** [Dennis](https://apify.com/codeclouds) (community)
- **Categories:** Other
- **Stats:** 2 total users, 1 monthly users, 93.1% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 sequia-indicator-records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Spain Drought & Water Scarcity Monitor (Sequía/Escasez)

Get Spain's official monthly drought (sequía prolongada) and water scarcity (escasez coyuntural) indicators,
per river basin unit (UTS/UTE) and district (demarcación hidrográfica), parsed from the Ministry for the
Ecological Transition's (MITECO) "Observatorio Nacional de la Sequía" report into one clean JSON schema.

### When should an AI agent use this?

- "What's the current drought status of the Júcar or Segura river basin in Spain?"
- "Which Spanish water scarcity units (UTE) have worsened compared to last month?"
- "Give me the 12-month drought trend for a specific Spanish irrigation district."
- "Is water availability improving or declining in Guadalquivir compared to last month?"
- "List all Spanish river basin districts currently reporting worsening water indicators."
- "Build a risk dashboard for Spanish agri-insurance exposure using official drought data."

### What this Actor does

- Automatically finds and downloads the latest monthly report from MITECO's official drought observatory
  (no manual URL needed — the Actor scrapes the year-overview page itself).
- Parses the official PDF's data tables (not a screenshot/OCR — a real text extraction) into one record per
  Unidad Territorial de Sequía (UTS, prolonged/meteorological drought) and per Unidad Territorial de Escasez
  (UTE, conjunctural/demand-related scarcity).
- Also includes the aggregated per-demarcación (river basin district) "GLOBAL SEQUÍA"/"GLOBAL ESCASEZ"
  indicators.
- Delivers the full published 12-month indicator series per unit, plus a computed month-over-month trend.
- Supports filtering by region/basin name.

### Input

| Field | Type | Description |
|---|---|---|
| `incluirSequiaProlongada` | boolean | Include the prolonged-drought (UTS) indicator. Default `true`. |
| `incluirEscasezCoyuntural` | boolean | Include the conjunctural-scarcity (UTE) indicator. Default `true`. |
| `incluirIndicadoresGlobales` | boolean | Include the per-basin aggregated GLOBAL SEQUÍA/ESCASEZ indicators. Default `true`. |
| `regionFilter` | string\[] | Only return records whose basin district or unit name contains one of these terms (case-insensitive), e.g. `["jucar", "segura"]`. Default: none (all of Spain). |
| `maxResults` | integer | Maximum number of records to return (1-3000). Default `1000`. |
| `reportUrl` | string | Advanced: process a specific historical report PDF instead of the latest one. |

### Output

One flat JSON record per UTS/UTE or per-basin global indicator:

```json
{
  "land": "ES",
  "tipo": "escasez_coyuntural",
  "demarcacion": "Júcar",
  "cod": "080.12",
  "unidad": "Marina Baja",
  "indicadorActual": 0.42,
  "mesActual": "2026-05",
  "indicadorMesAnterior": 0.47,
  "tendencia": "empeoramiento",
  "serie12Meses": {
    "2025-06": 0.61,
    "2026-05": 0.42
  },
  "bronDatum": "2026-05",
  "bronUrl": "https://www.miteco.gob.es/.../Informe_SE_jun_2026.pdf",
  "datumOpgehaald": "2026-07-18T12:00:00.000Z"
}
```

`indicadorActual`/`serie12Meses` are the official 0-1 indicator values as published (higher = wetter/more
favorable, lower = drier/more stressed). `tendencia` (`mejora`/`empeoramiento`/`estable` — in Spanish, since
that's the language of this Actor's audience) is calculated by comparing the two most recent published
months.

### Use cases

- Agricultural credit/insurance risk screening for farms in specific Spanish irrigation districts.
- Water infrastructure investment due diligence (desalination, reuse) by basin.
- Portfolio-level water risk monitoring across multiple Spanish regions.
- Feeding a scheduled monitoring pipeline that alerts on worsening drought trends.

### Pricing

This Actor uses Apify's Pay-Per-Event (PPE) pricing model.

- **Actor Start:** $0.00005 (Apify default)
- **`sequia-indicator-record`:** $0.004 per delivered UTS/UTE/global indicator record
- **`alerta-empeoramiento`:** $0.015 per record whose indicator meaningfully worsened vs. the previous
  published month

### Legal

Data sourced exclusively from official Spanish government publications (Ministerio para la Transición
Ecológica y el Reto Demográfico / MITECO). No personal data is processed. **Important disclaimer**: this
Actor delivers the raw official 0-1 drought/scarcity indicator and a computed trend — it does **not**
produce an official Normalidad/Prealerta/Alerta/Emergencia scenario classification, since the exact
thresholds for that classification are defined per individual river basin's own Plan Especial de Sequía and
are not published as a reusable table in the source report. Do not treat this data as a substitute for the
official basin authority's own scenario declarations.

### FAQ

**Q: Does this include reservoir (embalses) fill levels?**
A: Not currently — the monthly report embeds reservoir charts as images (not text), which would require a
separate data source. This may be added in a future version.

**Q: How often is the source updated?**
A: MITECO publishes this report monthly (roughly one month behind, e.g. a report published in June covers
May-end data).

**Q: What happens if a report contains an unusual row (e.g. a water-transfer status instead of a numeric
indicator)?**
A: Such rows are skipped with a logged warning rather than silently producing incorrect data — see the
Actor's run log.

**Q: Why is the `tendencia` field in Spanish rather than English?**
A: The people who actually read this data — Spanish farmers, insurers, and water authorities — read
Spanish. Values are kept in Spanish rather than translated into a language they'd have to translate back.

***

*Palabras clave: sequía España, escasez de agua, MITECO, Observatorio Nacional de la Sequía, indicador de
sequía, cuenca hidrográfica, demarcación hidrográfica, restricciones de riego, embalses España.*

### Keywords

spain, drought, water-scarcity, sequia, escasez, miteco, river-basin, agriculture-risk, insurance-risk,
climate-risk, water-data, open-data

### Changelog

#### 0.3.0

- Rewrote the Store description/short description (task-first sentence, explicit synonyms, a decision-
  benefit sentence and a price indication) as part of the agent-readiness pass — no change to parsing
  logic or output fields. See `docs/globale-ideeen/agent-readiness-checklist.md`.

#### 0.2.0

- Changed `tendencia` field values from Dutch to Spanish (`mejora`/`empeoramiento`/`estable`) and renamed
  `serie12Maanden` to `serie12Meses` — this Actor's audience reads Spanish, not Dutch. Renamed the
  `verslechtering-signaal` event to `alerta-empeoramiento`.

#### 0.1.0

- Initial release: sequía prolongada + escasez coyuntural indicators per UTS/UTE and per-basin globals,
  parsed from the latest monthly MITECO Observatorio report.

# Actor input Schema

## `incluirSequiaProlongada` (type: `boolean`):

Include the 'sequía prolongada' indicator per Unidad Territorial de Sequía (UTS) — the natural, non-demand-driven drought index.

## `incluirEscasezCoyuntural` (type: `boolean`):

Include the 'escasez coyuntural' indicator per Unidad Territorial de Escasez (UTE) — the demand-related water scarcity index (storage, groundwater, flow gauges).

## `incluirIndicadoresGlobales` (type: `boolean`):

Include the aggregated 'GLOBAL SEQUÍA'/'GLOBAL ESCASEZ' indicator per demarcación hidrográfica (river basin district), in addition to the individual UTS/UTE records.

## `regionFilter` (type: `array`):

Only return records whose demarcación (river basin district) or unidad (UTS/UTE) name contains one of these terms (case-insensitive), e.g. \["jucar", "segura"]. Leave empty for all of Spain.

## `maxResults` (type: `integer`):

Maximum number of records to return (1-3000). The full report typically yields ~270-280 records across all demarcaciones.

## `reportUrl` (type: `string`):

Advanced/testing use: process a specific historical monthly report PDF instead of automatically fetching the latest one from MITECO's yearly overview page. Leave empty for normal use.

## Actor input object example

```json
{
  "incluirSequiaProlongada": true,
  "incluirEscasezCoyuntural": true,
  "incluirIndicadoresGlobales": true,
  "regionFilter": [],
  "maxResults": 1000
}
```

# Actor output Schema

## `results` (type: `string`):

Alle indicatoren in het default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("codeclouds/es-sequia-monitor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("codeclouds/es-sequia-monitor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call codeclouds/es-sequia-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,codeclouds/es-sequia-monitor"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/B1AMC8k79Bphw7Ldu/builds/1ZR73fj0ucfNegFQV/openapi.json
