-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from semantic-systems/develop
Going live with Publication and Researcher details pages
- Loading branch information
Showing
32 changed files
with
1,758 additions
and
779 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import requests | ||
from objects import thing, Article, Author | ||
import logging | ||
import utils | ||
from sources import data_retriever | ||
import traceback | ||
|
||
|
||
# logging.config.fileConfig(os.getenv('LOGGING_FILE_CONFIG', './logging.conf')) | ||
logger = logging.getLogger('nfdi_search_engine') | ||
|
||
@utils.timeit | ||
def get_publication(doi: str): | ||
|
||
source = "CROSSREF Publication" | ||
|
||
try: | ||
search_result = data_retriever.retrieve_single_object(source=source, | ||
base_url=utils.config["publication_details_crossref_publications"], | ||
doi=doi) | ||
|
||
search_result = search_result.get('message',{}) | ||
|
||
publication = Article() | ||
|
||
title = search_result.get("title") | ||
publication.name = utils.remove_html_tags(title[0]) | ||
publication.identifier = search_result.get("DOI", "").replace("https://doi.org/", "") | ||
publication.abstract = utils.remove_html_tags(search_result.get("abstract", "")) | ||
|
||
references = search_result.get("reference", []) | ||
for reference in references: | ||
referenced_publication = Article() | ||
referenced_publication.text = reference.get("unstructured", "") | ||
referenced_publication.identifier = reference.get("DOI", "") | ||
publication.citation.append(referenced_publication) | ||
|
||
return publication | ||
|
||
except requests.exceptions.Timeout as ex: | ||
logger.error(f'Timed out Exception: {str(ex)}') | ||
|
||
except Exception as ex: | ||
logger.error(f'Exception: {str(ex)}') | ||
logger.error(traceback.format_exc()) |
Oops, something went wrong.