Commit 38e22142 authored by Fabien Maniere's avatar Fabien Maniere

Update Corpus.hs

parent 64c7b130
......@@ -14,7 +14,7 @@ import Servant.API (ToHttpApiData(..))
data Corpus = Corpus
{ _corpus_docid :: Text
, _corpus_title :: [Text]
, _corpus_title_lang_map :: Map ISO639_1 [Text]
, _corpus_abstract :: [Text]
, _corpus_abstract_lang_map :: Map ISO639_1 [Text]
, _corpus_date :: Maybe Text
......@@ -40,6 +40,12 @@ instance FromJSON Corpus where
_corpus_authors_affiliations <- o .: "authOrganism_s" <|> return []
_corpus_struct_id <- o .: "structId_i" <|> return []
titles <-
mapM (\lang -> do
ma <- o .:? (langTitleS lang)
pure $ (\a -> (lang, a)) <$> ma) allLangs
let _corpus_title_lang_map = Map.fromList $ catMaybes titles
abstracts <-
mapM (\lang -> do
ma <- o .:? (langAbstractS lang)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment