Published
Edited
Apr 29, 2021
Fork of DS4200
1 fork
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

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
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
zipcode_food = getZipFood();
Insert cell
Insert cell
Insert cell
// //Use the query to do the recommendation.
// givenQuery =
// "call {match (f:Food {categories:"+addApostrophe(foodtype)+"})<-[:Assoc]-(r:Restaurant)-[:Assoc]-> (f2:Food) where f2.categories <> 'Restaurants' and f2.categories <> 'Food' with f2, count(*) as nAssoc order by count(*) desc limit 5 return collect(f2.categories) as topcat} match (c:City)<-[rel1:Assoc {ZIPCode:"+addApostrophe(zipcode)+"}]-(r2:Restaurant)-[rel2:Assoc]->(f3:Food) with r2, c, f3, rel1, rel2 where f3.categories in topcat or f3.categories = "+addApostrophe(foodtype)+" match (h:Hours)<-[m:Assoc]-(r2)-[rel3:Assoc]->(s:stars) where h.name = "+addApostrophe(time)+" and time(head(split(m.Time, '-'))) <= time() + duration({hours:-4}) return r2, c, s, f3, m, rel1, rel2,rel3 order by s.Stars desc limit 10"
Insert cell
// //Get the data according to query.
// queryArrayOriginal = buildDataArrayOriginal(givenQuery);
Insert cell
// //Deal with the original data.
// queryArray = queryArrayOriginal.records
Insert cell
// //Final array that include the data in {node, link} structure.
// finalArray = dealWithDataWithParallel(queryArray);
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mapValue = {
thirdTypeFinalArray.links.map(d => d.value = 1)
}
Insert cell
mapRadius = {
thirdTypeFinalArray.nodes.map(d => d.radius = thirdTypeFinalArray.links.filter(a => a.source === d.ID || a.target === d.ID).length)
}
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

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