diff --git a/src/components/Charts/publications/editeurs/dynamique-ouverture/chart-taux-ouverture.js b/src/components/Charts/publications/editeurs/dynamique-ouverture/chart-taux-ouverture.js index 1651248d..2dfc2029 100644 --- a/src/components/Charts/publications/editeurs/dynamique-ouverture/chart-taux-ouverture.js +++ b/src/components/Charts/publications/editeurs/dynamique-ouverture/chart-taux-ouverture.js @@ -40,8 +40,8 @@ const Chart = ({ domain, id, hasComments, hasFooter }) => { const idWithDomain = withDomain(id, domain); const publisherTitle = publisher !== '*' ? ` (${publisher})` : ''; const dataTitle = { - publisherTitle, publicationYear: beforeLastObservationSnap, + publisherTitle, }; const optionsGraph = chartOptions[id].getOptions( idWithDomain, diff --git a/src/components/Charts/publications/general/langues-evolution/get-data.js b/src/components/Charts/publications/general/langues-evolution/get-data.js index a1a7bff1..76dbdf61 100644 --- a/src/components/Charts/publications/general/langues-evolution/get-data.js +++ b/src/components/Charts/publications/general/langues-evolution/get-data.js @@ -12,7 +12,7 @@ const colors = { others: getCSSValue('--purple-medium-100'), }; -function useGetData(observationSnap, domain, isPercent) { +function useGetData(observationSnap, domain, isPercent, needle = '*') { const intl = useIntl(); const [allData, setData] = useState({}); const [isLoading, setLoading] = useState(true); @@ -23,7 +23,7 @@ function useGetData(observationSnap, domain, isPercent) { const query = getFetchOptions({ key: 'publicationsByYear', domain, - parameters: [lastObservationSnap, 'lang.keyword'], + parameters: [lastObservationSnap, 'lang.keyword', needle], objectType: ['publications'], }); const res = await Axios.post(ES_API_URL, query, HEADERS); @@ -129,7 +129,7 @@ function useGetData(observationSnap, domain, isPercent) { dataGraph, }; }, - [domain, intl, isPercent], + [domain, intl, isPercent, needle], ); useEffect(() => { @@ -147,7 +147,7 @@ function useGetData(observationSnap, domain, isPercent) { } getData(); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [observationSnap, isPercent]); + }, [isPercent, needle, observationSnap]); return { allData, isError, isLoading }; } diff --git a/src/components/Charts/publications/general/langues-evolution/langues-by-year.js b/src/components/Charts/publications/general/langues-evolution/langues-by-year.js index ad755619..aa26b7fa 100644 --- a/src/components/Charts/publications/general/langues-evolution/langues-by-year.js +++ b/src/components/Charts/publications/general/langues-evolution/langues-by-year.js @@ -1,4 +1,5 @@ import { Radio, RadioGroup } from '@dataesr/react-dsfr'; +import Axios from 'axios'; import Highcharts from 'highcharts'; import HCExportingData from 'highcharts/modules/export-data'; import HCExporting from 'highcharts/modules/exporting'; @@ -7,11 +8,18 @@ import PropTypes from 'prop-types'; import React, { useEffect, useRef, useState } from 'react'; import { useIntl } from 'react-intl'; +import { ES_API_URL, HEADERS } from '../../../../../config/config'; import customComments from '../../../../../utils/chartComments'; +import getFetchOptions from '../../../../../utils/chartFetchOptions'; import { chartOptions } from '../../../../../utils/chartOptions'; import { domains, graphIds } from '../../../../../utils/constants'; -import { getObservationLabel, withDomain } from '../../../../../utils/helpers'; +import { + capitalize, + getObservationLabel, + withDomain, +} from '../../../../../utils/helpers'; import useGlobals from '../../../../../utils/Hooks/useGetGlobals'; +import SearchableSelect from '../../../../SearchableSelect'; import WrapperChart from '../../../../WrapperChart'; import GraphComments from '../../../graph-comments'; import useGetData from './get-data'; @@ -22,6 +30,8 @@ HCExportingData(Highcharts); const Chart = ({ domain, hasComments, hasFooter, id }) => { const [chartComments, setChartComments] = useState(''); const [isPercent, setPercent] = useState(false); + const [options, setOptions] = useState([]); + const [scientificField, setScientificField] = useState('*'); const chartRef = useRef(); const intl = useIntl(); const { beforeLastObservationSnap, lastObservationSnap } = useGlobals(); @@ -29,10 +39,13 @@ const Chart = ({ domain, hasComments, hasFooter, id }) => { lastObservationSnap, domain, isPercent, + scientificField, ); const { dataGraph, categories } = allData; + const scientificFieldTitle = scientificField !== '*' ? ` (${scientificField})` : ''; const dataTitle = { publicationYear: getObservationLabel(beforeLastObservationSnap, intl), + scientificFieldTitle, }; const idWithDomain = withDomain(id, domain); const optionsGraph = chartOptions[id].getOptions( @@ -44,6 +57,35 @@ const Chart = ({ domain, hasComments, hasFooter, id }) => { isPercent, ); + useEffect(() => { + const query = getFetchOptions({ + key: 'scientificFieldList', + domain, + parameters: [lastObservationSnap], + }); + + Axios.post(ES_API_URL, query, HEADERS).then((response) => { + const opts = response.data.aggregations.by_discipline.buckets.map( + (item) => ({ + label: capitalize( + intl.formatMessage({ + id: `app.discipline.${item.key}`, + defaultMessage: item.key, + }), + ), + value: item.key, + }), + ); + opts.unshift({ + label: capitalize( + intl.formatMessage({ id: 'app.all-scientific-fields' }), + ), + value: '*', + }); + setOptions(opts); + }); + }, [domain, intl, lastObservationSnap]); + useEffect(() => { setChartComments(customComments(allData, idWithDomain, intl)); }, [allData, idWithDomain, intl]); @@ -77,6 +119,12 @@ const Chart = ({ domain, hasComments, hasFooter, id }) => { value='percent' /> + (e.length > 0 ? setScientificField(e) : null)} + options={options} + selected={scientificField} + /> In particular, we note that among publications published in {publicationYear}, there are {publicationsEnglishTotal} publications in English of which {publicationsEnglishOpen} are open and {publicationsEnglishClosed} are closed (i.e. an open access rate of {publicationsEnglishRate}%), and {publicationsFrenchTotal} publications in French of which {publicationsFrenchOpen} are open and {publicationsFrenchClosed} closed (i.e. a rate of {publicationsFrenchRate}%). French-language publications are therefore less open than English-language publications. Publications in Spanish, German and Portuguese represent smaller numbers, statistically less significant.", "app.health-publi.general.langues-ouverture.chart-repartition-publications.comments": "This graph shows the open access rate of publications {commentsName} in health released in {publicationYear} according to their language of publication, while specifying the open access routes. The language data was extracted from PubMed metadata if available, or inferred from the title and abstract in the remaining cases. In particular, we note that among publications published in {publicationYear}, there are {publicationsEnglishTotal} publications in English of which {publicationsEnglishOpen} are open and {publicationsEnglishClosed} are closed (i.e. an open access rate of {publicationsEnglishRate}%), and {publicationsFrenchTotal} publications in French of which {publicationsFrenchOpen} are open and {publicationsFrenchClosed} closed (i.e. a rate of {publicationsFrenchRate}%). French-language publications are therefore less open than English-language publications. Publications in Spanish, German and Portuguese represent smaller numbers, statistically less significant.", - "app.national-publi.general.langues.chart-publications-by-year.title": "Evolution of the number of publications {commentsName} according to their language of publication", "app.national-publi.general.voies-ouverture.description": "Open access to scientific publications can be achieved through several routes: natively open access publication by the publisher on a dissemination platform or deposit by the author in an app.glossary.archive-ouverte-min. These two routes are not exclusive, as a publication may be hosted both on an open repository and on the publisher's publishing platform. This simultaneity, which tends to increase over time, is a factor of resilience since it makes it possible to offer editorial quality and guarantee the durability of access to French scientific publications.", "app.health-publi.general.voies-ouverture.description": "Open access to scientific publications can be achieved through several routes: natively open access publication by the publisher on a dissemination platform or deposit by the author in an app.glossary.archive-ouverte-min. These two routes are not exclusive, as a publication may be hosted both on an open repository and on the publisher's publishing platform. This simultaneity, which tends to increase over time, is a factor of resilience since it makes it possible to offer editorial quality and guarantee the durability of access to French scientific publications.", "app.national-publi.general.voies-ouverture.chart-evolution-taux.tooltip": "Publication year {point.x}
• Open access rate
with hosting {series.name}:
{point.y:.2f}% ({point.y_abs} / {point.y_tot})
• Total open access rate:
{point.stackTotal:.2f}% ({point.y_oa} / {point.y_tot})", @@ -1040,6 +1040,7 @@ "app.publi.general.genres-ouverture.chart-repartition-genres.tooltip": "{point.name} published in {point.publicationDate} ({point.bsoDomain})
{point.value} in {point.oaType}
i.e. {point.percentage:.2f}% of the total of the publications of {point.publicationDate}", "app.publi.general.genres-ouverture.chart-repartition-taux.tooltip": "{point.x_val} ({point.bsoDomain})
• Open access rate
with hosting {series.name}:
{point.y:.2f}% ({point.y_abs} / {point.y_tot})
• Total open access rate: {point.stacktotal:.2f}%", "app.publi.general.langues-ouverture.chart-repartition-publications.tooltip": "{point.name} published in {point.publicationDate} ({point.bsoDomain})
{point.value} in {point.oaType}
that is {point.percentage:.2f}% of the total publications of {point.publicationDate}", + "app.national-publi.general.langues.chart-publications-by-year.title": "Evolution of the number of publications {commentsName} according to their language of publication{scientificFieldTitle}", "app.publi.general.langues.chart-publications-by-year.tooltip": "{point.lang}: {point.ypercent} % of publications in {point.name}
", "app.publi.general.langues.chart-publications-by-year-percent.tooltip": "{point.lang}: {point.yabs} publications in {point.name}
", "app.publi.navigation.go-to-page": "Go to page", @@ -1122,6 +1123,7 @@ "app.publications.document.title": "Publications of the French Open Science Monitor", "app.publications.global": "French publications (all areas)", "app.publications.health": "French health publications", + "app.scientific-field-filter-label": "Select a scientific field", "app.publishers": "publishers and platforms", "app.publishers-filter-label": "Select a publisher or platform", "app.publishers.apc-gold": "APC Gold", diff --git a/src/translations/fr.json b/src/translations/fr.json index 901b29b9..2448771e 100644 --- a/src/translations/fr.json +++ b/src/translations/fr.json @@ -31,6 +31,7 @@ "app.all-journals": "toutes les revues", "app.all-publications": "Toutes les publications", "app.all-publishers": "tous les éditeurs", + "app.all-scientific-fields": "toutes les disciplines", "app.all-repositories": "Toutes les archives ouvertes", "app.all-sponsor-types": "tous types de promoteur", "app.sponsor-type": "Type de promoteur", @@ -966,7 +967,9 @@ "app.health-publi.general.langues-ouverture.chart-repartition-publications.title": "Taux d'accès ouvert par langue de publications {commentsName} dans le domaine de la santé, publications de {publicationYear}", "app.national-publi.general.langues-ouverture.chart-repartition-publications.comments": "Ce graphique montre le taux d'accès ouvert des publications {commentsName} parues en {publicationYear} en fonction de leur langue de publication, tout en précisant les voies de l'ouverture. La donnée concernant la langue a été extraite des métadonnées de PubMed si disponible, ou inférée à partir du titre et du résumé dans le reste des cas.On remarque notamment que, parmi les publications parues en {publicationYear}, on dénombre {publicationsEnglishTotal} publications en anglais dont {publicationsEnglishOpen} ouvertes et {publicationsEnglishClosed} fermées (soit un taux d'accès ouvert de {publicationsEnglishRate} %), et {publicationsFrenchTotal} publications en français dont {publicationsFrenchOpen} ouvertes et {publicationsFrenchClosed} fermées (soit un taux de {publicationsFrenchRate} %). Les publications en langue française sont donc moins ouvertes que les publications en langue anglaise. Les publications en espagnol, allemand et portugais représentent de plus petits effectifs, statistiquement moins significatifs.", "app.health-publi.general.langues-ouverture.chart-repartition-publications.comments": "Ce graphique montre le taux d'accès ouvert des publications {commentsName} en santé parues en {publicationYear} en fonction de leur langue de publication, tout en précisant les voies de l'ouverture. La donnée concernant la langue a été extraite des métadonnées de PubMed si disponible, ou inférée à partir du titre et du résumé dans le reste des cas.On remarque notamment que, parmi les publications parues en {publicationYear}, on dénombre {publicationsEnglishTotal} publications en anglais dont {publicationsEnglishOpen} ouvertes et {publicationsEnglishClosed} fermées (soit un taux d'accès ouvert de {publicationsEnglishRate} %), et {publicationsFrenchTotal} publications en français dont {publicationsFrenchOpen} ouvertes et {publicationsFrenchClosed} fermées (soit un taux de {publicationsFrenchRate} %). Les publications en langue française sont donc moins ouvertes que les publications en langue anglaise. Les publications en espagnol, allemand et portugais représentent de plus petits effectifs, statistiquement moins significatifs.", - "app.national-publi.general.langues.chart-publications-by-year.title": "Évolution du nombre de publications {commentsName} par langue de publication", + "app.national-publi.general.langues.chart-publications-by-year.title": "Évolution du nombre de publications {commentsName} par langue de publication{scientificFieldTitle}", + "app.publi.general.langues.chart-publications-by-year.tooltip": "{point.lang}: {point.ypercent} % des publications en {point.name}", + "app.publi.general.langues.chart-publications-by-year-percent.tooltip": "{point.lang}: {point.yabs} publications en {point.name}", "app.national-publi.general.voies-ouverture.description": "L'accès ouvert aux publications scientifiques peut se faire par plusieurs voies : la publication nativement en accès ouvert par l'éditeur sur une plateforme de publication ou le dépôt par l'auteur dans une app.glossary.archive-ouverte-min. Ces deux voies ne sont pas exclusives, une publication pouvant être à la fois hébergée sur une archive ouverte et sur la plateforme de publication de l'éditeur. Cette simultanéité, qui tend à s'accroître au cours du temps, est un facteur de résilience puisqu'elle permet à la fois d'offrir la qualité éditoriale et de garantir la pérennité de l'accès aux publications scientifiques françaises.", "app.health-publi.general.voies-ouverture.description": "L'accès ouvert aux publications scientifiques peut se faire par plusieurs voies : la publication nativement en accès ouvert par l'éditeur sur une plateforme de publication ou le dépôt par l'auteur dans une app.glossary.archive-ouverte-min. Ces deux voies ne sont pas exclusives, une publication pouvant être à la fois hébergée sur une archive ouverte et sur la plateforme de publication de l'éditeur. Cette simultanéité, qui tend à s'accroître au cours du temps, est un facteur de résilience puisqu'elle permet à la fois d'offrir la qualité éditoriale et de garantir la pérennité de l'accès aux publications scientifiques françaises.", "app.national-publi.general.voies-ouverture.chart-evolution-taux.tooltip": "Année de publication {point.x}
• Taux d'accès ouvert
avec hébergement {series.name} :
{point.y:.2f} % ({point.y_abs} / {point.y_tot})
• Taux d'accès ouvert total :
{point.stackTotal:.2f} % ({point.y_oa} / {point.y_tot})", @@ -1234,8 +1237,6 @@ "app.publi.general.genres-ouverture.chart-repartition-genres.tooltip": "{point.name} publiés en {point.publicationDate} ({point.bsoDomain})
{point.value} en {point.oaType}
soit {point.percentage:.2f} % du total des publications de {point.publicationDate}", "app.publi.general.genres-ouverture.chart-repartition-taux.tooltip": "{point.x_val} ({point.bsoDomain})
• Taux d'accès ouvert
avec hébergement {series.name} :
{point.y:.2f} % ({point.y_abs} / {point.y_tot})
• Taux d'accès ouvert total :
{point.stackTotal:.2f} % ({point.y_oa} / {point.y_tot})", "app.publi.general.langues-ouverture.chart-repartition-publications.tooltip": "{point.name} publiés en {point.publicationDate} ({point.bsoDomain})
{point.value} en {point.oaType}
soit {point.percentage:.2f} % du total des publications de {point.publicationDate}", - "app.publi.general.langues.chart-publications-by-year.tooltip": "{point.lang}: {point.ypercent} % des publications en {point.name}", - "app.publi.general.langues.chart-publications-by-year-percent.tooltip": "{point.lang}: {point.yabs} publications en {point.name}", "app.publi.navigation.go-to-page": "Aller à la page", "app.publi.navigation.affiliation.dynamique": "La dynamique d'ouverture par type d'affiliation", "app.publi.navigation.affiliation.impact": "Impact des pays d'affiliation", @@ -1315,6 +1316,7 @@ "app.publications.health": "publications françaises en santé", "app.publications.local": "publications {commentsName}", "app.with-at-least-one-explicit-mention": "Proportion des publications avec au moins une mention explicite à un jeu de données", + "app.scientific-field-filter-label": "Sélectionner une discipline", "app.publishers": "éditeurs et plateformes", "app.publishers-filter-label": "Sélectionner un éditeur", "app.publishers.apc-gold": "APC Gold", diff --git a/src/utils/chartFetchOptions.js b/src/utils/chartFetchOptions.js index eedadffa..10c8b4f9 100644 --- a/src/utils/chartFetchOptions.js +++ b/src/utils/chartFetchOptions.js @@ -431,7 +431,7 @@ export default function getFetchOptions({ }, }, }), - disciplinesList: ([observationSnap, disciplineField]) => ({ + scientificFieldList: ([observationSnap]) => ({ size: 0, query: { bool: { @@ -447,8 +447,8 @@ export default function getFetchOptions({ aggs: { by_discipline: { terms: { - field: disciplineField, - size: 30, + field: 'bso_classification.keyword', + size: 50, }, }, }, @@ -2220,12 +2220,16 @@ export default function getFetchOptions({ publicationsByYear: ([ lastObservationSnap, customField, + needleScientificField = '*', minPublicationDate = 2013, ]) => ({ size: 0, query: { bool: { filter: [ + { + wildcard: { 'bso_classification.keyword': needleScientificField }, + }, { range: { year: {