Public
Edited
Mar 4, 2024
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
artistesJE = artistesmonareconciliation.concat(artistesIles)
Insert cell
Object.keys(artistesmonareconciliation[0])
Insert cell
Object.keys(artistesIles[0])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
artistesMONA_both = artistesJE.filter(d => d.id_wikidata != "" && d.id_ULAN != "")
Insert cell
artistesMONA_both
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ulan_500275139 = FileAttachment("ulan_500275139.json").json()
Insert cell
ulan_500542593 = FileAttachment("ulan_500542593.json").json()
Insert cell
ulan_500715034 = FileAttachment("ulan_500715034.json").json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
testRimouski = testAssociationGenre.filter(d => d.territory=="Rimouski (Bas-Saint-Laurent)" && d.wiki == true).map(d => d.artists[0].id)
Insert cell
_.uniqBy(testRimouski)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
testAssociationGenre = {
var resultat = []

artworks.forEach(art =>{
var genre = associationGenreAOeuvre(art.artists)
art.genre = genre

art.artists ? art.wiki = getArtistWiki(art.artists[0].id) : art.wiki = false
resultat.push(art)
})
return resultat
}
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
function getGenre(artiste){
//pour un artiste, classifie le genre selon l'état des recherches

//par défaut le genre associé est inconnu
var genreAssocie
// si on a récupéré l'identité de genre avec wikidata
if (artiste.is == "collective")
genreAssocie = "collectif"
else if (artiste.sex_or_gender != "")
genreAssocie = artiste.sex_or_gender
else if(artiste.hint_gender != "non") // si on a un hint
genreAssocie = artiste.hint_gender
else if (artiste.hint_gender == "non") //Camille n'a pas de hint de gender
genreAssocie = "inconnu"
else {
console.log("else dans getGenre()", artiste)
genreAssocie = "null"
}
return genreAssocie

}
Insert cell
Insert cell
function associationGenreAOeuvre(listeArtistes){
// adaptée depuis https://observablehq.com/@artistes-femmes-mac/donnees-et-autres-communs#associationGenreAOeuvre
//liste des genres des artistes associés à l'œuvre
var genresDesArtistes = []
var categorisation;
// *** Option 1: s'il n'y a qu'un·e artiste ***
if (listeArtistes == null)
categorisation = "pas d'artiste connu"
else if (listeArtistes.length == 1){
var id = listeArtistes[0].id

//récupérer les données à propos de l'artiste
var artiste = artistesJE.find( d => d.id == id)

if(artiste)
categorisation = getGenre(artiste)
else
categorisation = "à étudier"
}
else {
// ***Option 2: s'il y a plusieurs artistes***
//pour chaque artiste
listeArtistes.forEach(a => {
//récupérer l'id de l'artiste ou du collectif
var id = a.id
//récupérer les données à propos de l'artiste

if(artiste)
categorisation = (genresDesArtistes.push(getGenre(artiste)))
else
categorisation = genresDesArtistes.push("à étudier")
})

var nbFemmes = 0;
var nbHommes = 0;
var nbFemmesWikidata = 0;
var nbFemmesHint = 0;
var nbHommesWikidata = 0;
var nbHommesHint = 0;
var nbCollectifs = 0;
var nbGenreInconnu = 0;
var nbArtisteInconnu = 0;
var nbArtisteARenseigner = 0;

genresDesArtistes.forEach(g => {
switch(g){
case "female":
nbFemmes++;
nbFemmesWikidata++;
break;
case "male":
nbHommes++;
nbHommesWikidata
break;
case "femme":
nbFemmes++;
nbFemmesHint++
break
case "homme":
nbHommes++;
nbHommesHint;
break;
case "collectif":
nbCollectifs++;
break;
case "inconnu":
nbGenreInconnu++;
break;
case "pas d'artiste connu":
nbArtisteInconnu++;
break;
case "à étudier":
nbArtisteARenseigner++;
break;
}
})

var total = listeArtistes.length
if (nbCollectifs != 0) //s'il y a un collectif dans la liste, on catégorise collectif
categorisation = "collectif"
else if (nbArtisteARenseigner != 0)
categorisation = "à étudier"
else if(nbFemmesWikidata == total) //si toutes les artistes sont des femmes identifiées dans wikidata
categorisation = "female"
else if (nbFemmesHint == total) //si toutes les artistes sont des femmes selon l'évaluation de Camille
categorisation = "femme"
else if (nbHommesWikidata == total) //si tous les artistes sont des hommes identifiés dans wikidata
categorisation = "male"
else if (nbHommesHint == total) //si tous les artistes sont des hommes selon l'évaluation de Camille
categorisation = "homme"
else if (nbFemmes == total) //si tous les artistes sont des hommes selon Wikidata et selon l'évaluation de Camille
categorisation = "femme"
else if (nbHommes == total)//si toutes les artistes sont des femmes selon Wikidata et selon l'évaluation de Camille
categorisation = "homme"
else if (nbHommes != 0 && nbFemmes != 0) // groupe mixte
categorisation = "mixte"
else {
console.log("cas non traité", listeArtistes)

}

}

return categorisation
}
Insert cell
import {data as artworks} from "31e2814f23fffc4a"
Insert cell
Insert cell
2023-09-29ArtistesMONAReconciliation.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
2023-10-06IlesMadeleines.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
artistesIles = {
var resultat = []
ilesmadeleines.forEach(a => {
var current = a

if (current.hint_gender !="non")
current.is = "artiste"
else
current.is = "collective"
current.is = "artiste"
current.website = ""
current.wikipedia = ""
current.facebook = ""
current.instagram = ""

resultat.push(current)
})
return resultat
}
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