Open RohitChattopadhyay opened 5 years ago
For displaying proper links of identifier the list of namespaces and their links is maintained. For now, as a precautionary measure, in case of the namespace is not present in our list then waring will be logged in the Gatsby Build and no links will be displayed in the frontend. This prevents failure of Gatsby Build and developers can take necessary steps to add the new identifier in the list.
Code for the list is available here https://github.com/cannin/ihop-reach/blob/41af180a92fd93d17e10f10af69f0e8e68309ea6/src/src/components/identifierDetails.js#L14
The identifier can be split into two parts, namespace
and the id
, for example
in uniprot:P10636
, uniprot
is the namespace and P10636
is the id.
In chebi:CHEBI:1
, chebi
is the namespace and CHEBI:1
is the id.
The links available in identifiers.org are being used as baseURL
. Usually, links in identifiers.org follow the pattern https://identifiers.org/{{NAMESPACE}}/{{ID}}
For example http://identifiers.org/uniprot/P10636 and http://identifiers.org/chebi/CHEBI:1
In our code, the list is mentioned as object
as follows
[namespace] : [baseURL, Name of the namespace]
Here Name of the namespace
refers to the way the abbreviation of the namespace is written. This will be visible on left of identifier in frontend.
For example, consider a situation where we need to add support for MeSH identifiers (eg mesh:1234
)
For MeSH identifiers:
namespace : mesh
Name of the namespace : MeSH
baseURL : http://identifiers.org/mesh/
Hence following will be added to the object
["mesh"]: ["http://identifiers.org/mesh/", "MeSH"],
Rebuilding GatsbyJS should add identifier links for these missing identifiers.
Incase namespace of the identifier is not available in the list, GatsbyJS build fails. https://github.com/cannin/ihop-reach/blob/41af180a92fd93d17e10f10af69f0e8e68309ea6/src/src/components/identifierDetails.js#L14