This example project gets a dataset from a aws lambda method, analizes the data and stores the results in DB
- Python 3
- Python Virtual Environments
- SQL Server Database
- Flask
- Pandas
- SQL Alchemy
- Pyodbc
- Requests
- Create a .env file (In the project is a .env.backup that can be used as an example) adding the database username and password.
- Create a new virtualenv
- Activate the virtualenv
- Run
pip install -r requirements.txt
- To create the models in DB run
flask shell
and after inside the flask shell run the following commands:
from dal.db import db
from dal.models.elementType import ElementType
from dal.models.purchaseAnalitics import PurchaseAnalitics
db.create_all()
- Finally run
flask run
to run the debug server, in the terminal you will find the endpoint to test the project
This project is built for scalability, creating strong limits that make it easy to modify and use, the only way to communicate with the database is using the DAL interface, this should connect only with the controller, and the controller returns the processed data to the Endpoint returning the data to the user.
classDiagram
PurchaseAnalitics <|-- ElementType
PurchaseAnalitics : +pk id
PurchaseAnalitics : +fk element_type_id
PurchaseAnalitics : +int purchase_amount
PurchaseAnalitics : +datetime timestamp
PurchaseAnalitics : insert_new_analitics_entry()
class ElementType{
+pk id
+String element_name
+find_or_create_element_type_by_name()
}