Collections (Python Models & SQLite Database)

  • For our project implementation, we created a new table called videos to contain data about each video uploaded to our video-sharing platform.

    From VSCode using SQLite3 Editor, show your unique collection/table in database, display rows and columns in the table of the SQLite database.

  • This table contained new data such as the uploader, the video description, view count, etc…

image

From VSCode model, show your unique code that was created to initialize table and create test data.

  • This shows the initialization of our ‘video’ table and test data to go along with it. In this case, we created 10 test videos.

image

image

Lists and Dictionaries

  • We used lists and dictionaries to send data and collect data. For example, we would have a list of dictionaries that contained a video object(list) and its data(dictionary).

    In VSCode using Debugger, show a list as extracted from database as Python objects.

  • This shows a list of video objects that each contain metadata.

alt text

In VSCode use Debugger and list, show two distinct example examples of dictionaries, show Keys/Values using debugger.

  • The first example shows a dictionary of one video and its metadata. The second example is in the users data table in which each user has a dictionary of metadata.

image

image

APIs and JSON

  • For our project, we used several different API endpoints to fit our needs, each with a different set of requests. In terms of using Postman, we utilized the software prior to completing the frontend of our features in order to make sure that the functionality was working as intended.

    In VSCode, show Python API code definition for request and response using GET, POST, UPDATE methods. Discuss algorithmic condition used to direct request to appropriate Python method based on request method.

  • In this example, we use a post method to upload videos to our database from our site. We use conditionals to check if the provided data and inputs are valid format applicable.

image

  • In this GET function, we are accessing all the videos from the database. Afterwards, we filter the videos by the user’s preferences and then sorts the videos in the list by their views and like/dislike ratios.

image

  • In this update function, we update the video’s view count. By incrementing by one. This functions receives the corresponding video’s id and changes that video with that specific id.

image

In VSCode, show algorithmic conditions used to validate data on a POST condition.

  • In this POST method, we check if the input data is valid format and existent. In this example, we use a post method to upload videos to our database from our site. We use conditionals to check if the provided data and inputs are valid format applicable.

image

In Postman, show URL request and Body requirements for GET, POST, and UPDATE methods.

  • In these Postman screenshots, we complete the body requirement with the appropriate inputs and then send the requests.
  • The GET request (returns the video data)

image

  • The POST request (returns the uploaded video data)

image

  • The PUT request (adds a view to the specific video)

image

In Postman, show the JSON response data for 200 success conditions on GET, POST, and UPDATE methods.

  • Success conditions for:
  • The GET request (returns the video data)

image

  • The POST request (returns the uploaded video data)

image

  • The PUT request (adds a view to the specific video)

image

In Postman, show the JSON response for error for 400 when missing body on a POST request.

  • In this image, when no input parameters were passed into the POST request in the body, it returned a 400 error.

image

In Postman, show the JSON response for error for 404 when providing an unknown user ID to a UPDATE request.

  • When I try to delete a user with an nonexistent UID, the response returns a 404 error to signify that it is invalid and that the UID doesn’t exist.

image

Frontend

In Chrome inspect, show response of JSON objects from fetch of GET, POST, and UPDATE methods.

  • JSON Response from GET (This is requesting to get all the videos from the database)

image

  • JSON Response from POST (This is posting a video to the backend)

image

  • JSON Response from PUT (Updates the video view count)

image

In the Chrome browser, show a demo (GET) of obtaining an Array of JSON objects that are formatted into the browsers screen.

  • This shows the array of videos that are returned to the user after the GET function in our homepage, where all the videos are displayed.

image

  • This shows the formatting of the videos into the HTML and CSS of the videos. The renderVideos() function takes in the list of videos as a parameter and formats them in a viewable format in the HTML.

image

In JavaScript code, describe fetch and method that obtained the Array of JSON objects.

  • The renderVideos() function takes in two parameters, the Array of video objects and then a certain query to sort the videos in the homepage to only display and match that video query. For example, this can be used to sort out videos following a certain query from the search bar. The videos variable represents the array of JSON objects.

image

In JavaScript code, show code that performs iteration and formatting of data into HTML.

  • This code shows iteration of each video provided in the videos array and then formats each video into the HTML.

image

In the Chrome browser, 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.

  • This demonstrates a successful POST request which is intended to upload a video to the database. It returns the video object that was uploaded, if successful.

image

  • This demonstrates an unsuccessful POST request as I inputted the wrong type of file for image file when uploading a thumbnail.

image

In JavaScript code, show and describe code that handles success. Describe how code shows success to the user in the Chrome Browser screen.

  • Upon success of the GET request to get the videos from the backend, it formats the videos into the HTML.

image

In JavaScript code, show and describe code that handles failure. Describe how the code shows failure to the user in the Chrome Browser screen.

  • If there is an error returned from the response, the function console logs the error.

image

Optional/Extra, Algorithm Analysis

Show algorithms and preparation of data for analysis. This includes cleaning, encoding, and one-hot encoding.

  • Encoding & One-hot encoding & Cleaning the data for the titanic machine learning.

image

image

Show algorithms and preparation for predictions.

  • The prediction algorithm for the Tip and the preparation for the data.

image

  • Instantiating the Tips model for the prediction

image

Discuss concepts and understanding of Linear Regression algorithms.

  • Linear regression is like drawing a straight line through points on a graph. Imagine you have some data points scattered on a graph, and you want to find a line that best fits through them. This line helps you predict what the value of one thing (like a person’s height) might be based on another thing (like their weight). If you have just one thing helping you predict, it’s called simple linear regression, but if you have more things, it’s called multiple linear regression. The goal is to find the line that’s closest to all the points. This line has a slope (how steep it is) and an intercept (where it crosses the y-axis). We use math to figure out these values, making sure the line is as close to all the points as possible. Once we have this line, we can use it to make predictions or understand the relationship between the two things we’re interested in. It helps to predict hings such as death probability (as seen in the Titanic model).

Discuss concepts and understanding of Decision Tree analysis algorithms.

  • Decision trees are like flowcharts for making decisions based on data. Each node in the tree represents a decision based on a feature, leading to more decisions or predictions. The top node is the initial decision, and as you move down, you encounter decisions based on other features until you reach a conclusion. While decision trees are easy to understand and interpret, they can overfit the data, so techniques like pruning or using ensemble methods like random forests help improve performance. Overall, decision trees are handy for various tasks, from predicting categories to numerical values, in fields like finance, healthcare, and marketing. Creates best fitting outcomes using different sets of tests and questions that categorizes it into the best fitting category.