Commit cb87d66d authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX][DOCUMENT] Type adapted to WOS parser.

parent ad5157f3
...@@ -22,7 +22,7 @@ import Gargantext.Components.Node (NodePoly(..)) ...@@ -22,7 +22,7 @@ import Gargantext.Components.Node (NodePoly(..))
type State = type State =
{ document :: Maybe (NodePoly DocumentV3) { document :: Maybe (NodePoly Document)
, inputValue :: String , inputValue :: String
} }
...@@ -99,22 +99,21 @@ data Document = ...@@ -99,22 +99,21 @@ data Document =
Document { abstract :: Maybe String Document { abstract :: Maybe String
, authors :: Maybe String , authors :: Maybe String
, bdd :: Maybe String , bdd :: Maybe String
, doi :: Maybe Int , doi :: Maybe String
, language_iso2 :: Maybe String , language_iso2 :: Maybe String
, language_iso3 :: Maybe String -- , page :: Maybe Int
, page :: Maybe Int
, publication_date :: Maybe String , publication_date :: Maybe String
, publication_second :: Maybe Int --, publication_second :: Maybe Int
, publication_minute :: Maybe Int --, publication_minute :: Maybe Int
, publication_hour :: Maybe Int --, publication_hour :: Maybe Int
, publication_day :: Maybe String , publication_day :: Maybe Int
, publication_month :: Maybe Int , publication_month :: Maybe Int
, publication_year :: Maybe Int , publication_year :: Maybe Int
, source :: Maybe String , source :: Maybe String
, title :: Maybe String , title :: Maybe String
, uniqId :: Maybe String , uniqId :: Maybe String
, url :: Maybe String --, url :: Maybe String
, text :: Maybe String --, text :: Maybe String
} }
defaultNodeDocument :: NodePoly Document defaultNodeDocument :: NodePoly Document
...@@ -128,6 +127,7 @@ defaultNodeDocument = ...@@ -128,6 +127,7 @@ defaultNodeDocument =
, hyperdata : defaultDocument , hyperdata : defaultDocument
} }
-- TODO: BUG if DOI does not exist, page is not shown
defaultDocument :: Document defaultDocument :: Document
defaultDocument = defaultDocument =
Document { abstract : Nothing Document { abstract : Nothing
...@@ -135,20 +135,19 @@ defaultDocument = ...@@ -135,20 +135,19 @@ defaultDocument =
, bdd : Nothing , bdd : Nothing
, doi : Nothing , doi : Nothing
, language_iso2 : Nothing , language_iso2 : Nothing
, language_iso3 : Nothing --, page : Nothing
, page : Nothing
, publication_date : Nothing , publication_date : Nothing
, publication_second : Nothing --, publication_second : Nothing
, publication_minute : Nothing --, publication_minute : Nothing
, publication_hour : Nothing --, publication_hour : Nothing
, publication_day : Nothing , publication_day : Nothing
, publication_month : Nothing , publication_month : Nothing
, publication_year : Nothing , publication_year : Nothing
, source : Nothing , source : Nothing
, title : Nothing , title : Nothing
, uniqId : Nothing , uniqId : Nothing
, url : Nothing --, url : Nothing
, text : Nothing --, text : Nothing
} }
derive instance genericDocument :: Generic Document _ derive instance genericDocument :: Generic Document _
...@@ -223,39 +222,37 @@ instance decodeDocument :: DecodeJson Document ...@@ -223,39 +222,37 @@ instance decodeDocument :: DecodeJson Document
bdd <- obj .? "bdd" bdd <- obj .? "bdd"
doi <- obj .? "doi" doi <- obj .? "doi"
language_iso2 <- obj .? "language_iso2" language_iso2 <- obj .? "language_iso2"
language_iso3 <- obj .? "language_iso3" -- page <- obj .? "page"
page <- obj .? "page"
publication_date <- obj .? "publication_date" publication_date <- obj .? "publication_date"
publication_second <- obj .? "publication_second" --publication_second <- obj .? "publication_second"
publication_minute <- obj .? "publication_minute" --publication_minute <- obj .? "publication_minute"
publication_hour <- obj .? "publication_hour" --publication_hour <- obj .? "publication_hour"
publication_day <- obj .? "publication_day" publication_day <- obj .? "publication_day"
publication_month <- obj .? "publication_month" publication_month <- obj .? "publication_month"
publication_year <- obj .? "publication_year" publication_year <- obj .? "publication_year"
source <- obj .? "source" source <- obj .? "source"
title <- obj .? "title" title <- obj .? "title"
uniqId <- obj .? "uniqId" uniqId <- obj .? "uniqId"
url <- obj .? "url" --url <- obj .? "url"
text <- obj .? "text" --text <- obj .? "text"
pure $ Document { abstract pure $ Document { abstract
, authors , authors
, bdd , bdd
, doi , doi
, language_iso2 , language_iso2
, language_iso3 -- , page
, page
, publication_date , publication_date
, publication_second --, publication_second
, publication_minute --, publication_minute
, publication_hour --, publication_hour
, publication_day , publication_day
, publication_month , publication_month
, publication_year , publication_year
, source , source
, title , title
, uniqId , uniqId
, url --, url
, text --, text
} }
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -267,10 +264,11 @@ performAction (Load nId) _ _ = do ...@@ -267,10 +264,11 @@ performAction (Load nId) _ _ = do
performAction (ChangeString ps) _ _ = pure unit performAction (ChangeString ps) _ _ = pure unit
performAction (SetInput ps) _ _ = void <$> modifyState $ _ { inputValue = ps } performAction (SetInput ps) _ _ = void <$> modifyState $ _ { inputValue = ps }
getNode :: Int -> Aff (NodePoly DocumentV3)
getNode :: Int -> Aff (NodePoly Document)
getNode = get <<< toUrl Back Node getNode = get <<< toUrl Back Node
_document :: Lens' State (Maybe (NodePoly DocumentV3)) _document :: Lens' State (Maybe (NodePoly Document))
_document = lens (\s -> s.document) (\s ss -> s{document = ss}) _document = lens (\s -> s.document) (\s ss -> s{document = ss})
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -394,8 +392,8 @@ docview = simpleSpec performAction render ...@@ -394,8 +392,8 @@ docview = simpleSpec performAction render
text' x = text $ maybe "Nothing" identity x text' x = text $ maybe "Nothing" identity x
badge s = span [className "badge badge-default badge-pill"] [text s] badge s = span [className "badge badge-default badge-pill"] [text s]
NodePoly {hyperdata : DocumentV3 document} = NodePoly {hyperdata : Document document} =
maybe defaultNodeDocumentV3 identity state.document maybe defaultNodeDocument identity state.document
aryPS :: Array String aryPS :: Array String
aryPS = ["Map", "Main", "Stop"] aryPS = ["Map", "Main", "Stop"]
......
...@@ -34,7 +34,7 @@ routing = ...@@ -34,7 +34,7 @@ routing =
<|> Folder <$> (route "folder" *> int) <|> Folder <$> (route "folder" *> int)
<|> Corpus <$> (route "corpus" *> int) <|> Corpus <$> (route "corpus" *> int)
<|> NGramsTable <$ route "ngrams" <|> NGramsTable <$ route "ngrams"
<|> Document <$> (route "document" *> int) <|> Document <$> (route "document" *> int)
<|> Dashboard <$ route "dashboard" <|> Dashboard <$ route "dashboard"
<|> PGraphExplorer <$ route "graph" <|> PGraphExplorer <$ route "graph"
<|> Annuaire <$> (route "annuaire" *> int) <|> Annuaire <$> (route "annuaire" *> int)
...@@ -52,7 +52,7 @@ instance showRoutes :: Show Routes where ...@@ -52,7 +52,7 @@ instance showRoutes :: Show Routes where
show AddCorpus = "AddCorpus" show AddCorpus = "AddCorpus"
show SearchView = "Search" show SearchView = "Search"
show (UserPage i) = "User" <> show i show (UserPage i) = "User" <> show i
show (Document i)= "Document" show (Document i) = "Document"
show (Corpus i) = "Corpus" <> show i show (Corpus i) = "Corpus" <> show i
show NGramsTable = "NGramsTable" show NGramsTable = "NGramsTable"
show (Annuaire i) = "Annuaire" <> show i show (Annuaire i) = "Annuaire" <> show i
......
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