nhgis_extract_to_code
Generate ready-to-run R or Python code from an NHGIS extract number to replicate the same data request.
Instructions
Generate ready-to-run R (ipumsr) and/or Python (ipumspy) code to reproduce an NHGIS extract. Fetches the extract definition by number and emits code that re-submits the same request. Use this after nhgis_create_extract to capture a reproducible workflow.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"extractNumber": "<extractNumber>"
},
"name": "nhgis_extract_to_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Output language(s): 'r', 'python', or 'both' (default: 'both') | both |
| extractNumber | Yes | NHGIS extract number to generate code for |