home..
Data Structures Writeup
April 2024 (371 Words, 3 Minutes)
Collections
- Python Model Code and SQLite Database
- The database table has name, uid, their encrypted password, items they have, DOB, favorite food, role, points, friends, and current friend requests
- There are some default users which are created in the users model. They get default items, a set uid & username, and data in other columns
Lists and Dictionaries
- Use of lists and dictionaries in the api code
-
Get request where python list of all users are being pulled and returned as json
- Two distinct examples of dictionaries
- Use of .uid and .role keys to access the user Flay’s dictionary
API and JSON
- API code for all CRUD operations.
- Series of if statements, loops, and returns to make sure that the POST request sent for login is valid. It returns specific errors based on how the request sent did not satisfy the login requirements
- Postman URL and body for the POST request
- Postman URL and body for the GET request
- POSTman URL and body for the PUT request
- Sqlite DB before PUT request
- After the PUT request
- Above screenshots have the 200 success already
- 400 error after missing password for authentication POST request
- 400 error after trying to edit a user who does not exist
Frontend
- Body of the POST request being done during authentication
- JSON object being returned from the GET request in the leaderboard
- Body of the PUT request being sent
- After the GET request, the JSON data being returned is sorted into tables with a for loop
- Redirect to main page once if there are no errors and the login is properly authenticate
- Below are all the different redirects based on the error received. For example, a 404 page redirects to its own page, 401 has its own, etc
Algorithm Analysis
- No cleaning is need because the dataset only has 2 columns; one for CPI value and the other for the date. However, the cpi rates are being converted to interest rates for later use
- Since we did not implement a decision tree for predicting the inflation rate for the next month, the program uses linear regression–not logistic regression. The date is plotted on the x axis and the inflation rate is plotted on the y axis. Then, a LSRL is used to try and predict future rates
- While our data science project did not use a decision tree, the titanic project did. A decison tree splits the data into categories and then at each decision it must make it predicts a value based on the data. After this process is finished it comes up with a conclusion based on the decisions the program made.