ldcoolp-figshare package¶
The FigshareInstituteAdmin
Class¶
- class FigshareInstituteAdmin(token, stage=False, admin_filter=None, log=<Logger stdout_logger (INFO)>)¶
Bases:
object
A Python interface for administration and data curation with institutional Figshare instances
Most methods take an
article_id
orcuration_id
input- Parameters
token (
str
) – Figshare OAuth2 authentication tokenstage (
bool
) – Flag to either use Figshare stage or production API. Default: productionadmin_filter (
Optional
[list
]) – List of filters to remove admin accounts from user listlog (
Logger
) – Logger object for stdout and file logging. Default: stdout
- Variables
token – Figshare OAuth2 authentication token
stage – Flag to either use Figshare stage or prod API
baseurl – Base URL of Figshare API
baseurl_institute – Base URL of Figshare API for institutions
headers – HTTP header information
admin_filter – List of filters to remove admin accounts from user list
ignore_admin – Flags whether to remove admin accounts from user list
- doi_check(article_id, process=True)¶
Check if DOI is present/reserved for
article_id
.Uses: https://docs.figshare.com/#private_article_details
- Parameters
article_id (
int
) – Figshare article IDprocess (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True
- Return type
Union
[Tuple
[bool
,str
],Response
]- Returns
Flag to indicate whether DOI is reserved and DOI (empty string if not). Returns the full
requests.Response
ifprocess=False
- endpoint(link, institute=True)¶
Concatenate the endpoint to the baseurl for
requests
- Parameters
link (
str
) – API endpoint to append to baseurlinstitute (
bool
) – Flag to use regular of institute baseurl
- Return type
str
- Returns
URL for HTTPS API
- get_account_details(flag=True)¶
Retrieve account details. This includes group association, number of articles, projects, and collections, and administrative and reviewer role flags
- Parameters
flag (
bool
) – Populate administrative and reviewer roles to database- Return type
DataFrame
- Returns
Relational database of details of all accounts for an institution
- get_account_group_roles(account_id, process=True)¶
Retrieve group roles for a given account,
account_id
.See: https://docs.figshare.com/#private_institution_account_group_roles
- Parameters
account_id (
int
) – Figshare institute account IDprocess (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True
- Return type
Union
[dict
,Response
]- Returns
Python dictionary of all group roles for a user or the full
requests.Response
- get_account_list(process=True)¶
Return pandas DataFrame of user accounts.
See: https://docs.figshare.com/#private_institution_accounts_list
- Parameters
process (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True- Return type
Union
[DataFrame
,Response
]- Returns
Relational database of all user accounts for an institution or the full
requests.Response
- get_articles(process=True)¶
Retrieve information about all articles within institutional instance
See: https://docs.figshare.com/#private_institution_articles
- Parameters
process (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True- Return type
Union
[DataFrame
,Response
]- Returns
Relational database of all articles for an institution or the full
requests.Response
- get_curation_comments(curation_id, process=True)¶
Retrieve comments about specified curation,
curation_id
.See: https://docs.figshare.com/#account_institution_curation_comments
- Parameters
curation_id (
int
) – Figshare curation IDprocess (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True
- Return type
Union
[dict
,Response
]- Returns
Python dictionary with curation comments or the full
requests.Response
- get_curation_details(curation_id, process=True)¶
Retrieve details about a specified curation,
curation_id
.See: https://docs.figshare.com/#account_institution_curation
- Parameters
curation_id (
int
) – Figshare curation IDprocess (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True
- Return type
Union
[dict
,Response
]- Returns
Python dictionary with curation metadata or the full
requests.Response
- get_curation_list(article_id=None, status='', process=True)¶
Retrieve list of curation records for
article_id
. If not specified, all curation records are retrieved.See: https://docs.figshare.com/#account_institution_curations
- Parameters
article_id (
Optional
[int
]) – Figshare article IDstatus (
Optional
[str
]) – Filter by status of review. Options are: [‘’, ‘pending’, ‘approved’, ‘rejected’, ‘closed’]process (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True
- Return type
Union
[DataFrame
,Response
]- Returns
Relational database of all curation records or the full
requests.Response
- get_groups(process=True)¶
Retrieve information about groups within institutional instance.
See: https://docs.figshare.com/#private_institution_groups_list
- Parameters
process (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True- Return type
Union
[DataFrame
,Response
]- Returns
Relational database of all Figshare groups for an institution or the full
requests.Response
- get_other_account_details(account_id)¶
Retrieve ORCID and Figshare account information (among other metadata)
See: https://docs.figshare.com/#private_account_institution_user
- Parameters
account_id (
int
) – Figshare institute account ID- Return type
dict
- Returns
Dictionary with full account details
- get_user_articles(account_id, process=True)¶
Impersonate a user,
account_id
, to retrieve articles associated with the user.See: https://docs.figshare.com/#private_articles_list
- Parameters
account_id (
int
) – Figshare institute account IDprocess (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True
- Return type
Union
[DataFrame
,Response
]- Returns
Relational database of all articles owned by user or the full
requests.Response
- get_user_collections(account_id, process=True)¶
Impersonate a user,
account_id
, to retrieve collections associated with the user.See: https://docs.figshare.com/#private_collections_list
- Parameters
account_id (
int
) – Figshare institute account IDprocess (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True
- Return type
Union
[DataFrame
,Response
]- Returns
Relational database of all collections owned by user or the full
requests.Response
- get_user_projects(account_id, process=True)¶
Impersonate a user,
account_id
, to retrieve projects associated with the user.See: https://docs.figshare.com/#private_projects_list
- Parameters
account_id (
int
) – Figshare institute account IDprocess (
bool
) – Returns JSON content fromredata_request
, otherwise the full request is provided. Default: True
- Return type
Union
[DataFrame
,Response
]- Returns
Relational database of all projects owned by user or the full
requests.Response
- reserve_doi(article_id)¶
Reserve DOI if one has not been reserved for
article_id
.See: https://docs.figshare.com/#private_article_reserve_doi
- Parameters
article_id (
int
) – Figshare article ID- Return type
str
- Returns
DOI string