Gurbop / CSPBlog2

MIT License
0 stars 0 forks source link

Data Structure Write up #10

Open Gurbop opened 2 months ago

Gurbop commented 2 months ago

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

Screenshot 2024-04-23 at 10 20 40 PM

This table displays a list of all the tournaments a user saves.

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

Screenshot 2024-04-23 at 10 21 32 PM Screenshot 2024-04-23 at 10 22 02 PM

This code initializes a table with the columns uid, id, and tournament name, the test values are passed with the tournament name of clash 1 and clash 2. It creates a relationship between the user id to the tournament name.

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

Screenshot 2024-04-17 at 5 16 58 PM

When I step through the debugger it starts here where the tournament list is being extracted as a python json object.

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

Screenshot 2024-04-17 at 5 18 22 PM

This shows two dictionaries of the data with attributes like uid and tournament name.

APIs and JSON:

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.

Screenshot 2024-04-17 at 5 21 37 PM

This code snippet shows a part of a web API for managing "tours" within a system. The post method adds a new tour with an ID and name to a database when called. The get method retrieves all tours from the database and formats them into a JSON response.

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

Screenshot 2024-04-17 at 5 22 28 PM

These are the parameters required to make a user as there is a minimum characters on the username and password.

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

Screenshot 2024-04-17 at 5 27 11 PM

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

Screenshot 2024-04-17 at 5 27 57 PM Screenshot 2024-04-17 at 5 28 18 PM

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

Screenshot 2024-04-17 at 5 28 36 PM Screenshot 2024-04-17 at 5 28 58 PM

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

Screenshot 2024-04-17 at 5 37 45 PM Screenshot 2024-04-17 at 5 38 02 PM

Postman is used to test API requests between a user and the backend. Based on what data is being ran with POST, GET, UPDATE, or DELETE, different errors or success will occur. Frontend: In Chrome inspect, show response of JSON objects from fetch of GET, POST, and UPDATE methods.
Screenshot 2024-04-18 2 42 41 PM This response happens when the user searches for a tournament. Based on the name a GET request will be sent to a clash royale API that will send back JSON objects matching what the user wants. In the Chrome browser, show a demo (GET) of obtaining an Array of JSON objects that are formatted into the browsers screen. I will demo getting the leaderboard data from the clash royale API

Screenshot 2024-04-23 at 10 36 33 PM

An array of json objects that has information on different tournaments is obtained using a GET request to a clash royale API. This information is formatted into a table so a user can see it.

In JavaScript code, describe fetch and method that obtained the Array of JSON objects. Screenshot 2024-04-18 2 46 47 PM This code fetches JSON data from the clash royale API so it can be through interactions in order to be displayed.

In JavaScript code, show code that performs iteration and formatting of data into HTML. Screenshot 2024-04-18 2 57 03 PM This code loops through the array of JSON objects and displays them in an HTML table based on what the data is representing. For example players, name duration, and rewards.

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.

I will demo searching the leaderboard without the backend running for failure and a demo for success. Screenshot 2024-04-18 3 14 19 PM Screenshot 2024-04-18 3 13 05 PM Without the backend running the requests can't be sent causing errors.

In JavaScript code, show and describe code that handles success. Describe how code shows success to the user in the Chrome Browser screen. Screenshot 2024-04-18 2 57 03 PM Upon success, a table with information will be displayed, and if data is saved it will be sent to the backend database. 200 code in terminal/console.

In JavaScript code, show and describe code that handles failure. Describe how the code shows failure to the user in the Chrome Browser screen. Screenshot 2024-04-18 3 03 43 PM This code does error handling notifying the user when an error occurs and in console outputs wether the code(400,403,404,500)

Extras: Show algorithms and preparation of data for analysis. This includes cleaning, encoding, and one-hot encoding. Screenshot 2024-04-18 3 07 28 PM When an instance of the datamodel class is created, it tries to load a machine learning model from a file using Python's pickle module; if the model file isn't found or isn't a logistic regression model, it initializes a new logistic regression model. It also reads data from a CSV file into a pandas DataFrame. The class includes methods to display the head of the data, preprocess the data.

Show algorithms and preparation for predictions. Screenshot 2024-04-18 3 08 16 PM The preprocess_data method prepares the data for modeling by setting certain columns as features and a target variable. The train_model method invokes data preprocessing and then presumably trains the logistic regression model. The predict method uses the trained model to make predictions given new input data, and there are also methods to add new data to the existing dataset (add_data) and retrieve the current dataset (get_data).

Discuss concepts and understanding of Linear Regression algorithms.

Linear regression is a statistical method used to model the relationship between a dependent variable and one or more independent variables by fitting a linear equation to observed data. The main goal is to find a straight line that best predicts the dependent variable based on the values of the independent variables. Discuss concepts and understanding of Decision Tree analysis algorithms.

Decision tree analysis is a machine learning method that models decisions and their possible consequences as a tree-like structure, where each branch represents a choice between alternatives. The algorithm splits the data into branches at decision nodes, based on feature values that lead to the most distinct subsets, aiming to classify or predict the outcome accurately.

Summary: My feature uses API requests from clash royales database to display data the user wants, tournaments/challanges, and a user can save a tornament and it will be stored in my own database under the users account.

LincolnC2008 commented 2 months ago

The collections have been thoroughly completed with all elements demonstrated accurately. Lists and dictionaries are also fully implemented, with all debugging correctly performed. The API section, including GET, POST, PUT, and DELETE operations, has been properly executed. Additionally, all relevant Postman and frontend components are correctly included and functioning. He also did the extra credit by explaining a decision tree and linear regression in a way where most can understand

0.95/1

Gurbop commented 2 months ago

Comment was sent on Slack.(the reviewer was not at home)

Screenshot 2024-04-24 at 7 56 32 PM