Skip to content

Commit

Permalink
fix(graph): Remove multiple lines on cumulated ORCIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Feb 8, 2024
1 parent 63c4ebf commit 5041507
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 56 deletions.
22 changes: 0 additions & 22 deletions src/components/Charts/orcid/general/get-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,28 +134,6 @@ function useGetData(beforeLastObservationSnap, observationSnap, domain) {
color: getCSSValue('--green-light-125'),
dataLabels: { style: { textOutline: 'none' } },
},
{
name: capitalize(
intl.formatMessage({
id: 'app.orcid.employment-count',
}),
),
data: employment,
turboThreshold: 0,
color: getCSSValue('--affiliations-etablissements-125'),
dataLabels: { style: { textOutline: 'none' } },
},
{
name: capitalize(
intl.formatMessage({
id: 'app.orcid.thesis-count',
}),
),
data: thesis,
turboThreshold: 0,
color: getCSSValue('--thesesfr'),
dataLabels: { style: { textOutline: 'none' } },
},
];

return {
Expand Down
32 changes: 11 additions & 21 deletions src/components/ProgressionCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@ import React, { useEffect, useState } from 'react';
import { FormattedMessage, useIntl } from 'react-intl';

import { domains } from '../../utils/constants';
import { getObservationLabel } from '../../utils/helpers';
import { getObservationLabel, isInProduction } from '../../utils/helpers';
import useGlobals from '../../utils/Hooks/useGetGlobals';
import useGetPublicationRateFrom from '../../utils/Hooks/useGetPublicationRateFrom';
import Icon from '../Icon';
import InfoCard from '../InfoCard';

const lastObservationSnapIndex = 0;
const previousObservationSnapIndex = 1;

export default function ProgressionCard({ domain }) {
const intl = useIntl();
const { observationSnaps } = useGlobals();

const [previousObservationSnap, setPreviousObservationSnap] = useState(
observationSnaps ? observationSnaps[previousObservationSnapIndex] : '',
);
const [lastObservationSnap, setLastObservationSnap] = useState(
observationSnaps ? observationSnaps[lastObservationSnapIndex] : '',
);
const { beforeLastObservationSnap, lastObservationSnap, observationSnaps } = useGlobals();
const [previousObservationSnap, setPreviousObservationSnap] = useState('');
const [progression, setProgression] = useState({});

useEffect(() => {
setPreviousObservationSnap(
isInProduction()
? beforeLastObservationSnap
: observationSnaps?.[observationSnaps?.length - 1],
);
}, [beforeLastObservationSnap, observationSnaps]);

const updateProgression = (res, year) => {
const { rate } = res;
if (
Expand Down Expand Up @@ -68,15 +67,6 @@ export default function ProgressionCard({ domain }) {
return progPoints;
};

useEffect(() => {
if (observationSnaps && !previousObservationSnap && !lastObservationSnap) {
setPreviousObservationSnap(
observationSnaps[previousObservationSnapIndex],
);
setLastObservationSnap(observationSnaps[lastObservationSnapIndex]);
}
}, [lastObservationSnap, observationSnaps, previousObservationSnap]);

return (
<InfoCard
icon={(
Expand Down
3 changes: 1 addition & 2 deletions src/pages/Declinaisons/Policy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Policy = () => {
},
{
from: 2021,
to: 2024,
to: 2023,
color: getCSSValue('--ouvrir-la-science-yellow'),
},
];
Expand All @@ -52,7 +52,6 @@ const Policy = () => {
{ y: 22, y_percent: 120 },
{ y: 30, y_percent: 500 },
{ y: 32, y_percent: 500 },
{ y: 37, y_percent: 505 },
],
},
];
Expand Down
10 changes: 5 additions & 5 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1367,10 +1367,10 @@
"url.software.general": "/software/general",
"url.thesis": "/thesis",
"app.orcid.nb": "Number of ORCID accounts",
"app.orcid.nb-cumulated": "Number of cumulated ORCID accounts",
"app.orcid.count": "Total number of French ORCID to-date",
"app.orcid.employment-count": "Total number of ORCID with a French employement to-date",
"app.orcid.thesis-count": "Total ORCIDs who defended a thesis in France",
"app.orcid.nb-cumulated": "Number of cumulated French ORCID accounts",
"app.orcid.count": "French ORCID to-date",
"app.orcid.employment-count": "ORCID with a French employement to-date",
"app.orcid.thesis-count": "ORCIDs who defended a thesis in France",
"app.orcid.creation-year": "ORCID account creation year",
"app.orcid.these-proportion": "Proportion of French PhD that have an ORCID",
"app.orcid.general": "General",
Expand All @@ -1383,7 +1383,7 @@
"app.national-orcid.general.chart-indicator-these-discipline.title": "Proportion of ORCIDs among PhD in France by field",
"app.national-orcid.general.chart-indicator-these-discipline.comments": "This graph estimates, by discipline of thesis defense, the proportion of PhDs with an ORCID (according to ABES, using the data.idref service). The discipline shown is the discipline in which the thesis was defended (the first one in the case of multiple theses).",
"app.national-orcid.general.chart-indicator-these-discipline.tooltip": "<b> Person with a PhD in {point.indicator}</b><br>{point.y:.1f} % of the PhD in {point.indicator} have an ORCID<br>({point.y_abs} persons with an ORCID / {point.y_tot} persons that defended in {point.indicator})",
"app.national-orcid.general.chart-evolution.title": "French ORCID accounts evolution",
"app.national-orcid.general.chart-evolution.title": "Cumulative number of French ORCIDs",
"app.national-orcid.general.chart-evolution.comments": "This graph shows the evolution of the number of French ORCIDs. An ORCID is considered French on the observation date (last available dump) if at least one of these conditions is met: a French employer on the date, a training course in progress in France on the date, the country indicated on the ORCID account is France, or a (public) email in .fr. Please note that very few emails are actually public in the ORCID dump.",
"app.national-orcid.general.chart-evolution.tooltip": "<b>{series.name}</b><br><b>{point.y}</b> ORCID accounts created (cumulated) until {point.creation_date:%Y}",
"app.national-orcid.general.creation-by-year.title": "Number of ORCID by creation year among PhD in France",
Expand Down
10 changes: 5 additions & 5 deletions src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1337,11 +1337,11 @@
"app.orcid.employment": "ORCID déclarant être employé actuellement en France",
"app.orcid.education": "ORCID déclarant suivre actuellement une formation en France",
"app.orcid.address": "ORCID déclarant une adresse en France",
"app.orcid.count": "Total ORCID français à date",
"app.orcid.employment-count": "Total ORCID avec employeur français à date",
"app.orcid.thesis-count": "Total ORCID ayant soutenu une thèse en France",
"app.orcid.count": "ORCID français à date",
"app.orcid.employment-count": "ORCID avec employeur français à date",
"app.orcid.thesis-count": "ORCID ayant soutenu une thèse en France",
"app.orcid.nb": "Nombre de comptes ORCID",
"app.orcid.nb-cumulated": "Nombre de comptes ORCID cumulés",
"app.orcid.nb-cumulated": "Nombre de comptes ORCID français cumulés",
"app.orcid.perc": "Proportion de comptes ORCID",
"app.orcid.creation-year": "Année de création de l'ORCID",
"app.orcid.proportion": "Proportion de comptes ORCID français",
Expand Down Expand Up @@ -1383,7 +1383,7 @@
"app.national-orcid.general.chart-indicator-these-discipline.title": "Proportion d'ORCID parmi les personnes ayant soutenu une thèse en France par discipline",
"app.national-orcid.general.chart-indicator-these-discipline.comments": "Ce graphique estime, par discipline de soutenance de thèse, la proportion de docteur ayant un ORCID (d'après l'ABES, en utilisant le service data.idref). La discipline indiquée est la discipline de soutenance de la thèse (la première année en cas de thèses multiples).",
"app.national-orcid.general.chart-indicator-these-discipline.tooltip": "<b> Personnes ayant soutenu une thèse en {point.indicator}</b><br>{point.y:.1f} % des thésard(e)s en {point.indicator} ont un ORCID<br>({point.y_abs} personnes avec un ORCID / {point.y_tot} personnes ayant soutenu en {point.indicator})",
"app.national-orcid.general.chart-evolution.title": "Evolution du nombre d'ORCID français",
"app.national-orcid.general.chart-evolution.title": "Evolution du nombre d'ORCID français cumulés",
"app.national-orcid.general.chart-evolution.comments": "Ce graphique présente l'évolution du nombre d'ORCID français. Un ORCID est considéré français à la date d'observation (dernier dump disponible) si au moins une de ces conditions est remplie : un employeur français à date, une formation en cours en France à date, le pays indiqué sur le compte ORCID est la France, ou un email (public) en .fr. Il est à noter que dans les faits, très peu d'emails sont publics dans le dump ORCID. ",
"app.national-orcid.general.chart-evolution.tooltip": "<b>{series.name}</b><br><b>{point.y}</b> comptes ORCID créés (en cumulé) avant {point.creation_date:%Y}",
"app.national-orcid.general.creation-by-year.title": "Nombre d'ORCID français par année de création parmi les personnes ayant soutenu une thèse en France",
Expand Down
7 changes: 6 additions & 1 deletion src/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,12 @@ export function getSource(id, otherSources = []) {
if (id.includes('impact-financement')) {
sources.push('ANR');
}
if (id.includes('thesis')) {
if (
id.includes('thesis')
|| id.includes('orcid.general.creation-by-year')
|| id.includes('orcid.general.chart-indicator-these-year')
|| id.includes('orcid.general.chart-indicator-these-discipline')
) {
sources.push('theses.fr');
}
if (id.includes('hal')) {
Expand Down

0 comments on commit 5041507

Please sign in to comment.