Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • chetouae/open-research-data-monitor-back
  • mlarrieu/open-research-data-monitor-back
2 results
Show changes
Commits on Source (179)
Showing
with 2566 additions and 2273 deletions
......@@ -3,29 +3,57 @@ image: python:3-alpine
actualisation_dois:
only:
# restreindre au déclenchement automatique par schedule ou déclenchement manuel pour éviter de tourner en boucle (le commit produit par le pipeline qui déclenche le pipeline à nouveau)
- schedules
- web
before_script:
# installations permettant de faire tourner git
- apk update
- apk add git openssh
script:
# installation des bibliothèques python et exécution du script
- pip install pandas
- pip install requests
- pip install matplotlib
- python run-all-codes.py
after_script:
# commit des changements suite à l'exécution du script
- git config user.name "${GITLAB_USER_NAME}"
- git config user.email "${GITLAB_USER_EMAIL}"
- git remote set-url --push origin "https://PUSH_TOKEN:${ACCESS_TOKEN}@gricad-gitlab.univ-grenoble-alpes.fr/${CI_PROJECT_PATH}.git"
- git add -f dois-uga.csv 2-produce-graph/hist-evol-datasets-per-repo.png 2-produce-graph/hist-quantity-year-type.png 2-produce-graph/pie--datacite-client.png 2-produce-graph/pie--datacite-type.png
- git add -f dois-uga.csv dois-uga--last-500.csv 2-produce-graph/hist-evol-datasets-per-repo.png 2-produce-graph/hist-quantity-year-type.png 2-produce-graph/pie--datacite-client.png 2-produce-graph/pie--datacite-type.png 2-produce-graph/hist-last-datasets-by-client.png 1-enrich-with-datacite/all_datacite_clients_for_uga.csv 1-enrich-with-datacite/nb-dois.txt
- git commit -m "Execution du pipeline. Actualisation des dois et des graphes."
- git push origin HEAD:$CI_COMMIT_REF_NAME
- git push origin HEAD:${CI_COMMIT_REF_NAME}
# création d'un espace accueillant le clone du repo du site web, et tests au cas où l'espace existe déjà
- cd ..
- if ! [ -d "cloned_repo" ]; then mkdir cloned_repo; fi
- if [ -d "cloned_repo/${PATH_TO_PUSH}" ]; then cd cloned_repo/${PATH_TO_PUSH}; git pull; else cd cloned_repo; git clone ${LINK_TO_CLONE}; fi
- cd -
# copier le fichier "nb-dois.txt" pour commit dans le repo du site web
- cp open-research-data-monitor-back/1-enrich-with-datacite/nb-dois.txt cloned_repo/${PATH_TO_PUSH}
- cd cloned_repo/${PATH_TO_PUSH}
# commit du fichier "nb-dois.txt" vers le repo du site web
- git config user.name "${GITLAB_USER_NAME}"
- git config user.email "${GITLAB_USER_EMAIL}"
- git remote set-url --push origin "https://PUSH_TOKEN2:${ACCESS_TOKEN2}@gricad-gitlab.univ-grenoble-alpes.fr/${PROJECT_PATH2}.git"
- git add -f nb-dois.txt
- git commit -m "Execution du pipeline. Actualisation du nombre de dois."
- git push origin HEAD:main
artifacts:
# ajout des fichiers du dépôt qui ont été modifiés, au cas où un problème serait survenu dans "after_script"
paths:
- dois-uga.csv
- dois-uga--last-500.csv
- 2-produce-graph/hist-evol-datasets-per-repo.png
- 2-produce-graph/hist-quantity-year-type.png
- 2-produce-graph/pie--datacite-client.png
- 2-produce-graph/pie--datacite-type.png
- 2-produce-graph/hist-last-datasets-by-client.png
- 1-enrich-with-datacite/nb-dois.txt
- 1-enrich-with-datacite/all_datacite_clients_for_uga.csv
This diff is collapsed.
......@@ -12,8 +12,8 @@ https://support.datacite.org/docs/can-i-see-more-detailed-affiliation-informatio
* mémo : pour descendre au niveau des auteurs , le filtre `?person-id=orcid-nb`
* nb 2024-01-13
retrait de l'AAU (jbru.aau) car tout est du PD de congrès
* note 2023-02
retrait de l'AAU (jbru.aau) car tout est du PDF de congrès
ajout de client.uid:inist.sshade et client.uid:inist.resif
"""
......@@ -125,19 +125,6 @@ if main_no_dois :
print("datasets with an other identifier than DOI has been finded")
[print(f"\t\t{elem}") for elem in main_no_dois]
## __________n__________ remove DOIs who are newer version via Figshare repository
## example 10.6084/m9.figshare.23737431.v2
## peut être refait lors de la récupération en véridiant que relatedIdentifiers/relationType:"IsIdenticalTo" ne soit présent
doi_to_remove = []
for doi in main_dois :
if "figshare" in doi :
# synthaxe : remove the number of the version
doi_shorten = doi[: len(doi) - 1]
if doi_shorten.endswith(".v") :
doi_to_remove.append(doi)
[main_dois.remove(elem) for elem in doi_to_remove]
## __________n__________ remove duplicates
unique_dois = list(set(main_dois))
print(f"\tNb of unique DOI\t{len(unique_dois)}")
......
......@@ -17,4 +17,18 @@ mbeligne
acarbonnelle
annegf
tleduc
abey
\ No newline at end of file
abey
mbarletta
lmaritaud
jbeaureder
kboczon
llacoste
fcorsi
ecarlier
lvanbogaert
nrousselot
jlevy1
mflecheux
pbai
ymonnier
slecuyerchardevel
\ No newline at end of file
......@@ -21,16 +21,16 @@ urls = [
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=authorAffiliation%3AUGA',
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=producerAffiliation%3AUGA',
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=contributorAffiliation%3AUGA',
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=datasetContactAffiliation%3AGrenoble',
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=authorAffiliation%3AGrenoble',
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=producerAffiliation%3AGrenoble',
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=contributorAffiliation%3AGrenoble'
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=datasetContactAffiliation%3A(Grenoble AND Alpes)',
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=authorAffiliation%3A(Grenoble AND Alpes)',
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=producerAffiliation%3A(Grenoble AND Alpes)',
'https://entrepot.recherche.data.gouv.fr/api/search?q=*&fq=contributorAffiliation%3A(Grenoble AND Alpes)'
# possiblilité d'ajouter d'autres requêtes
]
# on définit une fonction pour la lancer la requete avec chaque url pour les différentes affiliations
def get_results(url):
req = requests.get(url)
req = requests.get(url+"&type=dataset")
#print(req.url)
results = [req.json()]
......@@ -39,7 +39,7 @@ def get_results(url):
count = nb_res
page = 1
while(nb_res > 0):
newurl = url+"&start="+str(count)
newurl = url+"&type=dataset"+"&start="+str(count)
req = requests.get(newurl)
results.append(req.json())
nb_res = results[page]["data"]["count_in_response"]
......@@ -59,7 +59,7 @@ def get_dois(results):
nb_dois += len(num_dois)
for item in num_dois :
dois.append(item["global_id"])
dois.append(item.get("global_id"))
print("\tnb DOIs\t\t" + str(nb_dois))
return dois
......
This diff is collapsed.
......@@ -5,7 +5,6 @@
"""
## todo
- v2 : rechercher UGA comme financeur `grants.funder.doi`
- v2 : passer par les ORCID des `creator.orcid` et `contributors.orcid`
## Documentation
* Liste des métadonnées obligatoires lors du dépôts (upload_type, sub_type, publication_date, titre, creators, ) https://developers.zenodo.org/#representation
......@@ -13,12 +12,9 @@
* Doc dev API champs de requêtes classsiques https://developers.zenodo.org/#records
* doc champs poussées pour la recherche https://help.zenodo.org/guides/search/
* typologie des dépôts possiblent : publication: Publication, poster: Poster, presentation: Presentation, Dataset: Dataset, image: Image, video: Video/Audio, software: Software, lesson: Lesson, physicalobject: Physical object, other: Other
* descendre au niveau des ORCID des `creator.orcid` et `contributors.orcid`
### Identifier les dépôts :
- utilisation du champs `creators.affiliation` et contributor.affiliation (multi affiliation)
- utilisation de la forme "grenoble" uniquement, possibilité de bruit
## Notes sur la récupération
- exemple résultats de requete : https://zenodo.org/api/records?q=creators.affiliation%3A*grenoble*&type=dataset&page=6&size=100&sort=mostrecent&all_version=False
- deux DOI identiques sont présents : un à la racine `[hits][doi]` et un autre dans `[hits][metadata][doi]`
......@@ -29,13 +25,6 @@ import requests, json
print("\n\nRunning zenodo.py")
with open("personnal-keys.json") as f :
## load zenodo keys for requests the API
ACCESS_TOKEN = json.load(f)["ZENODO_KEY"]
def req_zenodo_with_page(uga_perimeter, record_type, page_nb) :
"""
retourne les jeux de données UGA depuis Zenodo
......@@ -51,7 +40,6 @@ def req_zenodo_with_page(uga_perimeter, record_type, page_nb) :
"size" : 100,
"sort" : "mostrecent",
"all_version" : False,
"access_tpoken" : ACCESS_TOKEN
}
)
# for debugging
......@@ -118,12 +106,20 @@ def req_zenodo(uga_perimeter, record_type) :
all_dois = set() # a set to gather all DOIs
uga_perimeter = "creators.affiliation:*grenoble* contributors.affiliation:*grenoble*"
uga_txt_query = "(\"grenoble alpes\" OR \"grenoble alps\" OR \"grenoble INP\" \
OR \"polytechnique de grenoble\" OR \"Grenoble Institute of Technology\" OR \"univeristé de grenoble\" )"
uga_query = f"creators.affiliation:{uga_txt_query} contributors.affiliation:{uga_txt_query}"
## memo 2024-02 two fields following by space will search in first field or in second field
## ne pas faire de recherche avec AND car ça recherche dans toutes les affiliations des auteurs
## SceincesPo Grenoble n'apporte pas de résultat https://zenodo.org/search?q=creators.affiliation%3A%28sciencespo%20AND%20Grenoble%29&q=type%3Adataset&l=list&p=1&s=10&sort=bestmatch
types_to_req = ["dataset", "image", "video", "software", "other"]
for record_type in types_to_req :
temp_dois = req_zenodo(uga_perimeter, record_type)
temp_dois = req_zenodo(uga_query, record_type)
## placer les DOI dans le buffer général qui ne peut contenir que des valeurs uniques
[all_dois.add(doi) for doi in temp_dois]
......
client,count
cern.zenodo,936
inist.sshade,468
inist.osug,238
figshare.ars,183
dryad.dryad,156
inist.resif,78
inist.persyval,55
rdg.prod,45
inist.humanum,28
figshare.sage,16
mcdy.dohrmi,12
rg.rg,4
vqpf.dris,3
tib.gfzbib,3
iris.iris,3
ugraz.unipub,2
inist.epure,2
bl.nerc,2
tib.repod,2
estdoi.ttu,1
inist.omp,1
tib.gfz,1
edi.edi,1
inist.opgc,1
bl.iita,1
ardcx.nci,1
umass.uma,1
crui.ingv,1
bl.mendeley,1
ethz.zora,1
inist.ird,1
inist.eost,1
ihumi.pub,1
tug.openlib,1
client,count,name,year,url
cern.zenodo,894,Zenodo,2013,https://zenodo.org/
inist.sshade,527,Solid Spectroscopy Hosting Architecture of Databases and Expertise,2019,https://www.sshade.eu/
figshare.ars,380,figshare Academic Research System,2016,http://figshare.com/
inist.osug,275,Observatoire des Sciences de l'Univers de Grenoble,2014,http://doi.osug.fr
dryad.dryad,168,DRYAD,2018,https://datadryad.org
inist.resif,101,Réseau sismologique et géodésique français,2014,https://www.resif.fr/
rdg.prod,84,Recherche Data Gouv France,2022,https://recherche.data.gouv.fr/en
inist.humanum,75,NAKALA,2020,https://nakala.fr
inist.persyval,64,PERSYVAL-Lab : Pervasive Systems and Algorithms Lab,2016,
fmsh.prod,28,Fondation Maison des sciences de l'homme,2023,
inist.ccj,22,Centre Camille Jullian – UMR 7299,2020,
pangaea.repository,18,PANGAEA,2020,https://www.pangaea.de/
mcdy.dohrmi,14,dggv-e-publications,2020,https://www.dggv.de/publikationen/dggv-e-publikationen.html
inist.cirm,7,Centre International de Rencontres Mathématiques,2017,
figshare.sage,6,figshare SAGE Publications,2018,
iris.iris,5,NSF Seismological Facility for the Advancement of Geoscience (SAGE),2018,http://www.iris.edu/hq/
tib.repod,4,RepOD,2015,https://repod.icm.edu.pl/
vqpf.dris,3,Direction des ressources et de l'information scientifique,2021,
tib.gfzbib,3,GFZpublic,2011,https://gfzpublic.gfz-potsdam.de
cnic.sciencedb,3,ScienceDB,2022,https://www.scidb.cn/en
inist.eost,2,Ecole et Observatoire des Sciences de la Terre,2017,https://eost.unistra.fr/en/
tib.gfz,2,GFZ Data Services,2011,https://dataservices.gfz-potsdam.de/portal/
bl.mendeley,2,Mendeley Data,2015,https://data.mendeley.com/
bl.nerc,2,NERC Environmental Data Service,2011,https://eds.ukri.org
tug.openlib,2,TU Graz OPEN Library,2020,https://openlib.tugraz.at/
crui.ingv,2,Istituto Nazionale di Geofisica e Vulcanologia (INGV),2013,http://data.ingv.it/
ugraz.unipub,2,unipub,2019,http://unipub.uni-graz.at
ethz.sed,2,"Swiss Seismological Service, national earthquake monitoring and hazard center",2013,http://www.seismo.ethz.ch
inist.opgc,1,Observatoire de Physique du Globe de Clermont-Ferrand,2017,
ethz.da-rd,1,ETHZ Data Archive - Research Data,2013,http://data-archive.ethz.ch
ethz.zora,1,"Universität Zürich, ZORA",2013,https://www.zora.uzh.ch/
estdoi.ttu,1,TalTech,2019,https://digikogu.taltech.ee
repod.dbuw,1,University of Warsaw Research Data Repository,2023,https://danebadawcze.uw.edu.pl/
inist.ird,1,IRD,2016,
inist.omp,1,Observatoire Midi-Pyrénées,2011,
umass.uma,1,University of Massachusetts (UMass) Amherst,2018,https://scholarworks.umass.edu/
edi.edi,1,Environmental Data Initiative,2017,https://portal.edirepository.org/nis/home.jsp
bl.iita,1,International Institute of Tropical Agriculture datasets,2017,http://data.iita.org/
ardcx.nci,1,National Computational Infrastructure,2020,
ihumi.pub,1,IHU Méditerranée Infection,2020,
inist.inrap,1,Institut national de recherches archéologiques préventives,2019,
tib.mpdl,1,Max Planck Digital Library,2015,
tudublin.arrow,1,ARROW@TU Dublin,2020,https://arrow.dit.ie/
2712
\ No newline at end of file
import requests, json
# Fonction pour éviter la redondance des données associées à des DOIs différents mais pointant vers les mêmes fichiers :
# Dans Zenodo par exemple, il y a un DOI associé à chaque version d'un dépôt et il faut remonter au DOI "chapeau"
# Si le DOI "chapeau" obtenu ou un "is_identical_to" fait référence à un DOI déjà existant dans le csv, il doit être ignoré.
def get_origin_version(doi, history=[], first=True):
if first: history=[] # ligne ajoutée pour éviter certains soucis de cache où history n'est pas vide au premier appel de la fonction
req = requests.get( f"https://api.datacite.org/dois/{doi}" )
res = req.json()
final = []
result = (doi, history, final) # doi est le DOI qui sera ajouté au csv, history retrace les dois et les relations ayant permis les recherches et final enregistre les relations du doi final ajouté au csv
try:
related = res["data"]["attributes"]["relatedIdentifiers"] # test si des relations existent pour le doi courant
except:
pass # si pas de relation, on renvoie le doi courant
else:
ignore = False # ignore correspond à un doi ayant une version "chapeau" qui doit être trouvée. Le doi courant doit donc être ignoré
duplicate = False # duplicate correspond à un doi étant identique à un autre
for i in related:
final.append(i.get("relationType"))
if i.get("relationType") == "IsVersionOf" and i.get("relatedIdentifierType") == "DOI":
ignore = True
elem_to_save_i = i.get("relatedIdentifier")
history.append([i.get("relationType"), i.get("relatedIdentifier")])
if i.get("relationType") == "IsIdenticalTo" and i.get("relatedIdentifierType") == "DOI":
duplicate = True
elem_to_save_d = i.get("relatedIdentifier") # pas de symétrie pour les is_identical_to, donc il suffit de prendre l'autre (pas le doi courant) pour éviter les doublons
history.append([i.get("relationType"), i.get("relatedIdentifier")])
if duplicate and not(ignore):
result = (elem_to_save_d, history, final) # si identique mais pas de version chapeau on peut s'arrêter
if ignore: result = get_origin_version(elem_to_save_i, history, False) # si version chapeau, on avance sans regarder les identiques
return result
def get_md_from_datacite( doi ) :
"""
retrieve data research metadata from datacite
......@@ -179,5 +210,3 @@ def from_files_load_dois(files_name) :
return all_dois
2-produce-graph/hist-evol-datasets-per-repo.png

63.3 KiB | W: 0px | H: 0px

2-produce-graph/hist-evol-datasets-per-repo.png

71.9 KiB | W: 0px | H: 0px

2-produce-graph/hist-evol-datasets-per-repo.png
2-produce-graph/hist-evol-datasets-per-repo.png
2-produce-graph/hist-evol-datasets-per-repo.png
2-produce-graph/hist-evol-datasets-per-repo.png
  • 2-up
  • Swipe
  • Onion skin
2-produce-graph/hist-last-datasets-by-client.png

46.7 KiB | W: 0px | H: 0px

2-produce-graph/hist-last-datasets-by-client.png

55.3 KiB | W: 0px | H: 0px

2-produce-graph/hist-last-datasets-by-client.png
2-produce-graph/hist-last-datasets-by-client.png
2-produce-graph/hist-last-datasets-by-client.png
2-produce-graph/hist-last-datasets-by-client.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -53,7 +53,7 @@ ax.tick_params(axis='both', which='major', labelsize=8)
plt.legend(reverse = False)
plt.title(f"Datasets registered over the last 30 days\ndistributed by DataCite client",
plt.title(f"Research data registered over the last 30 days\ndistributed by DataCite client",
fontsize = 18, x = 0.5, y = 1.03, alpha = 0.8)
plt.suptitle(f"n = {len(df_last_weeks)}", fontsize = 12, x = 0.5, y = 0.89, alpha = 0.6)
......
2-produce-graph/hist-quantity-year-type.png

51.8 KiB | W: 0px | H: 0px

2-produce-graph/hist-quantity-year-type.png

61.4 KiB | W: 0px | H: 0px

2-produce-graph/hist-quantity-year-type.png
2-produce-graph/hist-quantity-year-type.png
2-produce-graph/hist-quantity-year-type.png
2-produce-graph/hist-quantity-year-type.png
  • 2-up
  • Swipe
  • Onion skin
2-produce-graph/pie--datacite-client.png

56.7 KiB | W: 0px | H: 0px

2-produce-graph/pie--datacite-client.png

65.5 KiB | W: 0px | H: 0px

2-produce-graph/pie--datacite-client.png
2-produce-graph/pie--datacite-client.png
2-produce-graph/pie--datacite-client.png
2-produce-graph/pie--datacite-client.png
  • 2-up
  • Swipe
  • Onion skin
2-produce-graph/pie--datacite-type.png

48.4 KiB | W: 0px | H: 0px

2-produce-graph/pie--datacite-type.png

63.9 KiB | W: 0px | H: 0px

2-produce-graph/pie--datacite-type.png
2-produce-graph/pie--datacite-type.png
2-produce-graph/pie--datacite-type.png
2-produce-graph/pie--datacite-type.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.