Skip to content

Commit fccc02c

Browse files
committed
drop wetlands
1 parent 7b12f54 commit fccc02c

File tree

4 files changed

+360
-1232
lines changed

4 files changed

+360
-1232
lines changed

app/chat.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Wetlands Data Chatbot
2-
// Uses an OpenAI-compatible LLM with MCP server access for querying wetlands data
1+
// Biodiversity Data Chatbot
2+
// Uses an OpenAI-compatible LLM with MCP server access for querying biodiversity data
33
//
44
// Debugging & Error Handling:
55
// - Enhanced logging for MCP query results and empty responses
@@ -15,7 +15,7 @@ import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
1515
import { layerRegistry } from './layer-registry.js';
1616
import { MCPToolFactory } from './mcp-tool-factory.js';
1717

18-
class WetlandsChatbot {
18+
class BiodiversityChatbot {
1919
constructor(config) {
2020
this.config = config;
2121
this.mcpServerUrl = config.mcp_server_url;
@@ -117,7 +117,7 @@ class WetlandsChatbot {
117117
console.log('✓ System prompt loaded');
118118
} catch (error) {
119119
console.error('Failed to load system prompt:', error);
120-
this.systemPrompt = 'You are a helpful assistant for wetlands data analysis.';
120+
this.systemPrompt = 'You are a helpful assistant for biodiversity data analysis.';
121121
}
122122
}
123123

@@ -130,7 +130,7 @@ class WetlandsChatbot {
130130

131131
// Create MCP client
132132
this.mcpClient = new Client({
133-
name: 'wetlands-chatbot',
133+
name: 'biodiversity-chatbot',
134134
version: '1.0.0'
135135
}, {
136136
capabilities: {}
@@ -242,12 +242,12 @@ class WetlandsChatbot {
242242

243243
container.innerHTML = `
244244
<div id="chat-header">
245-
<h3>🦆 Wetlands Data Assistant</h3>
245+
<h3>🌍 Biodiversity Data Assistant</h3>
246246
<button id="chat-toggle">−</button>
247247
</div>
248248
<div id="chat-messages"></div>
249249
<div id="chat-input-container">
250-
<input type="text" id="chat-input" placeholder="Ask about wetlands data..." />
250+
<input type="text" id="chat-input" placeholder="Ask about biodiversity data..." />
251251
<button id="chat-send">Send</button>
252252
</div>
253253
<div id="chat-footer">
@@ -275,11 +275,11 @@ class WetlandsChatbot {
275275
// Welcome message
276276
this.addMessage(
277277
'assistant',
278-
'Hi! I can help you explore global wetlands data and control the map. Try asking:\n\n' +
279-
'* "How many hectares of peatlands are there?"\n' +
280-
'* "Calculate vulnerable carbon stored in different wetlands of India?"\n' +
278+
'Hi! I can help you explore global biodiversity data and control the map. Try asking:\n\n' +
279+
'* "How much protected area is in India?"\n' +
280+
'* "Calculate vulnerable carbon stored in IUCN category Ia areas"\n' +
281281
'* "Show state-owned protected areas colored by IUCN category"\n' +
282-
'* "Filter Ramsar sites to those meeting Criterion 1 and 2"'
282+
'* "Show only IUCN category II protected areas"'
283283
);
284284
}
285285

@@ -541,12 +541,12 @@ class WetlandsChatbot {
541541

542542
// Count queries
543543
if (lower.includes('count(')) {
544-
if (lower.includes('ramsar')) return 'Counting Ramsar wetland sites';
544+
if (lower.includes('species')) return 'Analyzing species data';
545545
if (lower.includes('wdpa')) return 'Counting protected areas';
546546
if (lower.includes('peatland') || (lower.includes('z between') && lower.includes('22'))) {
547547
return 'Calculating total peatland area';
548548
}
549-
if (lower.includes('wetland')) return 'Counting wetlands by type';
549+
if (lower.includes('protected')) return 'Counting protected areas';
550550
return 'Counting matching records';
551551
}
552552

@@ -562,10 +562,9 @@ class WetlandsChatbot {
562562

563563
// Geographic filters
564564
let desc = 'Querying ';
565-
if (lower.includes('ramsar')) desc += 'Ramsar sites';
566-
else if (lower.includes('wdpa')) desc += 'protected areas';
567-
else if (lower.includes('hydrobasin')) desc += 'watershed data';
568-
else if (lower.includes('wetland')) desc += 'wetlands';
565+
if (lower.includes('protected')) desc += 'protected areas';
566+
else if (lower.includes('wdpa')) desc += 'WDPA sites';
567+
else if (lower.includes('area')) desc += 'areas';
569568
else desc += 'data';
570569

571570
// Add geographic context
@@ -1127,8 +1126,8 @@ function initializeChatbot() {
11271126
.then(response => response.json())
11281127
.then(config => {
11291128
console.log('Config loaded successfully');
1130-
chatbot = new WetlandsChatbot(config);
1131-
console.log('Wetlands chatbot initialized');
1129+
chatbot = new BiodiversityChatbot(config);
1130+
console.log('Biodiversity chatbot initialized');
11321131

11331132
// Clean up on page unload
11341133
window.addEventListener('beforeunload', () => {

app/index.html

Lines changed: 3 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<title>Wetlands Map</title>
7+
<title>Biodiversity Map</title>
88

99
<!-- Import map for MCP SDK -->
1010
<script type="importmap">
@@ -33,116 +33,18 @@
3333
<div class="menu-section">
3434
<label class="section-title">Overlays</label>
3535
<div class="checkbox-group">
36-
<label>
37-
<input id="wetlands-layer" type="checkbox" name="rtoggle" value="wetlands" checked="checked">
38-
<span>Global Wetlands</span>
39-
</label>
40-
<label>
41-
<input id="ncp-layer" type="checkbox" name="rtoggle" value="ncp">
42-
<span>Nature's Contributions</span>
43-
</label>
4436
<label>
4537
<input id="carbon-layer" type="checkbox" name="rtoggle" value="carbon">
4638
<span>Vulnerable Carbon</span>
4739
</label>
4840
<label>
49-
<input id="ramsar-layer" type="checkbox" name="rtoggle" value="ramsar">
50-
<span>Ramsar Sites</span>
41+
<input id="ncp-layer" type="checkbox" name="rtoggle" value="ncp">
42+
<span>Nature's Contributions</span>
5143
</label>
5244
<label>
5345
<input id="wdpa-layer" type="checkbox" name="rtoggle" value="wdpa">
5446
<span>Protected Areas (WDPA)</span>
5547
</label>
56-
<label>
57-
<input id="hydrobasins-layer" type="checkbox" name="rtoggle" value="hydrobasins">
58-
<span>Watersheds (HydroBASINS L6)</span>
59-
</label>
60-
</div>
61-
</div>
62-
</div>
63-
64-
<div id="legend">
65-
<div id="legend-header">
66-
<h3>GLWD Wetland Classes</h3>
67-
<button id="legend-toggle"></button>
68-
</div>
69-
<div id="legend-content">
70-
<div class="legend-section">
71-
<h4>Open Water</h4>
72-
<div class="legend-item"><span style="background: rgb(0, 112, 255)"></span>Freshwater lake</div>
73-
<div class="legend-item"><span style="background: rgb(0, 197, 255)"></span>Saline lake</div>
74-
<div class="legend-item"><span style="background: rgb(0, 92, 230)"></span>Reservoir</div>
75-
<div class="legend-item"><span style="background: rgb(0, 38, 115)"></span>Large river</div>
76-
<div class="legend-item"><span style="background: rgb(83, 115, 115)"></span>Large estuarine river</div>
77-
<div class="legend-item"><span style="background: rgb(156, 156, 156)"></span>Other permanent waterbody
78-
</div>
79-
<div class="legend-item"><span style="background: rgb(115, 178, 255)"></span>Small streams</div>
80-
</div>
81-
82-
<div class="legend-section">
83-
<h4>Lacustrine Wetlands</h4>
84-
<div class="legend-item"><span style="background: rgb(38, 115, 0)"></span>Lacustrine, forested</div>
85-
<div class="legend-item"><span style="background: rgb(163, 255, 115)"></span>Lacustrine, non-forested
86-
</div>
87-
</div>
88-
89-
<div class="legend-section">
90-
<h4>Riverine Wetlands</h4>
91-
<div class="legend-item"><span style="background: rgb(0, 168, 132)"></span>Regularly flooded, forested
92-
</div>
93-
<div class="legend-item"><span style="background: rgb(163, 255, 184)"></span>Regularly flooded,
94-
non-forested</div>
95-
<div class="legend-item"><span style="background: rgb(76, 115, 0)"></span>Seasonally flooded, forested
96-
</div>
97-
<div class="legend-item"><span style="background: rgb(204, 242, 77)"></span>Seasonally flooded,
98-
non-forested</div>
99-
<div class="legend-item"><span style="background: rgb(0, 100, 0)"></span>Seasonally saturated, forested
100-
</div>
101-
<div class="legend-item"><span style="background: rgb(178, 178, 178)"></span>Seasonally saturated,
102-
non-forested</div>
103-
</div>
104-
105-
<div class="legend-section">
106-
<h4>Palustrine Wetlands</h4>
107-
<div class="legend-item"><span style="background: rgb(115, 76, 0)"></span>Regularly flooded, forested
108-
</div>
109-
<div class="legend-item"><span style="background: rgb(230, 152, 0)"></span>Regularly flooded,
110-
non-forested</div>
111-
<div class="legend-item"><span style="background: rgb(115, 115, 0)"></span>Seasonally saturated,
112-
forested</div>
113-
<div class="legend-item"><span style="background: rgb(255, 235, 175)"></span>Seasonally saturated,
114-
non-forested</div>
115-
</div>
116-
117-
<div class="legend-section">
118-
<h4>Ephemeral Wetlands</h4>
119-
<div class="legend-item"><span style="background: rgb(168, 112, 0)"></span>Ephemeral, forested</div>
120-
<div class="legend-item"><span style="background: rgb(255, 170, 0)"></span>Ephemeral, non-forested</div>
121-
</div>
122-
123-
<div class="legend-section">
124-
<h4>Peatlands</h4>
125-
<div class="legend-item"><span style="background: rgb(158, 187, 215)"></span>Arctic/boreal, forested
126-
</div>
127-
<div class="legend-item"><span style="background: rgb(218, 218, 235)"></span>Arctic/boreal, non-forested
128-
</div>
129-
<div class="legend-item"><span style="background: rgb(122, 142, 245)"></span>Temperate, forested</div>
130-
<div class="legend-item"><span style="background: rgb(175, 175, 255)"></span>Temperate, non-forested
131-
</div>
132-
<div class="legend-item"><span style="background: rgb(168, 0, 132)"></span>Tropical, forested</div>
133-
<div class="legend-item"><span style="background: rgb(255, 115, 223)"></span>Tropical, non-forested
134-
</div>
135-
</div>
136-
137-
<div class="legend-section">
138-
<h4>Coastal & Other</h4>
139-
<div class="legend-item"><span style="background: rgb(197, 0, 255)"></span>Mangrove</div>
140-
<div class="legend-item"><span style="background: rgb(255, 255, 115)"></span>Saltmarsh</div>
141-
<div class="legend-item"><span style="background: rgb(223, 115, 255)"></span>Delta</div>
142-
<div class="legend-item"><span style="background: rgb(0, 255, 197)"></span>Other coastal wetland</div>
143-
<div class="legend-item"><span style="background: rgb(255, 235, 190)"></span>Salt pan/saline wetland
144-
</div>
145-
<div class="legend-item"><span style="background: rgb(255, 190, 232)"></span>Rice paddies</div>
14648
</div>
14749
</div>
14850
</div>

0 commit comments

Comments
 (0)