Public
Edited
Jun 27, 2024
Importers
Insert cell
Insert cell
USSenateVotingData = {
const votingsZip = await FileAttachment("US_senate_voting_2024@1.zip").zip();

return await Promise.all(
votingsZip.filenames.map(async (f) =>
votingsZip
.file(f)
.text()
.then(xmlToJSON)
.then((res) => res.roll_call_vote)
)
).then(res => res.map(
r => {
r.parsed_date = new Date(r.vote_date);
return r;
}
));
}
Insert cell
downloadURL = DOM.download(
new Blob([urls], { type: "text/csv" }),
"us_senate_urls.txt",
"Download URLS"
)
Insert cell
data = xmlToJSON(await FileAttachment("vote_menu_118_2.xml").text())
Insert cell
urls = data.vote_summary.votes.vote.map(
(v) =>
`https://www.senate.gov/legislative/LIS/roll_call_votes/vote${
"" + data.vote_summary.congress + data.vote_summary.session
}/vote_${data.vote_summary.congress}_${data.vote_summary.session}_${v.vote_number}.xml`
).join("\n")
Insert cell
import {xmlToJSON} from "@visnup/xml-to-json"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more