Published
Edited
Sep 30, 2021
2 stars
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
import { swatches } from "@d3/color-legend"
Insert cell
dsfr = ({
"Ouverture des données": "#FF6F4C",
"Partage de données (API)": "#FF9940",
"Codes sources": "#FDCF41",
"Algorithmes": "#FFE800",
"Exploitation des données (dataviz, IA, hubs...)" :"#00AC8C",
"Acculturation / Formation": "#169B62",
"Gouvernance": "#466964",
"Pilotage feuille de route": "#484D7A",
"Engagements Circulaire": "#5770BE",
"Animation de communauté": "#FF8D7E",
"Ethique, juridique et régulation": "#E1000F",
"Carrière et gestion RH": "#A26859",
"Moyens": "#7D4E5B"
})
Insert cell
color = ({
type: "categorical",
domain: Object.keys(dsfr),
unknown: "#ccc",
range: Object.values(dsfr)
})
Insert cell
Insert cell
Insert cell
Insert cell
//raw = FileAttachment("Actions_Ministères_FDR-Grid view(1).csv").csv()
raw = await d3.dsv(";", "https://www.data.gouv.fr/fr/datasets/r/1d3b31e2-8518-4d1f-bdfb-d57287ca0728")
Insert cell
Inputs.table(raw)
Insert cell
thematiques = [...new Set(raw.map(a => a["Thématiques"]))]
.sort((a,b) => raw.filter(x => x["Thématiques"] == b).length - raw.filter(x => x["Thématiques"] == a).length)
Insert cell
Inputs.table(thematiques.map(t => ({ thematique: t, count: raw.filter(a => a["Thématiques"] == t).length })))
Insert cell
ministeres = [...new Set(raw.map(a => a["Ministères"]))]
.sort((a,b) => raw.filter(x => x["Ministères"] == b).length - raw.filter(x => x["Ministères"] == a).length)
Insert cell
Inputs.table(ministeres.map(m => ({ ministere: m, count: raw.filter(a => a["Ministères"] == m).length })))
Insert cell
function echeanche_duration(text){
}
Insert cell
echeances = [...new Set(raw.map(a => a['Echéances']))].map(e =>{
let text = e
let start = undefined //new Date()
let end = undefined // new Date()

if (e == 'NA') {
start = null
end = null
} else if (e == 'CONT') {
start = new Date('2021-01-01')
end = new Date('2024-12-31')
} else {
let parts = e.split(' ')
let y = undefined
let s_start = undefined
let s_end = undefined
if ( parts.length == 1) {
y = parts
s_start = '01-01'
s_end = '12-31'
} else if (parts[0] == "S1"){
y = parts[1]
s_start = '01-01'
s_end = '06-30'
} else {
y = parts[1]
s_start = '07-01'
s_end = '12-31'
}

start = new Date(`${y}-${s_start}`)
end = new Date(`${y}-${s_end}`)
}

let actions = raw.filter(a => a["Echéances"] == e)
return {text, start, end, actions}
})
.sort((a,b) => b.end - a.end)
.sort((a,b) => a.start - b.start)
Insert cell
data = echeances
.map(e => e.actions.map(a => ({...a, e})))
.flat()
.sort((a,b) => thematiques.indexOf(a['Thématiques']) - thematiques.indexOf(b['Thématiques']))
.sort((a,b) => b.end - a.end)
.sort((a,b) => a.e.start - b.e.start)
Insert cell
import { datasetCard, organizationCard, reuseCard } from '@taniki/datagouvfr-oembed'
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