From 0090ff30d0b401a30fd306ece42e1ee8ba3a5c32 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Przemys=C5=82aw=20Kaminski?= <pk@intrepidus.pl>
Date: Fri, 30 Jun 2023 07:22:46 +0200
Subject: [PATCH] [openalex] allow author display_name to be null

---
 cabal.project                                   | 10 +++++-----
 src/Gargantext/Core/Text/Corpus/API/OpenAlex.hs |  4 ++--
 stack.yaml                                      |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/cabal.project b/cabal.project
index 52fdc8bc..e0d69afe 100644
--- a/cabal.project
+++ b/cabal.project
@@ -96,6 +96,11 @@ source-repository-package
     location: https://gitlab.iscpif.fr/gargantext/crawlers/istex.git
     tag: a34bb341236d82cf3d488210bc1d8448a98f5808
 
+source-repository-package
+    type: git
+    location: https://gitlab.iscpif.fr/gargantext/crawlers/openalex.git
+    tag: d7aeb1144fce77f60d94a159b4c40329cb6d1960
+
 source-repository-package
     type: git
     location: https://gitlab.iscpif.fr/gargantext/crawlers/pubmed.git
@@ -143,11 +148,6 @@ source-repository-package
     location: https://github.com/rspeer/wikiparsec.git
     tag: 9637a82344bb70f7fa8f02e75db3c081ccd434ce
 
-source-repository-package
-    type: git
-    location: https://gitlab.iscpif.fr/gargantext/crawlers/openalex.git
-    tag: 0083c02d62441d73f3616409c6453c87302c698f
-    
 allow-older: *
 allow-newer: *
 
diff --git a/src/Gargantext/Core/Text/Corpus/API/OpenAlex.hs b/src/Gargantext/Core/Text/Corpus/API/OpenAlex.hs
index 7af4944d..d01cac0c 100644
--- a/src/Gargantext/Core/Text/Corpus/API/OpenAlex.hs
+++ b/src/Gargantext/Core/Text/Corpus/API/OpenAlex.hs
@@ -54,9 +54,9 @@ toDoc (OA.Work { .. } ) =
 
         authors :: [OA.Authorship] -> Maybe Text
         authors [] = Nothing
-        authors aus = Just $ T.intercalate ", " (getDisplayName <$> aus)
+        authors aus = Just $ T.intercalate ", " $ catMaybes (getDisplayName <$> aus)
           where
-            getDisplayName :: OA.Authorship -> Text
+            getDisplayName :: OA.Authorship -> Maybe Text
             getDisplayName OA.Authorship { author = OA.DehydratedAuthor { display_name = dn } } = dn
 
         institutes :: [OA.Authorship] -> Maybe Text
diff --git a/stack.yaml b/stack.yaml
index c4acb8d4..ee3ec38b 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -60,7 +60,7 @@ extra-deps:
 - git: https://gitlab.iscpif.fr/gargantext/crawlers/arxiv-api.git
   commit: 2d7e5753cbbce248b860b571a0e9885415c846f7
 - git: https://gitlab.iscpif.fr/gargantext/crawlers/openalex.git
-  commit: 0083c02d62441d73f3616409c6453c87302c698f
+  commit: d7aeb1144fce77f60d94a159b4c40329cb6d1960
   # NP libs
 - git: https://github.com/alpmestan/servant-job.git
   commit: b4182487cfe479777c11ca19f3c0d47840b376f6
-- 
2.21.0