:py:mod:`peptidedigest.article_db` ================================== .. py:module:: peptidedigest.article_db .. autoapi-nested-parse:: Functions for creating and managing a SQLite database for storing articles and their model responses. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: peptidedigest.article_db.create_database peptidedigest.article_db.insert_article peptidedigest.article_db.get_article peptidedigest.article_db.get_articles peptidedigest.article_db.update_article peptidedigest.article_db.check_article_exists peptidedigest.article_db.delete_article .. py:function:: create_database(name) Create a SQLite database with the given name. :Parameters: **name** (*str*) -- The name of the database to create. :returns: The database is created in the current working directory. :rtype: None .. py:function:: insert_article(database, article_info, model_responses=None) Insert an article and its model responses into the database. :Parameters: * **database** (*str*) -- The name of the database to insert the article into. * **article_info** (*dict*) -- A dictionary containing the article information. * **model_responses** (*dict*) -- A dictionary containing the model responses for the article. :returns: The article and model responses are inserted into the database. :rtype: None .. py:function:: get_article(database, doi=None, pmc_id=None) Get the article information and model responses for a given DOI. :Parameters: * **database** (*str*) -- The name of the database to retrieve the article from. * **doi** (*str*) -- The DOI of the article to retrieve. * **pmc_id** (*str*) -- The PMC ID of the article to retrieve. :returns: A dictionary containing the article information and model responses. :rtype: dict .. py:function:: get_articles(database) Get all articles from the database. :Parameters: **database** (*str*) -- The name of the database to retrieve the articles from. :returns: A list of dictionaries containing the article information and model responses. :rtype: list .. py:function:: update_article(database, doi, model_responses) Update the model responses for an article in the database. :Parameters: * **database** (*str*) -- The name of the database to update the article in. * **doi** (*str*) -- The DOI of the article to update. * **model_responses** (*dict*) -- A dictionary containing the updated model responses. :returns: The model responses for the article are updated in the database. :rtype: None .. py:function:: check_article_exists(database, value, column) Check if an article with the given value in the specified column exists in the database. :Parameters: * **database** (*str*) -- The name of the database to check for the article. * **value** (*str*) -- The value to check for in the specified column. * **column** (*str*) -- The column to check for the value. :returns: True if the article exists, False otherwise. :rtype: bool .. py:function:: delete_article(database, doi=None, pmc_id=None) Delete an article and its model responses from the database. :Parameters: * **database** (*str*) -- The name of the database to delete the article from. * **doi** (*str*) -- The DOI of the article to delete. * **pmc_id** (*str*) -- The PMC ID of the article to delete. :returns: The article and model responses are deleted from the database. :rtype: None