Skip to content

Commit

Permalink
feat(studio): Add new datasets graphs in the studio
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Oct 31, 2024
1 parent bdb375d commit 5a9be70
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 55 deletions.
63 changes: 42 additions & 21 deletions src/components/Studio/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,27 @@ import { CopyToClipboard } from 'react-copy-to-clipboard';
import { useIntl } from 'react-intl';

import downloadFile from '../../utils/files';
import { getCSSValue, getObservationLabel } from '../../utils/helpers';
import {
getCSSValue,
getObservationLabel,
isInProduction,
} from '../../utils/helpers';
import useGlobals from '../../utils/Hooks/useGetGlobals';
import tree from './tree';

const Studio = () => {
const intl = useIntl();
const { lastObservationSnap } = useGlobals();
const [bsoLocalAffiliation, setBsoLocalAffiliation] = useState('130015506');
const [bsoLocalAffiliation, setBsoLocalAffiliation] = useState('130015506'); // University of Lorraine
const [displayComment, setDisplayComment] = useState(true);
const [displayFooter, setDisplayFooter] = useState(true);
const [displayTitle, setDisplayTitle] = useState(false);
const [endYear, setEndYear] = useState(2022);
const [firstObservationYear, setFirstObservationYear] = useState(2018);
const [endYear, setEndYear] = useState('2022');
const [firstObservationYear, setFirstObservationYear] = useState('2018');
const [lang, setLang] = useState('fr');
const [lastObservationYear, setLastObservationYear] = useState();
const [object, setObject] = useState('publi');
const [startYear, setStartYear] = useState(2013);
const [startYear, setStartYear] = useState('2013');
const [tab, setTab] = useState('general');
const [useHalId, setUseHalId] = useState(false);

Expand All @@ -49,26 +53,39 @@ const Studio = () => {
{ label: 'Français', value: 'fr' },
{ label: 'Anglais', value: 'en' },
];
const observationYears = [2018, 2019, 2020, 2021, 2022, 2023].map((item) => ({
label: item,
value: item,
}));
const observationYears = ['2018', '2019', '2020', '2021', '2022', '2023'].map(
(item) => ({
label: item,
value: item,
}),
);
observationYears.push({ label: 'La plus récente', value: 'latest' });
const publicationYears = [
2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022,
'2013',
'2014',
'2015',
'2016',
'2017',
'2018',
'2019',
'2020',
'2021',
'2022',
].map((item) => ({ label: item, value: item }));
const values = {
archiveTitle: '',
commentsName,
publicationYear: endYear,
observationYear: lastObservationYear,
publicationYear: endYear,
publisherTitle: '',
archiveTitle: '',
};

const objects = tree.map((item) => ({
...item,
label: intl.formatMessage({ id: item.key }, values),
}));
const objects = tree
.filter((item) => !isInProduction() || (item?.isInProduction ?? true))
.map((item) => ({
...item,
label: intl.formatMessage({ id: item.key }, values),
}));
let tabs = objects?.find((item) => item.value === object)?.children || [];
tabs = tabs.map((item) => ({
...item,
Expand Down Expand Up @@ -142,7 +159,7 @@ const Studio = () => {
hint="Si périmètre ad-hoc, identifiant communiqué par l'équipe BSO ou RoR. Dans tous les cas, identifiant de structure HAL, ou code collection HAL"
label="Identifiant de l'établissement"
message='Merci de saisir un identifiant'
messageType={bsoLocalAffiliation === '' ? 'error' : ''}
messageType={bsoLocalAffiliation === '' ? 'error' : null}
onChange={(e) => setBsoLocalAffiliation(e.target.value)}
required
style={{ backgroundColor: getCSSValue('--white') }}
Expand All @@ -156,7 +173,7 @@ const Studio = () => {
options={langs}
selected={lang}
style={{
marginTop: '50px',
marginTop: '71px',
backgroundColor: getCSSValue('--white'),
}}
/>
Expand All @@ -180,7 +197,7 @@ const Studio = () => {
options={tabs}
selected={tab}
style={{
marginTop: '50px',
marginTop: '51px',
backgroundColor: getCSSValue('--white'),
}}
/>
Expand All @@ -200,6 +217,7 @@ const Studio = () => {
<Row gutters>
<Col n='12 md-6'>
<Select
disabled={object !== 'publi'}
hint="Filtre sur l'année de publication supérieure ou égale"
label='Première année de publication'
onChange={(e) => setStartYear(e.target.value)}
Expand All @@ -210,10 +228,11 @@ const Studio = () => {
</Col>
<Col n='12 md-6'>
<Select
disabled={object !== 'publi'}
hint="Filtre sur l'année de publication inférieure ou égale"
label='Dernière année de publication'
message='Attention, la dernière année de publication doit être inférieure à la première année de publication'
messageType={endYear < startYear ? 'error' : ''}
messageType={endYear < startYear ? 'error' : null}
onChange={(e) => setEndYear(e.target.value)}
options={publicationYears}
selected={endYear}
Expand All @@ -224,6 +243,7 @@ const Studio = () => {
<Row gutters>
<Col n='12 md-6'>
<Select
disabled={object !== 'publi'}
hint="Filtre sur l'année d'observation inférieure ou égale"
label="Première année d'observation"
onChange={(e) => setFirstObservationYear(e.target.value)}
Expand All @@ -234,14 +254,15 @@ const Studio = () => {
</Col>
<Col n='12 md-6'>
<Select
disabled={object !== 'publi'}
hint="Filtre sur l'année d'observation supérieure ou égale"
label="Dernière année d'observation"
onChange={(e) => setLastObservationYear(e.target.value)}
options={observationYears}
selected={lastObservationYear}
style={{ backgroundColor: getCSSValue('--white') }}
messageType={
lastObservationYear < firstObservationYear ? 'error' : ''
lastObservationYear < firstObservationYear ? 'error' : null
}
message="Attention, la dernière année d'observation doit être inférieure à la première année d'observation"
/>
Expand Down
37 changes: 37 additions & 0 deletions src/components/Studio/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,43 @@ const tree = [
},
],
},
{
key: 'app.baro-national.datasets',
value: 'datasets',
isInProduction: false,
children: [
{
key: 'app.tree.datasets.by-publisher',
value: 'publisher',
children: [
{
key: 'app.national-data.general.repositories.datasets-by-publisher.title',
value: 'data.general.repositories.datasets-by-publisher',
},
],
},
{
key: 'app.tree.datasets.by-size',
value: 'size',
children: [
{
key: 'app.national-data.general.repositories.datasets-by-size.title',
value: 'data.general.repositories.datasets-by-size',
},
],
},
{
key: 'app.tree.datasets.by-format',
value: 'format',
children: [
{
key: 'app.national-data.general.repositories.datasets-by-format.title',
value: 'data.general.repositories.datasets-by-format',
},
],
},
],
},
];

export default tree;
10 changes: 7 additions & 3 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@
"app.glossary.embargo": "Embargo",
"app.glossary.embargo-min": "embargo",
"app.glossary.embargo.definition": "Period during which a scientific production cannot be disseminated in an open archive. For scientific publications financed by the State, the Law for a Digital Republic limits the embargo period after which the writing can be disseminated openly, regardless of the contract with the publisher. (See Law for a Digital Republic). For theses, it is possible for the author to define a period during which the thesis is available only within the academic community.",
"app.glossary.entrepot": "Data repository",
"app.glossary.entrepot.definition": "Multidisciplinary or thematic within a scientific field, datasets are deposited, documented and disseminated. A repository allows better archiving and wider access to data than a laboratory server or other local solution",
"app.glossary.repository": "Data repository",
"app.glossary.repository.definition": "Multidisciplinary or thematic within a scientific field, datasets are deposited, documented and disseminated. A repository allows better archiving and wider access to data than a laboratory server or other local solution",
"app.glossary.essai-clinique": "Clinical trial",
"app.glossary.essai-clinique.definition": "Also called interventional studies, it is a type of clinical research in which participants are distributed in groups receiving one or more interventions so that researchers can evaluate the effects of interventions on biomedical outcomes or health-related results. The notion of intervention is defined as any act carried out on the person not justified by the medical care of the person.",
"app.glossary.etude-observationelle": "Observational study",
Expand Down Expand Up @@ -1260,6 +1260,7 @@
"app.baro-national.software.intro": "Code and software play a key role in scientific research, where they are tool, result and object of study. The availability of software source code, with the possibility of modifying, reusing and disseminating them, is a major challenge to enable the reproducibility of scientific results and to support the sharing and creation of knowledge, in an open science approach.<linebreak></linebreak>The Open Science Monitor uses an approach via the full text of French publications to detect code and software. This approach is only conducted on the basis of publications for which the full text could be downloaded.<linebreak></linebreak>This analysis mobilizes the open source software <glossary0>app.glossary.grobid</glossary0> and <glossary1>app.glossary.softcite</glossary1><linebreak></linebreak><cta0>An interface for exploring</cta0> mentions of software detected in the corpus is also being made available, on an experimental basis.",
"app.baro-national.software.title": "Code and software",
"app.baro-national.software.title.beta": "Code and software [beta]",
"app.baro-national.datasets": "Datasets",
"app.baro-national.thesis.title": "PhD theses",
"app.baro-national.data-and-software.title": "Research data and software",
"app.beta": "[beta]",
Expand Down Expand Up @@ -1491,5 +1492,8 @@
"app.repositories.label.ucldiscovery": "UCL Discovery (USA)",
"app.repositories.label.univoak": "univOAK (France)",
"app.repositories.label.usofficeofscientificandtechnicalinformation": "US OSTP (USA)",
"app.repositories.label.zenodo": "Zenodo (Europe)"
"app.repositories.label.zenodo": "Zenodo (Europe)",
"app.tree.datasets.by-publisher": "By repository",
"app.tree.datasets.by-size": "By size",
"app.tree.datasets.by-format": "By format"
}
10 changes: 7 additions & 3 deletions src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"app.baro-national.data.title.beta": "Les données de la recherche [bêta]",
"app.baro-national.software.title": "Les code et logiciels",
"app.baro-national.software.title.beta": "Les code et logiciels [bêta]",
"app.baro-national.datasets": "Les jeux de données",
"app.baro-national.data-and-software.title": "Données de la recherche et code ou logiciels",
"app.baro-national.today-title": "Le baromètre, aujourd'hui c'est…",
"app.thesis.intro": "Les thèses de doctorat constituent une contribution majeure à la recherche et à la production de nouvelles connaissances. Elles font partie des jalons essentiels dans le processus collectif de recherche et l'ambition de la politique de science ouverte est de favoriser leur ouverture au public, sauf exceptions légitimes liées au secret professionnel ou secrets industriels et commerciaux.<linebreak></linebreak><linebreak></linebreak>Une thèse constitue à la fois une œuvre de l'esprit, un document administratif et une archive publique. La diffusion des thèses au format électronique est régie par deux arrêtés ministériels successifs. Pour les thèses soutenues entre 2006 et 2016, le docteur ne peut s'opposer à la diffusion de sa thèse en accès restreint au sein de son établissement de soutenance. Pour les thèses soutenues à partir de septembre 2016, le docteur ne peut s'opposer à la diffusion de sa thèse au sein de l'ensemble de la communauté universitaire. En revanche, le docteur peut s'opposer temporairement à la diffusion de sa thèse en accès libre sur internet en la soumettant à un embargo : une thèse sous embargo est consultable en accès restreint au sein de la communauté universitaire française pendant toute la période de l'embargo, avant de devenir consultable en accès libre sur internet. Seules les thèses confidentielles ne sont consultables par personne.",
Expand Down Expand Up @@ -442,8 +443,8 @@
"app.glossary.embargo": "Embargo",
"app.glossary.embargo-min": "embargo",
"app.glossary.embargo.definition": "Période pendant laquelle une production scientifique ne peut pas être diffusée dans une archive ouverte. Pour les publications scientifiques financées par l'État, la loi pour une République numérique limite la période d'embargo après laquelle l'écrit peut être diffusé ouvertement, quel que soit le contrat avec l'éditeur. (Voir Loi pour une République numérique). Pour les thèses, il est possible pour l'auteur de définir une période pendant laquelle la thèse est disponible uniquement au sein de la communauté universitaire.",
"app.glossary.entrepot": "Entrepôt de données",
"app.glossary.entrepot.definition": "Pluridisciplinaire ou thématique dans une discipline, des jeux de données y sont déposés, documentés et diffusés. Un entrepôt permet un meilleur archivage et un accès plus large aux données qu'un serveur de laboratoire ou une autre solution locale.",
"app.glossary.repository": "Entrepôt de données",
"app.glossary.repository.definition": "Pluridisciplinaire ou thématique dans une discipline, des jeux de données y sont déposés, documentés et diffusés. Un entrepôt permet un meilleur archivage et un accès plus large aux données qu'un serveur de laboratoire ou une autre solution locale.",
"app.glossary.essai-clinique": "Essai clinique",
"app.glossary.essai-clinique.definition": "Aussi appelé études interventionelles, c'est un type de recherche clinique dans laquelle les participants sont répartis dans des groupes qui reçoivent une ou plusieurs interventions afin que les chercheurs puissent évaluer les effets des interventions sur les résultats biomédicaux ou liés à la santé. La notion d'intervention est définie comme tout acte réalisé sur la personne non justifié par la prise en charge médicale de la personne.",
"app.glossary.etude-observationelle": "Étude observationelle",
Expand Down Expand Up @@ -1540,5 +1541,8 @@
"app.repositories.label.ucldiscovery": "UCL Discovery (USA)",
"app.repositories.label.univoak": "univOAK (France)",
"app.repositories.label.usofficeofscientificandtechnicalinformation": "US OSTP (USA)",
"app.repositories.label.zenodo": "Zenodo (Europe)"
"app.repositories.label.zenodo": "Zenodo (Europe)",
"app.tree.datasets.by-publisher": "Par entrepôt",
"app.tree.datasets.by-size": "Par taille",
"app.tree.datasets.by-format": "Par format"
}
54 changes: 27 additions & 27 deletions src/translations/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@
"intlDefinition": "app.glossary.code-source.definition",
"intlEntry": "app.glossary.code-source"
},
"datastet": {
"intlDefinition": "app.glossary.datastet.definition",
"intlEntry": "app.glossary.datastet",
"cta": "https://github.com/kermitt2/datastet"
},
"debusqapc": {
"intlDefinition": "app.glossary.debusqapc.definition",
"intlEntry": "app.glossary.debusqapc",
"ctas": [
"https://hal-lara.archives-ouvertes.fr/OUVRIR-LA-SCIENCE/hal-03909068",
"https://www.ouvrirlascience.fr/wp-content/uploads/2022/12/APC_Cost_Study_Poster.pdf"
]
},
"diamond": {
"intlDefinition": "app.glossary.diamond.definition",
"intlEntry": "app.glossary.diamond"
Expand All @@ -52,10 +65,6 @@
"intlDefinition": "app.glossary.embargo.definition",
"intlEntry": "app.glossary.embargo"
},
"entrepot": {
"intlDefinition": "app.glossary.entrepot.definition",
"intlEntry": "app.glossary.entrepot"
},
"essai-clinique": {
"intlDefinition": "app.glossary.essai-clinique.definition",
"intlEntry": "app.glossary.essai-clinique"
Expand All @@ -81,6 +90,11 @@
"intlDefinition": "app.glossary.gold-full-apc.definition",
"intlEntry": "app.glossary.gold-full-apc"
},
"grobid": {
"intlDefinition": "app.glossary.grobid.definition",
"intlEntry": "app.glossary.grobid",
"cta": "https://github.com/kermitt2/grobid"
},
"hal": {
"intlDefinition": "app.glossary.hal.definition",
"intlEntry": "app.glossary.hal",
Expand Down Expand Up @@ -156,11 +170,20 @@
"intlEntry": "app.glossary.pubmed",
"cta": "https://pubmed.ncbi.nlm.nih.gov/"
},
"repository": {
"intlDefinition": "app.glossary.repository.definition",
"intlEntry": "app.glossary.repository"
},
"resultat-essai-clinique": {
"intlDefinition": "app.glossary.resultat-essai-clinique.definition",
"intlEntry": "app.glossary.resultat-essai-clinique",
"cta": "https://clinicaltrials.gov/"
},
"softcite": {
"intlDefinition": "app.glossary.softcite.definition",
"intlEntry": "app.glossary.softcite",
"cta": "https://github.com/ourresearch/software-mentions"
},
"type-hebergement-oa": {
"intlDefinition": "app.glossary.type-hebergement-oa.definition",
"intlEntry": "app.glossary.type-hebergement-oa"
Expand All @@ -169,29 +192,6 @@
"intlDefinition": "app.glossary.unpaywall.definition",
"intlEntry": "app.glossary.unpaywall",
"cta": "https://unpaywall.org/"
},
"grobid": {
"intlDefinition": "app.glossary.grobid.definition",
"intlEntry": "app.glossary.grobid",
"cta": "https://github.com/kermitt2/grobid"
},
"softcite": {
"intlDefinition": "app.glossary.softcite.definition",
"intlEntry": "app.glossary.softcite",
"cta": "https://github.com/ourresearch/software-mentions"
},
"datastet": {
"intlDefinition": "app.glossary.datastet.definition",
"intlEntry": "app.glossary.datastet",
"cta": "https://github.com/kermitt2/datastet"
},
"debusqapc": {
"intlDefinition": "app.glossary.debusqapc.definition",
"intlEntry": "app.glossary.debusqapc",
"ctas": [
"https://hal-lara.archives-ouvertes.fr/OUVRIR-LA-SCIENCE/hal-03909068",
"https://www.ouvrirlascience.fr/wp-content/uploads/2022/12/APC_Cost_Study_Poster.pdf"
]
}
}
]
2 changes: 1 addition & 1 deletion src/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export function isInLocal() {
}

/**
*
* Return true if the app in running in production mode
* @returns boolean
*/
export function isInProduction() {
Expand Down

0 comments on commit 5a9be70

Please sign in to comment.