Public
Edited
Oct 16, 2024
Insert cell
Insert cell
ajoutBot_2024-09-26@1.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
data2 = [{id_oeuvre: 1852, artiste: "Danaé Brissonnet", id_wikidata_artiste: "Q124847247"}, {id_oeuvre: 1523, artiste: "Borrris", id_wikidata_artiste:"Q125024491"}]
Insert cell
resultat2 = {
var resultat = []

for (var i = 0; i < data2.length ; i++){
var current = {
"artwork_id": data2[i].id_oeuvre,
"wikidata_qid": null,
}

var artwork = artworksAPI.data.find(d => d.id == data2[i].id_oeuvre)

current.title_fr = artwork.title.fr
current.title_en = artwork.title.en
current.latitude = artwork.location.lat
current.longitude = artwork.location.lng
current.year = Number(artwork.produced_at)
current.category = artwork.categories ? artwork.categories.fr[0] : null //attention on prend juste la première catégorie
current.artist_id = artwork.artists[0].id // attention on prend juste le·a première artiste
current.artist_name = artwork.artists[0].name
current.artist_wikidata = data2[i].id_wikidata_artiste
resultat.push(current)
}

return resultat


/*"latitude": 45.541759,
"longitude": -73.613317,
"year": 2018,
"category": null,
"artist_id": 682,
"artist_name": "Julie Favreau",
"artist_wikidata": "Q120967504"*/
}
Insert cell
Select a data source…
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
/*
{
"artwork_id": 26,
"wikidata_qid": "Q130364331",
"title_fr": "Moments",
"title_en": "Moments",
"latitude": 45.541759,
"longitude": -73.613317,
"year": 2018,
"category": null,
"artist_id": 682,
"artist_name": "Julie Favreau",
"artist_wikidata": "Q120967504"
}

*/
Insert cell
artworksAPI = d3.json("https://picasso.iro.umontreal.ca/~mona/api/v3/artworks")
Insert cell
data = {
var resultat = []

for (var i = 0; i < dataStart.length ; i++){
var current = {
"artwork_id": dataStart[i].id_oeuvre,
"wikidata_qid": null,
}

var artwork = artworksAPI.data.find(d => d.id == dataStart[i].id_oeuvre)

current.title_fr = artwork.title.fr
current.title_en = artwork.title.en
current.latitude = artwork.location.lat
current.longitude = artwork.location.lng
current.year = Number(artwork.produced_at)
current.category = artwork.categories ? artwork.categories.fr[0] : null //attention on prend juste la première catégorie
current.artist_id = artwork.artists[0].id // attention on prend juste le·a première artiste
current.artist_name = artwork.artists[0].name
current.artist_wikidata = dataStart[i].id_wikidata_artiste
resultat.push(current)
}

return resultat


/*"latitude": 45.541759,
"longitude": -73.613317,
"year": 2018,
"category": null,
"artist_id": 682,
"artist_name": "Julie Favreau",
"artist_wikidata": "Q120967504"*/
}
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