diff --git a/scibot/bookmarklet.py b/scibot/bookmarklet.py index bf61387..ccbd405 100644 --- a/scibot/bookmarklet.py +++ b/scibot/bookmarklet.py @@ -115,7 +115,7 @@ def bookmarklet_wrapper(request, endpoint): from scibot.extract import process_POST_request, find_rrids as finder from scibot.check import check_already_submitted -from scibot.services import existing_tags, get_pmid, rrid_resolver_xml +from scibot.services import existing_tags, rrid_resolver_xml from scibot.submit import annotate_doi_pmid, submit_to_h @@ -130,35 +130,20 @@ def inner(text: str) -> Generator: return inner - +""" def pmid_logic(doi, pmid_from_source, target_uri=None, document=None, h=None, tags=None): # TODO move the annotation of errors out of this - if doi: - pmid_from_doi = get_pmid(doi) - else: - pmid_from_doi = None - - if pmid_from_source and pmid_from_doi: - if pmid_from_source == pmid_from_doi: - pmid = pmid_from_source - else: - # TODO responses -> db - # TODO tag for marking errors explicitly without the dashboard? - r1 = annotate_doi_pmid(target_uri, document, None, pmid_from_doi, h, tags, 'ERROR\nPMID from DOI') - r2 = annotate_doi_pmid(target_uri, document, None, pmid_from_source, h, tags, 'ERROR\nPMID from source') - pmid = None - elif pmid_from_source: + if pmid_from_source: pmid = pmid_from_source - elif pmid_from_doi: - pmid = pmid_from_doi else: pmid = None return pmid +""" def rrid_POST(request, h, logloc, URL_LOCK): - (target_uri, document, doi, pmid_from_source, + (target_uri, document, doi, pmid, head, body, text, cleaned_text) = process_POST_request(request) running = URL_LOCK.start_uri(target_uri) log.info(target_uri) @@ -168,7 +153,7 @@ def rrid_POST(request, h, logloc, URL_LOCK): try: tags, unresolved_exacts = existing_tags(target_uri, h) - pmid = pmid_logic(doi, pmid_from_source, target_uri, document, h, tags) + #pmid = pmid_logic(doi, pmid_from_source, target_uri, document, h, tags) r = annotate_doi_pmid(target_uri, document, doi, pmid, h, tags) # todo r -> db with responses # these values are defined up here as shared state that will be diff --git a/scibot/extract.py b/scibot/extract.py index d380bde..d530f88 100644 --- a/scibot/extract.py +++ b/scibot/extract.py @@ -441,7 +441,7 @@ def idPaper(self): # scrapeIds(uri) if doi is not None: log.info(doi) - pmid = get_pmid(doi) + # pmid = get_pmid(doi) log.warning('json malformed in get_pmid') log.info(pmid) resp = annotate_doi_pmid(url, doi, pmid, rrcu.h_curation, []) diff --git a/scibot/release.py b/scibot/release.py index dc2fb8b..1f0a4f8 100755 --- a/scibot/release.py +++ b/scibot/release.py @@ -17,7 +17,7 @@ from scibot.export import bad_tags, get_proper_citation from scibot.submit import annotate_doi_pmid from scibot.papers import Papers, SameDOI, SamePMID -from scibot.services import get_pmid +# from scibot.services import get_pmid from scibot.workflow import parse_workflow try: breakpoint diff --git a/scibot/services.py b/scibot/services.py index 950e97a..4051632 100644 --- a/scibot/services.py +++ b/scibot/services.py @@ -37,6 +37,8 @@ def existing_tags(target_uri, h): # PMIDs +# removed as metabase already handles this codepath +""" def get_pmid(doi): # TODO url = f'https://www.ncbi.nlm.nih.gov/pubmed/?term={quote(doi)}[Location ID]&report=uilist&format=text' body = requests.get(url).text @@ -52,10 +54,13 @@ def get_pmid(doi): # TODO params={'idtype':'auto', 'format':'json', 'ids':doi,} endpoint = 'https://www.ncbi.nlm.nih.gov/pmc/utils/idconv/v1.0/' resp = requests.get(endpoint, params=params) - if resp.ok: - pj = resp.json() - else: - resp.raise_for_status() + try: + if resp.ok: + pj = resp.json() + else: + resp.raise_for_status() + except HTTPError: + return log.debug(pj) for rec in pj['records']: @@ -63,7 +68,8 @@ def get_pmid(doi): # TODO return 'PMID:' + rec['pmid'] except KeyError: pass - +""" + # RRIDs def rrid_resolver_xml(exact, found_rrids):