From 43a58ff00bdd753df5969f4b000d8f9ee5a0736c Mon Sep 17 00:00:00 2001
From: Maxence Larrieu <maxence.larrieu@univ-grenoble-alpes.fr>
Date: Sun, 25 Aug 2024 23:11:48 +0200
Subject: [PATCH] export a lighter table w the last 500 DOIs

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

diff --git a/1-enrich-with-datacite/concatenate-enrich-dois.py b/1-enrich-with-datacite/concatenate-enrich-dois.py
index 0f74b73..1f33bc5 100644
--- a/1-enrich-with-datacite/concatenate-enrich-dois.py
+++ b/1-enrich-with-datacite/concatenate-enrich-dois.py
@@ -87,10 +87,18 @@ if temp_rows :
 	df_out.to_csv("../dois-uga.csv", index = False)
 	print(f"\n\nnb of doi exported \t{len(df_out)}")
 
+
 	# write the number of dois found in a file to display on the website
 	with open("nb-dois.txt", 'w') as outf :
 		outf.write(str(len(df_out)))
 
+
+	## output last 500 DOIs to make it easier to open in web tools
+	df_last_dois = df_out.sort_values(by = "created", ascending = False, inplace = False)[:500]
+	df_last_dois["created"] = df_last_dois["created"].str[:10]
+	df_last_dois[["doi", "client", "resourceTypeGeneral", "created", "publisher", "rights", "sizes"]].to_csv("../dois-uga--last-500.csv", index = False)
+
+
 	## for the website : output another csv with datacite client and number of datasets
 	df_client_raw = df_out["client"].value_counts().to_frame()
 
-- 
GitLab