From fbd3379a74f220a4984c41299f41a293efd96b79 Mon Sep 17 00:00:00 2001 From: Arushi Pandey <75818107+Arushi-maker@users.noreply.github.com> Date: Fri, 10 May 2024 15:07:26 -0700 Subject: [PATCH] data struc --- .../2024-04-17-DataStructureWriteUp.ipynb | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/_notebooks/2024-04-17-DataStructureWriteUp.ipynb b/_notebooks/2024-04-17-DataStructureWriteUp.ipynb index 30d5424..5e12fd3 100644 --- a/_notebooks/2024-04-17-DataStructureWriteUp.ipynb +++ b/_notebooks/2024-04-17-DataStructureWriteUp.ipynb @@ -18,8 +18,10 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "\n", "----------------------------------------------------------------------\n", - "## 1) Blog Python Model code and SQLite Database.\n", + "\n", + "## 1 Blog Python Model code and SQLite Database.\n", "\n", "- From VSCode using SQLite3 Editor, show your unique collection/table in database, display rows and columns in the table of the SQLite database.\n", "This database basically stores messages users write in the journal feature of my group's old CPT project, which we integrated with the Trimester 3 project. \n", @@ -28,16 +30,16 @@ "\n", "- From VSCode model, show your unique code that was created to initialize table and create test data.\n", "The table above was created from journal-messages. The function journal-messages includes what is shown below. This code collects the users responses and then stores it in the sqlite database found at journal-messages.\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/6fa85e71-7302-4a26-964f-1894eed01584)\n", + "\n", "\n", "\n", - "## 2) Blog Python API code and use of List and Dictionaries.\n", + "## 2 Blog Python API code and use of List and Dictionaries.\n", "\n", "- In VSCode using Debugger, show a list as extracted from database as Python objects.\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/15b20184-4beb-4aaa-86bf-798f18e3a351)\n", + "\n", "\n", "- In VSCode use Debugger and list, show two distinct examples of dictionaries, show Keys/Values using debugger. Essentially, keys are the purple values on the left side that appear when I click run and debug. The orange text next to it are the values, these can range from the user input I have recieved to what I wrote in the code before.\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/2d9fffd0-e504-498c-8e61-f9b346417eb2)\n", + "\n", "\n", "\n", "## 3) Blog Python API code and use of Postman to request and respond with JSON.\n", @@ -49,56 +51,56 @@ "\n", "b) GET: The GET method is used when finding the user's input from the database and listing it underneath the rest of the new posts created from other users. \n", "\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/43c6a600-0d67-472f-a509-8e875b977576)\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/b98a4499-eb26-4350-adad-824fdd105bde)\n", + "\n", + "\n", "\n", "- In VSCode, show algorithmic conditions used to validate data on a POST condition. The condition below validates the POST by providing other messages if there is an error such as no body, then needing to provide details, or if specifically ID is missing it will tell you to type it again, lastly if the user ID and password is wrong, it will user you about that as well.\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/cc0b8075-cf38-41da-8ee6-1f9690d0fe65)\n", + "\n", "\n", "- In Postman, show URL request and Body requirements for GET, POST, and UPDATE methods. I use the 127.0.0.1.9000 as my site because originally I was having issues with my port, so I created a new one 9000 and changed it in my docker. Anyways, then I add a path to api, then users, to finally authenticate a user. The basic user is toby. In POST, the authentication works, but in GET it sends a message. This means the program did work because the error message DID send. \n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/75eae235-0f47-4bb3-9caf-3c98bf5af5bb)\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/9a018769-cd8d-42a3-a311-357fe5c5b5ee)\n", + "\n", + "\n", "- In Postman, show the JSON response data for 200 success conditions on GET, POST, and UPDATE methods. When the methods work, a 200 OK is seen in the middle right of Postman, which indicates the success.\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/0389f1cf-24e0-472c-80a1-628afc623c6d)\n", + "\n", "\n", "- In Postman, show the JSON response for error for 400 when missing body on a POST request. When incorrect or error in the message, the body displays a 400 error, and Postman displays a 500 Internal Servor Error.\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/ce36f541-fec7-4701-80d0-2f844745f7ac)\n", + "\n", "\n", "- In Postman, show the JSON response for error for 404 when providing an unknown user ID to a UPDATE request. This is the third kind of error, where the body displays an invalid user id or password.\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/190f0e36-079e-44b7-911e-ebe0a9cea8a3)\n", + "\n", "\n", "## 4) Blog JavaScript API fetch code and formatting code to display JSON.\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/188b76df-baab-4c92-88b5-779cf048bfd3)\n", + "\n", "\n", " - Show response of JSON objects from fetch of GET, POST, and UPDATE methods in Chrome inspect. When adding a breakpoint on my fetch in the Frontend, I can see a green hightlight around my code. \n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/0ac7d307-0e07-45bb-a6d5-bc6c8ae263b4)\n", + "\n", "\n", "\n", " - Show a demo (GET) of obtaining an Array of JSON objects that are formatted into the browsers screen in the Chrome browser. Within the inspect, when I go to sources I can navigate towards my debugger where there are arrays such as the \"callback:.\"\n", - " ![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/d23081f2-7fc3-4cea-9034-e64b0ad60892)\n", + " \n", "\n", " - Describe fetch and method that obtained the Array of JSON objects in JavaScript code. In my JS code, the fetch function links to my backend through the same URL and pulls the old posts, past users made that were stored in the database.\n", - " ![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/c1d7c0c6-c658-47fc-9e4e-804a7e6b1e2c)\n", + " \n", "\n", " - Show code that performs iteration and formatting of data into HTML in JavaScript code. \n", "\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/789f0009-f7f0-460e-88d3-d3e7d0772bef)\n", + "\n", "\n", " - Show a demo (POST or UPDATE) gathering and sending input and receiving a response that show update. Repeat this demo showing both success and failure in the Chrome browser.\n", "\n", "\n", " a) Failure:\n", " When there is failure the inspect shows this and says failure to load data. Then, the posts also don't show up when clicking fetch database because the database wasn't able to be brought up on the frontend posts.\n", - " ![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/d9e332ab-0328-4d2c-b04b-6c9b2430f9a6)\n", + " \n", " b) Success:\n", " When there is success, you can see all the posts from the database including the new posts that were just created on the frontend. This means the fetch, and connection the backend link worked.\n", - " ![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/be2f3a33-ae88-4929-b148-14e000fc9f92)\n", + " \n", "\n", " - Show and describe code that handles success. Describe how code shows success to the user in the Chrome Browser screen in JavaScript code. When there is a success, the post gets created. Each post has it's own container and contains a box for the username and a box for the journal log submission. This function \"updatePostsContainer\" causes the creation of whatever is in the database, back into a post box as well.\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/9bba7a4e-a362-4111-8a18-bf60ae8b4572)\n", + "\n", "\n", " - Show and describe code that handles failure. Describe how the code shows failure to the user in the Chrome Browser screen in JavaScript code. When the code fails, Failed to Fetch, will be shown in the console. Otherwise there will be an Error message.\n", - "![Image](https://github.com/nighthawkcoders/teacher_portfolio/assets/75818107/2317c27a-cffa-4774-8691-089e65263cbe)\n" + "" ] } ],