Skip to content

Commit

Permalink
Final Changes for first PR
Browse files Browse the repository at this point in the history
  • Loading branch information
aldensyi committed Feb 22, 2024
1 parent 1c013f9 commit eb889ec
Showing 1 changed file with 11 additions and 27 deletions.
38 changes: 11 additions & 27 deletions ace/scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,43 +76,27 @@ def esearch(self, query, retstart=None, retmax=10000, extract_ids=True, **kwargs
return response

def efetch(self, input_id, retmode='txt', rettype='medline', db = 'pubmed', **kwargs):
if (access_db == "pmc"):
params = {
"db": "pmc",
"id": input_id, # assuming that the input id would be pmcid
"retmode": retmode,
"rettype": rettype
}
else:
params = {
"db": "pubmed",
"id": input_id, # assuming that the input id would be pmid
"retmode": retmode,
"rettype": rettype
}
params = {
"db": db,
"id": input_id, # type of input id should change with the type of db being accessed
"retmode": retmode,
"rettype": rettype
}


response = self.get("efetch", params=params, **kwargs)
return response

def elink(self, pmid, retmode='ref', access_db = 'pubmed', **kwargs):
params = {
"dbfrom": "pubmed",
"id": pmid
"id": pmid,
"retmode": retmode
}
if access_db == "pmc":
params = {
"dbfrom": "pubmed",
"id": pmid,
"linkname": "pubmed_pmc",
"retmode": retmode
}
params["linkname"] = "pubmed_pmc"
else:
params = {
"dbfrom": "pubmed",
"id": pmid,
"cmd": "prlinks",
"retmode": retmode
}
params["cmd"] = "prlinks"

response = self.get("elink", params=params, **kwargs)
return response
Expand Down

0 comments on commit eb889ec

Please sign in to comment.