-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7dcf7eb
commit 3702d24
Showing
1 changed file
with
7 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
BASE_DIR = os.path.dirname(os.path.realpath(__file__)) | ||
DEFAULT_DB = os.path.join(BASE_DIR, 'data', 'impact_factor.db') | ||
|
||
__version__ = '1.0.3' | ||
__version__ = '1.0.5' | ||
__author__ = 'suqingdong' | ||
__author_email__ = '[email protected]' | ||
|
||
|
@@ -63,6 +63,7 @@ def search(self, value, field=None, like=True): | |
for key in ('issn', 'e_issn', 'journal', 'med_abbr', 'nlm_id'): | ||
context = self.manager.query(Factor, key, value, like=like) | ||
if context: | ||
context['factor_history'] = json.loads(context['factor_history']) | ||
return context | ||
|
||
def pubmed_filter(self, min_value=None, max_value=None, indexed=None, outfile=None, **kwargs): | ||
|
@@ -72,12 +73,13 @@ def pubmed_filter(self, min_value=None, max_value=None, indexed=None, outfile=No | |
if min_value is not None: | ||
res = res.filter(Factor.factor >= min_value) | ||
if max_value is not None: | ||
res = res.filter(Factor.factor <= max_value) | ||
res = res.filter(Factor.factor < max_value) | ||
|
||
if res.count() > 4000: | ||
print('total {n} journals with IF: {min_value} - {max_value} (limit 4000)'.format(n=res.count(), **locals())) | ||
issn_list = '|'.join(each.issn or '"{}"[Journal]'.format(each.med_abbr) for each in res) | ||
|
||
if len(issn_list) > 4000: | ||
print('total {n} journals with IF: {min_value} - {max_value} (exceed 4000 characters)'.format(n=res.count(), **locals())) | ||
else: | ||
issn_list = '|'.join(each.issn or '"{}"[Journal]'.format(each.med_abbr) for each in res) | ||
print('{n} journals with IF: {min_value} - {max_value}'.format(n=res.count(), **locals())) | ||
if outfile: | ||
with util.safe_open(outfile, 'w') as out: | ||
|