From acab36c6bd794a0d6df226e3d13b1b384f3e5ab9 Mon Sep 17 00:00:00 2001
From: Elias Chetouane <elias.chetouane@univ-grenoble-alpes.fr>
Date: Fri, 16 Feb 2024 16:28:35 +0100
Subject: [PATCH] Ajout d'informations sur les clients datacite.

---
 1-enrich-with-datacite/concatenate-enrich-dois.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/1-enrich-with-datacite/concatenate-enrich-dois.py b/1-enrich-with-datacite/concatenate-enrich-dois.py
index 08f4529..7a0e8b1 100644
--- a/1-enrich-with-datacite/concatenate-enrich-dois.py
+++ b/1-enrich-with-datacite/concatenate-enrich-dois.py
@@ -61,6 +61,21 @@ if temp_rows :
 
 	## output another csv with datacite client and number of datasets
 	df_client_raw = df_out["client"].value_counts()
+
+	## get informations about each client
+	client_names = []
+	client_years = []
+	client_urls = []
+	for client in df_client_raw["client"]:
+		req = requests.get('https://api.datacite.org/clients?query=id:%22cern.zenodo%22')
+		client_names.append(req.json()["data"][0]["attributes"]["name"])
+		client_years.append(req.json()["data"][0]["attributes"]["year"])
+		client_urls.append(req.json()["data"][0]["attributes"]["url"])
+	
+	## add informations to the output csv
+	df_client_raw["name"] = client_names
+	df_client_raw["year"] = client_years
+	df_client_raw["url"] = client_urls
 	df_client_raw.to_csv("all_datacite_clients_for_uga.csv")
 
 
-- 
GitLab