美國十年人口普查資料查詢 (2020 PL / DHC / 2010 SF1)
us_query_decennial
台灣專屬MIT
**關鍵字 / Keywords**: 美國 十年 人口普查 2020 2010 2000 PL DHC redistricting census decennial dec pl dhc sf1 population race hispanic housing units state county block
Scope: US Census Bureau · Decennial Census.
Query the every-10-years constitutionally-mandated Census (used for
congressional apportionment, federal funding formulas, and as the
universe for every subsequent ACS estimate). Response matrix is
converted to `rows: [{col: val}, ...]`.
Endpoint:
https://api.census.gov/data/{year}/dec/{dataset}?get={vars}&for={for_geo}&in={in_geo}
Args:
year: 2020, 2010, 2000, 1990.
variables: decennial variable codes. Common:
- "P1_001N" — total population (2020 PL / DHC)
- "P2_002N" — Hispanic / Latino population (2020 PL)
- "H1_001N" — total housing units (2020 PL)
- "P0010001" — total population (2010 SF1)
for_geo: same syntax as `us_query_acs`.
in_geo: parent scope for hierarchical queries.
dataset: decennial sub-dataset:
- "pl" — PL 94-171 (redistricting · earliest release)
- "dhc" — DHC (Demographic & Housing Characteristics,
2020 full detail)
- "sf1" — Summary File 1 (2010 / 2000 · legacy)
- "dp" — Demographic Profile (2020)
- "ddhca" — Detailed DHC-A
Default `"pl"` (available for 2020, 2010, 2000).
Returns dict with `columns`, `rows`, `total_rows`, `raw_matrix`.
Same gate / key logic as `us_query_acs`. License: US Public Domain
(17 USC §105).輸入 schema
{
"properties": {
"year": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"title": "Year"
},
"variables": {
"items": {
"type": "string"
},
"title": "Variables",
"type": "array"
},
"for_geo": {
"title": "For Geo",
"type": "string"
},
"in_geo": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "In Geo"
},
"dataset": {
"default": "pl",
"title": "Dataset",
"type": "string"
}
},
"required": [
"year",
"variables",
"for_geo"
],
"title": "us_query_decennialArguments",
"type": "object"
}呼叫方式
配置好 Twinkle Hub 的 MCP client 後,agent 會看到 us_query_decennial。直接讓它呼叫即可,例如:
# Ask Claude / any MCP client: 請用 us_query_decennial 處理 "…"。 # It will call: us_query_decennial(input="…")
尚未設定 Client?
Claude Desktop 約 3 分鐘即可完成設定 — 下載 .mcpb 檔案並雙擊即可,或參閱文件中的各 Client 安裝步驟。
查看使用者設定文件