data-analyst-mcp 0.0.0-stage → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (640) hide show
  1. package/README.md +261 -2
  2. package/dist/adapters/_acf_tidy.d.ts +18 -0
  3. package/dist/adapters/_acf_tidy.js +432 -0
  4. package/dist/adapters/_acf_tidy.js.map +1 -0
  5. package/dist/adapters/_actuaries_read.d.ts +38 -0
  6. package/dist/adapters/_actuaries_read.js +728 -0
  7. package/dist/adapters/_actuaries_read.js.map +1 -0
  8. package/dist/adapters/_census_micro.d.ts +70 -0
  9. package/dist/adapters/_census_micro.js +622 -0
  10. package/dist/adapters/_census_micro.js.map +1 -0
  11. package/dist/adapters/_census_util.d.ts +40 -0
  12. package/dist/adapters/_census_util.js +275 -0
  13. package/dist/adapters/_census_util.js.map +1 -0
  14. package/dist/adapters/_dol_states.d.ts +6 -0
  15. package/dist/adapters/_dol_states.js +58 -0
  16. package/dist/adapters/_dol_states.js.map +1 -0
  17. package/dist/adapters/_govinfo_entities.d.ts +4 -0
  18. package/dist/adapters/_govinfo_entities.js +6 -0
  19. package/dist/adapters/_govinfo_entities.js.map +1 -0
  20. package/dist/adapters/_govinfo_json.d.ts +13 -0
  21. package/dist/adapters/_govinfo_json.js +107 -0
  22. package/dist/adapters/_govinfo_json.js.map +1 -0
  23. package/dist/adapters/_govinfo_py.d.ts +22 -0
  24. package/dist/adapters/_govinfo_py.js +272 -0
  25. package/dist/adapters/_govinfo_py.js.map +1 -0
  26. package/dist/adapters/_govinfo_xml.d.ts +22 -0
  27. package/dist/adapters/_govinfo_xml.js +233 -0
  28. package/dist/adapters/_govinfo_xml.js.map +1 -0
  29. package/dist/adapters/_hud_excel.d.ts +2 -0
  30. package/dist/adapters/_hud_excel.js +166 -0
  31. package/dist/adapters/_hud_excel.js.map +1 -0
  32. package/dist/adapters/_omb_grid.d.ts +17 -0
  33. package/dist/adapters/_omb_grid.js +132 -0
  34. package/dist/adapters/_omb_grid.js.map +1 -0
  35. package/dist/adapters/_omb_util.d.ts +40 -0
  36. package/dist/adapters/_omb_util.js +192 -0
  37. package/dist/adapters/_omb_util.js.map +1 -0
  38. package/dist/adapters/_usaspending_state.d.ts +6 -0
  39. package/dist/adapters/_usaspending_state.js +54 -0
  40. package/dist/adapters/_usaspending_state.js.map +1 -0
  41. package/dist/adapters/_usda-fna_book.d.ts +59 -0
  42. package/dist/adapters/_usda-fna_book.js +869 -0
  43. package/dist/adapters/_usda-fna_book.js.map +1 -0
  44. package/dist/adapters/_usda-fna_pdf.d.ts +20 -0
  45. package/dist/adapters/_usda-fna_pdf.js +361 -0
  46. package/dist/adapters/_usda-fna_pdf.js.map +1 -0
  47. package/dist/adapters/_usda-outlook_read.d.ts +70 -0
  48. package/dist/adapters/_usda-outlook_read.js +362 -0
  49. package/dist/adapters/_usda-outlook_read.js.map +1 -0
  50. package/dist/adapters/acf.d.ts +3 -0
  51. package/dist/adapters/acf.js +187 -0
  52. package/dist/adapters/acf.js.map +1 -0
  53. package/dist/adapters/actuaries.d.ts +3 -0
  54. package/dist/adapters/actuaries.js +293 -0
  55. package/dist/adapters/actuaries.js.map +1 -0
  56. package/dist/adapters/bts.d.ts +3 -0
  57. package/dist/adapters/bts.js +26 -0
  58. package/dist/adapters/bts.js.map +1 -0
  59. package/dist/adapters/census-geocoder.d.ts +10 -0
  60. package/dist/adapters/census-geocoder.js +47 -0
  61. package/dist/adapters/census-geocoder.js.map +1 -0
  62. package/dist/adapters/census.d.ts +17 -0
  63. package/dist/adapters/census.js +983 -0
  64. package/dist/adapters/census.js.map +1 -0
  65. package/dist/adapters/cfpb.d.ts +7 -0
  66. package/dist/adapters/cfpb.js +348 -0
  67. package/dist/adapters/cfpb.js.map +1 -0
  68. package/dist/adapters/clinical-trials.d.ts +3 -0
  69. package/dist/adapters/clinical-trials.js +135 -0
  70. package/dist/adapters/clinical-trials.js.map +1 -0
  71. package/dist/adapters/cms.d.ts +3 -0
  72. package/dist/adapters/cms.js +292 -0
  73. package/dist/adapters/cms.js.map +1 -0
  74. package/dist/adapters/college-scorecard.d.ts +3 -0
  75. package/dist/adapters/college-scorecard.js +122 -0
  76. package/dist/adapters/college-scorecard.js.map +1 -0
  77. package/dist/adapters/congress.d.ts +33 -0
  78. package/dist/adapters/congress.js +589 -0
  79. package/dist/adapters/congress.js.map +1 -0
  80. package/dist/adapters/dhs-ohss.d.ts +13 -0
  81. package/dist/adapters/dhs-ohss.js +598 -0
  82. package/dist/adapters/dhs-ohss.js.map +1 -0
  83. package/dist/adapters/doj-news.d.ts +7 -0
  84. package/dist/adapters/doj-news.js +286 -0
  85. package/dist/adapters/doj-news.js.map +1 -0
  86. package/dist/adapters/dol.d.ts +4 -0
  87. package/dist/adapters/dol.js +634 -0
  88. package/dist/adapters/dol.js.map +1 -0
  89. package/dist/adapters/eia.d.ts +15 -0
  90. package/dist/adapters/eia.js +456 -0
  91. package/dist/adapters/eia.js.map +1 -0
  92. package/dist/adapters/epa-aqs.d.ts +3 -0
  93. package/dist/adapters/epa-aqs.js +357 -0
  94. package/dist/adapters/epa-aqs.js.map +1 -0
  95. package/dist/adapters/epa.d.ts +3 -0
  96. package/dist/adapters/epa.js +298 -0
  97. package/dist/adapters/epa.js.map +1 -0
  98. package/dist/adapters/fbi.d.ts +3 -0
  99. package/dist/adapters/fbi.js +192 -0
  100. package/dist/adapters/fbi.js.map +1 -0
  101. package/dist/adapters/fda.d.ts +5 -0
  102. package/dist/adapters/fda.js +184 -0
  103. package/dist/adapters/fda.js.map +1 -0
  104. package/dist/adapters/fdic.d.ts +4 -0
  105. package/dist/adapters/fdic.js +95 -0
  106. package/dist/adapters/fdic.js.map +1 -0
  107. package/dist/adapters/fec.d.ts +3 -0
  108. package/dist/adapters/fec.js +142 -0
  109. package/dist/adapters/fec.js.map +1 -0
  110. package/dist/adapters/fed-board.d.ts +12 -0
  111. package/dist/adapters/fed-board.js +581 -0
  112. package/dist/adapters/fed-board.js.map +1 -0
  113. package/dist/adapters/federal-register.d.ts +11 -0
  114. package/dist/adapters/federal-register.js +43 -0
  115. package/dist/adapters/federal-register.js.map +1 -0
  116. package/dist/adapters/fhfa.d.ts +3 -0
  117. package/dist/adapters/fhfa.js +253 -0
  118. package/dist/adapters/fhfa.js.map +1 -0
  119. package/dist/adapters/fsa.d.ts +9 -0
  120. package/dist/adapters/fsa.js +335 -0
  121. package/dist/adapters/fsa.js.map +1 -0
  122. package/dist/adapters/govinfo.d.ts +30 -0
  123. package/dist/adapters/govinfo.js +636 -0
  124. package/dist/adapters/govinfo.js.map +1 -0
  125. package/dist/adapters/gsa-calc.d.ts +10 -0
  126. package/dist/adapters/gsa-calc.js +318 -0
  127. package/dist/adapters/gsa-calc.js.map +1 -0
  128. package/dist/adapters/hud.d.ts +3 -0
  129. package/dist/adapters/hud.js +200 -0
  130. package/dist/adapters/hud.js.map +1 -0
  131. package/dist/adapters/index.d.ts +3 -0
  132. package/dist/adapters/index.js +25 -0
  133. package/dist/adapters/index.js.map +1 -0
  134. package/dist/adapters/irs-soi.d.ts +6 -0
  135. package/dist/adapters/irs-soi.js +576 -0
  136. package/dist/adapters/irs-soi.js.map +1 -0
  137. package/dist/adapters/naep.d.ts +15 -0
  138. package/dist/adapters/naep.js +341 -0
  139. package/dist/adapters/naep.js.map +1 -0
  140. package/dist/adapters/nhtsa.d.ts +10 -0
  141. package/dist/adapters/nhtsa.js +239 -0
  142. package/dist/adapters/nhtsa.js.map +1 -0
  143. package/dist/adapters/nih.d.ts +5 -0
  144. package/dist/adapters/nih.js +196 -0
  145. package/dist/adapters/nih.js.map +1 -0
  146. package/dist/adapters/noaa.d.ts +3 -0
  147. package/dist/adapters/noaa.js +148 -0
  148. package/dist/adapters/noaa.js.map +1 -0
  149. package/dist/adapters/nrel.d.ts +3 -0
  150. package/dist/adapters/nrel.js +186 -0
  151. package/dist/adapters/nrel.js.map +1 -0
  152. package/dist/adapters/nws.d.ts +3 -0
  153. package/dist/adapters/nws.js +119 -0
  154. package/dist/adapters/nws.js.map +1 -0
  155. package/dist/adapters/omb.d.ts +15 -0
  156. package/dist/adapters/omb.js +517 -0
  157. package/dist/adapters/omb.js.map +1 -0
  158. package/dist/adapters/open-payments.d.ts +5 -0
  159. package/dist/adapters/open-payments.js +149 -0
  160. package/dist/adapters/open-payments.js.map +1 -0
  161. package/dist/adapters/pbgc.d.ts +13 -0
  162. package/dist/adapters/pbgc.js +283 -0
  163. package/dist/adapters/pbgc.js.map +1 -0
  164. package/dist/adapters/philfed.d.ts +12 -0
  165. package/dist/adapters/philfed.js +59 -0
  166. package/dist/adapters/philfed.js.map +1 -0
  167. package/dist/adapters/regulations.d.ts +6 -0
  168. package/dist/adapters/regulations.js +58 -0
  169. package/dist/adapters/regulations.js.map +1 -0
  170. package/dist/adapters/sec.d.ts +13 -0
  171. package/dist/adapters/sec.js +504 -0
  172. package/dist/adapters/sec.js.map +1 -0
  173. package/dist/adapters/senate-lobbying.d.ts +3 -0
  174. package/dist/adapters/senate-lobbying.js +181 -0
  175. package/dist/adapters/senate-lobbying.js.map +1 -0
  176. package/dist/adapters/snapqc.d.ts +32 -0
  177. package/dist/adapters/snapqc.js +701 -0
  178. package/dist/adapters/snapqc.js.map +1 -0
  179. package/dist/adapters/treasury-yields.d.ts +3 -0
  180. package/dist/adapters/treasury-yields.js +170 -0
  181. package/dist/adapters/treasury-yields.js.map +1 -0
  182. package/dist/adapters/usaspending.d.ts +3 -0
  183. package/dist/adapters/usaspending.js +340 -0
  184. package/dist/adapters/usaspending.js.map +1 -0
  185. package/dist/adapters/usda-fna.d.ts +7 -0
  186. package/dist/adapters/usda-fna.js +707 -0
  187. package/dist/adapters/usda-fna.js.map +1 -0
  188. package/dist/adapters/usda-fooddata.d.ts +3 -0
  189. package/dist/adapters/usda-fooddata.js +101 -0
  190. package/dist/adapters/usda-fooddata.js.map +1 -0
  191. package/dist/adapters/usda-nass.d.ts +3 -0
  192. package/dist/adapters/usda-nass.js +108 -0
  193. package/dist/adapters/usda-nass.js.map +1 -0
  194. package/dist/adapters/usda-outlook.d.ts +12 -0
  195. package/dist/adapters/usda-outlook.js +696 -0
  196. package/dist/adapters/usda-outlook.js.map +1 -0
  197. package/dist/adapters/usgs.d.ts +9 -0
  198. package/dist/adapters/usgs.js +265 -0
  199. package/dist/adapters/usgs.js.map +1 -0
  200. package/dist/adapters/usitc.d.ts +18 -0
  201. package/dist/adapters/usitc.js +170 -0
  202. package/dist/adapters/usitc.js.map +1 -0
  203. package/dist/adapters/uspto.d.ts +3 -0
  204. package/dist/adapters/uspto.js +47 -0
  205. package/dist/adapters/uspto.js.map +1 -0
  206. package/dist/adapters/world-bank.d.ts +3 -0
  207. package/dist/adapters/world-bank.js +163 -0
  208. package/dist/adapters/world-bank.js.map +1 -0
  209. package/dist/analysis/cite.d.ts +31 -0
  210. package/dist/analysis/cite.js +229 -0
  211. package/dist/analysis/cite.js.map +1 -0
  212. package/dist/analysis/combine.d.ts +27 -0
  213. package/dist/analysis/combine.js +198 -0
  214. package/dist/analysis/combine.js.map +1 -0
  215. package/dist/analysis/compute.d.ts +62 -0
  216. package/dist/analysis/compute.js +583 -0
  217. package/dist/analysis/compute.js.map +1 -0
  218. package/dist/analysis/expr.d.ts +69 -0
  219. package/dist/analysis/expr.js +780 -0
  220. package/dist/analysis/expr.js.map +1 -0
  221. package/dist/analysis/factfmt.d.ts +16 -0
  222. package/dist/analysis/factfmt.js +187 -0
  223. package/dist/analysis/factfmt.js.map +1 -0
  224. package/dist/analysis/facts.d.ts +63 -0
  225. package/dist/analysis/facts.js +355 -0
  226. package/dist/analysis/facts.js.map +1 -0
  227. package/dist/analysis/handoff.d.ts +58 -0
  228. package/dist/analysis/handoff.js +208 -0
  229. package/dist/analysis/handoff.js.map +1 -0
  230. package/dist/analysis/pyfmt.d.ts +16 -0
  231. package/dist/analysis/pyfmt.js +156 -0
  232. package/dist/analysis/pyfmt.js.map +1 -0
  233. package/dist/analysis/rerun.d.ts +13 -0
  234. package/dist/analysis/rerun.js +125 -0
  235. package/dist/analysis/rerun.js.map +1 -0
  236. package/dist/analysis/table.d.ts +18 -0
  237. package/dist/analysis/table.js +109 -0
  238. package/dist/analysis/table.js.map +1 -0
  239. package/dist/analysis/tools.d.ts +67 -0
  240. package/dist/analysis/tools.js +217 -0
  241. package/dist/analysis/tools.js.map +1 -0
  242. package/dist/analysis/write_table.d.ts +13 -0
  243. package/dist/analysis/write_table.js +59 -0
  244. package/dist/analysis/write_table.js.map +1 -0
  245. package/dist/bin/cli.d.ts +10 -0
  246. package/dist/bin/cli.js +177 -0
  247. package/dist/bin/cli.js.map +1 -0
  248. package/dist/core/cache.d.ts +14 -0
  249. package/dist/core/cache.js +90 -0
  250. package/dist/core/cache.js.map +1 -0
  251. package/dist/core/context.d.ts +12 -0
  252. package/dist/core/context.js +15 -0
  253. package/dist/core/context.js.map +1 -0
  254. package/dist/core/env.d.ts +14 -0
  255. package/dist/core/env.js +52 -0
  256. package/dist/core/env.js.map +1 -0
  257. package/dist/core/generic-rest.d.ts +61 -0
  258. package/dist/core/generic-rest.js +639 -0
  259. package/dist/core/generic-rest.js.map +1 -0
  260. package/dist/core/http.d.ts +120 -0
  261. package/dist/core/http.js +514 -0
  262. package/dist/core/http.js.map +1 -0
  263. package/dist/core/keys.d.ts +43 -0
  264. package/dist/core/keys.js +174 -0
  265. package/dist/core/keys.js.map +1 -0
  266. package/dist/core/manual.d.ts +41 -0
  267. package/dist/core/manual.js +218 -0
  268. package/dist/core/manual.js.map +1 -0
  269. package/dist/core/package.d.ts +58 -0
  270. package/dist/core/package.js +228 -0
  271. package/dist/core/package.js.map +1 -0
  272. package/dist/core/packs.d.ts +139 -0
  273. package/dist/core/packs.js +173 -0
  274. package/dist/core/packs.js.map +1 -0
  275. package/dist/core/policy.d.ts +69 -0
  276. package/dist/core/policy.js +189 -0
  277. package/dist/core/policy.js.map +1 -0
  278. package/dist/core/py.d.ts +40 -0
  279. package/dist/core/py.js +171 -0
  280. package/dist/core/py.js.map +1 -0
  281. package/dist/core/routing.d.ts +10 -0
  282. package/dist/core/routing.js +39 -0
  283. package/dist/core/routing.js.map +1 -0
  284. package/dist/core/tabular.d.ts +21 -0
  285. package/dist/core/tabular.js +229 -0
  286. package/dist/core/tabular.js.map +1 -0
  287. package/dist/deep/_bea_api.d.ts +102 -0
  288. package/dist/deep/_bea_api.js +457 -0
  289. package/dist/deep/_bea_api.js.map +1 -0
  290. package/dist/deep/_bea_fetch.d.ts +151 -0
  291. package/dist/deep/_bea_fetch.js +1274 -0
  292. package/dist/deep/_bea_fetch.js.map +1 -0
  293. package/dist/deep/_bea_util.d.ts +14 -0
  294. package/dist/deep/_bea_util.js +156 -0
  295. package/dist/deep/_bea_util.js.map +1 -0
  296. package/dist/deep/_bls_api.d.ts +84 -0
  297. package/dist/deep/_bls_api.js +231 -0
  298. package/dist/deep/_bls_api.js.map +1 -0
  299. package/dist/deep/_bls_ids.d.ts +43 -0
  300. package/dist/deep/_bls_ids.js +188 -0
  301. package/dist/deep/_bls_ids.js.map +1 -0
  302. package/dist/deep/_bls_lib.d.ts +61 -0
  303. package/dist/deep/_bls_lib.js +442 -0
  304. package/dist/deep/_bls_lib.js.map +1 -0
  305. package/dist/deep/_fred_api.d.ts +148 -0
  306. package/dist/deep/_fred_api.js +545 -0
  307. package/dist/deep/_fred_api.js.map +1 -0
  308. package/dist/deep/_fred_pack.d.ts +162 -0
  309. package/dist/deep/_fred_pack.js +1027 -0
  310. package/dist/deep/_fred_pack.js.map +1 -0
  311. package/dist/deep/_fred_py.d.ts +40 -0
  312. package/dist/deep/_fred_py.js +199 -0
  313. package/dist/deep/_fred_py.js.map +1 -0
  314. package/dist/deep/_ipums_bundle.d.ts +29 -0
  315. package/dist/deep/_ipums_bundle.js +194 -0
  316. package/dist/deep/_ipums_bundle.js.map +1 -0
  317. package/dist/deep/_ipums_ddi.d.ts +23 -0
  318. package/dist/deep/_ipums_ddi.js +162 -0
  319. package/dist/deep/_ipums_ddi.js.map +1 -0
  320. package/dist/deep/_opm_io.d.ts +26 -0
  321. package/dist/deep/_opm_io.js +383 -0
  322. package/dist/deep/_opm_io.js.map +1 -0
  323. package/dist/deep/_opm_parquet.d.ts +31 -0
  324. package/dist/deep/_opm_parquet.js +744 -0
  325. package/dist/deep/_opm_parquet.js.map +1 -0
  326. package/dist/deep/_opm_py.d.ts +6 -0
  327. package/dist/deep/_opm_py.js +74 -0
  328. package/dist/deep/_opm_py.js.map +1 -0
  329. package/dist/deep/_treasury_api.d.ts +48 -0
  330. package/dist/deep/_treasury_api.js +221 -0
  331. package/dist/deep/_treasury_api.js.map +1 -0
  332. package/dist/deep/_treasury_context.d.ts +34 -0
  333. package/dist/deep/_treasury_context.js +142 -0
  334. package/dist/deep/_treasury_context.js.map +1 -0
  335. package/dist/deep/_treasury_lib.d.ts +109 -0
  336. package/dist/deep/_treasury_lib.js +686 -0
  337. package/dist/deep/_treasury_lib.js.map +1 -0
  338. package/dist/deep/bea.d.ts +3 -0
  339. package/dist/deep/bea.js +248 -0
  340. package/dist/deep/bea.js.map +1 -0
  341. package/dist/deep/bls.d.ts +3 -0
  342. package/dist/deep/bls.js +220 -0
  343. package/dist/deep/bls.js.map +1 -0
  344. package/dist/deep/fred.d.ts +3 -0
  345. package/dist/deep/fred.js +325 -0
  346. package/dist/deep/fred.js.map +1 -0
  347. package/dist/deep/ipums.d.ts +59 -0
  348. package/dist/deep/ipums.js +744 -0
  349. package/dist/deep/ipums.js.map +1 -0
  350. package/dist/deep/opm.d.ts +56 -0
  351. package/dist/deep/opm.js +1033 -0
  352. package/dist/deep/opm.js.map +1 -0
  353. package/dist/deep/treasury.d.ts +3 -0
  354. package/dist/deep/treasury.js +218 -0
  355. package/dist/deep/treasury.js.map +1 -0
  356. package/dist/envelope.d.ts +47 -0
  357. package/dist/envelope.js +88 -0
  358. package/dist/envelope.js.map +1 -0
  359. package/dist/index.d.ts +277 -0
  360. package/dist/index.js +106 -0
  361. package/dist/index.js.map +1 -0
  362. package/dist/remote/app.d.ts +21 -0
  363. package/dist/remote/app.js +218 -0
  364. package/dist/remote/app.js.map +1 -0
  365. package/dist/remote/oauth.d.ts +14 -0
  366. package/dist/remote/oauth.js +90 -0
  367. package/dist/remote/oauth.js.map +1 -0
  368. package/dist/remote/pages.d.ts +8 -0
  369. package/dist/remote/pages.js +56 -0
  370. package/dist/remote/pages.js.map +1 -0
  371. package/dist/remote/sign.d.ts +4 -0
  372. package/dist/remote/sign.js +40 -0
  373. package/dist/remote/sign.js.map +1 -0
  374. package/dist/remote/store.d.ts +31 -0
  375. package/dist/remote/store.js +129 -0
  376. package/dist/remote/store.js.map +1 -0
  377. package/dist/report/audit_answer.d.ts +94 -0
  378. package/dist/report/audit_answer.js +1349 -0
  379. package/dist/report/audit_answer.js.map +1 -0
  380. package/dist/report/audit_report.d.ts +23 -0
  381. package/dist/report/audit_report.js +637 -0
  382. package/dist/report/audit_report.js.map +1 -0
  383. package/dist/report/build_report.d.ts +27 -0
  384. package/dist/report/build_report.js +1168 -0
  385. package/dist/report/build_report.js.map +1 -0
  386. package/dist/report/method_audit.d.ts +47 -0
  387. package/dist/report/method_audit.js +716 -0
  388. package/dist/report/method_audit.js.map +1 -0
  389. package/dist/report/policyset.d.ts +50 -0
  390. package/dist/report/policyset.js +421 -0
  391. package/dist/report/policyset.js.map +1 -0
  392. package/dist/report/py.d.ts +58 -0
  393. package/dist/report/py.js +311 -0
  394. package/dist/report/py.js.map +1 -0
  395. package/dist/report/scan_secrets.d.ts +24 -0
  396. package/dist/report/scan_secrets.js +265 -0
  397. package/dist/report/scan_secrets.js.map +1 -0
  398. package/dist/report/style_check.d.ts +29 -0
  399. package/dist/report/style_check.js +173 -0
  400. package/dist/report/style_check.js.map +1 -0
  401. package/dist/report/tools.d.ts +87 -0
  402. package/dist/report/tools.js +167 -0
  403. package/dist/report/tools.js.map +1 -0
  404. package/dist/server.d.ts +5 -0
  405. package/dist/server.js +247 -0
  406. package/dist/server.js.map +1 -0
  407. package/dist/session.d.ts +47 -0
  408. package/dist/session.js +107 -0
  409. package/dist/session.js.map +1 -0
  410. package/dist/toolkit.d.ts +21 -0
  411. package/dist/toolkit.js +2 -0
  412. package/dist/toolkit.js.map +1 -0
  413. package/dist/tools.d.ts +299 -0
  414. package/dist/tools.js +491 -0
  415. package/dist/tools.js.map +1 -0
  416. package/guide/WORKFLOW.md +134 -0
  417. package/guide/assets/disclaimer.txt +1 -0
  418. package/guide/assets/download_data.ps1 +162 -0
  419. package/guide/assets/download_data.sh +143 -0
  420. package/guide/assets/report_template.html +597 -0
  421. package/guide/references/report_patterns.md +199 -0
  422. package/guide/references/routing.md +171 -0
  423. package/guide/references/style_guide.md +398 -0
  424. package/package.json +54 -4
  425. package/packs/acf/endpoints.json +114 -0
  426. package/packs/acf/policy.json +104 -0
  427. package/packs/acf/source.md +138 -0
  428. package/packs/actuaries/endpoints.json +82 -0
  429. package/packs/actuaries/policy.json +109 -0
  430. package/packs/actuaries/source.md +137 -0
  431. package/packs/bea/assets/download_bea.ps1 +182 -0
  432. package/packs/bea/assets/download_bea.sh +144 -0
  433. package/packs/bea/docs/bea_api.md +461 -0
  434. package/packs/bea/docs/datasets.md +157 -0
  435. package/packs/bea/docs/report_patterns.md +112 -0
  436. package/packs/bea/policy.json +170 -0
  437. package/packs/bea/source.md +152 -0
  438. package/packs/bls/assets/download_bls.ps1 +152 -0
  439. package/packs/bls/assets/download_bls.sh +167 -0
  440. package/packs/bls/docs/analysis_patterns.md +108 -0
  441. package/packs/bls/docs/bls_api.md +73 -0
  442. package/packs/bls/docs/series_ids.md +149 -0
  443. package/packs/bls/policy.json +238 -0
  444. package/packs/bls/series_ids.json +1375 -0
  445. package/packs/bls/source.md +156 -0
  446. package/packs/bts/endpoints.json +347 -0
  447. package/packs/bts/policy.json +94 -0
  448. package/packs/bts/source.md +97 -0
  449. package/packs/cdc/endpoints.json +197 -0
  450. package/packs/cdc/policy.json +83 -0
  451. package/packs/cdc/source.md +74 -0
  452. package/packs/census/endpoints.json +99 -0
  453. package/packs/census/policy.json +238 -0
  454. package/packs/census/source.md +304 -0
  455. package/packs/census-geocoder/endpoints.json +70 -0
  456. package/packs/census-geocoder/policy.json +80 -0
  457. package/packs/census-geocoder/source.md +53 -0
  458. package/packs/cfpb/endpoints.json +327 -0
  459. package/packs/cfpb/policy.json +119 -0
  460. package/packs/cfpb/source.md +96 -0
  461. package/packs/clinical-trials/endpoints.json +167 -0
  462. package/packs/clinical-trials/policy.json +84 -0
  463. package/packs/clinical-trials/source.md +82 -0
  464. package/packs/cms/endpoints.json +69 -0
  465. package/packs/cms/policy.json +96 -0
  466. package/packs/cms/source.md +112 -0
  467. package/packs/college-scorecard/endpoints.json +253 -0
  468. package/packs/college-scorecard/policy.json +106 -0
  469. package/packs/college-scorecard/source.md +92 -0
  470. package/packs/congress/endpoints.json +1701 -0
  471. package/packs/congress/policy.json +117 -0
  472. package/packs/congress/source.md +190 -0
  473. package/packs/dhs-ohss/endpoints.json +66 -0
  474. package/packs/dhs-ohss/policy.json +107 -0
  475. package/packs/dhs-ohss/source.md +120 -0
  476. package/packs/doj-news/endpoints.json +59 -0
  477. package/packs/doj-news/policy.json +96 -0
  478. package/packs/doj-news/source.md +99 -0
  479. package/packs/dol/endpoints.json +818 -0
  480. package/packs/dol/policy.json +135 -0
  481. package/packs/dol/source.md +181 -0
  482. package/packs/eia/endpoints.json +718 -0
  483. package/packs/eia/policy.json +112 -0
  484. package/packs/eia/source.md +112 -0
  485. package/packs/epa/endpoints.json +292 -0
  486. package/packs/epa/policy.json +99 -0
  487. package/packs/epa/source.md +99 -0
  488. package/packs/epa-aqs/endpoints.json +174 -0
  489. package/packs/epa-aqs/policy.json +96 -0
  490. package/packs/epa-aqs/source.md +97 -0
  491. package/packs/fbi/endpoints.json +1842 -0
  492. package/packs/fbi/policy.json +118 -0
  493. package/packs/fbi/source.md +108 -0
  494. package/packs/fda/endpoints.json +238 -0
  495. package/packs/fda/policy.json +121 -0
  496. package/packs/fda/source.md +117 -0
  497. package/packs/fdic/endpoints.json +417 -0
  498. package/packs/fdic/policy.json +83 -0
  499. package/packs/fdic/source.md +92 -0
  500. package/packs/fec/endpoints.json +708 -0
  501. package/packs/fec/policy.json +93 -0
  502. package/packs/fec/source.md +90 -0
  503. package/packs/fed-board/endpoints.json +89 -0
  504. package/packs/fed-board/policy.json +136 -0
  505. package/packs/fed-board/source.md +118 -0
  506. package/packs/federal-register/endpoints.json +143 -0
  507. package/packs/federal-register/policy.json +86 -0
  508. package/packs/federal-register/source.md +98 -0
  509. package/packs/fema/endpoints.json +646 -0
  510. package/packs/fema/policy.json +103 -0
  511. package/packs/fema/source.md +103 -0
  512. package/packs/fhfa/endpoints.json +105 -0
  513. package/packs/fhfa/policy.json +109 -0
  514. package/packs/fhfa/source.md +108 -0
  515. package/packs/fred/assets/download_fred.ps1 +122 -0
  516. package/packs/fred/assets/download_fred.sh +123 -0
  517. package/packs/fred/docs/analysis_patterns.md +124 -0
  518. package/packs/fred/docs/fred_api.md +94 -0
  519. package/packs/fred/docs/series.md +188 -0
  520. package/packs/fred/policy.json +253 -0
  521. package/packs/fred/source.md +142 -0
  522. package/packs/fsa/endpoints.json +150 -0
  523. package/packs/fsa/policy.json +99 -0
  524. package/packs/fsa/source.md +102 -0
  525. package/packs/govinfo/endpoints.json +520 -0
  526. package/packs/govinfo/policy.json +116 -0
  527. package/packs/govinfo/source.md +241 -0
  528. package/packs/gsa-calc/endpoints.json +93 -0
  529. package/packs/gsa-calc/policy.json +97 -0
  530. package/packs/gsa-calc/source.md +108 -0
  531. package/packs/hud/endpoints.json +147 -0
  532. package/packs/hud/policy.json +84 -0
  533. package/packs/hud/source.md +97 -0
  534. package/packs/ipums/assets/download_ipums.ps1 +215 -0
  535. package/packs/ipums/assets/download_ipums.sh +192 -0
  536. package/packs/ipums/docs/ipums_api.md +67 -0
  537. package/packs/ipums/docs/report_patterns.md +117 -0
  538. package/packs/ipums/docs/variables.md +284 -0
  539. package/packs/ipums/lib/fetch_text.json +112 -0
  540. package/packs/ipums/policy.json +215 -0
  541. package/packs/ipums/source.md +169 -0
  542. package/packs/irs-soi/endpoints.json +114 -0
  543. package/packs/irs-soi/policy.json +107 -0
  544. package/packs/irs-soi/source.md +124 -0
  545. package/packs/medicaid/endpoints.json +412 -0
  546. package/packs/medicaid/policy.json +108 -0
  547. package/packs/medicaid/source.md +136 -0
  548. package/packs/naep/endpoints.json +217 -0
  549. package/packs/naep/policy.json +100 -0
  550. package/packs/naep/source.md +120 -0
  551. package/packs/nhtsa/endpoints.json +132 -0
  552. package/packs/nhtsa/policy.json +93 -0
  553. package/packs/nhtsa/source.md +109 -0
  554. package/packs/nih/endpoints.json +453 -0
  555. package/packs/nih/policy.json +86 -0
  556. package/packs/nih/source.md +108 -0
  557. package/packs/noaa/endpoints.json +432 -0
  558. package/packs/noaa/policy.json +95 -0
  559. package/packs/noaa/source.md +88 -0
  560. package/packs/nrel/endpoints.json +328 -0
  561. package/packs/nrel/policy.json +96 -0
  562. package/packs/nrel/source.md +91 -0
  563. package/packs/nws/endpoints.json +272 -0
  564. package/packs/nws/policy.json +82 -0
  565. package/packs/nws/source.md +81 -0
  566. package/packs/nyfed/endpoints.json +80 -0
  567. package/packs/nyfed/policy.json +92 -0
  568. package/packs/nyfed/source.md +89 -0
  569. package/packs/omb/endpoints.json +460 -0
  570. package/packs/omb/policy.json +106 -0
  571. package/packs/omb/source.md +130 -0
  572. package/packs/open-payments/endpoints.json +298 -0
  573. package/packs/open-payments/policy.json +101 -0
  574. package/packs/open-payments/source.md +99 -0
  575. package/packs/opm/assets/download_opm.ps1 +125 -0
  576. package/packs/opm/assets/download_opm.sh +85 -0
  577. package/packs/opm/docs/fields.md +184 -0
  578. package/packs/opm/docs/opm_api.md +71 -0
  579. package/packs/opm/docs/report_patterns.md +83 -0
  580. package/packs/opm/lib/data_dictionary.csv +73 -0
  581. package/packs/opm/policy.json +142 -0
  582. package/packs/opm/source.md +137 -0
  583. package/packs/pbgc/endpoints.json +483 -0
  584. package/packs/pbgc/policy.json +94 -0
  585. package/packs/pbgc/source.md +95 -0
  586. package/packs/philfed/endpoints.json +85 -0
  587. package/packs/philfed/policy.json +94 -0
  588. package/packs/philfed/source.md +125 -0
  589. package/packs/port.json +287 -0
  590. package/packs/regulations/endpoints.json +288 -0
  591. package/packs/regulations/policy.json +86 -0
  592. package/packs/regulations/source.md +84 -0
  593. package/packs/sec/endpoints.json +237 -0
  594. package/packs/sec/policy.json +86 -0
  595. package/packs/sec/source.md +101 -0
  596. package/packs/senate-lobbying/endpoints.json +554 -0
  597. package/packs/senate-lobbying/policy.json +99 -0
  598. package/packs/senate-lobbying/source.md +100 -0
  599. package/packs/snapqc/endpoints.json +1426 -0
  600. package/packs/snapqc/policy.json +92 -0
  601. package/packs/snapqc/source.md +96 -0
  602. package/packs/treasury/catalog.json +2267 -0
  603. package/packs/treasury/docs/api_guide.md +245 -0
  604. package/packs/treasury/docs/datasets.md +56 -0
  605. package/packs/treasury/docs/report_patterns.md +126 -0
  606. package/packs/treasury/policy.json +159 -0
  607. package/packs/treasury/source.md +170 -0
  608. package/packs/treasury-yields/endpoints.json +226 -0
  609. package/packs/treasury-yields/policy.json +86 -0
  610. package/packs/treasury-yields/source.md +80 -0
  611. package/packs/usaspending/endpoints.json +1316 -0
  612. package/packs/usaspending/policy.json +109 -0
  613. package/packs/usaspending/source.md +103 -0
  614. package/packs/usda-fna/endpoints.json +427 -0
  615. package/packs/usda-fna/policy.json +133 -0
  616. package/packs/usda-fna/source.md +217 -0
  617. package/packs/usda-fooddata/endpoints.json +181 -0
  618. package/packs/usda-fooddata/policy.json +94 -0
  619. package/packs/usda-fooddata/source.md +105 -0
  620. package/packs/usda-nass/endpoints.json +324 -0
  621. package/packs/usda-nass/policy.json +95 -0
  622. package/packs/usda-nass/source.md +85 -0
  623. package/packs/usda-outlook/endpoints.json +86 -0
  624. package/packs/usda-outlook/policy.json +109 -0
  625. package/packs/usda-outlook/source.md +144 -0
  626. package/packs/usgs/endpoints.json +313 -0
  627. package/packs/usgs/policy.json +95 -0
  628. package/packs/usgs/source.md +96 -0
  629. package/packs/usitc/endpoints.json +74 -0
  630. package/packs/usitc/policy.json +111 -0
  631. package/packs/usitc/source.md +90 -0
  632. package/packs/uspto/endpoints.json +141 -0
  633. package/packs/uspto/policy.json +95 -0
  634. package/packs/uspto/source.md +101 -0
  635. package/packs/va/endpoints.json +414 -0
  636. package/packs/va/policy.json +101 -0
  637. package/packs/va/source.md +129 -0
  638. package/packs/world-bank/endpoints.json +122 -0
  639. package/packs/world-bank/policy.json +101 -0
  640. package/packs/world-bank/source.md +93 -0
@@ -0,0 +1,122 @@
1
+ <#
2
+ .SYNOPSIS
3
+ Download the FRED files for one data-analyst request into the folder that holds this script.
4
+
5
+ .DESCRIPTION
6
+ Files marked key, bearer or group come from the FRED API and need your own free FRED API key
7
+ (https://fredaccount.stlouisfed.org/apikeys). The script uses $env:FRED_API_KEY when it is set,
8
+ otherwise asks for it with hidden input; press Enter to skip those files. The key is never printed
9
+ and never written into the saved files.
10
+
11
+ .EXAMPLE
12
+ powershell -NoProfile -ExecutionPolicy Bypass -File "$HOME\Downloads\download_fred.ps1"
13
+ #>
14
+ [CmdletBinding()]
15
+ param([switch]$NoPause)
16
+ $ErrorActionPreference = 'Stop'
17
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
18
+ $here = Split-Path -Parent $MyInvocation.MyCommand.Path
19
+
20
+ # file <TAB> kind <TAB> pages <TAB> url <TAB> then_file <TAB> then_url ("-" = empty, pages 0 = unpaged)
21
+ # kind: plain (no key), key (key in the query), bearer (FRED API v2, key in a header, paged),
22
+ # group (GeoFRED series group; its fields fill the __GROUP_*__ placeholders of then_url)
23
+ $manifest = @'
24
+ @MANIFEST@
25
+ '@
26
+ $items = $manifest -split "`n" | ForEach-Object { $_.TrimEnd("`r") } | Where-Object { $_ } | ForEach-Object {
27
+ $f = $_ -split "`t"
28
+ [pscustomobject]@{ File = $f[0]; Kind = $f[1]; Pages = [int]$f[2]; Url = $f[3]; ThenFile = $f[4]; ThenUrl = $f[5] }
29
+ }
30
+
31
+ $key = $env:FRED_API_KEY
32
+ if (-not $key -and ($items | Where-Object { $_.Kind -ne 'plain' })) {
33
+ Write-Host 'Some files need a FRED API key (https://fredaccount.stlouisfed.org/apikeys). Press Enter to skip them.'
34
+ if ([Console]::IsInputRedirected) { $key = [Console]::In.ReadLine() }
35
+ else {
36
+ $secure = Read-Host -Prompt 'FRED API key (hidden)' -AsSecureString
37
+ $bstr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($secure)
38
+ try { $key = [Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr) }
39
+ finally { [Runtime.InteropServices.Marshal]::ZeroFreeBSTR($bstr) }
40
+ }
41
+ }
42
+ if ($null -eq $key) { $key = '' }
43
+ $key = $key -replace '\s', ''
44
+
45
+ $utf8 = New-Object System.Text.UTF8Encoding($false)
46
+ $saved = New-Object System.Collections.ArrayList
47
+
48
+ # Download one keyed file, wrap it with the request URL (placeholder, not the key) and save it.
49
+ # Returns the reply text, or $null when the request failed.
50
+ function Save-Keyed([string]$file, [string]$url, [bool]$bearer) {
51
+ try {
52
+ if ($bearer) {
53
+ $r = Invoke-WebRequest -UseBasicParsing -UserAgent 'data-analyst/1.0' -Uri $url `
54
+ -Headers @{ Authorization = "Bearer $key" }
55
+ } else {
56
+ $r = Invoke-WebRequest -UseBasicParsing -UserAgent 'data-analyst/1.0' -Uri ($url.Replace('__FRED_KEY__', $key))
57
+ }
58
+ } catch {
59
+ $msg = "$($_.Exception.Message) $($_.ErrorDetails.Message)"
60
+ if ($key) { $msg = $msg.Replace($key, '[KEY]') }
61
+ Write-Host "${file}: download failed ($msg)"
62
+ return $null
63
+ }
64
+ $text = $utf8.GetString($r.RawContentStream.ToArray())
65
+ $wrapped = '{"request": "' + $url + '", "response": ' + $text + '}'
66
+ $dest = Join-Path $here $file
67
+ [IO.File]::WriteAllText($dest, $wrapped, $utf8)
68
+ [void]$saved.Add($dest)
69
+ Write-Host "saved $file"
70
+ return $text
71
+ }
72
+
73
+ foreach ($it in $items) {
74
+ if ($it.Kind -eq 'plain') {
75
+ $dest = Join-Path $here $it.File
76
+ try {
77
+ Invoke-WebRequest -UseBasicParsing -UserAgent 'data-analyst/1.0' -Uri $it.Url -OutFile $dest
78
+ [void]$saved.Add($dest)
79
+ Write-Host "saved $($it.File)"
80
+ } catch { Write-Host "$($it.File): download failed ($($_.Exception.Message))" }
81
+ Start-Sleep -Milliseconds 600
82
+ continue
83
+ }
84
+ if (-not $key) { Write-Host "skipped (needs a key): $($it.File)"; continue }
85
+ switch ($it.Kind) {
86
+ 'key' { [void](Save-Keyed $it.File $it.Url $false) }
87
+ 'bearer' {
88
+ # FRED API v2 release/observations: follow next_cursor up to Pages pages
89
+ $n = 1; $u = $it.Url; $f = $it.File
90
+ while ($true) {
91
+ $body = Save-Keyed $f $u $true
92
+ if ($null -eq $body -or $body -notmatch '"has_more"\s*:\s*true') { break }
93
+ if ($body -notmatch '"next_cursor"\s*:\s*"([^"]*)"' -or $n -ge $it.Pages) { break }
94
+ $n++
95
+ $u = $it.Url + '&next_cursor=' + [Uri]::EscapeDataString($Matches[1])
96
+ $f = $it.File -replace '\.json$', ('__p{0:D2}.json' -f $n)
97
+ Start-Sleep -Milliseconds 600
98
+ }
99
+ }
100
+ 'group' {
101
+ # GeoFRED: the series group first, then the cross-section it names
102
+ $body = Save-Keyed $it.File $it.Url $false
103
+ if ($null -ne $body) {
104
+ $g = (ConvertFrom-Json $body).series_group
105
+ $u = $it.ThenUrl
106
+ foreach ($k in 'series_group', 'region_type', 'season', 'units', 'frequency', 'max_date') {
107
+ $v = "$($g.$k)"
108
+ if ($k -eq 'frequency') { $v = $v.Substring(0, [Math]::Min(1, $v.Length)).ToLower() }
109
+ $u = $u.Replace('__GROUP_' + $k.ToUpper() + '__', [Uri]::EscapeDataString($v))
110
+ }
111
+ Start-Sleep -Milliseconds 600
112
+ [void](Save-Keyed $it.ThenFile $u $false)
113
+ }
114
+ }
115
+ }
116
+ Start-Sleep -Milliseconds 600
117
+ }
118
+ $key = $null
119
+ Write-Host ''
120
+ Write-Host 'Done. Upload these files to the chat:'
121
+ $saved | ForEach-Object { Write-Host " $_" }
122
+ if (-not $NoPause -and -not [Console]::IsInputRedirected) { Read-Host 'Press Enter to close' | Out-Null }
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env bash
2
+ # Download the FRED files for one data-analyst request into the folder that holds this script.
3
+ # Needs only bash and curl. Run: bash download_fred.sh
4
+ #
5
+ # Files marked key, bearer or group come from the FRED API and need your own free FRED API key
6
+ # (https://fredaccount.stlouisfed.org/apikeys). The script uses FRED_API_KEY when it is set,
7
+ # otherwise asks for it with hidden input; press Enter to skip those files. The key reaches curl
8
+ # on stdin (curl -K -), never on a command line, and is never written into the saved files.
9
+ set -u
10
+ here="$(cd "$(dirname "$0")" && pwd)"
11
+ command -v curl >/dev/null 2>&1 || { echo "curl is required" >&2; exit 1; }
12
+
13
+ # file <TAB> kind <TAB> pages <TAB> url <TAB> then_file <TAB> then_url ("-" = empty, pages 0 = unpaged)
14
+ # kind: plain (no key), key (key in the query), bearer (FRED API v2, key in a header, paged),
15
+ # group (GeoFRED series group; its fields fill the __GROUP_*__ placeholders of then_url)
16
+ manifest="$(cat <<'MANIFEST_END'
17
+ @MANIFEST@
18
+ MANIFEST_END
19
+ )"
20
+
21
+ key="${FRED_API_KEY:-}"
22
+ if [ -z "$key" ] && printf '%s\n' "$manifest" | cut -f2 | grep -qv '^plain$'; then
23
+ echo "Some files need a FRED API key (https://fredaccount.stlouisfed.org/apikeys). Press Enter to skip them."
24
+ if [ -t 0 ]; then
25
+ printf 'FRED API key (hidden): '; IFS= read -rs key; echo
26
+ else
27
+ IFS= read -r key || true
28
+ fi
29
+ fi
30
+ key="$(printf '%s' "$key" | tr -d '[:space:]')"
31
+
32
+ tmp="$(mktemp "${TMPDIR:-/tmp}/fred.XXXXXX")" || exit 1
33
+ trap 'rm -f "$tmp"' EXIT
34
+ saved=()
35
+
36
+ urlencode() {
37
+ local LC_ALL=C s="$1" out="" c i
38
+ for ((i = 0; i < ${#s}; i++)); do
39
+ c="${s:i:1}"
40
+ case "$c" in
41
+ [a-zA-Z0-9.~_-]) out+="$c" ;;
42
+ *) out+="$(printf '%%%02X' "'$c")" ;;
43
+ esac
44
+ done
45
+ printf '%s' "$out"
46
+ }
47
+
48
+ # json_str FILE NAME: the last string or number value of "NAME" in FILE
49
+ json_str() {
50
+ grep -oE "\"$2\" *: *(\"[^\"]*\"|[-0-9.]+)" "$1" | tail -n 1 | sed -E 's/^[^:]*: *"?//; s/"$//'
51
+ }
52
+
53
+ # keyed_get URL BEARER: download URL into $tmp with the key from stdin config; prints the HTTP status
54
+ keyed_get() {
55
+ if [ "$2" = "1" ]; then
56
+ printf 'url = "%s"\nheader = "Authorization: Bearer %s"\n' "$1" "$key"
57
+ else
58
+ printf 'url = "%s"\n' "${1/__FRED_KEY__/$key}"
59
+ fi | curl -sS -K - -A data-analyst/1.0 -o "$tmp" -w '%{http_code}'
60
+ }
61
+
62
+ # save_keyed FILE URL BEARER: download, wrap with the request URL (placeholder, not the key), save
63
+ save_keyed() {
64
+ local code msg
65
+ code="$(keyed_get "$2" "$3")" || { echo "$1: could not reach FRED; check the connection, then run again."; return 1; }
66
+ if [ "$code" != "200" ]; then
67
+ msg="$(head -c 200 "$tmp" | tr -d '\r\n')"
68
+ echo "$1: HTTP $code ${msg//"$key"/[KEY]}"
69
+ return 1
70
+ fi
71
+ { printf '{"request": "%s", "response": ' "$2"; cat "$tmp"; printf '}\n'; } > "$here/$1"
72
+ saved+=("$here/$1")
73
+ echo "saved $1"
74
+ }
75
+
76
+ while IFS=$'\t' read -r file kind pages url tfile turl; do
77
+ [ -n "$file" ] || continue
78
+ if [ "$kind" = "plain" ]; then
79
+ curl -sS -f -A data-analyst/1.0 -o "$here/$file" "$url" || { echo "$file: download failed"; continue; }
80
+ saved+=("$here/$file")
81
+ echo "saved $file"
82
+ sleep 0.6
83
+ continue
84
+ fi
85
+ if [ -z "$key" ]; then echo "skipped (needs a key): $file"; continue; fi
86
+ case "$kind" in
87
+ key)
88
+ save_keyed "$file" "$url" 0
89
+ ;;
90
+ bearer) # FRED API v2 release/observations: follow next_cursor up to pages
91
+ n=1; u="$url"; f="$file"
92
+ while save_keyed "$f" "$u" 1; do
93
+ grep -qE '"has_more" *: *true' "$tmp" || break
94
+ cur="$(json_str "$tmp" next_cursor)"
95
+ [ -n "$cur" ] && [ "$n" -lt "$pages" ] || break
96
+ n=$((n + 1))
97
+ u="$url&next_cursor=$(urlencode "$cur")"
98
+ f="${file%.json}__p$(printf '%02d' "$n").json"
99
+ sleep 0.6
100
+ done
101
+ ;;
102
+ group) # GeoFRED: the series group first, then the cross-section it names
103
+ if save_keyed "$file" "$url" 0; then
104
+ u="$turl"
105
+ for k in series_group region_type season units frequency max_date; do
106
+ v="$(json_str "$tmp" "$k")"
107
+ [ "$k" = "frequency" ] && v="$(printf '%s' "${v:0:1}" | tr '[:upper:]' '[:lower:]')"
108
+ kk="$(printf '%s' "$k" | tr '[:lower:]' '[:upper:]')"
109
+ u="${u//__GROUP_${kk}__/$(urlencode "$v")}"
110
+ done
111
+ sleep 0.6
112
+ save_keyed "$tfile" "$u" 0
113
+ fi
114
+ ;;
115
+ esac
116
+ sleep 0.6
117
+ done <<EOF
118
+ $manifest
119
+ EOF
120
+ key=""
121
+ echo
122
+ echo "Done. Upload these files to the chat:"
123
+ for p in "${saved[@]+"${saved[@]}"}"; do echo " $p"; done
@@ -0,0 +1,124 @@
1
+ # Analysis patterns for FRED data (budget and economic analysis)
2
+
3
+ Read this once at the start of any analysis. It lists the choices that change headline numbers (and so
4
+ become the critical questions), the conventions to follow (those of the institution the question comes from, else the source agency's), how to benchmark, and
5
+ how a report is laid out.
6
+
7
+ Contents: 1. Critical questions catalog · 2. Conventions · 3. Benchmarks and checks · 4. Typical questions
8
+ · 5. Publication structure · 6. Chart forms
9
+
10
+ ## 1. Critical questions catalog
11
+ Ask only the ones the request leaves open **and** that would change a headline number. Each has a default
12
+ rule for "Don't know — decide empirically" (show the main alternative as a sensitivity test).
13
+
14
+ | Choice | Typical options | Default rule when the user does not know |
15
+ |---|---|---|
16
+ | **Which measure** | Inflation: PCE vs. CPI-U vs. CPI-W vs. C-CPI-U; headline vs. core. Output: real GDP, GDP per capita, GDI. Debt: held by the public vs. total public debt. Interest: budget net interest (FYOINT) vs. NIPA interest payments | The measure the question's institution uses (for example, the Federal Reserve and the budget agencies lead with PCE for inflation and debt **held by the public**); indexing questions use the index the law names (CPI-W for Social Security COLAs, C-CPI-U for tax brackets, CPI-U for most other programs); budget questions use budget-basis series (OMB/Treasury), not NIPA |
17
+ | **Calendar or fiscal year** | Calendar year; federal fiscal year (October to September) | Budget amounts (outlays, revenues, deficits, debt, interest): fiscal years, and a share of GDP uses fiscal-year GDP (the average of the four quarters October to September). Economic variables: calendar years, unless they feed a fiscal-year ratio |
18
+ | **Nominal or real; deflator; base year** | Current dollars; real via PCE, CPI-U, GDP deflator; base = latest full year or a chosen year | Budget amounts: nominal, plus shares of GDP (the usual convention for comparisons over time). Incomes and wages: real, deflated by PCE or CPI-U when the user's context is CPI-based; base = latest full year; say "in <year> dollars" |
19
+ | **Growth measure** | Quarterly annualized; year over year; fourth quarter to fourth quarter; annual average over annual average; CAGR between dates | The publishing agency's convention: BEA's annual growth of GDP is **annual average over annual average** (its headline "real GDP increased 2.8 percent in 2024"); **Q4 over Q4** when comparing with Federal Reserve or CBO projections, which use it; annual average for levels such as unemployment and interest rates; quarterly annualized for the latest quarter (BEA's headline). Name the measure every time |
20
+ | **Frequency conversion** | Average, end of period, sum | Rates and prices: average. Stocks (debt, balances): end of period. Flows reported per period (monthly outlays): sum. Never let FRED convert silently: convert in `compute` (a rollup by period), and drop incomplete periods |
21
+ | **Vintage** | Latest data; as published on a date (ALFRED); first release; full revision history | Latest, unless the question is about what was known at a time (a baseline's starting point, a forecast evaluation, "as first reported"): then the vintage dated just before that time, and say so. Revision questions compare first release with latest |
22
+ | **Seasonal adjustment** | SA vs. NSA | Short-run changes and charts: SA. 12-month changes of CPI and annual averages: NSA (BLS convention). Fiscal-year sums: NSA source data summed over complete years |
23
+ | **Period and baseline** | A business-cycle peak (2019 Q4, Feb 2020), a policy date, the last 10 or 20 years | The business-cycle peak before the event the user cares about; otherwise the latest 10 complete years (20 for budget ratios). Show one alternative baseline as a sensitivity |
24
+ | **Projections** | Include CBO's projected potential output or NROU beyond the last actual date, or stop at the last actual | Stop at the last actual date for every comparison with data. Use projections only when the user asks about them, labeled as CBO's projections and with the vintage of the outlook |
25
+
26
+ Ask at most four, in one round. Series IDs are never a question for the user: resolve them with
27
+ `docs/series.md` and `request_schema` searches (words, or `describe <IDs>`).
28
+
29
+ ## 2. Conventions
30
+ - **Shares of GDP:** numerator and denominator on the same basis and period. Fiscal-year budget amounts over
31
+ fiscal-year GDP; mind the units (FYOINT in millions, GDP in billions: divide the numerator by 1,000 first).
32
+ Benchmark against FRED's own ratio where one exists (FYOIGDA188S, FYFSGDA188S, FYGFGDQ188S), but know how it is
33
+ built: FRED's annual budget ratios divide the fiscal-year amount by **calendar-year** GDP (GDPA) as published
34
+ when the ratio was last updated (FY2025 interest: 970,065 / about 30,762, GDPA as published in April 2026, = 3.15
35
+ percent; current GDPA is higher after BEA's September 2026 revision; on fiscal-year GDP it is 3.18 percent;
36
+ checked 2026-10-20). CBO and OMB use fiscal-year GDP. So a ratio on fiscal-year GDP differs from
37
+ FRED's annual ratios by a few hundredths of a point; a larger gap means a units or fiscal-year error.
38
+ FYGFGDQ188S is different: quarterly debt over that quarter's annualized GDP, so its Q3 value differs from
39
+ debt over fiscal-year GDP by about 0.5 to 1.5 points (FY2019: 77.5 against 79.0). Never present FRED's
40
+ ratio as a fiscal-year-GDP ratio. `FYGDP` is OMB's fiscal-year GDP (from its latest budget; it lags BEA's
41
+ revisions); averaging the four quarters of `GDP` gives the current-vintage equivalent.
42
+ - **Annualized rates:** quarterly GDP growth is reported at an annual rate: `(Q_t/Q_{t-1})^4 - 1`.
43
+ GDP levels are already at an annual rate (SAAR): do not multiply by four; a fiscal-year
44
+ GDP is the mean of four quarterly SAAR values, not their sum.
45
+ - **Real values:** chained-dollar components do not add up to their totals; do not sum chained-dollar series.
46
+ Compute shares in nominal terms.
47
+ - **Indexes:** an index level is not a price. Percent changes of indexes from the published values, rounded to one
48
+ decimal at the end.
49
+ - **Fiscal years:** FY2025 = October 1, 2024, to September 30, 2025. `compute`'s `fiscal_year` and
50
+ `to_fiscal` steps assign fiscal years (FRED dates fiscal-year dollar series on Sep 30 and some ratios on Jan 1).
51
+ - **Gaps:** October 2025 was not collected for the CPI, CPS and LAUS (lapse in appropriations); daily market
52
+ series skip holidays. Changes and averages across a gap need both endpoints or a complete period.
53
+ - **Levels across vintages:** a comprehensive revision changes the reference year of chained-dollar series (real
54
+ GDP: chained 2012 dollars in vintages before September 2023, 2017 dollars after) and can redefine nominal
55
+ levels. Compare growth rates, shares and ratios across vintages, and say which base year each vintage uses.
56
+ - **Revisions:** BEA revises GDP in each later estimate and in annual and comprehensive updates; CBO's potential
57
+ output is re-estimated with each outlook; BLS revises payrolls and seasonal factors. State the retrieval date
58
+ (the builder adds it), and use ALFRED vintages when the timing matters.
59
+ - **CBO projections in FRED** (GDPPOT, NGDPPOT, NROU) reflect the outlook named on the series page
60
+ (last_updated). After a BEA comprehensive revision, an output gap that mixes the new GDP with potential built on
61
+ the old GDP can shift; say so when `last_updated` of the two differs by more than a few months.
62
+ - **Recessions:** shade from USREC (downloaded, never from memory) and the builder adds the note.
63
+ - **Correlation, not cause:** an event "coincided with" a change unless a method that supports a causal claim was
64
+ used. No forecasts of your own; CBO's or the Federal Reserve's projections are cited as theirs.
65
+
66
+ ## 3. Benchmarks and checks
67
+ - **Benchmark every headline number** against a published figure, and save each comparison in
68
+ `exhibits/benchmark.csv` (measure, period, computed, published, source, URL, accessed date):
69
+ - FRED's own derived series: A191RL1Q225SBEA (real GDP growth), FYOIGDA188S / FYFSGDA188S / FYGFGDQ188S
70
+ (budget ratios), the `pc1` transform of a price index (download it as a second variant).
71
+ - The source's release: BEA's GDP release, BLS's CPI release, OMB's Historical Tables, the Treasury's Monthly
72
+ Treasury Statement, CBO's Monthly Budget Review or The Budget and Economic Outlook (cbo.gov, read through
73
+ the browser or the Wayback Machine when scripts are blocked).
74
+ Say "matches" only for rows in that file; a source not opened is "not checked".
75
+ - **Sanity checks before writing:** units (millions vs. billions), dates (fiscal-year end vs. start), the last
76
+ date of each series (a lagging annual series silently shortens a ratio), projections cut off, no FRED-side
77
+ conversion across a gap.
78
+ - **Sampling error:** most FRED macro series are not survey estimates with published standard errors; do not
79
+ call differences "statistically significant". For survey-based series (unemployment), see the bls pack's
80
+ thresholds or say "little changed" for small moves.
81
+
82
+ ## 4. Typical questions
83
+ - **Output gap and potential growth** (GDPC1, GDPPOT, NROU vs. UNRATE): gap by quarter, versus 2019 Q4;
84
+ potential growth Q4/Q4; the unemployment gap.
85
+ - **Inflation for indexing or deflating a cost estimate** (CPI-W, CPI-U, C-CPI-U, PCE): Q3-average CPI-W growth
86
+ for COLAs, calendar- or fiscal-year averages, cumulative growth between two dates.
87
+ - **Federal interest costs** (FYOINT, FYOIGDA188S, GS10, TB3MS, FYGFDPUN): net interest as a share of GDP by
88
+ fiscal year, the average rate on debt (interest over average debt held by the public), versus market yields.
89
+ - **Deficits and debt** (FYFSD, FYFR, FYONET, FYGFGDQ188S): shares of GDP, past averages (50-year average),
90
+ peaks.
91
+ - **Revisions and real-time data** (ALFRED): GDP growth as first reported vs. current, the data a past baseline
92
+ used.
93
+ - **State comparisons** (GeoFRED or `<ST>UR`, `<ST>PCPI`): rank states, change over a year.
94
+
95
+ ## 5. Publication structure (the report builder's `"mode": "report"`)
96
+ 1. Cover with the month and year, the title with the period, and an optional hero chart.
97
+ 2. **At a Glance:** one framing paragraph (which measures, which period, calendar or fiscal years) and 3–5
98
+ findings, each with a bold lead naming its section.
99
+ 3. Contents and List of Exhibits (built automatically).
100
+ 4. **Notes About This Report:** calendar or fiscal years; rounding; seasonal adjustment and annual rates; dollar
101
+ year and deflator; data source, retrieval date and vintage; projections; definitions; recession shading.
102
+ 5. **Introduction:** a lead paragraph with the headline numbers; question-style subsections ("How Large Is the
103
+ Output Gap?") and "What Data Were Used?".
104
+ 6. **Sections** (2–5): a summary page, then one exhibit per page with 2–4 paragraphs beside the chart (level,
105
+ change, comparison).
106
+ 7. **Appendix A: Data and Methods:** series IDs and sources, units and conversions, fiscal-year construction,
107
+ deflators, vintages, benchmark comparisons, limitations. The builder appends the data vintage, the series
108
+ citations and the FRED notice.
109
+ 8. References; About This Document (optional); replication materials and audit trail.
110
+
111
+ Exhibit titles end with the period: "Output Gap, 2007 Q1 to 2026 Q2"; "Net Interest Outlays as a Percentage of
112
+ GDP, Fiscal Years 2000 to 2025". The units line names the basis: "Percent of GDP"; "Billions of chained 2017
113
+ dollars, seasonally adjusted annual rate".
114
+
115
+ ## 6. Chart forms
116
+ - Trends: line charts with a real date axis (the exhibit CSV keeps the `date`
117
+ column) and recession shading (`"recessions": true`); at most 4–5 series.
118
+ - Fiscal-year amounts: columns for a few years, a line for long histories; label years by number and say "fiscal
119
+ years" in the title.
120
+ - Comparisons at one date (states, components): horizontal bars when labels are long.
121
+ - Composition (contributions to growth, outlays by category): stacked columns.
122
+ - Indexes compared over time: rebase to 100 at the same date (a `compute` derive step).
123
+ - No dual axes (put the second measure in its own exhibit), no pies, no 3-D. Leave gaps empty in the exhibit CSV
124
+ so the line breaks there.
@@ -0,0 +1,94 @@
1
+ # FRED, ALFRED and GeoFRED: what the fetch relies on
2
+
3
+ Checked live on 2026-10-20 unless marked "(docs)". The `fetch` tool implements all of this; read this file
4
+ when a download fails or a request needs a parameter the spec does not expose.
5
+
6
+ ## Two routes
7
+ | | FRED API (`api.stlouisfed.org/fred/`) | Keyless graph downloads (`fred.stlouisfed.org/graph/`) |
8
+ |---|---|---|
9
+ | Key | `api_key=<32 lowercase letters/digits>` query parameter; free at https://fredaccount.stlouisfed.org/apikeys; one key per user (terms) | none |
10
+ | Data | `series/observations`, JSON, `"."` = missing | `fredgraph.csv?id=X`, `""` = missing |
11
+ | Metadata | `series` (title, units, frequency, SA, last_updated, **notes**), `series/release`, `release/sources` (the source agency for the citation) | `fredgraph.xlsx?id=A,B,...` README sheet: title, units, frequency, SA, "Data Updated". No notes, source or copyright |
12
+ | Vintages (ALFRED) | `realtime_start/realtime_end`, `vintage_dates`, `output_type` (1 by real-time period, 2/3 by vintage, 4 initial release), `series/vintagedates` | `alfred.stlouisfed.org/graph/alfredgraph.csv?id=X,X&vintage_date=D1,D2&cosd=..,..&coed=..,..` (one repeated ID per vintage; columns `X_YYYYMMDD`). No first-release or full history |
13
+ | Search | `series/search` (`search_text`, `order_by=popularity`, `filter_variable`, `tag_names`) | none: use https://fred.stlouisfed.org/searchresults/?st=... in a browser, then the `request_schema` search `describe <IDs>` |
14
+ | Regional | GeoFRED `geofred/series/group?series_id=`, `geofred/regional/data` (`series_group`, `region_type` state/county/msa/bea/frb/necta/censusregion/country, `date`, `season`, `units`, `frequency`) | explicit per-area IDs (CAUR, TXUR ...; CAPCPI ...) through fredgraph.csv |
15
+ | Errors | HTTP 400 JSON `{"error_code":400,"error_message":"Bad Request. The value for variable api_key is not registered. ..."}`; 429 above 120 requests a minute; 404 unknown series (docs) | 404 with an **HTML page** for an unknown ID (not CSV); check the content |
16
+ | Limits | 120 requests/minute; `limit` 100000 observations per call (paged); 2000 vintage dates per call (docs) | not published: be gentle (fetch paces about 1.8 requests a second); a graph holds **at most 12 series** and silently drops the rest |
17
+
18
+ ## Parameters worth knowing (`series/observations`, and the graph equivalents)
19
+ - Dates: `observation_start`/`observation_end` (graph: `cosd`/`coed`, one value per ID).
20
+ - `units` (graph: `transformation`): `lin` levels, `chg` change, `ch1` change from a year ago, `pch` percent
21
+ change, `pc1` percent change from a year ago, `pca` compounded annual rate, `cch`/`cca` continuously
22
+ compounded, `log`. The column becomes `X_PC1` etc. on the graph route.
23
+ - `frequency` (graph: `fq` = Monthly, Quarterly, Annual ...) with `aggregation_method` `avg`/`sum`/`eop`
24
+ (graph: `fam`). Only to a lower frequency. **FRED averages whatever observations exist**: a quarter with a
25
+ missing month still gets a value (CPI, October 2025). Prefer native frequency and convert only complete
26
+ periods yourself (count the observations in each period).
27
+ - Several IDs in one graph CSV: date bounds must be given per ID (`cosd=a,b`); mixed frequencies come back as
28
+ a **zip** with `monthly.csv`, `quarterly.csv`. fetch sends one ID per CSV request.
29
+
30
+ ## Dates that mean something else
31
+ - Fiscal-year dollar series (FYONET, FYFR, FYFSD, FYOINT) are dated at the **end** of the fiscal year
32
+ (2025-09-30 = FY2025); fiscal-year percent-of-GDP series (FYFSGDA188S, FYOIGDA188S) at **January 1** of the
33
+ fiscal year's number. `compute`'s `fiscal_year` maps both to 2025.
34
+ - Quarterly data are dated at the first day of the quarter (2026-04-01 = 2026 Q2); monthly at the first of
35
+ the month; weekly at the week's end day (MORTGAGE30US: Thursday); "Quarterly, End of Period" stocks
36
+ (FYGFDPUN, GFDEBTN) are still dated at the quarter's first day.
37
+ - CBO series (GDPPOT, NGDPPOT, NROU) run about **ten years into the future**: projections, not data.
38
+ - USREC is 1 "from the period following the peak through the trough": the first shaded month is the month
39
+ after the NBER peak.
40
+
41
+ ## Terms of use (https://fred.stlouisfed.org/docs/api/terms_of_use.html, https://fred.stlouisfed.org/legal/)
42
+ - Every user uses their own API key. Never share or embed one; the server keeps the key out of every file.
43
+ - No wholesale downloading, and no building a cache or archive of FRED content: request only the series and
44
+ dates the question needs. The `data/fred/` folder is the working copy for one analysis.
45
+ - Products built on the API carry: "This product uses the FRED® API but is not endorsed or certified by the
46
+ Federal Reserve Bank of St. Louis." (fetch puts it in the README when the data came from the API.)
47
+ - Copyright: each series page shows a tag: **Public Domain: Citation Requested**, **Copyrighted: Citation
48
+ Required**, or **Copyrighted: Pre-Approval Required** (S&P, some Moody's, ICE BofA ... series; for example
49
+ SP500: reproduction needs the owner's written permission). Every page also shows a generic banner "Data in
50
+ this graph are copyrighted": ignore the banner, read the **tag**. With a key fetch reads that tag
51
+ from `fred/series/tags` (group `cc`, e.g. "public domain: citation requested"; verified live 2026-10-22)
52
+ and fall back to the notes ("Copyright, ..." → `copyrighted`) only when the tags cannot be read; keyless
53
+ downloads are `unknown`. `no_copyright_notice` (notes fallback) is not proof of public domain: USREC's
54
+ notes carry no "Copyright", yet its tag is Copyrighted: Citation Required (checked 2026-10-20). Both are shareable with a
55
+ citation; for a report, read the tag of any series from a private publisher before sharing its data.
56
+ - Citation (the series page's "Suggested Citation"): "U.S. Bureau of Economic Analysis, Real Gross Domestic
57
+ Product [GDPC1], retrieved from FRED, Federal Reserve Bank of St. Louis; https://fred.stlouisfed.org/series/GDPC1,
58
+ October 20, 2026."
59
+
60
+ ## Keyed responses (checked live with a key, 2026-10-20)
61
+ - **As of a date** (`vintage_dates=D1,D2`): rows by real-time period (`realtime_start`/`realtime_end`); fetch
62
+ assigns each row to every requested vintage date inside its period.
63
+ - **Full history** (`realtime_start=1776-07-04&realtime_end=9999-12-31`): one row per value and real-time period;
64
+ `vintage` = the date the value was published. To rebuild the series as known on a date, keep for each period
65
+ the row whose real-time window contains that date (`realtime_start` <= date <= `realtime_end`).
66
+ - **First release** (`output_type=4`): needs the same full real-time window, or FRED answers HTTP 400 "No
67
+ vintage dates exist for the specified real-time period". Each row's `realtime_start` is its first publication
68
+ date (GDPC1 2020 Q2: 17,205.822, published 2020-07-30).
69
+ - **GeoFRED** `regional/data`: `{"meta": {"title", "region", "seasonality", "units", "frequency", "data": {date:
70
+ [{region, code, value (a number), series_id}]}}}`. The title can name a different month than the date key
71
+ (a September title for 2026-08-01 data); trust the date key. `series/group` gives the group, region type,
72
+ season, units, frequency and `max_date` for a member series (CAUR → group 1224, 50 states and DC).
73
+ - Output types 2 and 3 (by vintage, in columns) are not used by fetch; it still parses their documented
74
+ `<ID>_<YYYYMMDD>` columns in case a raw file has them.
75
+ - In the manual bundle, a GeoFRED request without `series_group` takes two calls; the download scripts make one
76
+ request per file and cannot chain them, so INSTRUCTIONS.md marks it as step 1 of 2: put `series_group` in the
77
+ spec's `regional` block to download it in one step.
78
+ - `series/vintagedates` of a derived series lists only the releases in which one of its (rounded) values changed:
79
+ A191RL1Q225SBEA has 68 vintages since July 30, 2020, GDPC1 has 74. Count or list releases from the levels
80
+ series (or the union), never from a growth-rate series alone.
81
+
82
+ ## Release calendar and whole releases (checked live 2026-10-20)
83
+ - `fred/release/dates?release_id=N&realtime_start=D&realtime_end=9999-12-31&include_release_dates_with_no_data=true`
84
+ lists a release's dates, scheduled future dates included (Employment Situation, release 50: 2026-10-02,
85
+ 2026-11-06, 2026-12-04); `fred/releases/dates` lists every release between two dates. The one-release form
86
+ gives no `release_name`. `request_schema` search `release_dates [ID]` or spec `release_dates`.
87
+ - FRED API v2 `fred/v2/release/observations?release_id=N&format=json&limit=L` returns every series of a
88
+ release with its observations and FRED's copyright tag (`copyright_id`, e.g. "public domain: citation
89
+ requested"), which v1 does not expose. Paging: `has_more` + `next_cursor` ("SERIES_ID,YYYY-MM-DD"); a page
90
+ can end inside a series, so the next page continues it (the pack merges them). **The key goes in the header
91
+ `Authorization: Bearer <key>`**; `api_key` in the query answers HTTP 401 `{"code":401,"message":"Missing or
92
+ invalid credentials."}`. v2 error
93
+ bodies arrive gzip-compressed even without `Accept-Encoding`. Release 53 (GDP) holds thousands of series:
94
+ cap with `limit`, `max_pages` and a `series` filter.