跳到正文
cccskills
免费在 GitHub 公开

portaljs-connect-ckan

Connect a PortalJS catalog to a live CKAN instance through its API. The skill generates a small server-side client and updates search and dataset showcase pages to fetch CKAN data, while pre-rendering pages for static deployment.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Wire a scaffolded PortalJS portal to a CKAN backend over its API. Generates a tiny server-side fetch client (no runtime dependency) and feeds the /search catalog and /@namespace/slug showcases from CKAN instead of datasets.json. Use when connecting an existing portal to a live CKAN instance instead of a static manifest.

实测评分 未实测

查看安装方法

适用场景

  • Connecting an existing PortalJS site to a CKAN catalog
  • Showing CKAN datasets in the portal search page
  • Filtering catalog results by organization or group

包含的文件(2)

  • SKILL.md6.1 KB
  • references/reference.md3.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

PortalJS — Connect CKAN

Overview

Connect an existing portaljs-catalog portal to a live CKAN backend for the "decoupled / any backend" path. The portal stops reading the static datasets.json manifest (and files in /public/data/) and instead feeds its two data surfaces — the /search catalog and the /@namespace/slug showcases — straight from a CKAN instance's REST API (package_search / package_show) through a generated fetch client. Output is plain, editable Next.js code with no runtime dependency — never @portaljs/ckan, whose bundle wires React UI components to React 18 internals and crashes at import under the template's React 19. Pages fetch CKAN server-side in getStaticProps/getStaticPaths, so the catalog is pre-rendered at build time and the site can still be statically deployed. Run this right after portaljs-new-portal to swap a freshly scaffolded portal's sample data over to CKAN.

Prerequisites

  • A scaffolded PortalJS portal (see portaljs-new-portal) with package.json, pages/, datasets.json, pages/search.tsx, and pages/[owner]/[slug].tsx present.
  • A CKAN base URL that is publicly reachable, e.g. https://demo.dev.datopian.com.
  • Node 18+ and npm available in the portal directory (no new packages are installed).

Instructions

The canonical, full step-by-step workflow is .claude/commands/portaljs-connect-ckan.md — the single source of truth. Read and follow it when executing. Summary:

  1. Gather input from $ARGUMENTS — CKAN base URL (required), org filter (optional), group filter (optional), portal directory (default .). If the URL is missing, interview the user; never dead-end with a missing-input error.
  2. Validate the target directory is a portaljs-catalog portal; if not, suggest portaljs-new-portal instead of failing silently.
  3. Verify the CKAN backend is reachable via package_search?rows=1, and validate each org filter via organization_show; on failure, explain and re-prompt rather than dead-ending.
  4. Generate lib/ckan.ts — a self-contained server-side fetch client wrapping package_search and package_show, with DMS, ORG_FILTER, GROUP_FILTER, and MAX_DATASETS as editable constants.
  5. Rewire pages/search.tsx to list datasets from package_search, linking each to /@namespace/slug via datasetHref; leave pages/index.tsx untouched.
  6. Overwrite pages/[owner]/[slug].tsx to pre-render one page per dataset via getStaticPaths and fetch details with package_show, previewing tabular resources through the existing Table component.
  7. Verify the build with npx next build; fix any error before reporting success.
  8. Report what changed: client, catalog, showcase, filters, and static page count.

Output

  • Created: lib/ckan.ts (fetch wrapper client — no dependency added to package.json).
  • Modified: pages/search.tsx (catalog reads package_search); pages/[owner]/[slug].tsx (showcase reads package_show, overwritten to drop the datasets.json source).
  • Unchanged: pages/index.tsx (still the static search-first landing page).
  • UI strings: any text it adds to JSX renders through t() (lib/i18n.ts), with the keys added to locales/en.json and every other locales/*.json; npm run i18n:check passes.
  • Verified: npx next build succeeds and prints the static page count.
  • Result: /search and /@namespace/slug are served from the CKAN backend; the DMS env var can override the base URL at deploy time without editing code.

Error Handling

SymptomCauseFix
Missing CKAN URLUser invoked the skill with no $ARGUMENTSAsk for the base URL (and optional org/group filter); never error out.
package_search request fails or times outURL isn't a reachable CKAN rootTell the user, ask them to confirm the URL, and retry.
Org filter not foundorganization_show returns success: falseList valid orgs from organization_list and ask which one was meant.
Catalog renders empty after connectingWrong org/group filter name in lib/ckan.tsClear or correct the filter constants and rebuild.
next build failsTypo in substituted CKAN_URL or bad TypeScript editPrint the log, fix the first error, and re-run before reporting success.
<Table> fails to load a resourceCKAN resource host blocks CORSNote that the Download link still works; prefer datastore-backed resources.

Examples

Example 1 — Public CKAN demo, no filters

/portaljs-connect-ckan url=https://demo.dev.datopian.com

Example 2 — Restrict the catalog to one organization

/portaljs-connect-ckan url=https://demo.dev.datopian.com org=my-org

Example 3 — Filter by group and target a specific portal directory

/portaljs-connect-ckan url=https://data.example.gov group=education dir=./my-portal

Resources

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Migrate an ArcGIS Hub open data site into a PortalJS catalog. The skill collects the inventory, exports and converts spatial and tabular data for publishing, uploads files to Cloudflare R2 through Git LFS, and produces a report comparing source and derived data.

中文简介正在准备中。当前显示英语简介。

  • Moving a city ArcGIS Hub catalog to PortalJS
  • Migrating selected datasets from a Hub site
  • Comparing exported data with its ArcGIS source
datopian/portaljs23702026年10月21日 更新

Add a line, bar, area, pie, or scatter chart to the showcase for a dataset already registered in PortalJS. The skill creates a reusable Chart component and displays it in the dataset’s Views section using the existing data source.

中文简介正在准备中。当前显示英语简介。

  • Show yearly emissions as a line chart
  • Compare imports and exports with grouped series
  • Display a categorical budget breakdown as a pie chart
datopian/portaljs23702026年10月21日 更新

Register a CSV, TSV, JSON, or GeoJSON source in an existing PortalJS portal. The skill adds it to the dataset catalog and routes local files or remote URLs so the catalog and showcase can display the data.

中文简介正在准备中。当前显示英语简介。

  • Register a local CSV in a PortalJS catalog
  • Add a public dataset URL without copying the file
  • Publish a GeoJSON dataset through the portal
datopian/portaljs23702026年10月21日 更新

Generate DCAT catalog feeds for a PortalJS site so open data catalogs can harvest its datasets. The skill supports JSON-LD, Turtle, and RDF/XML formats, adds feed discovery, and checks conformance to selected profiles.

中文简介正在准备中。当前显示英语简介。

  • Making a PortalJS catalog harvestable by an EU open data portal
  • Preparing feeds for a US or national open data catalog
  • Publishing catalog metadata in multiple RDF formats
datopian/portaljs23702026年10月21日 更新

Prepare a vector geospatial dataset for a PortalJS portal by converting its coordinate system, creating a map-ready PMTiles file and a queryable GeoParquet file, and registering both with the original data for an automatically rendered showcase.

中文简介正在准备中。当前显示英语简介。

  • Turn GeoJSON into a portal map and spatial query view
  • Ingest a zipped Shapefile from a URL
  • Publish a GeoPackage layer with its original file
datopian/portaljs23702026年10月21日 更新

Add an interactive Leaflet map to a selected GeoJSON dataset’s PortalJS showcase. The skill can register a local or remote GeoJSON source, install the map dependencies, and render the map in the page’s Views section.

中文简介正在准备中。当前显示英语简介。

  • Show a map alongside a registered GeoJSON dataset
  • Register a local GeoJSON file and display it on a map
  • Add a remote GeoJSON source to a PortalJS showcase
datopian/portaljs23702026年10月21日 更新

查看 datopian 的全部技能

报告此技能的问题