Question
Hi there, can someone give me a solution to solve this scripting question about a book database on working with Files?: The goal of this
Hi there, can someone give me a solution to solve this scripting question about a book database on working with Files?:
The goal of this lab is to create a very simple database of books. The underlying storage for this database is either a CSV file or JSON. When completely implemented, the database will support the following operations:
Listing books in the database. Options include: Unsorted: list all the books in the database without first sorting them
Sorted: list all the books in the database sorted according to some key
Filtered: list only books matching specified filtering criteria
Searching the database. The following options should be supported: Search by title: Return all the books whose title include any of the words in the search term
Search by author's name: The search term for this option is a single name to match either the author's first or last name. All books matching the criteria are returned.
Creating new books. This option supports creating multiple books at once.
Updating a book. This option supports editing one or multiple fields of the book
Deleting a book.
CRUD operations, i.e. create, update, delete, should be immediately followed by saving the current contents of the database to the underlying CSV or JSON storage.
Code structure (There's more than one image because the code is pretty long, the Pass sections are where new codes are to be inputed):
Can someone help with this? Thank you
4. You should implement the following functions: - load_db(): takes the path to the database file as argument, reads the contents and returns a list of books - save_db(): takes the path to the database file as argument, and writes a list of books to the file. This function overwrites the database file each time it is called. - format_book(): takes a book as an argument and returns a formatted representation of the book 1/2 ks Database Part I.md 3/2/2023 - filter_books(): takes a list of books and the filter criteria as arguments, and returns a list of books matching the filter criteria. The filter criteria is a combination of a key and value. Example: The perform_action () function is the heart of this program, but it is not yet fully implemented. For Part I you should only implement the first two options action 1 , that is: - Display all books unsorted - Display books filtered according to some criteria. You can filter books based on the author, genre, publisher or year of publication. You should get the user to indicate how to filter the books by providing a key and value. Example: filter_books(books, 'genre', 'fiction') The God of Small Things Author: Arundhati, Roy Genre: fiction Publisher: Fourth Estate Year: 1997 ID: 1 Cryptonomicon Author: Neal, Stephenson Genre: fiction Publisher: Avon Books Year: 1999 ID: 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started