Published
Edited
Oct 16, 2020
2 forks
Insert cell
Insert cell
Insert cell
viewof monthSelect = select({
title: `What Month`,
options: yrmonth,
value: yrmonth[0],
description: 'Select the month and year'
})
Insert cell
viewof drug = text({title: "Drug Search", placeholder: "Enter a drug name", description: "Note that searches need to be case sensitive"})
Insert cell
drug_filter = data.filter(element => element["VMP_PRODUCT_NAME"].includes(drug));
Insert cell
table(drug_filter)
Insert cell
Insert cell
Insert cell
Insert cell
import {text} from "@jashkenas/inputs"
Insert cell
import {checkbox} from "@jashkenas/inputs"
Insert cell
Insert cell
Insert cell
import {table} from "@tmcw/tables/2"
Insert cell
md `## Sources

The csv files have the schema https://storage.googleapis.com/datopian-nhs/scmd/SCMD_{yrmonth}.csv`
Insert cell
Insert cell
yrmonth
Insert cell
d3 = require("d3")
Insert cell
data = d3.csv(hero + url)
Insert cell
data[0]["VMP_PRODUCT_NAME"].search("Twat")
Insert cell
Insert cell
available_VMP = {
var all_VMP = []
for (var i = 0; i < data.length; i++){
let d = data[i]["VMP_PRODUCT_NAME"];
// if available_VMP.find(
all_VMP.push(d);
}
return [...new Set(all_VMP)]; // removes duplicates
}
Insert cell
test = 'Methotrexate'
Insert cell
Insert cell
Insert cell
url = `https://storage.googleapis.com/datopian-nhs/scmd/SCMD_${monthSelect}.csv`
Insert cell
md `dollar{variable} allows use of template literals`
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

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