Published
Edited
Mar 25, 2022
Insert cell
# Mapping census for ARPA
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
searchData
Insert cell
searchData
.params({ search: op.lower(search) })
.derive({ workIndex: (d) => op.indexof(d.text_process, search) })
.derive({
startIndex: (d) => d.workIndex - 100,
endText: (d) => d.workIndex + 100
})
.derive({
exampleSentence: (d) => op.slice(d.text_process, d.startIndex, d.endText)
})
.select("name", "exampleSentence"),
{ layout: "auto" }
Insert cell
searched_pdfs = dataRaw.filter(i=> typeof(i.text) == 'string' && i.text.includes(search)).map(i=>i.filename.split('/')[2])
Insert cell
searched_counties = pdf_linkage.filter(i=> searched_pdfs.includes(i['PDF Name'])).map(i=> i.counties)
Insert cell
typeof('acdb')
Insert cell
options = Object.keys(county_data[0]).filter((i) => !ignore_columns.includes(i))
Insert cell
ignore_columns = ["geoid", "countyfp", "name"]
Insert cell
Insert cell
Insert cell
data_url = 'https://mchapioviz.s3.us-east-2.amazonaws.com/arpa_counties.csv'
Insert cell
Insert cell
Insert cell
counties_geojson = d3.json('https://cdn.jsdelivr.net/npm/us-atlas@2/us/10m.json')
Insert cell
Insert cell
Insert cell
Insert cell
county_data = FileAttachment("acs5_2019_medianage_counties.csv").csv()
Insert cell
searchData = data
.params({ search: op.lower(search) })
.filter((d) => op.includes(d.text_process, search))
Insert cell
data = aq
.from(dataRaw)
.derive({ name: (d) => op.replace(d.filename, "output_data/pdfs/", "") })
Insert cell
dataRaw = FileAttachment("parsed_pdf_text.csv").csv({ typed: true })
Insert cell
pdf_linkage = FileAttachment("Treasury Scrape-Has Recovery Plan(2).csv").csv()
Insert cell
FileAttachment("acs5_2019_medianage_counties.csv").csv()
Insert cell
d3 = require('d3')
Insert cell
d3.csv('https://raw.githubusercontent.com/red-bin/arpascraper/main/data/arpa_scrape.csv')
Insert cell
import {vl} from '@vega/vega-lite-api'
Insert cell
import { select,radio,checkbox, slider, text } from "@jashkenas/inputs"
Insert cell
import {rangeSlider} from '@mootari/range-slider'
Insert cell
import { aq, op } from "@uwdata/arquero"
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