一键导入
dataverse-sync
Sync local repository with Harvard Dataverse archive using the API. Use when uploading, replacing, or deleting files in a Dataverse dataset.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Sync local repository with Harvard Dataverse archive using the API. Use when uploading, replacing, or deleting files in a Dataverse dataset.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Get code reviews, plan evaluations, and second opinions using OpenAI Codex CLI (GPT-5.5). Use for reviewing code changes, evaluating implementation plans, getting alternative perspectives, or validating approaches with another AI model.
Web search, URL analysis, and multi-source synthesis using the Antigravity CLI (agy). Use for online research, fetching and analyzing web pages, combining web search with local files, and synthesizing information from multiple sources.
Maintain a per-repo napkin file that tracks mistakes, corrections, and what works. Activates EVERY session, unconditionally. Read the napkin before doing anything. Write to it continuously as you work — not just at session boundaries. Log your own mistakes, not just user corrections. The napkin lives in the repo at `.claude/napkin.md`.
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation. Also use when user says 'ask me questions', 'interview me', or needs help clarifying requirements.
Use when returning to a project after time away, starting a work session, or recovering from interruption - provides comprehensive project context and recent activity summary
Clean survey data with missing value handling, variable recoding, and Stata label conversion to R factors. Use when processing raw survey/health study data, handling coded missing values (91/92/97/98), or converting Stata labels in R.
基于 SOC 职业分类
| name | dataverse-sync |
| description | Sync local repository with Harvard Dataverse archive using the API. Use when uploading, replacing, or deleting files in a Dataverse dataset. |
Sync local files with a Harvard Dataverse dataset using the Native API.
| Action | Endpoint | Method |
|---|---|---|
| Get dataset metadata | /api/datasets/:persistentId/?persistentId={DOI} | GET |
| Add file | /api/datasets/:persistentId/add?persistentId={DOI} | POST |
| Replace file | /api/files/{file_id}/replace | POST |
| Delete file | /api/files/{file_id} | DELETE |
All requests require the X-Dataverse-key header with your API token:
headers = {"X-Dataverse-key": "your-api-token"}
import requests
url = "https://dataverse.harvard.edu/api/datasets/:persistentId/"
params = {"persistentId": "doi:10.7910/DVN/XXXXXX"}
headers = {"X-Dataverse-key": API_TOKEN}
response = requests.get(url, params=params, headers=headers)
data = response.json()
files = data["data"]["latestVersion"]["files"]
for f in files:
file_id = f["dataFile"]["id"]
md5 = f["dataFile"].get("md5", "")
filename = f.get("label", f["dataFile"].get("filename"))
directory = f.get("directoryLabel", "")
import json
url = "https://dataverse.harvard.edu/api/datasets/:persistentId/add"
params = {"persistentId": DOI}
headers = {"X-Dataverse-key": API_TOKEN}
json_data = json.dumps({
"directoryLabel": "path/to/directory", # Optional
"categories": [],
})
with open(filepath, "rb") as f:
files = {
"file": (filename, f),
"jsonData": (None, json_data, "application/json"),
}
response = requests.post(url, params=params, headers=headers, files=files)
url = f"https://dataverse.harvard.edu/api/files/{file_id}"
headers = {"X-Dataverse-key": API_TOKEN}
response = requests.delete(url, headers=headers)
import hashlib
def compute_md5(filepath):
md5_hash = hashlib.md5()
with open(filepath, "rb") as f:
for chunk in iter(lambda: f.read(8192), b""):
md5_hash.update(chunk)
return md5_hash.hexdigest()
Harvard Dataverse uses AWS WAF which may block direct uploads of certain file types (.R, .do files).
Workaround: Upload files inside a ZIP archive. See dataverse-upload-zip skill.
directoryLabel that defines their folder pathdirectoryLabel in the JSON metadataThe /api/files/{id}/replace endpoint may return 403 for some file types. Alternative approach:
def sync(dry_run=True):
# 1. Fetch current Dataverse files
dataverse_files = get_dataset_files() # {path: {id, md5, directoryLabel}}
# 2. Scan local files
local_files = get_local_files() # {path: {local_path, md5}}
# 3. Compare
for path, local_info in local_files.items():
if path in dataverse_files:
if local_info["md5"] != dataverse_files[path]["md5"]:
# Modified - replace
replace_file(...)
else:
# New - add
add_file(...)
# 4. Find deleted
for path in dataverse_files:
if path not in local_files:
# Deleted - optionally remove
delete_file(...)