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 (236)
Showing
with 3078 additions and 1900 deletions
build-job:
stage: build
script:
- echo "Hello, $GITLAB_USER_LOGIN!"
image: python:3-alpine
test-job1:
stage: test
script:
- echo "This job tests something"
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
test-job2:
stage: test
script:
- echo "This job tests something, but takes more time than test-job1."
- echo "After the echo commands complete, it runs the sleep command for 20 seconds"
- echo "which simulates a test that runs 20 seconds longer than test-job1"
- sleep 20
deploy-prod:
stage: deploy
before_script:
# installations permettant de faire tourner git
- apk update
- apk add git openssh
script:
- echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
environment: production
# 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 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}
# 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.
......@@ -3,28 +3,21 @@
"""
## Documentation
* Doc générale API : https://support.datacite.org/docs/api
## Doc
* datacite API : https://support.datacite.org/docs/api
* Recherche d'un DOI : https://support.datacite.org/docs/api-sampling
* Pagination : https://support.datacite.org/docs/pagination
> "DataCite added support for affiliation identifiers in Metadata Schema 4.3, released August 2019"
* nb : "DataCite added support for affiliation identifiers in Metadata Schema 4.3, released August 2019"
https://support.datacite.org/docs/can-i-see-more-detailed-affiliation-information-in-the-rest-api
* pour descendre au niveau des auteurs
le filtre `?person-id=orcid-nb`
"""
* mémo : pour descendre au niveau des auteurs , le filtre `?person-id=orcid-nb`
query_mode = [
'creators.affiliation.affiliationIdentifier:"https://ror.org/02rx3b187"',
'contributors.affiliation.affiliationIdentifier:"https://ror.org/02rx3b187"',
"publisher:(grenoble AND alpes)", # /!\ apporte du text
"client_id:inist.osug", # OSUG https://doi.osug.fr/
"client_id:jbru.aau", # le laboratoire AAU (architecture) /!\ apporte du text
"client_id:inist.persyval" # Labex Persyval-lab (PIA)
# possibilité d'ajouter d'autres requêtes
]
* 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
"""
def get_results(query_from_list):
def get_results(query_from_list, view_results):
"""
lance les requêtes dans l'API
"""
......@@ -32,7 +25,7 @@ def get_results(query_from_list):
query_root = "https://api.datacite.org/dois?query="
# les type de datasets à exclure (à voir si on retire text)
# nb : en 2023-12-15 ça retire seulement 15 DOIs
# note 2023-12-15 ça retire seulement 15 DOIs
query_filter_type = " AND resource_type_id:(-book -bookChapter -conferencePaper -conferenceProceeding -dissertation -event -journal -journalArticle -peerReview -preprint -report -service)"
query_page = "&page[size]=100"
......@@ -40,8 +33,10 @@ def get_results(query_from_list):
req = requests.get(query_root + query_from_list + query_filter_type + query_page)
results = [req.json()]
# print total dataset per query
print(f"\n\t{req.url}\n\t{results[0]['meta']['total']}")
if view_results:
# print total dataset per query
print(f"\n\t{req.url}")
print(f"\t{results[0]['meta']['total']}")
# obtenir les résultats de chaque page dans la liste results
nb_pages = results[0]["meta"]["totalPages"]
......@@ -58,9 +53,7 @@ def get_dois(results):
"""
Ajouter les datasets avec DOI dans une liste et identifier ceux sans DOI
"""
dois = []
not_dois = []
temp_dois = []
# prendre en compte les résultats de chaque page
for res in results:
......@@ -69,37 +62,74 @@ def get_dois(results):
for item in num_dois :
item_id = item["id"]
# si le dataset a autre chose qu'un DOI
if item.get("type") != "dois":
not_dois.append(item_id)
# si le dataset a un id qui correspond à un DOI
if item.get("type") == "dois":
temp_dois.append(item_id)
else:
dois.append(item_id)
## si l'id n'est pas un DOI on l'ajoute ds une liste globale
main_no_dois.append(item_id)
return dois, not_dois
return temp_dois
print("\n\nRunning datacite.py")
import requests, pandas as pd
main_dois = []
main_no_dois = []
# _____0____ récupérer les dois
import requests
dois, not_dois = [], []
## __________0__________ query with all RORs from UGA on authors and contributors
### load table containing finded ROR
df_raw = pd.read_csv("uga-find-ror-childs/UGA-ror-childs--2023-12-29--manual.csv")
#print("columns name: ", [colname for colname in df_raw.columns])
for query in query_mode:
doi, not_doi = get_dois(get_results(query))
dois += doi
not_dois += not_doi
### select accurate ROR
df_hal = df_raw[ df_raw["docid"].notna() ] ## RORs finded via HAL
df_ror = df_raw[ df_raw["Unnamed: 6"] == "include"] ## RORs selected manually /!\ col name
rors = df_hal.ror.tolist() + df_ror.ror.tolist()
rors.append("https://ror.org/02rx3b187") ## add the ROR from UGA !
print(f"\t__process by ROR\n\tnb of ROR loaded\t{len(rors)}")
# debug : try only with UGA ROR
# rors = ["https://ror.org/02rx3b187"]
for ror in rors : # to debug add [:1]
for auth_type in ["creators", "contributors"] :
query = f"{auth_type}.affiliation.affiliationIdentifier:\"{ror}\""
temp_doi_list = get_dois(get_results(query, False))
[main_dois.append(elem) for elem in temp_doi_list]
print(f"\tnb DOIs finded \t{len(main_dois)}")
## __________1__________ query by datacite client and UGA as pupublisher
print(f"\n\t__process by datacite clients")
query_client_publisher = [
"client_id:inist.osug", # OSUG https://doi.osug.fr/
"client.uid:inist.sshade", # services nationaux d'observation portés par l'OSUG
"client.uid:inist.resif", # services nationaux d'observation portés par l'OSUG
"client_id:inist.persyval", # Labex Persyval-lab (PIA)
"publisher:(grenoble AND alpes)" # /!\ apporte du text
]
for query in query_client_publisher :
temp_doi_list = get_dois(get_results(query, True))
[main_dois.append(elem) for elem in temp_doi_list]
if not_doi :
print("Des données avec un autre identifiant que le DOI ont été trouvées")
[print(f"\t\t{item_id}") for item_id in not_doi]
print(f"\tnb DOI finded \t{len(main_dois)}")
# _____n____ remove duplicates in DOI list
unique_dois = list(set(dois))
print(f"Nb unique DOI\t{len(unique_dois)}")
## __________n__________ if Datasets with other things that a DOI have been finded
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 duplicates
unique_dois = list(set(main_dois))
print(f"\tNb of unique DOI\t{len(unique_dois)}")
# _____z____ exporter liste DOI format txt
# __________z__________ export DOIs in txt files
with open("datacite-dois.txt", 'w') as f :
[f.write(f"{line}\n") for line in unique_dois]
......@@ -8,8 +8,8 @@
10.34847/nkl.748eqz51
10.34847/nkl.2c0fj3ai
10.34847/nkl.2bad8uj6
10.34847/nkl.87788ro3
10.34847/nkl.2404plkh
10.34847/nkl.87788ro3
10.34847/nkl.bafagy29
10.34847/nkl.9bd4vqc6
10.34847/nkl.4540o25d
......@@ -22,8 +22,8 @@
10.34847/nkl.3dbc2mtb
10.34847/nkl.bc2b1071
10.34847/nkl.81dcdekj
10.34847/nkl.b1cb3arm
10.34847/nkl.c9e92or4
10.34847/nkl.ef903o6v
10.34847/nkl.ae94a74k
10.34847/nkl.bf5f263z
10.34847/nkl.9f85iol5
10.34847/nkl.345bf9i7
......
......@@ -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
......@@ -68,17 +68,20 @@ def get_dois_n_users(user_id):
import json, requests
print("\n\nRunning nakala.py")
## list to stock datas
nakala_uga_users = []
all_dois = []
other_user_finded = []
## importer les users depuis le fichier txt
## load nakala users from txt file
with open('nakala-uga-users.txt', 'r') as f:
## attention bien stripper quand on import du txt sinon les sauts de ligne sont présents
[nakala_uga_users.append( user.strip() ) for user in f.readlines()]
print("nb d'utilisateur Nakala UGA importés", len(nakala_uga_users))
print("\tnb nakala users loaded", len(nakala_uga_users))
# ____n____ iterer sur les users uga
for user in nakala_uga_users :
......@@ -87,7 +90,7 @@ for user in nakala_uga_users :
res = get_dois_n_users(user)
if res["continue"] :
print(f"{user}\n\tnb DOI {len(res['content'])}" )
#print(f"{user}\n\tnb DOI {len(res['content'])}" )
## ajouter les DOIs trouvés
if len(res["content"]) > 0 :
......@@ -98,6 +101,8 @@ for user in nakala_uga_users :
#print(f"\nnew person {','.join(res['other_users'])}")
other_user_finded += [x for x in res["other_users"] ]
print(f"\tnb dois finded\t\t{len(all_dois)}")
## ____n____ exporter les DOI au format txt
......@@ -106,7 +111,7 @@ with open("nakala-dois.txt", 'w') as fh :
## print les autres utilisateurs trouvés
if other_user_finded :
print("\n\n nakala new user finded ")
print("\n\n\tnakala new user finded ")
for elem in other_user_finded :
print(f"\t\t{elem}")
print(f"\t\t\t{elem}")
10.57745/52HT2L
10.57745/7RFNNP
10.57745/UOGRPY
10.57745/GRHRZJ
10.57745/7HF7KG
10.57745/ENJADK
10.57745/XHQ7TL
10.15454/O93984
10.57745/3D4DFW
10.57745/69UNAM
10.57745/NZFWP9
10.57745/R1NIKK
10.57745/TVAHUQ
10.57745/3VMB3Y
10.57745/TOR3SF
10.57745/OVCWQN
10.57745/GRHRZJ
10.57745/Z3BG2U
10.57745/QCVYG3
10.57745/KTFZQD
10.57745/B6PSX0
10.15454/M7OK9E
10.57745/CM2WOI
10.57745/GZKUZS
10.57745/NGC4J0
10.57745/IZHDPC
10.57745/LPJ2S2
10.57745/W9N5Z9
10.57745/TVAHUQ
10.57745/MXEMI4
10.57745/BYWEA3
10.15454/O93984
10.57745/QOA1QO
10.57745/YWBDQQ
10.57745/7RFNNP
10.57745/B6PSX0
10.57745/JOZ1NA
10.57745/XHQ7TL
10.57745/OT1IFB
10.57745/NGC4J0
10.57745/ID1LS6
10.57745/3VMB3Y
10.57745/MXEMI4
10.57745/LPJ2S2
10.57745/GZKUZS
10.57745/LXTWNG
10.57745/KTFZQD
10.57745/ENJADK
10.57745/NZFWP9
10.57745/NOHRHJ
10.57745/OVCWQN
10.57745/5O6QIH
10.57745/RUQLJL
10.57745/OT1IFB
10.57745/Z3BG2U
10.57745/3D4DFW
10.57745/LXTWNG
10.57745/LUTMNE
10.15454/8UIA76
10.57745/TOR3SF
10.57745/UOGRPY
10.57745/5O6QIH
10.57745/J2A44Q
10.57745/7HF7KG
10.57745/W9N5Z9
10.15454/8UIA76
10.57745/HZDPTT
10.57745/IZHDPC
10.57745/52HT2L
10.57745/CM2WOI
10.57745/R1NIKK
10.57745/QOA1QO
10.57745/LUTMNE
10.57745/YWBDQQ
......@@ -2,9 +2,6 @@
## 2023-12-01, Elias Chetouane
"""
## todo
/
## Documentation
* Noms des champs à requêter : https://entrepot.recherche.data.gouv.fr/api/metadatablocks/citation
* Doc API Dataverse : https://guides.dataverse.org/en/5.12.1/api/search.html
......@@ -24,16 +21,17 @@ 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()]
# obtenir les résultats de chaque page dans la liste results
......@@ -41,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"]
......@@ -61,13 +59,14 @@ 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("Nombre de résultats trouvés : " + str(nb_dois))
print("\tnb DOIs\t\t" + str(nb_dois))
return dois
# on récupère les dois
print("\n\nRunning rdg.py")
# on récupère les dois
dois = []
for url in urls:
......@@ -77,10 +76,11 @@ for url in urls:
unique_dois = list(set(dois))
print("Nombre de dois différents trouvés : " + str(len(unique_dois)))
print("\tnb DOIs uniques\t\t" + str(len(unique_dois)))
# exporter la liste de DOI au format txt
with open("rdg-dois.txt", 'w') as f :
[f.write(f"{line[4:]}\n") for line in unique_dois] # [4:] pour retirer "doi:" au début de chaque ligne
# memo [4:] pour retirer "doi:" au début de chaque lignes
[f.write(f"{line[4:]}\n") for line in unique_dois]
ror,name,type,docid,hal_child_nb,ror_relation_nb,,
https://ror.org/05588ks88,LInguistique et DIdactique des Langues Étrangères et Maternelles,laboratory,1043147,0.0,,,
https://ror.org/01yxtfe92,École nationale supérieure d'architecture de Grenoble,institution,1043352,1.0,,,
https://ror.org/05hz99a17,"Ambiances, Architectures, Urbanités",laboratory,1088635,0.0,,,
https://ror.org/0509qp208,Centre d'études et de recherches appliquées à la gestion,laboratory,1043181,0.0,,,
https://ror.org/05sbt2524,Institut polytechnique de Grenoble - Grenoble Institute of Technology,institution,1043329,15.0,,,
https://ror.org/02z8yps18,"Laboratoire de Génie des Procédés pour la Bioraffinerie, les Matériaux Bio-sourcés et l'Impression Fonctionnelle",laboratory,1162332,0.0,,,
https://ror.org/04eg25g76,Laboratoire de Conception et d'Intégration des Systèmes,laboratory,1043068,0.0,,,
https://ror.org/02wrme198,Grenoble Images Parole Signal Automatique,laboratory,1043333,0.0,,,
https://ror.org/043pfpy19,Laboratoire des Écoulements Géophysiques et Industriels [Grenoble],laboratory,1043048,0.0,,,
https://ror.org/03985kf35,Translational Innovation in Medicine and Complexity / Recherche Translationnelle et Innovation en Médecine et Complexité - UMR 5525,laboratory,1043049,0.0,,,
https://ror.org/03bcdsr62,"Laboratoire sols, solides, structures - risques [Grenoble]",laboratory,1043064,0.0,,,
https://ror.org/04dbzz632,Institut Néel,laboratory,1043183,0.0,,,
https://ror.org/05hyx5a17,Laboratoire de Génie Electrique de Grenoble,laboratory,1043220,0.0,,,
https://ror.org/01c8rcg82,Laboratoire d'Informatique de Grenoble,laboratory,1043301,0.0,,,
https://ror.org/05afmzm11,VERIMAG,laboratory,1043148,0.0,,,
https://ror.org/04ett5b41,Laboratoire Jean Kuntzmann,laboratory,1043077,0.0,,,
https://ror.org/03taa9n66,"Institut de Microélectronique, Electromagnétisme et Photonique - Laboratoire d'Hyperfréquences et Caractérisation",laboratory,1043224,0.0,,,
https://ror.org/03f0apy98,Laboratoire de Physique Subatomique et de Cosmologie,laboratory,1043144,0.0,,,
https://ror.org/00fwjkb59,Laboratoire d'Economie Appliquée de Grenoble,laboratory,1043256,0.0,,,
https://ror.org/04axb9j69,Laboratoire d'Electrochimie et de Physico-chimie des Matériaux et des Interfaces,laboratory,1043074,0.0,,,
https://ror.org/04as3rk94,[GIN] Grenoble Institut des Neurosciences,regrouplaboratory,408885,0.0,,,
https://ror.org/05rwrfh97,Institut Fourier,laboratory,1043234,0.0,,,
https://ror.org/036zswm25,Laboratoire des technologies de la microélectronique,laboratory,1043042,0.0,,,
https://ror.org/023n9q531,Laboratoire Interdisciplinaire de Physique [Saint Martin d’Hères],laboratory,1043294,0.0,,,
https://ror.org/026j45x50,"Pacte, Laboratoire de sciences sociales",laboratory,1043180,0.0,,,
https://ror.org/02mc6qk71,Laboratoire de physique et modélisation des milieux condensés,laboratory,1043152,0.0,,,
https://ror.org/04szabx38,Institut de biologie structurale,department,1043235,0.0,,,
https://ror.org/02dpnb389,Clinatec - Centre de recherche biomédicale Edmond J.Safra,department,416269,0.0,,,
https://ror.org/03x1z2w73,Laboratoire d'Ecologie Alpine,laboratory,1043062,0.0,,,
https://ror.org/045ktmd28,Laboratoire national des champs magnétiques intenses - Grenoble,laboratory,1043255,0.0,,,
https://ror.org/04qz4qy85,LAboratoire de Recherche Historique Rhône-Alpes - UMR5190,laboratory,1043116,0.0,,,
https://ror.org/041rhpw39,Centre Hospitalier Universitaire de Grenoble,healthcare,,,4.0,include,
https://ror.org/000tdrn36,Centre Interuniversitaire de MicroElectronique et Nanotechnologies,facility,,,2.0,include,
https://ror.org/02wmc6m46,Institut d'Histoire des Représentations et des Idées dans les Modernités,facility,,,6.0,error,old UMR
https://ror.org/01cf2sz15,Institut des Sciences de la Terre,facility,,,5.0,include,
https://ror.org/01wwcfa26,Institute of Environmental Geosciences,facility,,,5.0,include,
https://ror.org/03eqm6y13,LabEx PERSYVAL-Lab,facility,,,5.0,include,
https://ror.org/0157h5t87,"Langages, Littératures, Sociétés. Études Transfrontalières et Internationales",facility,,,2.0,error,old UMR
https://ror.org/02f7wz369,Pierre Mendès-France University,education,,,7.0,include,
https://ror.org/03yppfm65,Stendhal University,education,,,5.0,include,
https://ror.org/02rmwrd87,"Laboratoire Environnements, Dynamiques et Territoires de Montagne",facility,,,4.0,include,
https://ror.org/047p7mf25,Institut Carnot PolyNat,facility,,,2.0,include,
https://ror.org/03vte9x46,Observatoire des Sciences de l'Univers de Grenoble,education,,,5.0,include,
https://ror.org/05c99vk74,Laboratoire de Recherche sur les Apprentissages en Contexte,facility,,,2.0,include,
https://ror.org/04fhvpc68,Département de Pharmacochimie Moléculaire,facility,,,2.0,include,
https://ror.org/03jrb0276,"Laboratoire Inter-universitaire de Psychologie: Personnalité, Cognition, Changement Social",facility,,,2.0,include,
https://ror.org/01kbr1737,PHotonique ELectronique et Ingénierie QuantiqueS,facility,,,2.0,include,
https://ror.org/00ndvqf03,Laboratoire Modélisation et Exploration des Matériaux,facility,,,2.0,include,
https://ror.org/0467x8h16,Maison des Sciences de l'Homme-Alpes,facility,,,2.0,include,
https://ror.org/02cmt9z73,Agence pour les Mathématiques en Interaction avec l'Entreprise et la Société,facility,,,2.0,exclude,GDR national
https://ror.org/026m44z54,Laboratoire Nanotechnologies et Nanosystèmes,facility,,,6.0,include,
https://ror.org/03949e763,Integrated Structural Biology Grenoble,facility,,,3.0,include,
https://ror.org/04ndt7n58,"Centre d'Etudes et de Recherche sur la diplomatie, l’Administration Publique et le Politique",facility,,,2.0,include,
https://ror.org/044cfnj78,GRIDCAD - Grenoble Alpes Recherche-Infrastructure de Calcul intensif et de Données,facility,,,4.0,include,
https://ror.org/03e044190,Spintronique et Technologie des Composants,facility,,,4.0,include,
https://ror.org/05hb8m595,PHOTOSYNTHESE,other,,,12.0,exclude,GDR national
https://ror.org/01w1erp60,Couplage Multi-physiques et Multi-échelles en mécanique géo-environnemental,other,,,19.0,exclude,GDR national
https://ror.org/05be9p317,Micropesanteur Fondamentale et Appliquée,other,,,14.0,exclude,GDR national
https://ror.org/01x6z5t49,Fédération de Recherche Spectroscopies de Photoémission,other,,,42.0,exclude,FR national
https://ror.org/01nrtdp55,GDR NBODY : Problème quantique à N corps en chimie et physique,facility,,,38.0,exclude,GDR national
https://ror.org/00hgbrg14,"Fédération française Matériaux sous hautes vitesses de déformation. Application aux matériaux en conditions extrêmes, Procédés et structures",other,,,16.0,exclude,FR national
https://ror.org/0459fdx51,Fédération de Recherche sur l'Energie Solaire,other,,,45.0,exclude,FR national
https://ror.org/04yem5s35,INFRANALYTICS,other,,,16.0,exclude,IR national
https://ror.org/01sgwka45,Microscopie Fonctionnelle du Vivant,facility,,,31.0,exclude,GDR national
ror,name,type,docid,hal_child_nb,ror_relation_nb
https://ror.org/05588ks88,LInguistique et DIdactique des Langues Étrangères et Maternelles,laboratory,1043147,0.0,
https://ror.org/01yxtfe92,École nationale supérieure d'architecture de Grenoble,institution,1043352,1.0,
https://ror.org/05hz99a17,"Ambiances, Architectures, Urbanités",laboratory,1088635,0.0,
https://ror.org/0509qp208,Centre d'études et de recherches appliquées à la gestion,laboratory,1043181,0.0,
https://ror.org/05sbt2524,Institut polytechnique de Grenoble - Grenoble Institute of Technology,institution,1043329,15.0,
https://ror.org/02z8yps18,"Laboratoire de Génie des Procédés pour la Bioraffinerie, les Matériaux Bio-sourcés et l'Impression Fonctionnelle",laboratory,1162332,0.0,
https://ror.org/04eg25g76,Laboratoire de Conception et d'Intégration des Systèmes,laboratory,1043068,0.0,
https://ror.org/02wrme198,Grenoble Images Parole Signal Automatique,laboratory,1043333,0.0,
https://ror.org/043pfpy19,Laboratoire des Écoulements Géophysiques et Industriels [Grenoble],laboratory,1043048,0.0,
https://ror.org/03985kf35,Translational Innovation in Medicine and Complexity / Recherche Translationnelle et Innovation en Médecine et Complexité - UMR 5525,laboratory,1043049,0.0,
https://ror.org/03bcdsr62,"Laboratoire sols, solides, structures - risques [Grenoble]",laboratory,1043064,0.0,
https://ror.org/04dbzz632,Institut Néel,laboratory,1043183,0.0,
https://ror.org/05hyx5a17,Laboratoire de Génie Electrique de Grenoble,laboratory,1043220,0.0,
https://ror.org/01c8rcg82,Laboratoire d'Informatique de Grenoble,laboratory,1043301,0.0,
https://ror.org/05afmzm11,VERIMAG,laboratory,1043148,0.0,
https://ror.org/04ett5b41,Laboratoire Jean Kuntzmann,laboratory,1043077,0.0,
https://ror.org/03taa9n66,"Institut de Microélectronique, Electromagnétisme et Photonique - Laboratoire d'Hyperfréquences et Caractérisation",laboratory,1043224,0.0,
https://ror.org/03f0apy98,Laboratoire de Physique Subatomique et de Cosmologie,laboratory,1043144,0.0,
https://ror.org/00fwjkb59,Laboratoire d'Economie Appliquée de Grenoble,laboratory,1043256,0.0,
https://ror.org/04axb9j69,Laboratoire d'Electrochimie et de Physico-chimie des Matériaux et des Interfaces,laboratory,1043074,0.0,
https://ror.org/04as3rk94,[GIN] Grenoble Institut des Neurosciences,regrouplaboratory,408885,0.0,
https://ror.org/036zswm25,Laboratoire des technologies de la microélectronique,laboratory,1043042,0.0,
https://ror.org/05rwrfh97,Institut Fourier,laboratory,1043234,0.0,
https://ror.org/026j45x50,"Pacte, Laboratoire de sciences sociales",laboratory,1043180,0.0,
https://ror.org/023n9q531,Laboratoire Interdisciplinaire de Physique [Saint Martin d’Hères],laboratory,1043294,0.0,
https://ror.org/04szabx38,Institut de biologie structurale,department,1043235,0.0,
https://ror.org/02mc6qk71,Laboratoire de physique et modélisation des milieux condensés,laboratory,1043152,0.0,
https://ror.org/02dpnb389,Clinatec - Centre de recherche biomédicale Edmond J.Safra,department,416269,0.0,
https://ror.org/03x1z2w73,Laboratoire d'Ecologie Alpine,laboratory,1043062,0.0,
https://ror.org/045ktmd28,Laboratoire national des champs magnétiques intenses - Grenoble,laboratory,1043255,0.0,
https://ror.org/04qz4qy85,LAboratoire de Recherche Historique Rhône-Alpes - UMR5190,laboratory,1043116,0.0,
https://ror.org/041rhpw39,Centre Hospitalier Universitaire de Grenoble,healthcare,,,4.0
https://ror.org/000tdrn36,Centre Interuniversitaire de MicroElectronique et Nanotechnologies,facility,,,2.0
https://ror.org/02wmc6m46,Institut d'Histoire des Représentations et des Idées dans les Modernités,facility,,,6.0
https://ror.org/01cf2sz15,Institut des Sciences de la Terre,facility,,,5.0
https://ror.org/01wwcfa26,Institute of Environmental Geosciences,facility,,,5.0
https://ror.org/03eqm6y13,LabEx PERSYVAL-Lab,facility,,,5.0
https://ror.org/0157h5t87,"Langages, Littératures, Sociétés. Études Transfrontalières et Internationales",facility,,,2.0
https://ror.org/02f7wz369,Pierre Mendès-France University,education,,,7.0
https://ror.org/03yppfm65,Stendhal University,education,,,5.0
https://ror.org/02rmwrd87,"Laboratoire Environnements, Dynamiques et Territoires de Montagne",facility,,,4.0
https://ror.org/047p7mf25,Institut Carnot PolyNat,facility,,,2.0
https://ror.org/03vte9x46,Observatoire des Sciences de l'Univers de Grenoble,education,,,5.0
https://ror.org/05c99vk74,Laboratoire de Recherche sur les Apprentissages en Contexte,facility,,,2.0
https://ror.org/04fhvpc68,Département de Pharmacochimie Moléculaire,facility,,,2.0
https://ror.org/03jrb0276,"Laboratoire Inter-universitaire de Psychologie: Personnalité, Cognition, Changement Social",facility,,,2.0
https://ror.org/01kbr1737,PHotonique ELectronique et Ingénierie QuantiqueS,facility,,,2.0
https://ror.org/00ndvqf03,Laboratoire Modélisation et Exploration des Matériaux,facility,,,2.0
https://ror.org/0467x8h16,Maison des Sciences de l'Homme-Alpes,facility,,,2.0
https://ror.org/02cmt9z73,Agence pour les Mathématiques en Interaction avec l'Entreprise et la Société,facility,,,2.0
https://ror.org/026m44z54,Laboratoire Nanotechnologies et Nanosystèmes,facility,,,6.0
https://ror.org/03949e763,Integrated Structural Biology Grenoble,facility,,,3.0
https://ror.org/04ndt7n58,"Centre d'Etudes et de Recherche sur la diplomatie, l’Administration Publique et le Politique",facility,,,2.0
https://ror.org/044cfnj78,GRIDCAD - Grenoble Alpes Recherche-Infrastructure de Calcul intensif et de Données,facility,,,4.0
https://ror.org/03e044190,Spintronique et Technologie des Composants,facility,,,4.0
https://ror.org/05hb8m595,PHOTOSYNTHESE,other,,,12.0
https://ror.org/01w1erp60,Couplage Multi-physiques et Multi-échelles en mécanique géo-environnemental,other,,,19.0
https://ror.org/05be9p317,Micropesanteur Fondamentale et Appliquée,other,,,14.0
https://ror.org/01x6z5t49,Fédération de Recherche Spectroscopies de Photoémission,other,,,42.0
https://ror.org/01nrtdp55,GDR NBODY : Problème quantique à N corps en chimie et physique,facility,,,38.0
https://ror.org/00hgbrg14,"Fédération française Matériaux sous hautes vitesses de déformation. Application aux matériaux en conditions extrêmes, Procédés et structures",other,,,16.0
https://ror.org/0459fdx51,Fédération de Recherche sur l'Energie Solaire,other,,,45.0
https://ror.org/04yem5s35,INFRANALYTICS,other,,,16.0
https://ror.org/01sgwka45,Microscopie Fonctionnelle du Vivant,facility,,,31.0
# Récupérer les RORs de l'env. UGA
## 2024-01-08, Maxence Larrieu
"""
## step
- recupere les ROR qui ont pour parent le ROR de l'UGA
- HAL : on réduit aux structures VALID
- ROR apporte du bruit et demande un nettoyage manuel a posteriori
- ROR : on retire les UMR passées et les réseaux nationaux type GDR, FR, IR
- cette dernière étape se fait à la main à partir des tableaux produits
## documentation
* HAL
https://api.archives-ouvertes.fr/ref/structure/?q=parentRor_id:02rx3b187
* ROR
https://ror.readme.io/docs/ror-schema-api-v2-beta
https://api.dev.ror.org/v2/organizations/02rx3b187
"""
import requests, json, pandas as pd
import datetime
## ___0____ from HAL structure API get UGA ROR childs
def hal_struct_return_docs(ror_id) :
"""
HAL structure referentiel
https://api.archives-ouvertes.fr/docs/ref/?resource=structure&schema=fields#fields
list structures who have a parent corresponding to ror_id
output raw results inside the "docs" key
"""
# query human language : childs of ROR structure that are VALID and has a ROR id
req_filter = f"q=parentRor_id:{ror_id}&fq=ror_s:[%22%22%20TO%20*]\
&fq=valid_s:VALID&fl=ror_s,name_s,type_s,docid"
req = requests.get("https://api.archives-ouvertes.fr/ref/structure/?" + req_filter + "&rows=500")
# to debug print(req.url)
res = req.json()
return res["response"]["docs"]
def hal_struct_return_ror_childs(ror_id) :
"""
boucle récursive
à partir d'un résultat de HAL structure sur parent_ror
itérer sur chacun des éléments et les ajouter
et refaire pareil sur ces éléments
"""
hal_results = hal_struct_return_docs(ror_id)
for item in hal_results :
# in HAL structure API, ror are in list
for ror_url in item["ror_s"] :
## find number of ROR child to the sub element
ror_id = convert_ror_url_to_id(ror_url)
new_hal_results = hal_struct_return_docs(ror_id)
nb_childs = len(new_hal_results)
struct_info = [ror_url, item["name_s"], item["type_s"], item["docid"], nb_childs]
ror_childs.append(struct_info)
## if sub element has ROR child lets iterate on these new results
if nb_childs > 0 :
new_ror_id = convert_ror_url_to_id(ror_url)
hal_struct_return_ror_childs(new_ror_id)
def convert_ror_url_to_id (ror_url) :
# convert https://ror.org/05rwrfh97 to 05rwrfh97
## car l'API de HAL renoie l'URL pour ces deux champs ror_s et ror_urls :/
return ror_url[ ror_url.rfind("/") +1 :]
ror_childs = []
hal_struct_return_ror_childs("02rx3b187")
print(f"from HAL, nb of childs raw\t{len(ror_childs)}")
df_hal = pd.DataFrame(ror_childs, columns = ["ror", "name", "type", "docid", "hal_child_nb"])
df_hal.drop_duplicates(subset = ["ror"], inplace = True)
print(f"from HAL, nb of unique childs\t{len(df_hal)}")
## ____2____ from ROR API get UGA ROR childs
def ror_get_child_info(ror_id) :
req = requests.get("https://api.dev.ror.org/v2/organizations/" + ror_id)
res = req.json()
types_list = [ item for item in res["types"]]
org_type = ",".join(types_list)
return {
"org_type" : org_type,
"relation_nb" : len(res["relationships"])
}
# query on ROR w UGA ROR_id
req = requests.get("https://api.dev.ror.org/v2/organizations/02rx3b187")
res = req.json()
# relationships contains all ror "childs"
ror_list = res["relationships"]
print(f"from ROR, nb of childs finded\t{len(ror_list)}")
## for each ROR finded enrich with ROR API
data_from_rors = []
for item in ror_list :
if item["id"] not in df_hal.ror.values :
org_info = ror_get_child_info(item["id"])
data_from_rors.append(
[ item["id"], item["label"], org_info["org_type"], org_info["relation_nb"] ]
)
df_ror = pd.DataFrame(data_from_rors, columns = ["ror", "name", "type", "ror_relation_nb"])
df = pd.concat([df_hal, df_ror], ignore_index = True)
date = datetime.datetime.now().strftime("%Y-%m-%d") ## format date has 2023-12-29
df.to_csv(f"UGA-ror-childs--{date}.csv", index = False)
print("nb of RORs finded", len(df))
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]`
......@@ -27,13 +23,7 @@
import requests, json
print("\n\nzenodo.py is launched")
with open("personnal-keys.json") as f :
## load zenodo keys for requests the API
ACCESS_TOKEN = json.load(f)["ZENODO_KEY"]
print("\n\nRunning zenodo.py")
def req_zenodo_with_page(uga_perimeter, record_type, page_nb) :
"""
......@@ -50,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
......@@ -89,7 +78,7 @@ def req_zenodo(uga_perimeter, record_type) :
# verifier si la requete a bien fonctionnée
if not res["continue"] :
print(r"/!\ oups, problem with the query")
print(r"\t/!\ oups, problem with the query")
print(res["content"].status_code ) ## contient la réponse de la requête
break
......@@ -117,20 +106,26 @@ 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]
print("Zenodo nb of DOIs catched",
len(all_dois)
)
print("\n\tnb DOIs finded\t", len(all_dois) )
## ____z____ exporter la liste de DOI au format txt
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
2727
\ No newline at end of file
2-produce-graph/hist--datasets-by-year.png

25.5 KiB

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

72 KiB