Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

CS 340 Southern New Hampshire University Fundamental Operations Lab Report

CS 340 Southern New Hampshire University Fundamental Operations Lab Report

Prompt

After completing the readings for this module, you will implement the fundamental operations of creating and reading documents (the C and R of CRUD) in Python. You will use the PyMongo driver to create CRUD functional access to your document collection.

  1. Upload the Austin Animal Center (AAC) Outcomes data set into MongoDB by importing a CSV file using the appropriate MongoDB import tool. This file is in the /usr/local/datasets/ directory in Apporto and the filename is “aac_shelter_outcomes.csv”. Use the database name “AAC” and collection name “animals”. Complete the import using the mongoimport tool and take screenshots of both the import command and its execution.

    Note: If you completed the Module Three milestone, you have already completed this step.

  1. Next, you must develop a Python module in a PY file, using object-oriented programming methodology, to enable create and read functionality for the database. To support code reusability, your Python code needs to be importable as a module by other Python scripts.

    Develop a CRUD class that, when instantiated, provides the following functionality:

    1. A method that inserts a document into a specified MongoDB database and collection
      1. Input -> argument to function will be set of key/value pairs in the data type acceptable to the MongoDB driver insert API call
      2. Return -> “True” if successful insert, else “False”
    2. A method that queries for documents from a specified MongoDB database and specified collection
      1. Input -> arguments to function should be the key/value lookup pair to use with the MongoDB driver find API call
      2. Return -> result in cursor if successful, else MongoDB returned error message

        Important: Be sure to use find() instead of find_one() when developing your method.

    As you develop your code, be sure to use industry standard best practices such as proper naming conventions, exception handling, and in-line comments. This will ensure that your code is easy to read and reusable for future projects.

    TIP: Use the following sample code to get started. Note that the authentication to MongoDB is in the initialization method for the CRUD class.

    Example Python Code to Insert a Documentfrom pymongo import MongoClientfrom bson.objectid import ObjectIdclass AnimalShelter(object):    """ CRUD operations for Animal collection in MongoDB """    def __init__(self, username, password):        # Initializing the MongoClient. This helps to         # access the MongoDB databases and collections.         self.client = MongoClient('mongodb://%s:%s@localhost:27017' % (username, password))        self.database = self.client['project']# Complete this create method to implement the C in CRUD.    def create(self, data):        if data is not None:            self.database.animals.insert(data)  # data should be dictionary                    else:            raise Exception("Nothing to save, because data parameter is empty")# Create method to implement the R in CRUD.
  1. Finally, create a Python testing script that imports your CRUD Python module to call and test the create and read instances of CRUD functionality. Be sure to use the username and password for the “aacuser” account for authentication when instantiating the class. This script should be created in a separate Jupyter Notebook IPYNB file, and should import and instantiate an object from your CRUD library to effect changes in MongoDB. After creating your script, execute it in Jupyter Notebook and take screenshots of the commands and their execution.
  2. Begin creating your own README file for the CRUD Python module that you began creating in the Module Four milestone. Use the README template to get started. You must address each of the following:
    • Describe the purpose of the project by completing the About the Project and Motivation sections of the template.
    • Demonstrate the project’s functional operations by completing the Usage section. Be sure to include examples of your code and screenshots that show how your module works.
    • Document the tools used, identifying each tool and including your rationale for using these tools, by completing the Installation section. “Tools” include any software applications as well as any libraries used to complete your work.
    • Create instructions for reproducing the project by completing the Getting Started section. Discuss what the user of this CRUD Python module would need to do to get started. Some points to address are:
      • Briefly describe the database and user authentication that you set up in the Module Three milestone.
      • Briefly describe how you created the C and R portions of your Python module, any challenges you encountered, and how you overcame them.

      Note: In this assignment, you only need to focus on creating a README for the create and read functionality of your CRUD Python module. You will continue developing the update and delete functionality as a part of Project One, which is due in Module Five. You will also need to update your README file for that assignment.

Guidelines for Submission

For your submission, you must include the code files for your Python module (PY file) and your Python testing script (IPYNB file). You must also submit a Microsoft Word document with your screenshots from Step 3.

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Studymonk only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Studymonk are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Studymonk is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Studymonk, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.