Found 8 repositories(showing 8)
RahulPatil-Tech
to the left & scrollbar to the right so that they both appear parallel & perfect. Buttons: We will add two button widgets on the window. One is to add more tasks in Listbox and the other is to delete tasks from Listbox. Entry box: Users will type the task in the entry box which further will be displayed in the Listbox. Messagebox: The Python Tkinter message box is used to display an error message when the user clicks on the add button with an empty entry box. Code explanation for ToDo list in Python Tkinter In this section, we will understand the source code for the ToDo list in Python Tkinter. The entire code is explained in a sequence of creation. Step 1 : Import Modules Before we start using Tkinter, we need to call Tkinter for use. so we import the module. Here * means everything. So we are importing everything from Tkinter then in the second line we have imported message box from Tkinter from tkinter import * from tkinter import messagebox Step 2: Create & Configure Window After importing module, we will create a window so that we can place widgets on it. ws is used to initialize Tk(). From now ws will be called as the parent window. All other widgets will be placed on it. ws.geometry(‘width x height + x-position+ y-position’) All the values provided must be integers. the width refers to the horizontal space of the window. height refers to the vertical space of the window. x-position refers to the position of the window on the display over the x-axis. y-position refers to the position of the window on the display over the y-axis. the title will add a title to the window. In our case, we have provided our website name as a title. You can find the title on the top left of the window next to feather. config is used to provide background color to the window. resizable accepts boolean values. Since the boolean values are provided false for both height and width that means the window can’t be resized. To know more about resizable please read our blog on python Tkinter windows size. ws.mainloop() holds the screen so that we can see the window. It is an infinite loop. screen pops up and then disappears but with this infinite loop this process of appearing & disappearing keeps on happening very fast. And we keep on seeing the updated window. ws = Tk() ws.geometry('500x450+500+200') ws.title('PythonGuides') ws.config(bg='#223441') ws.resizable(width=False, height=False) .... .... ws.mainloop() Step 3: Creating a frame In this section we will understand why we have used frames as a first widget in our code. Frame widgets are used to hold other widgets. They help in keeping & maintaining user interface (UI) & user experience (UX) clean & organized. Moving forward we will place Listbox, scrollbars & buttons inside the frame. So in this way frame will act as an additional window over the parent window. Another benefit of placing a frame is now we will add scrollbars to the frame and that solves our purpose. Scrollbars are no easy to place but using frames we can do it in no time. pady=10 means we have added extra padding around the frame from outside. frame = Frame(ws) frame.pack(pady=10) Step 4: Adding Listbox In this section, we will learn why and how we have used Listbox on the window. lb is the variable name for storing Listbox. Listbox is placed on the frame window. width: Horizontal space provided is 25. height: 8 rows in the vertical position are provided. font: Times New Roman font is provided with 14 sizes. bd = 0 refers to the border is zero fg is the foreground color or the text color. highlightthickness=0 every time the focus is moved to any item then it should not show any movement that is value 0 value is provided. by default it has some value. selectbackground it decides the color of the focused item in the Listbox. activestyle=”none” removes the underline that appears when the item is selected or focused. geometry manager used is pack() side=LEFTthis will keep the Listbox to the left side of the frame. We did this on purpose so that we can assign the right position to scrollbars. fill=BOTH this will fill the blank space in both the directions that are x and y lb = Listbox( frame, width=25, height=8, font=('Times', 18), bd=0, fg='#464646', highlightthickness=0, selectbackground='#a6a6a6', activestyle="none", ) lb.pack(side=LEFT, fill=BOTH) Step 5: Adding dummy data We have added dummy data so that the application is ready to view. You add or delete whatever data you want. the data is in a list format and is stored in a variable named task_list. for loop is used to insert data in the Listbox. every time loop runs it adds an item to the Listbox & this process keeps on going until all the items in the task_list are inserted. lb.insert(END, item) this command stacks the items in Listbox. lb is the variable used for Listbox insert is a built-in method of Listbox to insert data. END signifies that a new item will be added in the end. If END is replaced with 0 then new data will be added at the top. item is the list item from task_list task_list = [ 'Eat apple', 'drink water', 'go gym', 'write software', 'write documentation', 'take a nap', 'Learn something', 'paint canvas' ] for item in task_list: lb.insert(END, item) Step 6: Adding Scrollbars In this section, we will understand why and how scrollbars are added to the window. Scrollbars are used so that users can scroll the information that is placed in a limited size on the window. In this scrollbars are placed on a frame and the variable assigned is sb The geometry method used is a pack() so that everything remains dynamic and in a sequence. side=RIGHT we have placed scrollbars on the right side of the frame. In the above code, we have provided side=LEFT to Listbox. So in this way, both the widgets are assigned paralleled. fill=BOTH this will fill the blank space in both the directions that are x and y lb.config(yscrollcommand=sb.set) here we have assigned a purpose to the scrollbar. In other words, we have bind Listbox with scrollbar sb.config(command=lb.yview), here yview means scrollbar will go in the vertical direction. If it would have been xview then the scrollbar would have worked in the horizontal direction. sb = Scrollbar(frame) sb.pack(side=RIGHT, fill=BOTH) lb.config(yscrollcommand=sb.set) sb.config(command=lb.yview) Step 7: Adding Entry Box Entry box is used to take input from the user. ws: entry box is placed on the parent window font: provides font name i.e ‘Times New Roman’ and size is 14 Geometry manager used is pack with padding of 20 outside the widget my_entry = Entry( ws, font=('times', 24) ) my_entry.pack(pady=20) Step: 8 Adding another frame for buttons Frames are used to organise the widgets. We have used separate frame for buttons. button_frame = Frame(ws) button_frame.pack(pady=20) Step 9: Adding Buttons Buttons are placed to trigger some action when pressed. Here we have created two button (addTask & deleteTask). Both of them have same features and look accept the background color and command. Command: When button is clicked the the function mentioned in command is called. In this case if user clicks on addTask_btn button then newTask function is called & when user clicks on the delTask_btn Button then delTask function is called. addTask_btn = Button( button_frame, text='Add Task', font=('times 14'), bg='#c5f776', padx=20, pady=10, command=newTask ) addTask_btn.pack(fill=BOTH, expand=True, side=LEFT) delTask_btn = Button( button_frame, text='Delete Task', font=('times 14'), bg='#ff8b61', padx=20, pady=10, command=deleteTask ) delTask_btn.pack(fill=BOTH, expand=True, side=LEFT) Step 10: newTask() function In this function, we have stored the value of the entry box in the task variable get() method is used to pull the value provided by the user in the entry box. If-else condition is applied to avoid black space entry in the Listbox. if the task does not have blank space then only it will allow it to store the information in the Listbox otherwise it will display a warning message box informing the user that the entry box can’t be empty. def newTask(): task = my_entry.get() if task != "": lb.insert(END, task) my_entry.delete(0, "end") else: messagebox.showwarning("warning", "Please enter some task.") Step 11: deleteTask() function Here ANCHOR refers to the selected item in the Listbox. lb variable assigned to Listbox delete is a built-in function to delete Listbox item. User will select the item in the Listbox and then to trigger this function he/she will click on the deleteTask button. Immediately the item will disappear from the Listbox. def deleteTask(): lb.delete(ANCHOR)
LookHere
Procedurally generated employee data can be useful for publicly discussing projects like HR dashboard styles (without exposing confidential data) or for testing live data vs. unbiased data to validate analysis. This project allows you to quickly creates dummy data with any demographic categories (with any ratios of workers in each category).
spt3gntlmn
Node.js & MySQL Overview In this activity, you'll be creating an Amazon-like storefront with the MySQL skills you learned this week. The app will take in orders from customers and deplete stock from the store's inventory. As a bonus task, you can program your app to track product sales across your store's departments and then provide a summary of the highest-grossing departments in the store. Make sure you save and require the MySQL and Inquirer npm packages in your homework files--your app will need them for data input and storage. Submission Guide Make sure you use the normal GitHub. Because this is a CLI App, there will be no need to deploy it to Heroku. This time, though, you need to include screenshots, a gif, and/or a video showing us that you got the app working with no bugs. You can include these screenshots or a link to a video in a README.md file. Include screenshots (or a video) of typical user flows through your application (for the customer and if relevant the manager/supervisor). This includes views of the prompts and the responses after their selection (for the different selection options). Include any other screenshots you deem necessary to help someone who has never been introduced to your application understand the purpose and function of it. This is how you will communicate to potential employers/other developers in the future what you built and why, and to show how it works. Because screenshots (and well-written READMEs) are extremely important in the context of GitHub, this will be part of the grading. If you haven't written a markdown file yet, click here for a rundown, or just take a look at the raw file of these instructions. Instructions Challenge #1: Customer View (Minimum Requirement) Create a MySQL Database called bamazon. Then create a Table inside of that database called products. The products table should have each of the following columns: item_id (unique id for each product) product_name (Name of product) department_name price (cost to customer) stock_quantity (how much of the product is available in stores) Populate this database with around 10 different products. (i.e. Insert "mock" data rows into this database and table). Then create a Node application called bamazonCustomer.js. Running this application will first display all of the items available for sale. Include the ids, names, and prices of products for sale. The app should then prompt users with two messages. The first should ask them the ID of the product they would like to buy. The second message should ask how many units of the product they would like to buy. Once the customer has placed the order, your application should check if your store has enough of the product to meet the customer's request. If not, the app should log a phrase like Insufficient quantity!, and then prevent the order from going through. However, if your store does have enough of the product, you should fulfill the customer's order. This means updating the SQL database to reflect the remaining quantity. Once the update goes through, show the customer the total cost of their purchase. If this activity took you between 8-10 hours, then you've put enough time into this assignment. Feel free to stop here -- unless you want to take on the next challenge. Challenge #2: Manager View (Next Level) Create a new Node application called bamazonManager.js. Running this application will: List a set of menu options: View Products for Sale View Low Inventory Add to Inventory Add New Product If a manager selects View Products for Sale, the app should list every available item: the item IDs, names, prices, and quantities. If a manager selects View Low Inventory, then it should list all items with an inventory count lower than five. If a manager selects Add to Inventory, your app should display a prompt that will let the manager "add more" of any item currently in the store. If a manager selects Add New Product, it should allow the manager to add a completely new product to the store. If you finished Challenge #2 and put in all the hours you were willing to spend on this activity, then rest easy! Otherwise continue to the next and final challenge. Challenge #3: Supervisor View (Final Level) Create a new MySQL table called departments. Your table should include the following columns: department_id department_name over_head_costs (A dummy number you set for each department) Modify the products table so that there's a product_sales column and modify the bamazonCustomer.js app so that this value is updated with each individual products total revenue from each sale. Modify your bamazonCustomer.js app so that when a customer purchases anything from the store, the price of the product multiplied by the quantity purchased is added to the product's product_sales column. Make sure your app still updates the inventory listed in the products column. Create another Node app called bamazonSupervisor.js. Running this application will list a set of menu options: View Product Sales by Department Create New Department When a supervisor selects View Product Sales by Department, the app should display a summarized table in their terminal/bash window. Use the table below as a guide. department_id department_name over_head_costs product_sales total_profit 01 Electronics 10000 20000 10000 02 Clothing 60000 100000 40000 The total_profit column should be calculated on the fly using the difference between over_head_costs and product_sales. total_profit should not be stored in any database. You should use a custom alias. If you can't get the table to display properly after a few hours, then feel free to go back and just add total_profit to the departments table. Hint: You may need to look into aliases in MySQL. Hint: You may need to look into GROUP BYs. Hint: You may need to look into JOINS. HINT: There may be an NPM package that can log the table to the console. What's is it? Good question :) Minimum Requirements Attempt to complete homework assignment as described in instructions. If unable to complete certain portions, please pseudocode these portions to describe what remains to be completed. Create a README.md Add a README.md to your repository describing the project. Here are some resources for creating your README.md. Here are some resources to help you along the way: About READMEs Mastering Markdown Add To Your Portfolio After completing the homework please add the piece to your portfolio. Make sure to add a link to your updated portfolio in the comments section of your homework so the TAs can easily ensure you completed this step when they are grading the assignment. To receive an 'A' on any assignment, you must link to it from your portfolio. One More Thing If you have any questions about this project or the material we have covered, please post them in the community channels in slack so that your fellow developers can help you! If you're still having trouble, you can come to office hours for assistance from your instructor and TAs. Good Luck!
rrbrink
Node.js & MySQL Overview In this activity, you'll be creating an Amazon-like storefront with the MySQL skills you learned this week. The app will take in orders from customers and deplete stock from the store's inventory. As a bonus task, you can program your app to track product sales across your store's departments and then provide a summary of the highest-grossing departments in the store. Make sure you save and require the MySQL and Inquirer npm packages in your homework files--your app will need them for data input and storage. Submission Guide Make sure you use the normal GitHub. Because this is a CLI App, there will be no need to deploy it to Heroku. This time, though, you need to include screenshots, a gif, and/or a video showing us that you got the app working with no bugs. You can include these screenshots or a link to a video in a README.md file. Include screenshots (or a video) of typical user flows through your application (for the customer and if relevant the manager/supervisor). This includes views of the prompts and the responses after their selection (for the different selection options). Include any other screenshots you deem necessary to help someone who has never been introduced to your application understand the purpose and function of it. This is how you will communicate to potential employers/other developers in the future what you built and why, and to show how it works. Because screenshots (and well-written READMEs) are extremely important in the context of GitHub, this will be part of the grading. If you haven't written a markdown file yet, click here for a rundown, or just take a look at the raw file of these instructions. Instructions Challenge #1: Customer View (Minimum Requirement) Create a MySQL Database called bamazon. Then create a Table inside of that database called products. The products table should have each of the following columns: item_id (unique id for each product) product_name (Name of product) department_name price (cost to customer) stock_quantity (how much of the product is available in stores) Populate this database with around 10 different products. (i.e. Insert "mock" data rows into this database and table). Then create a Node application called bamazonCustomer.js. Running this application will first display all of the items available for sale. Include the ids, names, and prices of products for sale. The app should then prompt users with two messages. The first should ask them the ID of the product they would like to buy. The second message should ask how many units of the product they would like to buy. Once the customer has placed the order, your application should check if your store has enough of the product to meet the customer's request. If not, the app should log a phrase like Insufficient quantity!, and then prevent the order from going through. However, if your store does have enough of the product, you should fulfill the customer's order. This means updating the SQL database to reflect the remaining quantity. Once the update goes through, show the customer the total cost of their purchase. If this activity took you between 8-10 hours, then you've put enough time into this assignment. Feel free to stop here -- unless you want to take on the next challenge. Challenge #2: Manager View (Next Level) Create a new Node application called bamazonManager.js. Running this application will: List a set of menu options: View Products for Sale View Low Inventory Add to Inventory Add New Product If a manager selects View Products for Sale, the app should list every available item: the item IDs, names, prices, and quantities. If a manager selects View Low Inventory, then it should list all items with an inventory count lower than five. If a manager selects Add to Inventory, your app should display a prompt that will let the manager "add more" of any item currently in the store. If a manager selects Add New Product, it should allow the manager to add a completely new product to the store. If you finished Challenge #2 and put in all the hours you were willing to spend on this activity, then rest easy! Otherwise continue to the next and final challenge. Challenge #3: Supervisor View (Final Level) Create a new MySQL table called departments. Your table should include the following columns: department_id department_name over_head_costs (A dummy number you set for each department) Modify the products table so that there's a product_sales column and modify the bamazonCustomer.js app so that this value is updated with each individual products total revenue from each sale. Modify your bamazonCustomer.js app so that when a customer purchases anything from the store, the price of the product multiplied by the quantity purchased is added to the product's product_sales column. Make sure your app still updates the inventory listed in the products column. Create another Node app called bamazonSupervisor.js. Running this application will list a set of menu options: View Product Sales by Department Create New Department When a supervisor selects View Product Sales by Department, the app should display a summarized table in their terminal/bash window. Use the table below as a guide. department_id department_name over_head_costs product_sales total_profit 01 Electronics 10000 20000 10000 02 Clothing 60000 100000 40000 The total_profit column should be calculated on the fly using the difference between over_head_costs and product_sales. total_profit should not be stored in any database. You should use a custom alias. If you can't get the table to display properly after a few hours, then feel free to go back and just add total_profit to the departments table. Hint: You may need to look into aliases in MySQL. Hint: You may need to look into GROUP BYs. Hint: You may need to look into JOINS. HINT: There may be an NPM package that can log the table to the console. What's is it? Good question :) Minimum Requirements Attempt to complete homework assignment as described in instructions. If unable to complete certain portions, please pseudocode these portions to describe what remains to be completed. One More Thing If you have any questions about this project or the material we have covered, please post them in the community channels in slack so that your fellow developers can help you! If you're still having trouble, you can come to office hours for assistance from your instructor and TAs. Good Luck! Copyright Coding Boot Camp (C) 2016. All Rights Reserved.
Raksh710
Predicting whether a patient will have a stroke (=1) or not (=0). The unique thing about this dataset is that it is highly unbalanced having around 95% of its dependent value column (i.e stroke column) as 0 and only around 5% as 1. Apart from that it also has a lot of missing data which had to be fixed, and for that, I used various categorical columns (and turned them into dummies) and then figured out on which features the missing value depended the most, and then mapping it accordingly. Since the dataset was highly unbalanced I remade another dataset with around 80% as stroke=0 and the rest 20% as stroke=1. I then used various classification algorithm to find out which fits the best, turns out Random Forest did. The metric used here was "F1 Score" instead of accuracy (because in the case of a highly unbalanced dataset accuracy could be misleading as it could be really high by only predicting only one value. Please have a look and let me know your thoughts on this: https://www.kaggle.com/raksh710/stroke-prediction-raksh710 © 2021 GitHub, Inc.
OVERVIEW: I have done building a Machine learning model and Data Analysis for X Education Company to identify the ‘Hot Leads’ as well as to find more ways to improve potential lead conversion rate. I was provided with a dataset having information on the leads (both converted and non-converted) and their behavior before enrolling for one or more of the online courses. We have followed few steps to do that, and they are:- a) Data Reading and Understanding – Here, we looked at the data, its rows and columns, and understood our requirements. b) Data Cleaning – Here, we checked for the missing values in the dataset and either imputed them with valid information or removed them if they were irrelevant. Also, we categorized the records into fewer levels where needed. c) Exploratory Data Analysis – In this step, we did univariate and bivariate analysis on the features and found out the correlation between the variables using a heat map. We, also, identified if some of the features have outliers in it, and treated them. (Depending on the business scenario and requirements.) d) Data Preparation – We performed outlier treatment, created dummy variables for the categorical variables, used Standard Scaler to scaling them and we also split the data set into Train and Test Dataset. e) Model Building – At this stage, we used RFE to filter the 15 most important and relevant variables from 39 variables from the dataset. Then we created models, checked their P-value, VIF score, then delete the features with high p-value and high VIF score (>5) and repeat these steps until we reached a position where all these values looked stable and good. f) Model Evaluation - We calculated evaluation metrics like Accuracy, Sensitivity, and Specificity etc. on train dataset first and then verified them on ROC curve. When everything looked good, we followed the same procedure on test data set again and evaluate all the metrics on the test dataset. OUR FINDINGS: When we promote our online education program via many ad campaigns, search engine optimization, blogging etc. we end up with a huge number of leads. However, only 38% of the whole dataset have 'Converted' meaning, only 38% of the total leads have enrolled with one or more of the online education programs. We, also, saw there are customers with various kind of occupations, for example - Working professionals, Unemployed, Students etc. who have enrolled for our program. Among those conversions, most of our leads reside in Mumbai and are Unemployed. Furthermore, they found out about the program via Google ads and opted for specialization which falls under 'Management' category. In addition to that, we also noticed the potential leads who spend maximum time on the website had a high rate of conversion. We would suggest, to make the Company's social media presence more prominent and keep working on the website content which would result in higher engagement. Also, the company could assign high performing sales team to be proactive on Olark Chat so that we can improve potential lead conversion on that platform as well. We can also, work on targeting audience residing outside Maharashtra, as company provides online education program and is suitable for everyone who wants to up skill in their career path. Now, coming to our machine building and prediction part, if we compare the values obtained for Train & Test: Train Data: Accuracy: 78% Sensitivity: 82% Specificity: 76% Precision: 70% Recall: 83% Test Data: Accuracy: 78% Sensitivity: 84% Specificity: 74% Precision: 66% Recall: 83% The score of Accuracy, Sensitivity and Accuracy in Train and Test data doesn't differ much. Which means our model can predict the conversion rate pretty decently and we should be able to give the CEO confidence in making good calls based on this model's 'Hot Lead' prediction.
itsrichardmai
# Node.js & MySQL ## Overview In this activity, you'll be creating an Amazon-like storefront with the MySQL skills you learned this unit. The app will take in orders from customers and deplete stock from the store's inventory. As a bonus task, you can program your app to track product sales across your store's departments and then provide a summary of the highest-grossing departments in the store. Make sure you save and require the MySQL and Inquirer npm packages in your homework files--your app will need them for data input and storage. ## Submission Guide Make sure you use the normal GitHub. Because this is a CLI App, there will be no need to deploy it to Heroku. This time, though, you need to include screenshots, a gif, and/or a video showing us that you got the app working with no bugs. You can include these screenshots or a link to a video in a `README.md` file. * Include screenshots (or a video) of typical user flows through your application (for the customer and if relevant the manager/supervisor). This includes views of the prompts and the responses after their selection (for the different selection options). * Include any other screenshots you deem necessary to help someone who has never been introduced to your application understand the purpose and function of it. This is how you will communicate to potential employers/other developers in the future what you built and why, and to show how it works. * Because screenshots (and well-written READMEs) are extremely important in the context of GitHub, this will be part of the grading. If you haven't written a markdown file yet, [click here for a rundown](https://guides.github.com/features/mastering-markdown/), or just take a look at the raw file of these instructions. ### Submission on BCS * Please submit the link to the Github Repository! ## Instructions ### Challenge #1: Customer View (Minimum Requirement) 1. Create a MySQL Database called `bamazon`. 2. Then create a Table inside of that database called `products`. 3. The products table should have each of the following columns: * item_id (unique id for each product) * product_name (Name of product) * department_name * price (cost to customer) * stock_quantity (how much of the product is available in stores) 4. Populate this database with around 10 different products. (i.e. Insert "mock" data rows into this database and table). 5. Then create a Node application called `bamazonCustomer.js`. Running this application will first display all of the items available for sale. Include the ids, names, and prices of products for sale. 6. The app should then prompt users with two messages. * The first should ask them the ID of the product they would like to buy. * The second message should ask how many units of the product they would like to buy. 7. Once the customer has placed the order, your application should check if your store has enough of the product to meet the customer's request. * If not, the app should log a phrase like `Insufficient quantity!`, and then prevent the order from going through. 8. However, if your store _does_ have enough of the product, you should fulfill the customer's order. * This means updating the SQL database to reflect the remaining quantity. * Once the update goes through, show the customer the total cost of their purchase. - - - * If this activity took you between 8-10 hours, then you've put enough time into this assignment. Feel free to stop here -- unless you want to take on the next challenge. - - - ### Challenge #2: Manager View (Next Level) * Create a new Node application called `bamazonManager.js`. Running this application will: * List a set of menu options: * View Products for Sale * View Low Inventory * Add to Inventory * Add New Product * If a manager selects `View Products for Sale`, the app should list every available item: the item IDs, names, prices, and quantities. * If a manager selects `View Low Inventory`, then it should list all items with an inventory count lower than five. * If a manager selects `Add to Inventory`, your app should display a prompt that will let the manager "add more" of any item currently in the store. * If a manager selects `Add New Product`, it should allow the manager to add a completely new product to the store. - - - * If you finished Challenge #2 and put in all the hours you were willing to spend on this activity, then rest easy! Otherwise continue to the next and final challenge. - - - ### Challenge #3: Supervisor View (Final Level) 1. Create a new MySQL table called `departments`. Your table should include the following columns: * department_id * department_name * over_head_costs (A dummy number you set for each department) 2. Modify the products table so that there's a product_sales column, and modify your `bamazonCustomer.js` app so that when a customer purchases anything from the store, the price of the product multiplied by the quantity purchased is added to the product's product_sales column. * Make sure your app still updates the inventory listed in the `products` column. 3. Create another Node app called `bamazonSupervisor.js`. Running this application will list a set of menu options: * View Product Sales by Department * Create New Department 4. When a supervisor selects `View Product Sales by Department`, the app should display a summarized table in their terminal/bash window. Use the table below as a guide. | department_id | department_name | over_head_costs | product_sales | total_profit | | ------------- | --------------- | --------------- | ------------- | ------------ | | 01 | Electronics | 10000 | 20000 | 10000 | | 02 | Clothing | 60000 | 100000 | 40000 | 5. The `total_profit` column should be calculated on the fly using the difference between `over_head_costs` and `product_sales`. `total_profit` should not be stored in any database. You should use a custom alias. 6. If you can't get the table to display properly after a few hours, then feel free to go back and just add `total_profit` to the `departments` table. * Hint: You may need to look into aliases in MySQL. * Hint: You may need to look into GROUP BYs. * Hint: You may need to look into JOINS. * **HINT**: There may be an NPM package that can log the table to the console. What's is it? Good question :) ### Reminder: Submission on BCS * Please submit the link to the Github Repository! - - - ### Minimum Requirements Attempt to complete homework assignment as described in instructions. If unable to complete certain portions, please pseudocode these portions to describe what remains to be completed. Adding a README.md as well as adding this homework to your portfolio are required as well and more information can be found below. - - - ### Create a README.md Add a `README.md` to your repository describing the project. Here are some resources for creating your `README.md`. Here are some resources to help you along the way: * [About READMEs](https://help.github.com/articles/about-readmes/) * [Mastering Markdown](https://guides.github.com/features/mastering-markdown/) - - - ### Add To Your Portfolio After completing the homework please add the piece to your portfolio. Make sure to add a link to your updated portfolio in the comments section of your homework so the TAs can easily ensure you completed this step when they are grading the assignment. To receive an 'A' on any assignment, you must link to it from your portfolio. - - - ### One More Thing If you have any questions about this project or the material we have covered, please post them in the community channels in slack so that your fellow developers can help you! If you're still having trouble, you can come to office hours for assistance from your instructor and TAs. **Good Luck!**
CaptainEFFF
# Node.js & MySQL ## Overview In this activity, you'll be creating an Amazon-like storefront with the MySQL skills you learned this unit. The app will take in orders from customers and deplete stock from the store's inventory. As a bonus task, you can program your app to track product sales across your store's departments and then provide a summary of the highest-grossing departments in the store. Make sure you save and require the MySQL and Inquirer npm packages in your homework files--your app will need them for data input and storage. ## Submission Guide Make sure you use the normal GitHub. Because this is a CLI App, there will be no need to deploy it to Heroku. This time, though, you need to include screenshots, a gif, and/or a video showing us that you got the app working with no bugs. You can include these screenshots or a link to a video in a `README.md` file. * Include screenshots (or a video) of typical user flows through your application (for the customer and if relevant the manager/supervisor). This includes views of the prompts and the responses after their selection (for the different selection options). * Include any other screenshots you deem necessary to help someone who has never been introduced to your application understand the purpose and function of it. This is how you will communicate to potential employers/other developers in the future what you built and why, and to show how it works. * Because screenshots (and well-written READMEs) are extremely important in the context of GitHub, this will be part of the grading. If you haven't written a markdown file yet, [click here for a rundown](https://guides.github.com/features/mastering-markdown/), or just take a look at the raw file of these instructions. ### Commits Having an active and healthy commit history on GitHub is important for your future job search. It is also extremely important for making sure your work is saved in your repository. If something breaks, committing often ensures you are able to go back to a working version of your code. * Committing often is a signal to employers that you are actively working on your code and learning. * We use the mantra “commit early and often.” This means that when you write code that works, add it and commit it! * Numerous commits allow you to see how your app is progressing and give you a point to revert to if anything goes wrong. * Be clear and descriptive in your commit messaging. * When writing a commit message, avoid vague messages like "fixed." Be descriptive so that you and anyone else looking at your repository knows what happened with each commit. * We would like you to have well over 200 commits by graduation, so commit early and often! ### Submission on BCS * Please submit the link to the Github Repository! ## Instructions ### Challenge #1: Customer View (Minimum Requirement) 1. Create a MySQL Database called `bamazon`. 2. Then create a Table inside of that database called `products`. 3. The products table should have each of the following columns: * item_id (unique id for each product) * product_name (Name of product) * department_name * price (cost to customer) * stock_quantity (how much of the product is available in stores) 4. Populate this database with around 10 different products. (i.e. Insert "mock" data rows into this database and table). 5. Then create a Node application called `bamazonCustomer.js`. Running this application will first display all of the items available for sale. Include the ids, names, and prices of products for sale. 6. The app should then prompt users with two messages. * The first should ask them the ID of the product they would like to buy. * The second message should ask how many units of the product they would like to buy. 7. Once the customer has placed the order, your application should check if your store has enough of the product to meet the customer's request. * If not, the app should log a phrase like `Insufficient quantity!`, and then prevent the order from going through. 8. However, if your store _does_ have enough of the product, you should fulfill the customer's order. * This means updating the SQL database to reflect the remaining quantity. * Once the update goes through, show the customer the total cost of their purchase. - - - * If this activity took you between 8-10 hours, then you've put enough time into this assignment. Feel free to stop here -- unless you want to take on the next challenge. - - - ### Challenge #2: Manager View (Next Level) * Create a new Node application called `bamazonManager.js`. Running this application will: * List a set of menu options: * View Products for Sale * View Low Inventory * Add to Inventory * Add New Product * If a manager selects `View Products for Sale`, the app should list every available item: the item IDs, names, prices, and quantities. * If a manager selects `View Low Inventory`, then it should list all items with an inventory count lower than five. * If a manager selects `Add to Inventory`, your app should display a prompt that will let the manager "add more" of any item currently in the store. * If a manager selects `Add New Product`, it should allow the manager to add a completely new product to the store. - - - * If you finished Challenge #2 and put in all the hours you were willing to spend on this activity, then rest easy! Otherwise continue to the next and final challenge. - - - ### Challenge #3: Supervisor View (Final Level) 1. Create a new MySQL table called `departments`. Your table should include the following columns: * department_id * department_name * over_head_costs (A dummy number you set for each department) 2. Modify the products table so that there's a product_sales column, and modify your `bamazonCustomer.js` app so that when a customer purchases anything from the store, the price of the product multiplied by the quantity purchased is added to the product's product_sales column. * Make sure your app still updates the inventory listed in the `products` column. 3. Create another Node app called `bamazonSupervisor.js`. Running this application will list a set of menu options: * View Product Sales by Department * Create New Department 4. When a supervisor selects `View Product Sales by Department`, the app should display a summarized table in their terminal/bash window. Use the table below as a guide. | department_id | department_name | over_head_costs | product_sales | total_profit | | ------------- | --------------- | --------------- | ------------- | ------------ | | 01 | Electronics | 10000 | 20000 | 10000 | | 02 | Clothing | 60000 | 100000 | 40000 | 5. The `total_profit` column should be calculated on the fly using the difference between `over_head_costs` and `product_sales`. `total_profit` should not be stored in any database. You should use a custom alias. 6. If you can't get the table to display properly after a few hours, then feel free to go back and just add `total_profit` to the `departments` table. * Hint: You may need to look into aliases in MySQL. * Hint: You may need to look into GROUP BYs. * Hint: You may need to look into JOINS. * **HINT**: There may be an NPM package that can log the table to the console. What's is it? Good question :) ### Reminder: Submission on BCS * Please submit the link to the Github Repository! - - - ### Minimum Requirements Attempt to complete homework assignment as described in instructions. If unable to complete certain portions, please pseudocode these portions to describe what remains to be completed. Adding a README.md as well as adding this homework to your portfolio are required as well and more information can be found below. - - - ### Create a README.md Add a `README.md` to your repository describing the project. Here are some resources for creating your `README.md`. Here are some resources to help you along the way: * [About READMEs](https://help.github.com/articles/about-readmes/) * [Mastering Markdown](https://guides.github.com/features/mastering-markdown/) - - - ### Add To Your Portfolio After completing the homework please add the piece to your portfolio. Make sure to add a link to your updated portfolio in the comments section of your homework so the TAs can easily ensure you completed this step when they are grading the assignment. To receive an 'A' on any assignment, you must link to it from your portfolio. - - - ### One More Thing If you have any questions about this project or the material we have covered, please post them in the community channels in slack so that your fellow developers can help you! If you're still having trouble, you can come to office hours for assistance from your instructor and TAs. **Good Luck!**
All 8 repositories loaded