Public
Edited
Mar 7, 2023
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
screenshot20230225At122836Pm = FileAttachment("Screenshot 2023-02-25 at 12.28.36 PM.png").image()
Insert cell
causes = await FileAttachment(
"Appendix C - Train Accident Cause Codes.csv"
).csv()
Insert cell
causesLookup = (code) => {
return causes.filter((d) => {
if (d.Code.trim() == code) {
return d;
}
})[0];
}
Insert cell
causesLookupType = (code, type) => {
if (type.length > 0) {
return causes.filter((d) => {
if (d.Code.trim() == code) {
return d;
}
})[0][type];
} else {
return causes.filter((d) => {
if (d.Code.trim() == code) {
return d;
}
})[0];
}
}
Insert cell
causesLookupType("E51C", "Description")
Insert cell
accidentTypeLookup = ({
"01": "Derailment",
"02": "Head on collision",
"03": "Rearend collision",
"04": "Side collision",
"05": "Raking collision",
"06": "Broken train collision",
"07": "Hwy-rail crossing",
"08": "RR Grade Crossing",
"09": "Obstruction",
"10": "Explosive-detonation",
"11": "fire/violent rupture",
"12": "Other impacts",
"13": "Other (described in narr)"
})
Insert cell
accidentTypeLookup["01"]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
raw2022 = FileAttachment("2022raw@1.csv").csv()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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