Public
Edited
Jan 21, 2024
1 fork
Insert cell
md`# Course Videos`
Insert cell
`mutation CreateVideos {
${statements.join("\n")}
}`
Insert cell
statements = _.map(
_.map(rawData, objectMapper),
createMutationMapper('createVideo')
);
Insert cell
function createMutationMapper(name){
return (input, i) => ` ${name}_${i}: ${name}(input: ${Serializer(input).replace(/\'/g, "\"")} ){ id }`;
}
Insert cell
function objectMapper(input, i){
return {
id: input.id,
title: input.title,
durationInSeconds: parseInt(input.durationInSeconds, 10),
videoUrl:input.videoUrl
};
}
Insert cell
rawData = FileAttachment("Tennessee Carry Course Data - Videos.csv").csv()
Insert cell
md`# Appendix`
Insert cell
d3 = require("d3@5")
Insert cell
_ = require("lodash");
Insert cell
sac = import('https://cdn.pika.dev/serialize-as-code@%5E1.3.1');
Insert cell
Serializer = sac.Serializer.create(o => {
if(o === "MULTIPLE_CHOICE") return "MULTIPLE_CHOICE";
});
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more