Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newsletter décembre #83

Merged
merged 45 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
178e838
prepare news
linogaliana Dec 14, 2023
6a88a3e
prépare le post
linogaliana Dec 14, 2023
7a9d125
Préparation infolettre
linogaliana Dec 14, 2023
236fcc6
retour
linogaliana Dec 14, 2023
c833d5c
mixtral et openai
linogaliana Dec 15, 2023
ece97ae
finalise
linogaliana Dec 15, 2023
03adb9d
image
linogaliana Dec 15, 2023
de859af
améliore
linogaliana Dec 15, 2023
1e5ff98
to do
linogaliana Dec 15, 2023
8c851f9
retour _quarto
linogaliana Dec 15, 2023
c64e90d
improve stats
linogaliana Dec 15, 2023
373defa
spoiler
linogaliana Dec 15, 2023
c430e72
end
linogaliana Dec 15, 2023
ab1064f
snow
linogaliana Dec 17, 2023
63e40b3
snow
linogaliana Dec 17, 2023
3b11ef6
js
linogaliana Dec 18, 2023
45fc848
new featured
linogaliana Dec 18, 2023
b1d6d93
Update infolettre/infolettre_16/index.qmd
linogaliana Dec 18, 2023
8c53957
Update infolettre/infolettre_16/index.qmd
linogaliana Dec 18, 2023
f87eec3
Update infolettre/infolettre_16/index.qmd
linogaliana Dec 18, 2023
dcbdc6a
Update infolettre/infolettre_16/index.qmd
linogaliana Dec 18, 2023
df3cce8
Update infolettre/infolettre_16/index.qmd
linogaliana Dec 18, 2023
fc95b2d
Update infolettre/infolettre_16/index.qmd
linogaliana Dec 18, 2023
5328de8
Update infolettre/infolettre_16/index.qmd
linogaliana Dec 18, 2023
1222dee
Update infolettre/infolettre_16/index.qmd
linogaliana Dec 18, 2023
ced158d
Update infolettre/infolettre_16/index.qmd
linogaliana Dec 18, 2023
f85b941
Update infolettre/infolettre_16/index.qmd
linogaliana Dec 18, 2023
0e675f5
Apply suggestions from code review
linogaliana Dec 18, 2023
74e6beb
Update index.qmd
linogaliana Dec 18, 2023
9e5a18e
Apply suggestions from code review
linogaliana Dec 18, 2023
4e0a67c
Apply suggestions from code review
linogaliana Dec 18, 2023
01c9d10
corrige liens morts
linogaliana Dec 18, 2023
130ce53
delete paragraph
linogaliana Dec 18, 2023
dec4a03
web assebmyl
linogaliana Dec 18, 2023
3141748
clean
linogaliana Dec 18, 2023
d862d92
correction typo
linogaliana Dec 18, 2023
dc08c1f
snow stop
linogaliana Dec 18, 2023
23d2747
update
linogaliana Dec 18, 2023
85c8f95
Update infolettre/infolettre_16/_snippet_progress_participants.qmd
linogaliana Dec 18, 2023
1ff4971
conseil
linogaliana Dec 19, 2023
0bea91f
Apply suggestions from code review
linogaliana Dec 19, 2023
31bccbf
Update infolettre/infolettre_16/_snippet_progress_participants.qmd
linogaliana Dec 19, 2023
2933dd5
conseil
linogaliana Dec 19, 2023
252c085
Merge branch 'news-decembre' of https://github.com/inseefrlab/ssphub …
linogaliana Dec 19, 2023
167310a
modifs corinne
linogaliana Dec 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions _extensions/emilhvitfeldt/snow/_extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title: snow
author: Emil Hvitfeldt
version: 1.0.0
contributes:
filters:
- snow.lua
2 changes: 2 additions & 0 deletions _extensions/emilhvitfeldt/snow/assets/snowflakes.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions _extensions/emilhvitfeldt/snow/snow-init.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
new Snowflakes();
</script>
8 changes: 8 additions & 0 deletions _extensions/emilhvitfeldt/snow/snow.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function Meta(m)
quarto.doc.add_html_dependency({
name = "magic-snowflakes",
version = "6.0.1",
scripts = {"assets/snowflakes.min.js"}
})
quarto.doc.include_file("after-body", "snow-init.html")
end
linogaliana marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions infolettre/infolettre_09/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ categories:
- Retrospective

image: featured.png

filters:
- snow
---



*Vous désirez intégrer la liste de diffusion ? Un mail à <[email protected]> suffit*

La [rétrospective de l'année 2022](https://ssphub.netlify.app/post/retrospective2022/) promettait
linogaliana marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -380,3 +384,4 @@ new Runtime().module(define, name => {
if (name === "grid") return new Inspector(document.querySelector("#observablehq-grid-bbfd8ffe"));
});
</script>

165 changes: 165 additions & 0 deletions infolettre/infolettre_16/_data.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<details>

<summary>

_Inputs_ pour `DuckDB` 🦆

</summary>

```{ojs}
url_events = `https://minio.lab.sspcloud.fr/lgaliana/ssphub/files/retrospective-2023/events_orginazed_2023.json`
url_latest = 's3://lgaliana/ssphub/files/retrospective-2023/list_contacts_latest.parquet'
url_hors_ssp = 's3://lgaliana/ssphub/files/retrospective-2023/series_part_ssp.parquet'
url_latest2 = 's3://lgaliana/ssphub/files/retrospective-2023/series_nombre_contact.parquet'
```


```{ojs}
configuredClient = {
const client = await DuckDBClient.of();
await client.sql`
SET s3_endpoint='minio.lab.sspcloud.fr'
`;
return client;
}

db = {
await configuredClient.query(`
CREATE VIEW share_ssp AS
SELECT * FROM read_parquet('${url_hors_ssp}') ;
`);
await configuredClient.query(`
CREATE VIEW latest AS
SELECT * FROM read_parquet('${url_latest}') WHERE date > '2023-01-01' ;
`);
await configuredClient.query(`
CREATE VIEW serie AS
SELECT * FROM read_parquet('${url_latest2}') WHERE date > '2023-01-01' ;
`);
return configuredClient
}

```



```{ojs}
//| eval: true
serie_contacts = db.sql`
SELECT date, CAST(SUM(mail) AS int) AS mail
FROM serie
GROUP BY date
`
serie_contacts_domain = db.sql`
SELECT date, domain, CAST(mail AS int) AS mail
FROM serie
`
```

```{ojs}
hors_ssp_data = db.query(`
SELECT * FROM share_ssp WHERE date in ('2023-12-09', '2023-01-10')
`)
```


```{ojs}
events = d3.json(url_events)
```

</details>

<details>

<summary>

_Arrays_ intermédiaire

</summary>

<!----
computed objects
------>

<details>

```{ojs}
serie_contacts_complete = interpolateDates(serie_contacts);
```


```{ojs}
start_count = serie_contacts.filter((d) => dateFormat(d.date) == "2023-01-10").map((d) => d.mail)[0]
```

```{ojs}
end_count = serie_contacts.filter((d) => dateFormat(d.date) == "2023-12-09").map((d) => d.mail)[0]
```


```{ojs}
events_data_figure1 = events.filter(d => events_chosen_figure1.includes(d.type))
events_data_figure1
```

```{ojs}
nombre_events = d3.rollup(events, (D) => D.length, (d) => d.type)
```


```{ojs}
measured_dates = db.query(`SELECT DISTINCT strftime(date, '%Y-%m-%d') AS date FROM serie`)
date_selected = measured_dates.map(d => d.date)
list_dates2 = db.query(`SELECT DISTINCT strftime(date, '%Y-%m-%d') AS date FROM serie`)
```


```{ojs}
links_website_ssphub = {
const toto = {};

events_data_figure1_b.forEach(item => {
toto[item.event] = item.href;
});

return toto
}
links_website_ssphub
```

```{ojs}
events_data_figure1_b = leftJoinArrays(events_data_figure1, serie_contacts_complete, "date", 0, 40)
```

</details>

<details>
<summary>
Quelques _array_ utiles
</summary>

```{ojs}
color_mapping_events = {

const color_mapping_events = {
"Evénement virtuel ou présentiel": "#4d78a6",
"Infolettre": "#f28e2c",
"Post de blog": "#e05658",
"Masterclass": "#76b7b1"
};

return color_mapping_events
}
```



```{ojs}
dates_2023 = Array.from({length: 365}, (_, i) => {
const date = new Date(2023, 0, 1);
date.setDate(i + 1);
return date;
})
```

</details>
121 changes: 121 additions & 0 deletions infolettre/infolettre_16/_functions.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<details>

<summary>
Fonctions utilisées
</summary>

```{ojs}
dateFormat = d3.utcFormat("%Y-%m-%d")
```


<!----
Compter les événements du réseau
------>

```{ojs}
function pluralizeEvent(input) {
switch (input) {
case "Evénement virtuel ou présentiel":
return "événements virtuels ou présentiels";
case "Infolettre":
return "infolettres";
case "Post de blog":
return "posts de blog";
case "Masterclass":
return "masterclasses";
default:
return "unknown event type";
}
}
```

```{ojs}
function countEvents(x){

const pluriel = pluralizeEvent(x);

const message = `
<span style="border-bottom: solid 4px ${color_mapping_events[x]}; margin-bottom: -2px;">${nombre_events.get(x)} ${pluriel}
</span>
` ;

return message
}
```

```{ojs}
function leftJoinArrays(array1, array2, key, mean, deviation) {
const randomNoise = d3.randomNormal(mean, deviation);

// Sort arrays by date
array1.sort((a, b) => new Date(a.date) - new Date(b.date));
array2.sort((a, b) => new Date(a.date) - new Date(b.date));

// Perform left join
const result = array1.map((item1, index) => {
const matchingItem = array2.find((item2) => item2[key] === item1[key]);
const noise = matchingItem ? randomNoise() : 0;
const noisedMail = matchingItem ? matchingItem.mail + noise : undefined;
return { rowNumber: index + 1, ...item1, ...matchingItem, noisedMail };
});

return result;
}
```


<!----
Manipulation de listes ou arrays
------>

```{ojs}
function unique(data, accessor) {
return Array.from(new Set(accessor ? data.map(accessor) : data));
}
```

```{ojs}
function interpolateDates(data) {
// Sort the data by date
data.sort((a, b) => new Date(a.date) - new Date(b.date));

// Create an array to store the interpolated data
const interpolatedData = [];

// Loop through the data to interpolate values between dates
for (let i = 0; i < data.length - 1; i++) {
const currentDate = new Date(data[i].date);
const nextDate = new Date(data[i + 1].date);

// Calculate the difference in days between current and next date
const daysDiff = (nextDate - currentDate) / (1000 * 60 * 60 * 24);

// Calculate the daily increment
const dailyIncrement = (data[i + 1].mail - data[i].mail) / daysDiff;

// Interpolate values for each day between the current and next date
for (let j = 0; j < daysDiff; j++) {
const interpolatedDate = new Date(currentDate);
interpolatedDate.setDate(currentDate.getDate() + j);

const interpolatedValue = data[i].mail + j * dailyIncrement;

interpolatedData.push({
date: interpolatedDate.toISOString().split('T')[0],
mail: Math.round(interpolatedValue), // Round to the nearest integer
});
}
}

// Add the last data point
interpolatedData.push({
date: data[data.length - 1].date,
mail: data[data.length - 1].mail,
});

return interpolatedData;
}
```

</details>
Loading
Loading