https://github.com/sergeimakarovv/wine-recommendation-analytics
Wine recommendation system
https://github.com/sergeimakarovv/wine-recommendation-analytics
airflow bigquery pandas postgresql tableau
Last synced: about 1 month ago
JSON representation
Wine recommendation system
- Host: GitHub
- URL: https://github.com/sergeimakarovv/wine-recommendation-analytics
- Owner: sergeimakarovv
- Created: 2024-02-29T20:15:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-29T21:02:27.000Z (over 2 years ago)
- Last Synced: 2025-02-25T17:45:24.568Z (over 1 year ago)
- Topics: airflow, bigquery, pandas, postgresql, tableau
- Language: Python
- Homepage:
- Size: 294 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `Wein für Sie`: Wine-Recommendation

[](https://public.tableau.com/app/profile/sergei.makarov/viz/WineDashboard_17067371597200/Main_Menu)
**`Wein für Sie`** provides detailed information about wineries, wines, their ratings, and food pairings. It is designed for wine enthusiasts and professionals seeking extensive wine-related data.
Google Cloud BigQuery is utilized for data storage and manipulation, and Apache Airflow is implemented to create an end-to-end data pipeline.
## Why we made `Wein für Sie`?


## Getting started


You can also copy the sample code below and read API implementation below:
#### 1) Get Wineries
- Sample Request
```{=html}
```
GET https://apide.fly.dev/wineries
- Sample Response Body
``` ruby
[
{
'website': 'http://www.vinicolaperini.com.br',
'wineryid': 10001,
'wineryname': 'Casa Perini'
}
]
```
#### 2) Get Wine Information
- Sample Request
```{=html}
```
GET https://apide.fly.dev/wine
- Sample Response Body
``` ruby
[
{
'abv': 7.5,
'acidity': 'High',
'body': 'Medium-bodied',
'code': 'BR',
'country': 'Brazil',
'elaborate': 'Varietal/100%',
'grapes': "['Muscat/Moscato']",
'harmonize': "['Pork', 'Rich Fish','Shellfish']",
'regionid': 1001,
'regionname': 'Serra Gaúcha',
'type': 'Sparkling',
'url': 'https://i.imgur.com/ff9UaLf.jpg',
'vintages': "[2020, 2019, 2018, 2017]",
'wineid': 100001,
'winename': 'Espumante Moscatel',
'wineryid': 10001
}
]
```
#### 3) Get Wine Ratings
- Sample Request
```{=html}
```
GET https://apide.fly.dev/ratings
- Sample Response Body
``` ruby
[
{
'avg_rating': 4.5,
'vintage': '1994',
'wineid': 174184
}
]
```
#### 4) Get Harmonizer Suggestion
- Sample Request
```{=html}
```
GET https://apide.fly.dev/harmonizer
- Sample Response Body
``` ruby
[
{
'snack': 'Aperitif',
'url': 'https://i.imgur.com/wE2P1rn.jpg'
}
]
```
# **API Implementation Documentation**
## **Overview**
This document details a Flask-based API interfacing with a PostgreSQL database, designed for managing data about wines, wineries, ratings, and harmonizer pictures. The deployment of both the Flask API and the PostgreSQL database is facilitated through **`fly.io`**, which simplifies the deployment process.
## **Database Schema**

### **Database Setup**
### Create Database Tables
Tables are created using SQL **`CREATE TABLE`** statements stored in **`table_create_sql_dict`** and executed through the **`create_table`** function.
### Inserting Data
Individual data insertion functions (**`inser_winery_data`**, **`inser_wines_data`**, etc.) add data to each table, requiring tuples formatted according to the table schema.
### Bulk Data Insertion
**`bulk_inserting`** allows for inserting data in bulk from CSV files into the specified tables, matching the table's schema.
### Retrieving Data
**`get_data`** retrieves data from a table, returning it as a list of dictionaries where each dictionary represents a row.
### Listing All Tables
**`list_tables`** provides a list of all table names in the database.
## **API Endpoints**
### **`/wineries`, `/wine`, `/ratings`, `/harmonizer`**
Each endpoint corresponds to its respective table, offering GET methods to return JSON data about the entities in the database.
## **Running the Application**
Start the Docker container with **`docker-compose up`** to run the Flask application and Airflow scheduler. Access the API at **`localhost:8080`**.
## **Notes**
Ensure the correct setup of the PostgreSQL database, proper configuration of environment variables, and installation of dependencies as per **`requirements.txt`**. This API provides a structured and comprehensive approach to accessing and managing wine-related data.

pip install -r requirements.txt












