Skip to content

Commit 63296a5

Browse files
Show the numbers of ORCID record connects and opt-ins to request notifications
Refs PREreview/prereview.org#3317
1 parent c8af9c8 commit 63296a5

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/data/private/users.json.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const Users = Schema.Array(
99
Schema.Struct({
1010
orcid: OrcidId.OrcidIdSchema,
1111
careerStage: Schema.OptionFromUndefinedOr(Schema.Literal('early', 'mid', 'late')),
12+
requestNotifications: Schema.Literal('not-opted-in', 'opted-in', 'opted-out'),
13+
orcidRecordConnected: Schema.Boolean,
1214
location: Schema.OptionFromUndefinedOr(Schema.String),
1315
timestamp: Schema.Union(Temporal.InstantFromStringSchema, Schema.Literal('not available from import source')),
1416
}),
@@ -18,6 +20,8 @@ const Output = Schema.Array(
1820
Schema.Struct({
1921
orcid: OrcidId.OrcidIdSchema,
2022
careerStage: Schema.OptionFromUndefinedOr(Schema.Literal('early', 'mid', 'late')),
23+
requestNotifications: Schema.Literal('not-opted-in', 'opted-in', 'opted-out'),
24+
orcidRecordConnected: Schema.Boolean,
2125
location: Schema.OptionFromUndefinedOr(Schema.String),
2226
country: Schema.OptionFromUndefinedOr(Iso3166.Alpha2CodeSchema),
2327
timestamp: Schema.OptionFromUndefinedOr(Temporal.InstantFromStringSchema),

src/private/users.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ const usersInTimePeriodWithAtLeast1ReviewPublished = d3.sum(reviewsByAuthorInTim
136136
const usersInTimePeriodWith1ReviewPublished = d3.sum(reviewsByAuthorInTimePeriod, d => (d[1] === 1 ? 1 : 0))
137137
const usersInTimePeriodWithMoreThan1ReviewsPublished = d3.sum(reviewsByAuthorInTimePeriod, d => (d[1] > 1 ? 1 : 0))
138138
const usersInTimePeriodWithMoreThan3ReviewsPublished = d3.sum(reviewsByAuthorInTimePeriod, d => (d[1] > 3 ? 1 : 0))
139+
140+
const usersInTimePeriodOptedInToRequestNotifications = d3.filter(
141+
usersInTimePeriod,
142+
user => user.requestNotifications === 'opted-in',
143+
)
144+
145+
const usersInTimePeriodOrcidRecordConnected = d3.filter(usersInTimePeriod, user => user.orcidRecordConnected)
139146
```
140147
141148
<div class="grid grid-cols-4">
@@ -265,6 +272,23 @@ function usersTimeline({ width } = {}) {
265272
</div>
266273
</div>
267274
275+
<div class="grid grid-cols-4">
276+
<div class="card">
277+
<h2>PREreviewers opted in to request notifications ${chosenYear ? ` joining in ${chosenYear}` : ''}</h2>
278+
<span class="big">${usersInTimePeriodOptedInToRequestNotifications.length.toLocaleString("en-US")}</span>
279+
${usersInTimePeriodOptedInToRequestNotifications.length > 0 ? html`
280+
<div>${d3.format(".1%")(usersInTimePeriodOptedInToRequestNotifications.length / usersInTimePeriod.length)} of all PREreviewers ${chosenYear ? ` joining in ${chosenYear}` : ''}</div>
281+
`: ''}
282+
</div>
283+
<div class="card">
284+
<h2>PREreviewers with connected ORCID record ${chosenYear ? ` joining in ${chosenYear}` : ''}</h2>
285+
<span class="big">${usersInTimePeriodOrcidRecordConnected.length.toLocaleString("en-US")}</span>
286+
${usersInTimePeriodOrcidRecordConnected.length > 0 ? html`
287+
<div>${d3.format(".1%")(usersInTimePeriodOrcidRecordConnected.length / usersInTimePeriod.length)} of all PREreviewers ${chosenYear ? ` joining in ${chosenYear}` : ''}</div>
288+
`: ''}
289+
</div>
290+
</div>
291+
268292
```js
269293
function usersByCareerStage({ width } = {}) {
270294
return Plot.plot({

0 commit comments

Comments
 (0)