Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues with refine_scopus() function (AttributeError: 'list' object has no attribute '_refine_docs') #34

Closed
colinmiller20 opened this issue Mar 28, 2023 · 3 comments

Comments

@colinmiller20
Copy link

Hello, I have been having issues with the refine_scopus() function and would appreciate some insight. After loading in a set of DOIs from an RIS file using

docs_remaining = litstudy.load_ris_file('/dbfs/*****************/DOI.ris')

I now see what type of object docs_remaining is.

print(type(docs_remaining))
<class 'list'>

print(len(docs_remaining))
2723

and then when I go to sort which DOIs are on scopus using the refine_scopus() function, as follows:

docs_scopus, docs_notfound = litstudy.refine_scopus(docs_remaining)

It throws an error "AttributeError: 'list' object has no attribute '_refine_docs'".

My initial thought is that the litstudy.load_ris_file should result in the creation of a DocumentSet with all the DOIs, rather than a list. I attached my commands below to provide additional assistance.

** For reproducibility, I am using Python 3.9.5 on a databricks 11.3 LTS (includes Apache Spark 3.3.0, Scala 2.12) instance **

Thank you so much! Please let me know if I can provide any more information.

---- commands to reproduce----

%pip install litstudy

import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sbs

plt.rcParams['figure.figsize'] = (10, 6)
sbs.set('paper')
path = os.path.abspath(os.path.join('..'))
if path not in sys.path:
sys.path.append(path)

import litstudy

import logging
logging.getLogger().setLevel(logging.CRITICAL)

docs_remaining = litstudy.load_ris_file('/dbfs/*****************/DOI.ris')

print(type(docs_remaining))
<class 'list'>

print(len(docs_remaining))
2723

docs_scopus, docs_notfound = litstudy.refine_scopus(docs_remaining)
Creating config file at /root/.pybliometrics/config.ini with default paths...
Configuration file successfully created at /root/.pybliometrics/config.ini
For details see https://pybliometrics.rtfd.io/en/stable/configuration.html.
AttributeError: 'list' object has no attribute '_refine_docs'

@stijnh
Copy link
Member

stijnh commented Mar 28, 2023

Thanks for creating this issue! This indeed appears to be a bug since load_ris_file should return a DocumentSet and not a list.

We will work on this and it should be fixed in the next release.

For now, you can work around this issue by using:

docs_remaining = litstudy.load_ris_file('/dbfs/*****************/DOI.ris')
docs_remaining = litstudy.types.DocumentSet(docs_remaining)

@stijnh stijnh closed this as completed in ad34d85 Mar 28, 2023
@stijnh stijnh reopened this Mar 28, 2023
@stijnh
Copy link
Member

stijnh commented Mar 28, 2023

This has been fixed by commit ad34d85. It will be part of the next release.

@colinmiller20
Copy link
Author

Thank you for looking into and resolving this! I was able to use the workaround successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants