aoptk.literature.databases.ncbi

Classes

NCBI

Helper class to retrieve data from NCBI databases - PubMed and PMC.

Module Contents

class aoptk.literature.databases.ncbi.NCBI(database: Literal['pmc', 'pubmed'])[source]

Bases: aoptk.literature.get_id.GetID

Helper class to retrieve data from NCBI databases - PubMed and PMC.

max_ncbi_results = 9998[source]
max_concurrency = 2[source]
max_requests_per_second = 2[source]
minimal_year_publication = 1940[source]
datetype = 'pdat'[source]
batch_size = 200[source]
async_retries = 10[source]
database[source]
semaphore[source]
limiter[source]
get_ids(search_term: str) list[aoptk.literature.id.ID][source]

Retrieve a list of publication IDs based on the search term.

get_abstract_records(ids: list[aoptk.literature.id.ID]) list[dict][source]

Retrieve abstract records based on the list of IDs. Note: There is still the 10 000 records limit.

Parameters:

ids (list[ID]) – A list of publication IDs for which to retrieve abstracts.

get_publications_metadata_records(ids: list[aoptk.literature.id.ID]) list[Any][source]

Retrieve publication metadata records based on the list of IDs.

_batch_requests(ids: list[aoptk.literature.id.ID], func: collections.abc.Callable[Ellipsis, Any]) list[Any][source]

Helper function to batch requests to NCBI.

async _async_get_ids(search_term: str) list[aoptk.literature.id.ID][source]

Asynchronously retrieve a list of publication IDs based on the search term.

_get_publication_count_and_ids(search_term: str, mindate: str | None = None, maxdate: str | None = None) tuple[int, list[str]][source]

Helper function to retrieve the count of publications and their IDs.

Retrieves IDs and total count based on the given search term and an optional date range.

async _async_get_publication_count_and_ids(search_term: str, mindate: str | None = None, maxdate: str | None = None) tuple[int, list[str]][source]

Asynchronously retrieve the count of publications and their IDs based on the search term and date range.

async _collect_ids_for_year(search_term: str, year: int) list[str][source]

Collect publication IDs for a specific year, splitting by months and days if the count exceeds the limit.

async _collect_ids_split_by_months_days(search_term: str, year: int) list[str][source]

Collect publication IDs for a specific year.

Split the search into months and days to avoid exceeding the result limit.