Category Archives: Uncategorized

Week 12

This week is the last forum-based learning week. In this week, we were assigned an assignment regarding malwares. Malware, or Malicious Software refers to any software that is designed to be used to gain access to unauthorized sensitive information or cause disruptions in the system.

Week 4 – Intelligent Systems

This week we learned about Adversarial Search that is used in games to considers the opponent’s move when deciding the best possible move. We studied about the minimax algorithm which maximizes our chances of winning by taking account enemy’s best move. The algorithm works on deterministic and non-deterministic games.

On top of that, we also discussed about alpha and beta pruning which eliminates the branches based on the information we have on the other branch. The pruning is centered around the idea that the enemy could cut unnecessary steps that the player wouldn’t take. This is implemented using DFS to try the finding the best path towards the solution.

Week 3 – Intelligent Systems

This week we studied the informed searches. In the informed searches, the functions possesses heuristic value alongside its path cost. In this session we learned and practiced on multiple algorithms such as A*, greedy, and genetic, which means that we continued learning into further detail of the A* algorithm after we have implemented the coding aspect of it in the second week during the lab class session.

The A* algorithm takes into consideration not only the heuristic value, but also its path cost unlike the greedy algorithm, which only considers the heuristic value. We also studied local search that includes hill climbing, which searches neighbors and check the most optimal value from the results. The genetic algorithm that we also practiced during this session is a trial and error method that occurs until the best solution is found.

Week 2 – Intelligent Systems

In this week’s session we studied about uninformed search. Some aspect of the uninformed search strategy is familiar to us as the uninformed search consists of Breadth First Search and Depth First Search. However we didn’t only recall on BFS and DFS in this session as we also learned more on the uninformed search strategies which are (BFS and DFS) FLS, UCS, and IDS.

These uninformed search strategies are used in order to search for results. A state graph has vertices and edges, as each state has its own path cost where these uninformed search strategies try to come up with an optimal result to reach its goal. And in order to practice and test our understandings, we were given an exercise to implement the uninformed search strategies that we learned in class.

Week 1 – Intelligent Systems

During this first week of the Intelligent Systems, we were introduced to what an AI and Machine Learning really is. The video that was presented in class helped me further understand what AI and Machine Learning really is and on what they actually do. The video explained that Machine Learning is a part of AI and that it is, like what the name itself implied, to make machine learn just like a human brain does.

The way Machine Learning is approached is that it is similar to the way how kids learn things, and also how humans learn which is by experience or a trial and error. The goal for Machine Learning is that so a machine can think rationally and make decisions by itself just like what a human does, which then results in an Artificial Intelligence (AI). The video also mentioned that if Machine Learning and AI is to advance to another level it could very well not be “Artificial” anymore rather, it is now “Intelligence” itself.

After the video, we learned more about AI and also its Intelligent Agent Design through the presentation presented during class by Ms. Nurul. It was mentioned that AI has many definitions and that it has 4 components which includes thinking like humans, thinking rationally, acting like humans, and acting rationally. The nature of AI isn’t only made through Computer Science, but there are also other aspects needed in order for them to fulfill the components of AI such as philosophy, psychology, etc.

Intelligent Agent consist of a sensor to help the AI to perceive the environment, which then allows them to take a certain action. There are plenty of Environmental Factors for the agent design, and also various Agent Types such as goal-based agent, utility-based agent, etc.

Database Project Contribution

Group Members:

  1. Adriel Soengadi (2201807980)
  2. Robert Reden (2201816612)
  3. Imanuel Febie (2201835800)
  4. Ikhsan Maulana (2201807993)

Throughout this group project, I have tried my best to help and has participated in things from the creation of the ERD, normalization of the tables and relations, web interface, and queries to access and update the database from the web. I have also helped in creating and resolving issues regarding both the database and web interface (pages in the web interface such as add category, address update, add product, and the cart page).

Database Final Project Report

E-Commerce Solution with Flask & MySQL

Introduction

Group Members:

  1. Adriel Soengadi (2201807980)
  2. Robert Reden (2201816612)
  3. Imanuel Febie (2201835800)
  4. Ikhsan Maulana (2201807993)

From startups to small business all the way to huge brands, businesses are benefiting from e-commerce. Businesses are able to allow easy access to their product or service thanks. Even individuals are able to start their own e-commerce business what little efforts these days. So it’s no surprise that we see it everywhere around us. We can see on how nowadays unicorn companies that derived its identity for being E-commerce such as Tokopedia, Bukalapak, Shopee,etc. have boosted in popularity recently. It is no wonder how SMEs wanted to start jumping towards “E-commerce” type of business, that is where our project comes in. 

We have interviewed a company namely PT. Lintas Data Indonesia, which is a SME,  in which they play not only in audio visual but also Video Conferencing devices and services. Now, they are still doing business using traditional way. They have a website whereby products are only displayed yet the rest of the transactions need to be dealt with face-to-face meeting even if the supposed sold products are service type of products. We believe that it is rather insufficient considering the trend of E-commerce and of course the existence of database to manage and simplify not only transactions online but also better manage their present stocks and possible ROI considering the efficiency of the steps taken compared to the traditional way. Furthermore, in the status quo they are still using traditional way of enlisting products that is manually. This way resulted in miscommunication due to how traditional way is more prone to errors. Considering on how they work as not only a primary distributor, this means they are also responsible for products that are not theirs.

So, based on the aforementioned story our project will address several problems:

  1. Efficiency of transactions of products
  2. Better management of stocks of products using database 
  3. Better management of different stores and their products

After further discussions of the problems, we have concluded that we will create an E-commerce website. We believe this is the best possible solution as the E-commerce website will:

  1. Be able to track all kinds of transactions, its users and payment methods in which it will be directly stored inside the database. This will also eliminate the long, arduous process of meeting up with people to confirm payments.
  2. Be able to better manage and supervise the availability of products that is existing.
  3. Be able to better manage different stores and their respective products.

For all those reasons we created an e-commerce in the form of a web application.

Roles

Considering on how this is a group project, we each have done our part in finishing this project

Imanuel Febie: Layed out the project structure in logical modules making it easier for each team member working on their own part. Besides that also responsible for creating authentication and authorization for the web app.

Ikhsan Maulana: Throughout this group project, I have tried my best to help and has participated in things from the creation of the ERD, normalization of the tables and relations, web interface, and queries to access and update the database from the web. I have also helped in creating and resolving issues regarding both the database and web interface (pages in the web interface such as add category, address update, add product, and the cart page).


Database Design

Entity-Relationship

Relations

This is our entire database. It consists of 12 tables in which all are inter-connected to each other.

The first table is to store address of users that are signed in to our website. There are 1 Foreign key inside this table, and there is one Primary key which is the address_id. All the columns are NOT NULL except city_id, line2 and line3 in which it is optional depending on how long the address would be. The primary key is auto-incremented to makes things easier to be sorted out. The foreign key city_id is to access the data regarding the country and city of the user.

address (address_id, line1, line2, line3, city_id, postal_code) 

foreign key city_id references city(city_id)

This table to store the methods of payment for the users. There is only 1 Primary key that is payment_method_id. By default we already put 3 values which is visa, mastercard and transfer. 

payment_method (payment_method_id, name, description)

This table stores the admin data. There is only 1 primary key that is admin_id.

admin (admin_id, username, email, password)

This table stores the user data. There is 1 primary key that is user_id and 1 Foreign key that is the address_id. Other than the Primary and Foreign Keys, we also used Unique Keys for email and store_id of the users as every user should have a different email and own different stores. We consider on how there is a possibility of a user having multiple addresses. Most of the columns except ‘lastname’, address_id, is_active and store_id is set to NOT NULL because there are some circumstances where a person only have a first name not everyone has a store, not all is always online and have home address.  

user (user_id, email, firstname, lastname, password, joined_on, address_id, is_active, store_id)

foreign key (address_id) references address (address_id)

unique (email) 

unique (store_id)

This table is to store data for each store registered in our database. There is 1 primary key that is the store_id and 1 foreign key that is the catalog_id. We associate the catalog_id as the store table’s foreign key because as mentioned before, each store have their own catalog(s). Most columns are set to NOT NULL except catalog_id because there could be a new store registered that has not created its own catalog yet. 

store (store_id, store_name, about, joined_on) 

unique (store_name)

This table is the category table that stores a variety of categories that our web offers. This table consist of 1 primary key that is the category_id and no foreign key. This table is simple because we think that the sufficient amount of data required for a category is only its id and name. As there are only little data stored in this table, all the columns are set to NOT NULL because a category can’t have any of these data (id & name) empty. 

category (category_id, category_name) 

This table is the order_item table stores each item that the user has added to their shopping basket/shopping cart to purchase. There is 1 primary key that is the order_item_id and 1 foreign key that is the product_id. The product_id foreign key is for the order_item table to access the data of the product that the user has added to their shopping cart. This order_item table is to record the data and total price of each item in the user’s shopping cart/basket. 

order_item (order_item_id, product_id, quantity, total_price) 

foreign key (product_id) references product (product_id)

This table stores the product data. This table has 1 primary key which is product_id and 2 foreign keys which are category_id from Category table and store_id from Store table. Each product is separated into a category of their own and since a certain type of product can be sold in numerous different stores, the product references its store.

product(product_id, name, brand_id, description, stock, price, available)

foreign key (category_id) references category (category_id)

foreign key (store_id) references store (store_id)

This table is to store country data which will be referenced in address table. This table has 1 primary key which is country_id and no foreign keys. 

country(country_id, name)

This table is the transaction table to store the transactions that users has made. There are 1 primary key. There are two foreign keys that are the payment_method_id and the user_id. The payment_method_id is to access the payment method that the user has chosen to fulfill the payment, while the user_id is to know who did the transaction. The ordered_on is a timestamp to show when the transaction occurs.

transaction (transactions_id, payment_method_id, user_id, order_item_id, ordered_on) 

foreign key (payment_method_id) references payment_method 

(payment_method_id) 

foreign key (user_id) references user (user_id)

This table is the city table in which it has one primary key being city_id and one foreign key being country_id. As multiple cities can exist in one country hence country_id is needed to link this table with the country table.

city(city_id, name, country_id)

foreign key(country_id) references country(country_id)

unique (name)

This table consists of one primary key which is the id and 2 foreign keys which are the transaction_id and the order_item_id. This table is created so that a transaction can be done and consists of multiple orders of items.

transaction_order_items(id, transaction_id, order_item_id)

foreign key(transaction_id) references transaction(transaction_id)

foreign key(order_item_id) references order_item(order_item_id)

Normalizations

AttributeDetermines
transaction_id ->
user_id, order_id and payment_method_id depends on the transaction_id in order to identify which user made the purchase and the payment method used. The order_id helps to identify which cart is the transaction referring to in order to access the data
user_id, payment_method_id, order_id
address_id ->
city_id and country_id both depends on the address_id as the address in each country differs, and with address_id we can identify from which city and country it is from
city_id, country_id
user_id -> 
address_id depends on user_id as each user is associated with an address
address_id
order_item_id ->
order_id and product_id depends on order_item_id as the items that each user ordered are different. The order_item_id will tell us which product the user has put in their cart alongside its quantity and price. The order_id will tell us which cart does this ordered item goes to as each cart can consists of 1 or more items. 
product_id, order_id
product_id ->
store_id and category_id depends on product_id as each product belongs to a specific store alongside the category of the product (e.g. Gadget)
store_id, category_id
city_id ->
country_id depends on city_id as the country depends on the city data
country_id
order_id ->
user_id depends on order_id as the orders table works as a cart and we need to identify which cart (order) belongs to which user. 
user_id

Sample Queries


1. Query to get total price of all items

SELECT sum(total_price) as total 

from transaction 

JOIN order_item 

ON transaction.order_item_id=order_item.order_item_id


2. Query to update the total price of an item depending on the quantity

UPDATE order_item as o 

INNER JOIN product as p

ON o.product_id=p.product_id

SET o.total_price=p.price * o.quantity

 
3. Query to combine transaction, order_item and product to access all necessary product data

SELECT * 

FROM transaction

JOIN order_item as o

JOIN product as p

WHERE transaction.order_item_id=o.order_item_id

AND order_item.product_id=product.product_id


4. Query to get all users that have an address in Indonesia

SELECT firstname, lastname

FROM user

JOIN address

JOIN country

WHERE country.name=’Indonesia’;


5. Query to know the total number of products that are in each category

SELECT category_id, count(*) ‘total’ 

FROM product

GROUP BY category_id;

User Interfaces

We didn’t write our own CSS for this project, rather we relied on a popular CSS framework developed by Google, called materialize css. We won’t go to every page, but we will display the important ones here

Customer authenication
Customer registration
Customer update form
Overview of the admin page
Customer overview. From here you can also delete or update a selected customer.
Overview of products. Products can be filtered by selecting a category
User shopping cart

Database Security

Our project relies on a 3rd party presence which is heroku. Heroku acted as the server in which we connect our database to. Hence, despite only having one account to access the database in which the account attain almost most roles, yet the account does not have root permission so they will not be able to wreck the server even if there is a breach. Of course, in addition Heroku in itself already has a lot of security certificates that comes along in us using them. Furthermore, we encrypted the passwords of all the users with sha256 in consideration of our users privacy if breach were to happen. To increase the security and the secrecy of the real data of the database we create a view for transactional history of users and/or stores. This means that they will receive any update of transactions from database, yet they will not be able to directly view how the database looks like and how the relations might be intertwined.

Project GitHub Link: https://github.com/imanuelfebie/flask-mysql-e-commerce

Project Report File: https://docs.google.com/document/d/1yRI19WMMutNJCB8B_EdW_QyIgn-BJHcCRzHUVq6_knI/edit#

Video Link:



Database Systems Project Proposal

Project Name: Database for Online Shopping System

Team Members:

  1. Adriel Soengadi (2201807980)
  2. Robert Reden (2201816612)
  3. Imanuel Febie (2201835800)
  4. Ikhsan Maulana (2201807993)

Problem Statement:

In consideration that the topic we picked is Online shopping system, we believe that companies that did not use database will find it a hard time to interact with the data. The data here we are referring to not only product data, but also the customer’s data and the transactions that has been made by them. This is crucial and time-sensitive considering how decision making of strategies might benefit companies more or create a massive loss when not spotted or dealt properly.

For instance, to be able to see which pricing strategy fits a certain pool of customers or to learn and compare KPI (Key Performance Indicator) between quarters and also to make performance progress chart by searching through transaction information. It is also pinnacle to be very systematic and structured in structuring the product data as online shopping store always have a huge amount of product data that when not taken care properly will result in miscommunication/misjudgment. For example, through the use of Traditional File System there is high possibility of lost in physical files and or application files; also checking stocks and/or possible alternative of items would be harder and take a longer time. In addition, Database offers more security than Traditional File System considering that it uses authorization process, password protection and also encryption and decryption.

Our database would be applicable to anyone in the online shopping store considering that they would have a lot of product, customer and transaction data. The user will directly interact with the database through a web application.

Target User:

Online Shopping Stores

List of Relations