π Analyze Seoul air pollution with MotherDuck and Ollama Qwen2.5
β‘ 4 views Β· π Market Research & Insights
Description
Quick overview
This workflow exposes a webhook that queries PM10 air pollution data from a MotherDuck database, sends the results to a local Ollama (qwen2.5:3b) model for analysis, and returns an HTML report showing the top polluted Seoul districts and the AI-generated findings.
How it works
- Receives a request on a webhook endpoint.
- Queries MotherDuck via its MCP API to calculate the top 10 Seoul monitoring districts by average PM10, including maximum PM10 values.
- Sends the summarized PM10 results to a local Ollama
/api/generateendpoint to produce a four-sentence air-quality analysis against the WHO PM10 guideline (50 ΞΌg/mΒ³). - Extracts the modelβs response text and injects it into a preformatted HTML page.
- Returns the HTML report to the webhook caller as the HTTP response.
Setup
- Create a MotherDuck API bearer token in n8n and ensure the
air_pollutiondatabase and referenced tables/columns exist for the provided SQL query. - Run Ollama where n8n can reach
http://ollama:11434and pull theqwen2.5:3bmodel (or update the model name and URL in the request). - Copy the webhook URL from n8n and call the
/air-qualityendpoint from your browser or monitoring system to render the report.
π Nodes Used
HTTP Request, Webhook
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File