microdata_extract_to_code
Reproduce an IPUMS microdata extract by generating ready-to-run R or Python code from the extract number, making workflows repeatable.
Instructions
Generate ready-to-run R (ipumsr) and/or Python (ipumspy) code to reproduce a microdata extract. Fetches the extract definition by number and emits code that re-submits the same request. Use this after microdata_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": {
"collection": "<collection>",
"extractNumber": "<extractNumber>"
},
"name": "microdata_extract_to_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| language | No | Output language(s): 'r', 'python', or 'both' (default: 'both') | both |
| collection | Yes | IPUMS microdata collection (e.g. 'usa', 'cps') | |
| extractNumber | Yes | Extract number to generate code for |