https://github.com/bayunova28/iowa_liquor_sales
This repository contains about final exam from Big Data Analytics I course at my college
https://github.com/bayunova28/iowa_liquor_sales
database mongodb
Last synced: 4 months ago
JSON representation
This repository contains about final exam from Big Data Analytics I course at my college
- Host: GitHub
- URL: https://github.com/bayunova28/iowa_liquor_sales
- Owner: Bayunova28
- Created: 2022-05-13T07:39:24.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-02-25T15:44:13.000Z (9 months ago)
- Last Synced: 2025-06-07T05:39:40.799Z (6 months ago)
- Topics: database, mongodb
- Language: SQL
- Homepage:
- Size: 601 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Iowa Liquor Sales
* Instructor : Iwan Prasetiawan S.KOM., M.M..
* Place : Multimedia Nusantara University
* Course : Big Data Analytics I
## Table of Contents
* [Background](#background)
* [Requirement](#requirement)
* [MapReduce](#mapreduce)
* [Schema](#schema)
## Background
Since the repeal of prohibition in 1933, Iowa is one of 18 states that directly controls the sale and distribution of alcoholic beverages.
The Alcoholic Beverages Division (ABD) governs state and federal laws and regulations related to the sale and use of alcohol and tobacco products. On March 8, 1934,
Iowa was established as a "control state," assuming direct control over the wholesaling of all alcoholic liquor and wine. Currently, ABD wholesales alcoholic liquor
only. ABD also regulates and licenses establishments that sell alcoholic beverages in Iowa. The Agency, in partnership with the Iowa Alcoholic Beverages Commission,
acts as a policy-making body. The Commission is comprised of members appointed to five-year terms by the Governor, subject to confirmation by the Iowa Senate. Besides
that, Iowa have a mission to serve Iowans through responsible and efficient licensing, regulation, and distribution of alcohol and provides clarity, consistency along
with equity to all stakeholders within the beverage industry.
## Requirement
### Google BigQuery Access
* Open chrome and login your google account for access [Google BigQuery](https://accounts.google.com/ServiceLogin/signinchooser?service=cloudconsole&passive=1209600&osid=1&continue=https%3A%2F%2Fconsole.cloud.google.com%2Fbigquery%3Fproject%3Dcharming-script-322807%26authuser%3D3&followup=https%3A%2F%2Fconsole.cloud.google.com%2Fbigquery%3Fproject%3Dcharming-script-322807%26authuser%3D3&flowName=GlifWebSignIn&flowEntry=ServiceLogin)
* Explore dataset and search `iowa liquor sales` and choose sales table
### Installation MongoDB Community Edition
* Download the binaries from [MongoDB Download Center](https://www.mongodb.com/try/download/community?tck=docs_server) and choose `.msi` package
* Run the MongoDB installer
* Follow the MongoDB Community Edition installation wizard
* Install MongoDB Compass
* When ready, click Install
### Start MongoDB Community Edition as a Windows Service
* Open command prompt
* Create database directory `cd C:\md "\data\db"`
* Install package your MongoDB database `"C:\Program Files\MongoDB\Server\5.0\bin\mongod.exe" --dbpath="c:\data\db"`
* Open directory of MongoDB service `cd C:\Program Files\MongoDB\Server\5.0\bin`
* Start MongoDB service `C:\Program Files\MongoDB\Server\5.0\bin>mongo`
* Show your database `> show dbs`
* Create your database `> use iowa_liquor_sales`
* Open MongoDB Compass and connect your localhost
* Finally, import `.csv` file from your local computer
## MapReduce
```js
/* create map function */
var mapFunction = function() {
emit(this.attribute1, this.attribute2);
};
/* create reduce function */
var reduceFunction = function(keyAttribute1, valuesAttribute2) {
return Array.sum(valuesAttribute2);
};
/* apply MapReduce function */
db.collection.mapReduce (
mapFunction,
reduceFunction,
{ out: "map_reduce_example" }
)
/* check MapReduce result */
db.map_reduce_example.find().pretty()
```
## Features
* Date : date of order
* Store name : name of store who ordered the liquor
* City : city where the store who ordered the liquor is located
* County : county where the store who ordered the liquor is located
* Category name : category of the liquor ordered
* Pack : the number of bottles in a case for the liquor ordered
* Bottle Volume (ml) : volume of each liquor bottle ordered in milliliters
* State bottle cost : the amount that Alcoholic Beverages Division paid for each bottle of liquor ordered
* State bottle retail : the amount the store paid for each bottle of liquor ordered
* Bottles sold : the number of bottles of liquor ordered by the store
* Sale dollars : total cost of liquor order (number of bottles multiplied by the state bottle retail)
* Volume sold liters : total volume of liquor ordered in liters. (i.e. (Bottle Volume (ml) x Bottles Sold)/1,000)
* Volume sold gallons : total volume of liquor ordered in gallons. (i.e. (Bottle Volume (ml) x Bottles Sold)/3785.411784)