# 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, 100.0% 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use 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.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
}
```

# 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("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=codeclouds/es-sequia-monitor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Spain Drought & Water Scarcity Monitor (Sequía/Escasez)",
        "description": "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.",
        "version": "0.2",
        "x-build-id": "Wb9McxeFOAcauhp8E"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/codeclouds~es-sequia-monitor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-codeclouds-es-sequia-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/codeclouds~es-sequia-monitor/runs": {
            "post": {
                "operationId": "runs-sync-codeclouds-es-sequia-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/codeclouds~es-sequia-monitor/run-sync": {
            "post": {
                "operationId": "run-sync-codeclouds-es-sequia-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "incluirSequiaProlongada": {
                        "title": "Include Sequía Prolongada (prolonged drought)",
                        "type": "boolean",
                        "description": "Include the 'sequía prolongada' indicator per Unidad Territorial de Sequía (UTS) — the natural, non-demand-driven drought index.",
                        "default": true
                    },
                    "incluirEscasezCoyuntural": {
                        "title": "Include Escasez Coyuntural (conjunctural scarcity)",
                        "type": "boolean",
                        "description": "Include the 'escasez coyuntural' indicator per Unidad Territorial de Escasez (UTE) — the demand-related water scarcity index (storage, groundwater, flow gauges).",
                        "default": true
                    },
                    "incluirIndicadoresGlobales": {
                        "title": "Include per-basin global indicators",
                        "type": "boolean",
                        "description": "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.",
                        "default": true
                    },
                    "regionFilter": {
                        "title": "Region filter",
                        "type": "array",
                        "description": "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.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 3000,
                        "type": "integer",
                        "description": "Maximum number of records to return (1-3000). The full report typically yields ~270-280 records across all demarcaciones.",
                        "default": 1000
                    },
                    "reportUrl": {
                        "title": "Specific report URL (advanced)",
                        "type": "string",
                        "description": "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."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
