@aborruso/ckan-mcp-server 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/openspec/apply.md +23 -0
- package/.claude/commands/openspec/archive.md +27 -0
- package/.claude/commands/openspec/proposal.md +28 -0
- package/.claude/settings.local.json +31 -0
- package/.gemini/commands/openspec/apply.toml +21 -0
- package/.gemini/commands/openspec/archive.toml +25 -0
- package/.gemini/commands/openspec/proposal.toml +26 -0
- package/.mcp.json +12 -0
- package/.opencode/command/openspec-apply.md +24 -0
- package/.opencode/command/openspec-archive.md +27 -0
- package/.opencode/command/openspec-proposal.md +29 -0
- package/AGENTS.md +18 -0
- package/CLAUDE.md +320 -0
- package/EXAMPLES.md +707 -0
- package/LICENSE.txt +21 -0
- package/LOG.md +154 -0
- package/PRD.md +912 -0
- package/README.md +468 -0
- package/REFACTORING.md +237 -0
- package/dist/index.js +1277 -0
- package/openspec/AGENTS.md +456 -0
- package/openspec/changes/archive/2026-01-08-add-mcp-resources/design.md +115 -0
- package/openspec/changes/archive/2026-01-08-add-mcp-resources/proposal.md +52 -0
- package/openspec/changes/archive/2026-01-08-add-mcp-resources/specs/mcp-resources/spec.md +92 -0
- package/openspec/changes/archive/2026-01-08-add-mcp-resources/tasks.md +56 -0
- package/openspec/changes/archive/2026-01-08-expand-test-coverage-specs/design.md +355 -0
- package/openspec/changes/archive/2026-01-08-expand-test-coverage-specs/proposal.md +161 -0
- package/openspec/changes/archive/2026-01-08-expand-test-coverage-specs/tasks.md +162 -0
- package/openspec/changes/archive/2026-01-08-translate-project-to-english/proposal.md +115 -0
- package/openspec/changes/archive/2026-01-08-translate-project-to-english/specs/documentation-language/spec.md +32 -0
- package/openspec/changes/archive/2026-01-08-translate-project-to-english/tasks.md +115 -0
- package/openspec/changes/archive/add-automated-tests/design.md +324 -0
- package/openspec/changes/archive/add-automated-tests/proposal.md +167 -0
- package/openspec/changes/archive/add-automated-tests/specs/automated-testing/spec.md +143 -0
- package/openspec/changes/archive/add-automated-tests/tasks.md +132 -0
- package/openspec/project.md +113 -0
- package/openspec/specs/documentation-language/spec.md +32 -0
- package/openspec/specs/mcp-resources/spec.md +94 -0
- package/package.json +46 -0
- package/spunti.md +19 -0
- package/tasks/todo.md +124 -0
- package/test-urls.js +18 -0
- package/tmp/test-org-search.js +55 -0
package/EXAMPLES.md
ADDED
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
# CKAN MCP Query Examples
|
|
2
|
+
|
|
3
|
+
This file contains practical examples of using the CKAN MCP server.
|
|
4
|
+
|
|
5
|
+
## Connection Tests
|
|
6
|
+
|
|
7
|
+
### Verify server status
|
|
8
|
+
```typescript
|
|
9
|
+
ckan_status_show({
|
|
10
|
+
server_url: "https://demo.ckan.org"
|
|
11
|
+
})
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### List datasets
|
|
15
|
+
```typescript
|
|
16
|
+
ckan_package_search({
|
|
17
|
+
server_url: "https://demo.ckan.org",
|
|
18
|
+
q: "*:*",
|
|
19
|
+
rows: 10
|
|
20
|
+
})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Italy Examples - dati.gov.it
|
|
24
|
+
|
|
25
|
+
### Search recent datasets
|
|
26
|
+
```typescript
|
|
27
|
+
ckan_package_search({
|
|
28
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
29
|
+
q: "*:*",
|
|
30
|
+
sort: "metadata_modified desc",
|
|
31
|
+
rows: 20
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### COVID-19 datasets
|
|
36
|
+
```typescript
|
|
37
|
+
ckan_package_search({
|
|
38
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
39
|
+
q: "covid OR coronavirus",
|
|
40
|
+
rows: 20
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Regione Siciliana datasets
|
|
45
|
+
```typescript
|
|
46
|
+
ckan_package_search({
|
|
47
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
48
|
+
fq: "organization:regione-siciliana",
|
|
49
|
+
sort: "metadata_modified desc",
|
|
50
|
+
rows: 20
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Search organizations by name (simple method)
|
|
55
|
+
```typescript
|
|
56
|
+
// Find organizations containing "toscana" in the name
|
|
57
|
+
ckan_organization_search({
|
|
58
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
59
|
+
pattern: "toscana"
|
|
60
|
+
})
|
|
61
|
+
// → Restituisce: Regione Toscana (10988 dataset), Autorità Idrica Toscana (12 dataset)
|
|
62
|
+
|
|
63
|
+
// Other examples
|
|
64
|
+
ckan_organization_search({
|
|
65
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
66
|
+
pattern: "salute"
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
ckan_organization_search({
|
|
70
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
71
|
+
pattern: "comune"
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Search organizations with wildcard (advanced method)
|
|
76
|
+
```typescript
|
|
77
|
+
// Alternative method using package_search (more flexible but more complex)
|
|
78
|
+
ckan_package_search({
|
|
79
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
80
|
+
q: "organization:*salute*",
|
|
81
|
+
rows: 0,
|
|
82
|
+
facet_field: ["organization"],
|
|
83
|
+
facet_limit: 100
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Statistics by organization
|
|
88
|
+
```typescript
|
|
89
|
+
ckan_package_search({
|
|
90
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
91
|
+
facet_field: ["organization"],
|
|
92
|
+
facet_limit: 20,
|
|
93
|
+
rows: 0
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Statistics by resource format
|
|
98
|
+
```typescript
|
|
99
|
+
ckan_package_search({
|
|
100
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
101
|
+
facet_field: ["res_format"],
|
|
102
|
+
facet_limit: 50,
|
|
103
|
+
rows: 0
|
|
104
|
+
})
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### List organizations
|
|
108
|
+
```typescript
|
|
109
|
+
ckan_organization_list({
|
|
110
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
111
|
+
all_fields: true,
|
|
112
|
+
sort: "package_count desc",
|
|
113
|
+
limit: 20
|
|
114
|
+
})
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Specific organization details
|
|
118
|
+
```typescript
|
|
119
|
+
ckan_organization_show({
|
|
120
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
121
|
+
id: "regione-siciliana",
|
|
122
|
+
include_datasets: true
|
|
123
|
+
})
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### CSV format datasets
|
|
127
|
+
```typescript
|
|
128
|
+
ckan_package_search({
|
|
129
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
130
|
+
fq: "res_format:CSV",
|
|
131
|
+
rows: 20
|
|
132
|
+
})
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## USA Examples - data.gov
|
|
136
|
+
|
|
137
|
+
### Search government datasets
|
|
138
|
+
```typescript
|
|
139
|
+
ckan_package_search({
|
|
140
|
+
server_url: "https://catalog.data.gov",
|
|
141
|
+
q: "climate change",
|
|
142
|
+
rows: 20
|
|
143
|
+
})
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Datasets by tag
|
|
147
|
+
```typescript
|
|
148
|
+
ckan_package_search({
|
|
149
|
+
server_url: "https://catalog.data.gov",
|
|
150
|
+
q: "tags:health",
|
|
151
|
+
rows: 20
|
|
152
|
+
})
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## CKAN Demo Examples
|
|
156
|
+
|
|
157
|
+
### Explore demo.ckan.org
|
|
158
|
+
```typescript
|
|
159
|
+
ckan_status_show({
|
|
160
|
+
server_url: "https://demo.ckan.org"
|
|
161
|
+
})
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
ckan_organization_list({
|
|
166
|
+
server_url: "https://demo.ckan.org",
|
|
167
|
+
all_fields: true
|
|
168
|
+
})
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
ckan_package_search({
|
|
173
|
+
server_url: "https://demo.ckan.org",
|
|
174
|
+
q: "*:*",
|
|
175
|
+
facet_field: ["organization", "tags", "res_format"],
|
|
176
|
+
rows: 10
|
|
177
|
+
})
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## DataStore Queries
|
|
181
|
+
|
|
182
|
+
### Basic query on resource
|
|
183
|
+
```typescript
|
|
184
|
+
ckan_datastore_search({
|
|
185
|
+
server_url: "https://demo.ckan.org",
|
|
186
|
+
resource_id: "5b3cf3a8-9a58-45ee-8e1a-4d98b8320c9a",
|
|
187
|
+
limit: 100
|
|
188
|
+
})
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Query with filters
|
|
192
|
+
```typescript
|
|
193
|
+
ckan_datastore_search({
|
|
194
|
+
server_url: "https://demo.ckan.org",
|
|
195
|
+
resource_id: "5b3cf3a8-9a58-45ee-8e1a-4d98b8320c9a",
|
|
196
|
+
filters: {
|
|
197
|
+
"Country": "Italy"
|
|
198
|
+
},
|
|
199
|
+
limit: 50
|
|
200
|
+
})
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Query with sorting
|
|
204
|
+
```typescript
|
|
205
|
+
ckan_datastore_search({
|
|
206
|
+
server_url: "https://demo.ckan.org",
|
|
207
|
+
resource_id: "5b3cf3a8-9a58-45ee-8e1a-4d98b8320c9a",
|
|
208
|
+
sort: "Year desc",
|
|
209
|
+
limit: 100
|
|
210
|
+
})
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Advanced Solr Searches
|
|
214
|
+
|
|
215
|
+
### AND combination
|
|
216
|
+
```typescript
|
|
217
|
+
ckan_package_search({
|
|
218
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
219
|
+
q: "popolazione AND sicilia",
|
|
220
|
+
rows: 20
|
|
221
|
+
})
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### OR combination
|
|
225
|
+
```typescript
|
|
226
|
+
ckan_package_search({
|
|
227
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
228
|
+
q: "sanità OR salute OR health",
|
|
229
|
+
rows: 20
|
|
230
|
+
})
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### NOT exclusion
|
|
234
|
+
```typescript
|
|
235
|
+
ckan_package_search({
|
|
236
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
237
|
+
q: "dati NOT personali",
|
|
238
|
+
rows: 20
|
|
239
|
+
})
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Search by title
|
|
243
|
+
```typescript
|
|
244
|
+
ckan_package_search({
|
|
245
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
246
|
+
q: "title:popolazione",
|
|
247
|
+
rows: 20
|
|
248
|
+
})
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Search by description
|
|
252
|
+
```typescript
|
|
253
|
+
ckan_package_search({
|
|
254
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
255
|
+
q: "notes:istat",
|
|
256
|
+
rows: 20
|
|
257
|
+
})
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Wildcard
|
|
261
|
+
```typescript
|
|
262
|
+
ckan_package_search({
|
|
263
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
264
|
+
q: "popola*",
|
|
265
|
+
rows: 20
|
|
266
|
+
})
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Date range filter
|
|
270
|
+
```typescript
|
|
271
|
+
ckan_package_search({
|
|
272
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
273
|
+
fq: "metadata_modified:[2023-01-01T00:00:00Z TO 2023-12-31T23:59:59Z]",
|
|
274
|
+
rows: 20
|
|
275
|
+
})
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Datasets modified in last month
|
|
279
|
+
```typescript
|
|
280
|
+
ckan_package_search({
|
|
281
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
282
|
+
fq: "metadata_modified:[NOW-1MONTH TO NOW]",
|
|
283
|
+
sort: "metadata_modified desc",
|
|
284
|
+
rows: 20
|
|
285
|
+
})
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Advanced Solr Query Features
|
|
289
|
+
|
|
290
|
+
CKAN uses Apache Solr for search. The `q` parameter supports advanced Solr query syntax including fuzzy matching, proximity search, boosting, and complex boolean logic.
|
|
291
|
+
|
|
292
|
+
### Fuzzy Search
|
|
293
|
+
|
|
294
|
+
Find terms with similar spelling (edit distance matching). Useful for typos or variations.
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
// Find datasets with title similar to "environment" (e.g., "enviroment", "environnement")
|
|
298
|
+
ckan_package_search({
|
|
299
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
300
|
+
q: "title:environment~2",
|
|
301
|
+
rows: 20
|
|
302
|
+
})
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
// Fuzzy search on multiple fields
|
|
307
|
+
ckan_package_search({
|
|
308
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
309
|
+
q: "title:health~1 OR notes:sanità~1",
|
|
310
|
+
rows: 20
|
|
311
|
+
})
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Proximity Search
|
|
315
|
+
|
|
316
|
+
Find phrases where words appear within N positions of each other.
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
// Find "climate" and "change" within 5 words of each other in notes
|
|
320
|
+
ckan_package_search({
|
|
321
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
322
|
+
q: "notes:\"climate change\"~5",
|
|
323
|
+
rows: 20
|
|
324
|
+
})
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
```typescript
|
|
328
|
+
// Proximity search in title
|
|
329
|
+
ckan_package_search({
|
|
330
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
331
|
+
q: "title:\"open data\"~3",
|
|
332
|
+
rows: 20
|
|
333
|
+
})
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Boosting (Relevance Scoring)
|
|
337
|
+
|
|
338
|
+
Control which terms have more weight in scoring results.
|
|
339
|
+
|
|
340
|
+
```typescript
|
|
341
|
+
// Prioritize matches in title over notes
|
|
342
|
+
ckan_package_search({
|
|
343
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
344
|
+
q: "title:climate^2 OR notes:climate",
|
|
345
|
+
sort: "score desc",
|
|
346
|
+
rows: 20
|
|
347
|
+
})
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
// Complex boosting with multiple fields
|
|
352
|
+
ckan_package_search({
|
|
353
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
354
|
+
q: "title:water^3 OR notes:water^1.5 OR tags:water",
|
|
355
|
+
sort: "score desc",
|
|
356
|
+
rows: 20
|
|
357
|
+
})
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
```typescript
|
|
361
|
+
// Constant score boosting
|
|
362
|
+
ckan_package_search({
|
|
363
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
364
|
+
q: "title:environment^=2.0 OR notes:sustainability^=1.0",
|
|
365
|
+
rows: 20
|
|
366
|
+
})
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Field Existence Checks
|
|
370
|
+
|
|
371
|
+
Find datasets where specific fields exist or don't exist.
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
// Find datasets that have organization set
|
|
375
|
+
ckan_package_search({
|
|
376
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
377
|
+
q: "organization:*",
|
|
378
|
+
rows: 20
|
|
379
|
+
})
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
```typescript
|
|
383
|
+
// Find datasets with at least one resource
|
|
384
|
+
ckan_package_search({
|
|
385
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
386
|
+
q: "num_resources:[1 TO *]",
|
|
387
|
+
rows: 20
|
|
388
|
+
})
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
```typescript
|
|
392
|
+
// Find datasets WITHOUT a specific field
|
|
393
|
+
ckan_package_search({
|
|
394
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
395
|
+
q: "*:* AND NOT author:*",
|
|
396
|
+
rows: 20
|
|
397
|
+
})
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Date Math
|
|
401
|
+
|
|
402
|
+
Use relative dates for dynamic queries.
|
|
403
|
+
|
|
404
|
+
```typescript
|
|
405
|
+
// Datasets created in the last year
|
|
406
|
+
ckan_package_search({
|
|
407
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
408
|
+
q: "metadata_created:[NOW-1YEAR TO NOW]",
|
|
409
|
+
sort: "metadata_created desc",
|
|
410
|
+
rows: 20
|
|
411
|
+
})
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
```typescript
|
|
415
|
+
// Datasets modified in the last 6 months
|
|
416
|
+
ckan_package_search({
|
|
417
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
418
|
+
q: "metadata_modified:[NOW-6MONTHS TO NOW]",
|
|
419
|
+
rows: 20
|
|
420
|
+
})
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
// Datasets created today
|
|
425
|
+
ckan_package_search({
|
|
426
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
427
|
+
q: "metadata_created:[NOW/DAY TO NOW]",
|
|
428
|
+
rows: 20
|
|
429
|
+
})
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
// Datasets modified between 2 months ago and 1 month ago
|
|
434
|
+
ckan_package_search({
|
|
435
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
436
|
+
q: "metadata_modified:[NOW-2MONTHS TO NOW-1MONTH]",
|
|
437
|
+
rows: 20
|
|
438
|
+
})
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Complex Nested Queries
|
|
442
|
+
|
|
443
|
+
Combine multiple operators for sophisticated searches.
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
// Find water or climate datasets, excluding those about sea, with recent modifications
|
|
447
|
+
ckan_package_search({
|
|
448
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
449
|
+
q: "(title:water^2 OR title:climate^2) AND NOT title:sea AND metadata_modified:[NOW-1YEAR TO *]",
|
|
450
|
+
sort: "metadata_modified desc",
|
|
451
|
+
rows: 20
|
|
452
|
+
})
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
```typescript
|
|
456
|
+
// Find health datasets with specific resource count range
|
|
457
|
+
ckan_package_search({
|
|
458
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
459
|
+
q: "(title:health OR title:sanità) AND num_resources:[5 TO 50]",
|
|
460
|
+
rows: 20
|
|
461
|
+
})
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
```typescript
|
|
465
|
+
// PNRR datasets modified in specific date range with boosting
|
|
466
|
+
ckan_package_search({
|
|
467
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
468
|
+
q: "(title:pnrr^3 OR notes:pnrr^1.5 OR tags:pnrr) AND metadata_modified:[2025-07-01T00:00:00Z TO 2025-10-31T23:59:59Z]",
|
|
469
|
+
sort: "score desc, metadata_modified desc",
|
|
470
|
+
rows: 50
|
|
471
|
+
})
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Range Queries with Different Bounds
|
|
475
|
+
|
|
476
|
+
Use inclusive `[a TO b]` or exclusive `{a TO b}` bounds.
|
|
477
|
+
|
|
478
|
+
```typescript
|
|
479
|
+
// Inclusive range: datasets with 10 to 50 resources (includes 10 and 50)
|
|
480
|
+
ckan_package_search({
|
|
481
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
482
|
+
q: "num_resources:[10 TO 50]",
|
|
483
|
+
rows: 20
|
|
484
|
+
})
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
```typescript
|
|
488
|
+
// Exclusive range: datasets with more than 10 but less than 50 resources
|
|
489
|
+
ckan_package_search({
|
|
490
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
491
|
+
q: "num_resources:{10 TO 50}",
|
|
492
|
+
rows: 20
|
|
493
|
+
})
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
```typescript
|
|
497
|
+
// Mixed bounds: more than 5 resources, up to and including 100
|
|
498
|
+
ckan_package_search({
|
|
499
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
500
|
+
q: "num_resources:{5 TO 100]",
|
|
501
|
+
rows: 20
|
|
502
|
+
})
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
### Wildcard Patterns
|
|
506
|
+
|
|
507
|
+
Use `*` for pattern matching within terms.
|
|
508
|
+
|
|
509
|
+
```typescript
|
|
510
|
+
// Find all terms starting with "popola" (popolazione, popolamento, etc.)
|
|
511
|
+
ckan_package_search({
|
|
512
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
513
|
+
q: "popola*",
|
|
514
|
+
rows: 20
|
|
515
|
+
})
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
```typescript
|
|
519
|
+
// Wildcard in middle of term
|
|
520
|
+
ckan_package_search({
|
|
521
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
522
|
+
q: "title:env*mental",
|
|
523
|
+
rows: 20
|
|
524
|
+
})
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
```typescript
|
|
528
|
+
// Combine wildcards with boolean operators
|
|
529
|
+
ckan_package_search({
|
|
530
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
531
|
+
q: "title:ambient* OR title:clima*",
|
|
532
|
+
rows: 20
|
|
533
|
+
})
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Practical Advanced Examples
|
|
537
|
+
|
|
538
|
+
```typescript
|
|
539
|
+
// Find recent environmental datasets from regional organizations
|
|
540
|
+
ckan_package_search({
|
|
541
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
542
|
+
q: "(title:ambiente* OR notes:ambiente*) AND organization:regione* AND metadata_modified:[NOW-6MONTHS TO *]",
|
|
543
|
+
facet_field: ["organization"],
|
|
544
|
+
rows: 50
|
|
545
|
+
})
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
```typescript
|
|
549
|
+
// High-quality datasets: many resources, recently updated, specific topic
|
|
550
|
+
ckan_package_search({
|
|
551
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
552
|
+
q: "title:istat AND num_resources:[5 TO *] AND metadata_modified:[NOW-1YEAR TO *]",
|
|
553
|
+
sort: "num_resources desc, metadata_modified desc",
|
|
554
|
+
rows: 20
|
|
555
|
+
})
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
```typescript
|
|
559
|
+
// Datasets with CSV resources, excluding drafts, recent updates
|
|
560
|
+
ckan_package_search({
|
|
561
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
562
|
+
fq: "res_format:CSV AND state:active",
|
|
563
|
+
q: "metadata_modified:[NOW-3MONTHS TO *]",
|
|
564
|
+
sort: "metadata_modified desc",
|
|
565
|
+
rows: 30
|
|
566
|
+
})
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
## Complete Workflows
|
|
570
|
+
|
|
571
|
+
### Workflow 1: Regional Dataset Analysis
|
|
572
|
+
|
|
573
|
+
```typescript
|
|
574
|
+
// Step 1: List regional organizations
|
|
575
|
+
ckan_organization_list({
|
|
576
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
577
|
+
all_fields: true,
|
|
578
|
+
sort: "package_count desc",
|
|
579
|
+
limit: 50
|
|
580
|
+
})
|
|
581
|
+
|
|
582
|
+
// Step 2: Select a region and search its datasets
|
|
583
|
+
ckan_package_search({
|
|
584
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
585
|
+
fq: "organization:regione-siciliana",
|
|
586
|
+
sort: "metadata_modified desc",
|
|
587
|
+
rows: 50
|
|
588
|
+
})
|
|
589
|
+
|
|
590
|
+
// Step 3: Get details of an interesting dataset
|
|
591
|
+
ckan_package_show({
|
|
592
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
593
|
+
id: "nome-dataset-trovato"
|
|
594
|
+
})
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### Workflow 2: Monitor New Publications
|
|
598
|
+
|
|
599
|
+
```typescript
|
|
600
|
+
// Datasets published in the last 7 days
|
|
601
|
+
ckan_package_search({
|
|
602
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
603
|
+
fq: "metadata_created:[NOW-7DAYS TO NOW]",
|
|
604
|
+
sort: "metadata_created desc",
|
|
605
|
+
rows: 50
|
|
606
|
+
})
|
|
607
|
+
|
|
608
|
+
// Datasets modified in the last 7 days
|
|
609
|
+
ckan_package_search({
|
|
610
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
611
|
+
fq: "metadata_modified:[NOW-7DAYS TO NOW]",
|
|
612
|
+
sort: "metadata_modified desc",
|
|
613
|
+
rows: 50
|
|
614
|
+
})
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
### Workflow 3: Data Coverage Analysis
|
|
618
|
+
|
|
619
|
+
```typescript
|
|
620
|
+
// Step 1: Statistics by format
|
|
621
|
+
ckan_package_search({
|
|
622
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
623
|
+
facet_field: ["res_format"],
|
|
624
|
+
facet_limit: 100,
|
|
625
|
+
rows: 0
|
|
626
|
+
})
|
|
627
|
+
|
|
628
|
+
// Step 2: Statistics by license
|
|
629
|
+
ckan_package_search({
|
|
630
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
631
|
+
facet_field: ["license_id"],
|
|
632
|
+
facet_limit: 50,
|
|
633
|
+
rows: 0
|
|
634
|
+
})
|
|
635
|
+
|
|
636
|
+
// Step 3: Statistics by organization
|
|
637
|
+
ckan_package_search({
|
|
638
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
639
|
+
facet_field: ["organization"],
|
|
640
|
+
facet_limit: 100,
|
|
641
|
+
rows: 0
|
|
642
|
+
})
|
|
643
|
+
|
|
644
|
+
// Step 4: Most used tags
|
|
645
|
+
ckan_package_search({
|
|
646
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
647
|
+
facet_field: ["tags"],
|
|
648
|
+
facet_limit: 50,
|
|
649
|
+
rows: 0
|
|
650
|
+
})
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
### Workflow 4: Specific Thematic Search
|
|
654
|
+
|
|
655
|
+
```typescript
|
|
656
|
+
// Example: Environment and climate datasets
|
|
657
|
+
|
|
658
|
+
// Step 1: General search
|
|
659
|
+
ckan_package_search({
|
|
660
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
661
|
+
q: "ambiente OR clima OR inquinamento OR emissioni",
|
|
662
|
+
facet_field: ["organization", "tags"],
|
|
663
|
+
rows: 50
|
|
664
|
+
})
|
|
665
|
+
|
|
666
|
+
// Step 2: Refine with filters
|
|
667
|
+
ckan_package_search({
|
|
668
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
669
|
+
q: "ambiente",
|
|
670
|
+
fq: "tags:aria AND res_format:CSV",
|
|
671
|
+
sort: "metadata_modified desc",
|
|
672
|
+
rows: 20
|
|
673
|
+
})
|
|
674
|
+
|
|
675
|
+
// Step 3: Analyze organizations publishing on this theme
|
|
676
|
+
ckan_package_search({
|
|
677
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
678
|
+
q: "ambiente",
|
|
679
|
+
facet_field: ["organization"],
|
|
680
|
+
rows: 0
|
|
681
|
+
})
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
## Output Formats
|
|
685
|
+
|
|
686
|
+
### Markdown format (default)
|
|
687
|
+
Readable, formatted with tables and sections
|
|
688
|
+
|
|
689
|
+
### JSON format
|
|
690
|
+
For programmatic processing
|
|
691
|
+
|
|
692
|
+
```typescript
|
|
693
|
+
ckan_package_search({
|
|
694
|
+
server_url: "https://www.dati.gov.it/opendata",
|
|
695
|
+
q: "popolazione",
|
|
696
|
+
rows: 10,
|
|
697
|
+
response_format: "json"
|
|
698
|
+
})
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
## Notes
|
|
702
|
+
|
|
703
|
+
- Default pagination is 10 results for `package_search`
|
|
704
|
+
- Maximum is 1000 results per call
|
|
705
|
+
- For very large datasets, use `start` to paginate
|
|
706
|
+
- The DataStore has a limit of 32,000 records per query
|
|
707
|
+
- Not all datasets have resources in the DataStore (check `datastore_active`)
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Andrea Borruso aborruso@gmail.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|