Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
137
Issues
137
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
a93e055b
Verified
Commit
a93e055b
authored
Jan 08, 2025
by
Przemyslaw Kaminski
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[search] pubmed constructor with api key
parent
282dafcd
Pipeline
#7191
passed with stages
in 20 minutes and 22 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
16 deletions
+18
-16
SearchField.purs
...omponents/Forest/Tree/Node/Action/Search/SearchField.purs
+12
-9
Types.purs
...text/Components/Forest/Tree/Node/Action/Search/Types.purs
+6
-7
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchField.purs
View file @
a93e055b
...
@@ -41,7 +41,6 @@ defaultSearch =
...
@@ -41,7 +41,6 @@ defaultSearch =
, node_id: Nothing
, node_id: Nothing
, epoApiUser: Nothing
, epoApiUser: Nothing
, epoApiToken: Nothing
, epoApiToken: Nothing
, pubmedApiKey: Nothing
, lang: Nothing
, lang: Nothing
, term: ""
, term: ""
, url: ""
, url: ""
...
@@ -252,10 +251,14 @@ isCNRS _ = false
...
@@ -252,10 +251,14 @@ isCNRS _ = false
isPubmed :: Maybe DataField -> Boolean
isPubmed :: Maybe DataField -> Boolean
isPubmed
isPubmed
( Just
( Just
(External
PubMed
)
(External
(PubMed _)
)
) = true
) = true
isPubmed _ = false
isPubmed _ = false
getPubmedAPIKey :: Maybe DataField -> Maybe String
getPubmedAPIKey (Just (External (PubMed mAPI))) = mAPI
getPubmedAPIKey _ = Nothing
isEPO :: Maybe DataField -> Boolean
isEPO :: Maybe DataField -> Boolean
isEPO
isEPO
( Just
( Just
...
@@ -477,15 +480,16 @@ pubmedInputLoadedCpt = here.component "pubmedInputLoaded" cpt
...
@@ -477,15 +480,16 @@ pubmedInputLoadedCpt = here.component "pubmedInputLoaded" cpt
search' <- T.useLive T.unequal search
search' <- T.useLive T.unequal search
R.useEffectOnce' $ do
R.useEffectOnce' $ do
when (search'.pubmedApiKey /= pubmedAPIKey) $ do
when (getPubmedAPIKey search'.datafield /= pubmedAPIKey) $ do
T.write_ (search' { pubmedApiKey = pubmedAPIKey }) search
T.modify_ (\s -> s { datafield = Just $ External $ PubMed pubmedAPIKey }) search
-- T.write_ (search' { pubmedApiKey = pubmedAPIKey }) search
pure $
pure $
H.div { className: "form-group p-1 m-0" }
H.div { className: "form-group p-1 m-0" }
[ H.div { className: "text-primary center" } [ H.text "Pubmed API key" ]
[ H.div { className: "text-primary center" } [ H.text "Pubmed API key" ]
, H.input
, H.input
{ className: "form-control"
{ className: "form-control"
, defaultValue: fromMaybe ""
search'.pubmedApi
Key
, defaultValue: fromMaybe ""
pubmedAPI
Key
, on:
, on:
{ blur: modifyPubmedAPIKey search
{ blur: modifyPubmedAPIKey search
, change: modifyPubmedAPIKey search
, change: modifyPubmedAPIKey search
...
@@ -502,7 +506,7 @@ pubmedInputLoadedCpt = here.component "pubmedInputLoaded" cpt
...
@@ -502,7 +506,7 @@ pubmedInputLoadedCpt = here.component "pubmedInputLoaded" cpt
s -> Just s
s -> Just s
T.modify_
T.modify_
( \s ->
( \s ->
s {
pubmedApiKey =
mVal }
s {
datafield = Just $ External $ PubMed
mVal }
)
)
searchS
searchS
...
@@ -894,9 +898,8 @@ searchQuery
...
@@ -894,9 +898,8 @@ searchQuery
searchQuery
searchQuery
selection
selection
{ databases
{ databases
, datafield: datafield@(Just (External
PubMed
))
, datafield: datafield@(Just (External
(PubMed mAPIKey)
))
, lang
, lang
, pubmedApiKey
, node_id
, node_id
, term
, term
} =
} =
...
@@ -906,7 +909,7 @@ searchQuery
...
@@ -906,7 +909,7 @@ searchQuery
, datafield = datafield
, datafield = datafield
, lang = lang
, lang = lang
, node_id = node_id
, node_id = node_id
, pubmedAPIKey =
pubmedApi
Key
, pubmedAPIKey =
mAPI
Key
, query = term
, query = term
, selection = selection
, selection = selection
}
}
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/Types.purs
View file @
a93e055b
...
@@ -33,7 +33,6 @@ type Search =
...
@@ -33,7 +33,6 @@ type Search =
, node_id :: Maybe Int
, node_id :: Maybe Int
, epoApiUser :: Maybe String
, epoApiUser :: Maybe String
, epoApiToken :: Maybe String
, epoApiToken :: Maybe String
, pubmedApiKey :: Maybe String
, term :: String
, term :: String
, years :: Array String
, years :: Array String
}
}
...
@@ -116,7 +115,7 @@ data Database
...
@@ -116,7 +115,7 @@ data Database
= All_Databases
= All_Databases
| Empty
| Empty
| OpenAlex
| OpenAlex
| PubMed
| PubMed
(Maybe String)
| Arxiv
| Arxiv
| HAL (Maybe Org)
| HAL (Maybe Org)
| IsTex
| IsTex
...
@@ -133,7 +132,7 @@ derive instance Generic Database _
...
@@ -133,7 +132,7 @@ derive instance Generic Database _
instance Show Database where
instance Show Database where
show All_Databases = "All Databases"
show All_Databases = "All Databases"
show OpenAlex = "OpenAlex"
show OpenAlex = "OpenAlex"
show
PubMed
= "PubMed"
show
(PubMed _)
= "PubMed"
show Arxiv = "Arxiv"
show Arxiv = "Arxiv"
show (HAL _) = "HAL"
show (HAL _) = "HAL"
show IsTex = "IsTex"
show IsTex = "IsTex"
...
@@ -148,7 +147,7 @@ instance Show Database where
...
@@ -148,7 +147,7 @@ instance Show Database where
instance Doc Database where
instance Doc Database where
doc All_Databases = "All databases"
doc All_Databases = "All databases"
doc OpenAlex = "OpenAlex db"
doc OpenAlex = "OpenAlex db"
doc
PubMed
= "All Medical publications"
doc
(PubMed _)
= "All Medical publications"
doc Arxiv = "Arxiv"
doc Arxiv = "Arxiv"
doc (HAL _) = "All open science (archives ouvertes)"
doc (HAL _) = "All open science (archives ouvertes)"
doc IsTex = "All Elsevier enriched by CNRS/INIST"
doc IsTex = "All Elsevier enriched by CNRS/INIST"
...
@@ -181,7 +180,7 @@ instance JSON.WriteForeign Database where
...
@@ -181,7 +180,7 @@ instance JSON.WriteForeign Database where
allDatabases :: Array Database
allDatabases :: Array Database
allDatabases =
allDatabases =
[ Empty
[ Empty
, PubMed
, PubMed
Nothing
, HAL Nothing
, HAL Nothing
, Arxiv
, Arxiv
, OpenAlex
, OpenAlex
...
@@ -197,7 +196,7 @@ allDatabases =
...
@@ -197,7 +196,7 @@ allDatabases =
dbToInputValue :: Database -> String
dbToInputValue :: Database -> String
dbToInputValue All_Databases = "all_databases"
dbToInputValue All_Databases = "all_databases"
dbToInputValue OpenAlex = "openalex"
dbToInputValue OpenAlex = "openalex"
dbToInputValue
PubMed
= "pubmed"
dbToInputValue
(PubMed _)
= "pubmed"
dbToInputValue Arxiv = "arxiv"
dbToInputValue Arxiv = "arxiv"
dbToInputValue (HAL _) = "hal"
dbToInputValue (HAL _) = "hal"
dbToInputValue IsTex = "istex"
dbToInputValue IsTex = "istex"
...
@@ -209,7 +208,7 @@ dbToInputValue Empty = "empty"
...
@@ -209,7 +208,7 @@ dbToInputValue Empty = "empty"
dbFromInputValue :: String -> Maybe Database
dbFromInputValue :: String -> Maybe Database
dbFromInputValue "all_databases" = Just All_Databases
dbFromInputValue "all_databases" = Just All_Databases
dbFromInputValue "openalex" = Just OpenAlex
dbFromInputValue "openalex" = Just OpenAlex
dbFromInputValue "pubmed" = Just
PubMed
dbFromInputValue "pubmed" = Just
(PubMed Nothing)
dbFromInputValue "arxiv" = Just Arxiv
dbFromInputValue "arxiv" = Just Arxiv
dbFromInputValue "hal" = Just (HAL Nothing)
dbFromInputValue "hal" = Just (HAL Nothing)
dbFromInputValue "istex" = Just IsTex
dbFromInputValue "istex" = Just IsTex
...
...
Przemyslaw Kaminski
@cgenie
mentioned in commit
c010d97a
·
Jan 30, 2025
mentioned in commit
c010d97a
mentioned in commit c010d97ad517cab5d8a6c43ceeaeb4769082ebed
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment