separation of areas
This commit is contained in:
@@ -6,7 +6,6 @@ from dash import Dash, html, dcc
|
|||||||
import dash_bootstrap_components as dbc
|
import dash_bootstrap_components as dbc
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
# Load data
|
|
||||||
accounts = pl.read_parquet('data/warehouse/accounts.parquet')
|
accounts = pl.read_parquet('data/warehouse/accounts.parquet')
|
||||||
categories = pl.read_parquet('data/warehouse/categories.parquet')
|
categories = pl.read_parquet('data/warehouse/categories.parquet')
|
||||||
dates = pl.read_parquet('data/warehouse/dates.parquet')
|
dates = pl.read_parquet('data/warehouse/dates.parquet')
|
||||||
@@ -149,7 +148,3 @@ app.layout = dbc.Container(
|
|||||||
],
|
],
|
||||||
fluid=True
|
fluid=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# Run the app
|
|
||||||
if __name__ == '__main__':
|
|
||||||
app.run(debug=True)
|
|
||||||
|
|||||||
@@ -8,10 +8,8 @@ import logging.config
|
|||||||
import logging.handlers
|
import logging.handlers
|
||||||
|
|
||||||
import config.exit_codes as ec
|
import config.exit_codes as ec
|
||||||
from pipeline.ingest import Ingest
|
from dash_app import app
|
||||||
from pipeline.raw_to_base import RawToBase
|
from pipeline.pipeline_main import pipeline_main
|
||||||
from pipeline.dimensions import DimAccounts, DimCategories, DimPayees, DimDate
|
|
||||||
from pipeline.facts import FactTransactions, FactScheduledTransactions
|
|
||||||
|
|
||||||
def set_up_logging():
|
def set_up_logging():
|
||||||
try:
|
try:
|
||||||
@@ -37,7 +35,7 @@ dotenv.load_dotenv()
|
|||||||
API_TOKEN = os.getenv('API_TOKEN')
|
API_TOKEN = os.getenv('API_TOKEN')
|
||||||
BUDGET_ID = os.getenv('BUDGET_ID')
|
BUDGET_ID = os.getenv('BUDGET_ID')
|
||||||
|
|
||||||
def main():
|
|
||||||
if not API_TOKEN or not BUDGET_ID:
|
if not API_TOKEN or not BUDGET_ID:
|
||||||
logging.error('API_TOKEN or BUDGET_ID is not set in .env file')
|
logging.error('API_TOKEN or BUDGET_ID is not set in .env file')
|
||||||
sys.exit(ec.MISSING_ENV_VARS)
|
sys.exit(ec.MISSING_ENV_VARS)
|
||||||
@@ -55,23 +53,12 @@ def main():
|
|||||||
config['API_TOKEN'] = API_TOKEN
|
config['API_TOKEN'] = API_TOKEN
|
||||||
config['BUDGET_ID'] = BUDGET_ID
|
config['BUDGET_ID'] = BUDGET_ID
|
||||||
|
|
||||||
logging.info('Starting data pipeline')
|
#sys.exit(ec.SUCCESS)
|
||||||
|
|
||||||
Ingest(config)
|
|
||||||
RawToBase(config)
|
|
||||||
DimAccounts(config)
|
|
||||||
DimCategories(config)
|
|
||||||
DimPayees(config)
|
|
||||||
DimDate(config)
|
|
||||||
FactTransactions(config)
|
|
||||||
FactScheduledTransactions(config)
|
|
||||||
|
|
||||||
logging.info('Data pipeline completed successfully')
|
|
||||||
sys.exit(ec.SUCCESS)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
main()
|
pipeline_main(config)
|
||||||
|
app.run() #debug=True)
|
||||||
except SystemExit as e:
|
except SystemExit as e:
|
||||||
exit_code = e.code
|
exit_code = e.code
|
||||||
if exit_code == ec.SUCCESS:
|
if exit_code == ec.SUCCESS:
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
'''Module to run the data pipeline'''
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from pipeline.ingest import Ingest
|
||||||
|
from pipeline.raw_to_base import RawToBase
|
||||||
|
from pipeline.dimensions import DimAccounts, DimCategories, DimPayees, DimDate
|
||||||
|
from pipeline.facts import FactTransactions, FactScheduledTransactions
|
||||||
|
|
||||||
|
|
||||||
|
def pipeline_main(config):
|
||||||
|
'''Run the data pipeline'''
|
||||||
|
logging.info('Starting data pipeline')
|
||||||
|
|
||||||
|
Ingest(config)
|
||||||
|
RawToBase(config)
|
||||||
|
DimAccounts(config)
|
||||||
|
DimCategories(config)
|
||||||
|
DimPayees(config)
|
||||||
|
DimDate(config)
|
||||||
|
FactTransactions(config)
|
||||||
|
FactScheduledTransactions(config)
|
||||||
|
|
||||||
|
logging.info('Data pipeline completed successfully')
|
||||||
Reference in New Issue
Block a user