{"data":{"slug":"github-datopian-portaljs-skills-portaljs-migrate-93e7c7c3a183","title":"Migrate Datasets Between Open-Data Platforms","summary":"Migrate datasets from CKAN, DCAT-US, DCAT-RDF, Socrata, OpenDataSoft, or ArcGIS to a static PortalJS catalog or CKAN instance. The deliverable is an updated `datasets.json` file or CKAN packages\/resources, depending on the target.","url":"https:\/\/skillshunter.net\/skills\/github-datopian-portaljs-skills-portaljs-migrate-93e7c7c3a183","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-datopian-portaljs-skills-portaljs-migrate-93e7c7c3a183","markdown_url":"https:\/\/skillshunter.net\/skills\/github-datopian-portaljs-skills-portaljs-migrate-93e7c7c3a183.md","download_url":"https:\/\/skillshunter.net\/skills\/github-datopian-portaljs-skills-portaljs-migrate-93e7c7c3a183\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"An existing PortalJS portal is required for the static target, with `datasets.json`, `package.json`, and `pages\/[owner]\/[slug].tsx` already in place. Node 18+ and npm must be installed, and for CKAN targets, a valid `CKAN_API_KEY` is required. For `download` copy mode, `git-lfs` and a PortalJS Arc account or self-hosted Giftless endpoint are needed.","instructions":"---\nname: portaljs-migrate\ndescription: Migrate (harvest) datasets between open-data platforms. Reads CKAN, a DCAT-US \/data.json catalog (DKAN, ArcGIS Hub, data.gov), a DCAT \/ DCAT-AP RDF feed (JSON-LD, Turtle, or RDF\/XML), Socrata, OpenDataSoft, or an ArcGIS FeatureServer, and writes them to a static PortalJS catalog or pushes them into a CKAN instance over its API. Use when moving datasets from an external open-data platform into a PortalJS portal, or bridging one CKAN instance to another.\nallowed-tools: Read, Write, Edit, Bash(npm:*), Bash(npx:*), Bash(node:*), Bash(curl:*), Bash(git:*), WebFetch\nversion: 1.0.0\nauthor: Datopian <hello@datopian.com>\nlicense: MIT\ncompatibility: Claude Code with PortalJS portals (Next.js 14, React 18, Node 18+). Runs from any project via the plugin, a personal ~\/.claude\/commands install, or a portaljs clone.\ntags:\n  - portaljs\n  - data-portal\n  - migration\n  - harvest\n  - dcat\n  - ckan\n---\n\n# PortalJS \u2014 Migrate\n\n## Overview\n\nHarvest datasets from an external open-data platform into a PortalJS portal, or\npush them into a CKAN instance. Every source reads into one canonical shape \u2014\n`{ slug, namespace, name, description, resources[] }` \u2014 then writes to the target\nfrom that shape, so adding a source covers every target automatically.\n\nSupported sources: CKAN, a DCAT-US `\/data.json` catalog (DKAN, ArcGIS Hub,\ndata.gov), a DCAT \/ DCAT-AP RDF feed, Socrata, OpenDataSoft, or an ArcGIS\nFeatureServer\/MapServer. Supported targets: a static PortalJS catalog\n(`datasets.json`, resources linked by URL or downloaded into Cloudflare R2) or a\nCKAN instance over its write API.\n\nThis is the copy-into-the-portal path, the inverse of `\/portaljs-connect-ckan`\n(which reads the source live at build time): a one-time, re-runnable snapshot so\nthe portal stands alone and needs no backend.\n\n## Prerequisites\n\n- An existing PortalJS portal for the static target: `datasets.json`,\n  `package.json`, and `pages\/[owner]\/[slug].tsx` must exist (the `portaljs-catalog`\n  template).\n- Node 18+ and npm, with portal dependencies installed (`npm install`).\n- Network access to the source platform's API or feed URL.\n- For a CKAN target: a write API key in `CKAN_API_KEY` \u2014 never hardcoded.\n- For `download` copy mode: `git-lfs` and a PortalJS Arc account (or a\n  self-hosted Giftless endpoint) to push resource files to R2.\n- For `dcat-rdf` sources: `lib\/metadata\/dcat-harvest.ts` and `dcat-profiles.ts`\n  (copy from `examples\/portaljs-catalog\/lib\/metadata\/` if missing), run via `npx tsx`.\n\n## Instructions\n\nFull step-by-step workflow:\n[`.claude\/commands\/portaljs-migrate.md`](https:\/\/github.com\/datopian\/portaljs\/blob\/main\/.claude\/commands\/portaljs-migrate.md).\n\n1. Gather input \u2014 source type, source URL, target (`static`\/`ckan`), portal\n   directory, copy mode (`link`\/`download`), filters. Interview instead of erroring.\n2. Validate the target \u2014 confirm the static catalog files exist, or that the CKAN\n   URL and API key authenticate.\n3. Detect the source type from the URL (or `--source`) and verify reachability.\n4. Read the source into canonical dataset entries, per the source's field table in\n   the reference doc, applying the metadata hygiene rules (license sentinel \u2014 never\n   fabricate CC-BY; description sanitizer + fallback chain; source dates preserved\n   with `migratedAt` separate; `cleanTitle` display-name cleanup with slugs from the\n   raw title; `category` from a meaningful theme).\n5. For a static target, resolve resource paths by copy mode: `link` keeps source\n   URLs; `download` copies files into the repo under Git LFS, pushed to R2.\n6. Print a dry-run preview; stop if `--dry-run` was passed.\n7. Write `datasets.json` (upsert or `--replace`), or push packages\/resources into\n   CKAN over its action API.\n8. Verify \u2014 `npm run build` (static) or re-query `package_search` (CKAN).\n9. Report datasets migrated, namespaces touched, and next steps.\n\n## Output\n\nStatic target: an updated `datasets.json` (upserted on `(namespace, slug)`),\noptionally with resource files in Git LFS served from Cloudflare R2, plus a\npassing `npm run build`. CKAN target: created\/updated packages and resources;\nper-dataset failures are logged and skipped, not fatal.\n\n## Error Handling\n\n| Symptom | Cause | Fix |\n| --- | --- | --- |\n| \"not a `portaljs-catalog` template\" | `datasets.json` missing | Confirm the portal directory, or run `\/portaljs-new-portal` |\n| CKAN target rejects every write (403) | Key missing, expired, or lacks org permission | Set a valid `CKAN_API_KEY`; stop rather than partially migrating |\n| Source URL matches no known format | Auto-detection failed | Pass `--source` explicitly (`ckan`, `dcat`, `dcat-rdf`, `socrata`, `ods`, `arcgis`) |\n| DCAT-RDF fetch returns HTML, not a feed | URL is a portal page, not the feed | Follow its `<link rel=\"alternate\">` href, or use the direct feed URL |\n| Build fails after write | Malformed entry (missing `slug`\/`namespace`\/`name`) | Inspect `\/tmp\/portaljs-migrate-build.log`, fix, rebuild |\n| `download` mode push fails | `git-lfs` missing, or no Arc\/Giftless token | Install `git-lfs`; mint a token via the Arc API or self-hosted Giftless |\n| Duplicate datasets after re-running | `--replace` used unintentionally, or slug collisions | Omit `--replace` to upsert; keep slugs unique per namespace |\n\n## Examples\n\n### Example 1 \u2014 CKAN to static catalog, link mode\n\n```bash\n\/portaljs-migrate --source ckan --source-url https:\/\/demo.dev.datopian.com \\\n  --target static --portal-dir . --copy-mode link\n```\nUpserts all packages from the CKAN demo instance into `datasets.json`, referencing\nsource resource URLs directly.\n\n### Example 2 \u2014 data.gov DCAT-US catalog, downloaded into R2\n\n```bash\n\/portaljs-migrate --source dcat --source-url https:\/\/catalog.data.gov\/data.json \\\n  --target static --copy-mode download --org-filter epa-gov\n```\nHarvests one publisher and copies every resource file into the repo under Git\nLFS, served from Cloudflare R2.\n\n### Example 3 \u2014 DCAT-AP RDF feed from a national portal\n\n```bash\n\/portaljs-migrate --source dcat-rdf \\\n  --source-url https:\/\/data.europa.eu\/api\/hub\/search\/catalog.jsonld \\\n  --target static --dry-run\n```\nFetches the JSON-LD feed through the RDF harvester and previews the canonical\ndatasets without writing anything.\n\n### Example 4 \u2014 CKAN to CKAN (platform-to-platform)\n\n```bash\n\/portaljs-migrate --source ckan --source-url https:\/\/old-portal.example.org \\\n  --target ckan --target-url https:\/\/new-portal.example.org --owner-org research\n```\nPushes every package from the old CKAN instance into the new one, filed under\n`research`.\n\n## Resources\n\n- Command source: [`.claude\/commands\/portaljs-migrate.md`](https:\/\/github.com\/datopian\/portaljs\/blob\/main\/.claude\/commands\/portaljs-migrate.md)\n- Field mappings and troubleshooting: [`references\/reference.md`](references\/reference.md)\n- Related skills: `\/portaljs-connect-ckan`, `\/portaljs-add-dcat`,\n  `\/portaljs-check-data-quality`, `\/portaljs-define-schema`\n- CKAN Action API reference: https:\/\/docs.ckan.org\/en\/latest\/api\/\n","use_cases":["Migrate datasets from a CKAN instance to a static PortalJS catalog","Transfer datasets from a DCAT-US \/data.json catalog to a CKAN instance","Harvest datasets from an ArcGIS FeatureServer into a PortalJS portal"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/datopian\/portaljs\/blob\/fc7ccd651459549a962c8b7aa08f60f8849fd9a5\/skills\/portaljs-migrate\/SKILL.md","source_commit":"fc7ccd651459549a962c8b7aa08f60f8849fd9a5","license":"MIT","version":"1.0.0","listing_approved_at":"2026-11-22","created_at":"2026-11-21T15:57:47.000000Z","updated_at":"2026-11-22T11:18:24.000000Z","seo_title":"Migrate Datasets Between Open-Data Platforms","seo_description":"Effortlessly migrate datasets between open-data platforms using PortalJS. Supports CKAN, DCAT, Socrata, and more.","seo_keywords":["dataset migration","CKAN to PortalJS","DCAT-US migration","ArcGIS to CKAN","open-data migration"]}}