sagepublishing / rejected_article_tracker_pkg

MIT License
14 stars 1 forks source link

KeyError manuscript_id when running README snippet #14

Closed dhimmel closed 3 years ago

dhimmel commented 3 years ago

When running the README code with rejected-article-tracker==1.5.6 on Python 3.9 linux, I'm getting the following error:

>>> # Run match
>>> RejectedArticlesMatch(
...             articles=articles,
...             config=config,
...             email=email,
...             results=results
...         ).match()
Traceback (most recent call last):
  File "/home/dhimmel/miniconda3/envs/rejected-article-tracker/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3361, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 76, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 5198, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 5206, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'manuscript_id'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dhimmel/miniconda3/envs/rejected-article-tracker/lib/python3.9/site-packages/rejected_article_tracker/src/RejectedArticlesMatch.py", line 28, in __init__
    self.articles = FilteredArticles(articles=articles)
  File "/home/dhimmel/miniconda3/envs/rejected-article-tracker/lib/python3.9/site-packages/rejected_article_tracker/src/FilteredArticles.py", line 8, in __init__
    self.articles = [ArticleItem(a) for a in self.__filter(articles)]
  File "/home/dhimmel/miniconda3/envs/rejected-article-tracker/lib/python3.9/site-packages/rejected_article_tracker/src/FilteredArticles.py", line 21, in __filter
    df = df[df['manuscript_id'] != 'draft']
  File "/home/dhimmel/miniconda3/envs/rejected-article-tracker/lib/python3.9/site-packages/pandas/core/frame.py", line 3455, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/home/dhimmel/miniconda3/envs/rejected-article-tracker/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3363, in get_loc
    raise KeyError(key) from err
KeyError: 'manuscript_id'

Any idea what is causing this?

part of https://github.com/openjournals/joss-reviews/issues/3348

dhimmel commented 3 years ago

Is it because the example article doesn't use the article format later in the REAMDE? It uses Manuscript ID instead of manuscript_id?

ad48 commented 3 years ago

Ah, well spotted! I've corrected this now and run the examples from the readme.md file. All working.