def get_biblio_for_id(self, id, provider_url_template=None, cache_enabled=True): self.logger.debug(u"%s /biblio_print getting biblio for %s" % (self.provider_name, id)) if not provider_url_template: provider_url_template = self.biblio_url_template url = provider_url_template % id self.logger.debug(u"%s /biblio_print _lookup_biblio_from_doi for %s" % (self.provider_name, id)) biblio_dict = self._lookup_biblio_from_doi(id, url, cache_enabled) self.logger.debug(u"%s /biblio_print _lookup_issn_from_doi for %s" % (self.provider_name, id)) biblio_dict.update(self._lookup_issn_from_doi(id, url, cache_enabled)) self.logger.debug(u"%s /biblio_print free_fulltext_fragments for %s" % (self.provider_name, id)) free_fulltext_fragments = ["/npre.", "/peerj.preprints"] if any(doi_fragment in id for doi_fragment in free_fulltext_fragments): biblio_dict["free_fulltext_url"] = url elif ("issn" in biblio_dict) and provider.is_issn_in_doaj( biblio_dict["issn"]): biblio_dict["free_fulltext_url"] = url return biblio_dict
def biblio(self, aliases, provider_url_template=None, cache_enabled=True): aliases_dict = provider.alias_dict_from_tuples(aliases) if not "pmid" in aliases_dict: return None id = aliases_dict["pmid"][0] self.logger.debug(u"%s getting biblio for %s" % (self.provider_name, id)) biblio_dict = {} efetch_url = self._get_templated_url(self.biblio_url_efetch_template, id, "biblio") efetch_page = self._get_eutils_page(efetch_url, id, cache_enabled=cache_enabled) biblio_dict.update(self._extract_biblio_efetch(efetch_page, id)) elink_url = self._get_templated_url(self.biblio_url_elink_template, id, "biblio") elink_page = self._get_eutils_page(elink_url, id, cache_enabled=cache_enabled) biblio_dict.update(self._extract_biblio_elink(elink_page, id)) if "pmc" in aliases_dict: biblio_dict["free_fulltext_url"] = self.pmc_article_template % aliases_dict["pmc"][0] elif ("issn" in biblio_dict) and provider.is_issn_in_doaj(biblio_dict["issn"]): biblio_dict["free_fulltext_url"] = self.aliases_pubmed_url_template %id return biblio_dict
def get_biblio_for_id(self, id, provider_url_template=None, cache_enabled=True): self.logger.debug(u"%s /biblio_print getting biblio for %s" % (self.provider_name, id)) if not provider_url_template: provider_url_template = self.biblio_url_template url = provider_url_template % id self.logger.debug(u"%s /biblio_print _lookup_biblio_from_doi for %s" % (self.provider_name, id)) biblio_dict = self._lookup_biblio_from_doi(id, url, cache_enabled) self.logger.debug(u"%s /biblio_print _lookup_issn_from_doi for %s" % (self.provider_name, id)) biblio_dict.update(self._lookup_issn_from_doi(id, url, cache_enabled)) self.logger.debug(u"%s /biblio_print free_fulltext_fragments for %s" % (self.provider_name, id)) free_fulltext_fragments = ["/npre.", "/peerj.preprints"] if any(doi_fragment in id for doi_fragment in free_fulltext_fragments): biblio_dict["free_fulltext_url"] = url elif ("issn" in biblio_dict) and provider.is_issn_in_doaj(biblio_dict["issn"]): biblio_dict["free_fulltext_url"] = url return biblio_dict
def biblio(self, aliases, provider_url_template=None, cache_enabled=True): biblio = {} doc = self._get_doc(aliases) if doc: biblio["url"] = doc.link biblio["abstract"] = doc.abstract if "issn" in doc.identifiers: biblio["issn"] = doc.identifiers["issn"] if provider.is_issn_in_doaj(biblio["issn"]): biblio["free_fulltext_url"] = self.get_best_url(aliases) return biblio
def test_is_issn_in_doaj_false(self): response = provider.is_issn_in_doaj("invalidissn") assert_equals(response, False)
def test_is_issn_in_doaj_true(self): zookeys_issn = "13132989" #this one is in test setup response = provider.is_issn_in_doaj(zookeys_issn) assert_equals(response, True)