Published
Edited
Mar 10, 2021
Insert cell
md`# Toxicology Websites`
Insert cell
md`Select from the categories below. Press Ctrl to select multiple choices.`
Insert cell
viewof selected_data_types = Select(unique_data_types, {label: "Select Species type", multiple: true, value: default_data_types})
Insert cell
viewof selected_Citations = Select(unique_Citations, {label: "Select Citations", multiple: true, value: default_Citations})
Insert cell
viewof selected_assay_type = Select(unique_assay_type, {label: "Select assay type", multiple: true, value: default_assay_type})
Insert cell
viewof selected_Prediction_type = Select(unique_Prediction_type, {label: "Select Prediction type", multiple: true, value: default_Prediction_type})
Insert cell
Table(filtered_datasets)
Insert cell
pie_chart_data = unique_assay_type.map(assay_type => {return {
"label": assay_type,
"count": filtered_datasets.filter(item => item["assay type"] == assay_type).length
}})
Insert cell
genPieChart(pie_chart_data, "count", "label", "Pie chart representation of assay types")
Insert cell
vl.markBar()
.data(filtered_datasets)
.encode(
vl.y().count(),
vl.x().fieldN("assay type"),
)
.width(600).height(400).render()
Insert cell
filtered_datasets = dataset
.filter(item => selected_Prediction_type.includes(item["Prediction type"]))
.filter(item => selected_assay_type.includes(item["assay type"]))
.filter(item => selected_Citations.includes(item["Citations"]))
.filter(item => selected_data_types.includes(item["Species type"]))
Insert cell
default_Citations = unique_Citations
Insert cell
unique_Citations = get_unique_elements(dataset, "Citations")
Insert cell
default_Prediction_type = unique_Prediction_type
Insert cell
unique_Prediction_type = get_unique_elements(dataset, "Prediction type")
Insert cell
default_assay_type = unique_assay_type
Insert cell
unique_assay_type = get_unique_elements(dataset, "assay type")
Insert cell
default_data_types = unique_data_types
Insert cell
unique_data_types = get_unique_elements(dataset, "Species type")
Insert cell
function get_unique_elements(array, property_name) {
var set = new Set(array.map(x => x[property_name]));
return Array.from(set).filter(function(item) {return item != null;}).sort()
}
Insert cell
dataset = fetch_dataset_to_array(dataset_url, {})
Insert cell
function fetch_dataset_to_array(dataset_url, query_options) {
return fetch(dataset_url, query_options).then(response_dataset => {
if (!response_dataset.ok) throw new Error(response_dataset.status);
return response_dataset.json();}).then(json => json.results.map(x => x.data));
}
Insert cell
dataset_url = base_url_edelweiss + dataset_id + "/versions/latest/data"
Insert cell
base_url_edelweiss = 'https://api.edelweissdata.com/datasets/'
Insert cell
dataset_id = "533b07e0-4645-40c4-98b7-99785641d1e6"
Insert cell
import {Select, Range, Toggle, Table} from "@observablehq/inputs"
Insert cell
import {genPieChart} from "@floran-hachez/vega-lite-pie-chart"
Insert cell
import { vl } from "@vega/vega-lite-api"
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