Published
Edited
Oct 21, 2019
Insert cell
html `temporarly broken due to source file key changing - will fix soon`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
html `Plan is to eventually use the drop down to select groups of projects who cluster together based on nlp tags, but it isn't working yet, <i>cough cough Elliot</i>. These clusters were created using agglomerative clustering in Scikit-learn. The tags that serve as the name for each cluster are the tags most common in each cluster while not also being super common in other clusters. `
Insert cell
viewof clusters_selected = select({
description: "Select a cluster to visualize",
options: cluster_descriptions_for_selection,
multiple: true,
value:["Spinach"]
})
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
codejson = d3.json('https://raw.githubusercontent.com/nasa/Open-Source-Catalog/master/code.json')
Insert cell
catalogjson = d3.json('https://raw.githubusercontent.com/nasa/code-nasa-gov/master/data/catalog.json')
Insert cell
catalog_clusters_demo_v1 = d3.json('https://gist.githubusercontent.com/JustinGOSSES/23af5c123a6df8d2c5d86055c56d72c2/raw/d1921435bc5c2e45401dbe53763fc30bfd68fb65/catalog_clusters_demo_v1.json')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function getAllTagClusterDescriptions(catalog_clusters_demo_v1){
var cluster_descriptions = []
var cluster_names = []
const clusters_infos = Object.values(catalog_clusters_demo_v1)
for (var i = 0; i < clusters_infos.length; i++){
cluster_descriptions.push(clusters_infos[i]["keyword_descriptions"])
cluster_names.push(clusters_infos[i]["project_names"])
}
var results = [cluster_descriptions,cluster_names]
return results
}
Insert cell
Insert cell
cluster_descriptions = cluster_desc_and_name_in_array[0]
Insert cell
cluster_names = cluster_desc_and_name_in_array[1]
Insert cell
function make_cluster_descriptions_for_selection(cluster_descriptions){
var cluster_descriptions_for_selection = []
for (var i = 0; i < cluster_descriptions.length; i++){
var cluster_desc_string = cluster_descriptions[i].join()
cluster_descriptions_for_selection.push(cluster_desc_string)
}
return cluster_descriptions_for_selection
}
Insert cell
cluster_descriptions_for_selection = make_cluster_descriptions_for_selection(cluster_descriptions)
Insert cell
Insert cell
Insert cell
catalogNLPcounts = countNLPTags(catalogjson)
Insert cell
html`<h4>Function that gets lists of all the Categories, those that were human-generated, with counts</h4>`
Insert cell
Insert cell
Insert cell
catalogHumancounts = countHumanTags(catalogjson)
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
vegalite({
"width": 820,
"height": 120,
data: {values: nasa_code_on_github},
mark: "line",
encoding: {
x: {timeUnit: "year-month", field: "created_at", type: "temporal"},
y: {aggregate: "sum", field: "stargazers", type: "quantitative"}
}
})
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
catalogNLPcounts_obj = turnCountsIntoObj(catalogNLPcounts)
Insert cell
catalogNLPcounts_obj["name"]
Insert cell
Insert cell
width = 932
Insert cell
height = width
Insert cell
format = d3.format(",d")
Insert cell
color = d3.scaleLinear()
.domain([0, 5])
.range(["hsl(152,80%,80%)", "hsl(228,30%,40%)"])
.interpolate(d3.interpolateHcl)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {form} from "@mbostock/form-input"
Insert cell
vegalite = require("@observablehq/vega-lite@0.1")
Insert cell
Insert cell
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