Sort out `WithQuery` structure, especially `database`/`datafield`
In G.A.N.Types
we have the WithQuery
structure: https://gitlab.iscpif.fr/gargantext/haskell-gargantext/blob/13457ca8b7db29f178a4001ce9cac0e849473cef/src/Gargantext/API/Node/Types.hs#L84
In particular, it contains fields named databases
and datafield
.
Thing is, this seems somewhat duplicated info.
The search dialog has multiple datafield options: External
(for Arxiv, Pubmed, etc APIs), Web
(for searx search). The Datafield
datatype (in G.A.N.Corpus.Types
we see it also allows for Gargantext
and Files
).
Anyways, the External Database
seems to be a duplicate of the WithQuery -> database
field.
And I think (database, datafield) = (Empty, Web)
seems the only option. So using database2origin
in G.A.N.Corpus.New
seems unnecessary (this is the only place that this function is used).
I think the best way is to remove the database
field altogether. Leave only Web
, Gargantext
, Files
and External (Database)
in datafield
.
Also, it would be nice to refactor things and insert pubmed_api_key
in to the PubMed
constructor and epo_api_user
/epo_api_token
into the EPO
construtor.
Moreover, we have very similar db structures in G.A.N.C.Types
-> Database
and G.A.A.O.Types
-> ExternalAPIs
. We could unify them. Also, add to/from JSON tests.