Demo file - conrad-blucher-institute/semaphore GitHub Wiki

from src.SeriesStorage.SeriesStorage.SQLAlchemyORM import SQLAlchemyORM
from src.ModelExecution.modelWrapper import ModelWrapper
from datetime import datetime, date, time
from dotenv import load_dotenv
from sqlalchemy import select

load_dotenv()


def run_test(dbIsPersistent: bool = True):
    DBM = SQLAlchemyORM()

    if(not dbIsPersistent):
        DBM.drop_DB()
        DBM.create_DB()
        DBM.insert_external_location_code('BHP', 'NOAATANDC', '8775870', 0)
        DBM.insert_external_location_code('packChan', 'NOAATANDC', '8775792', 0)
        DBM.insert_external_location_code('Aransas', 'NOAATANDC', '8775241', 0)
        DBM.insert_external_location_code('lagunamadre', 'tcoon', '48646513645', 0)

    tim = datetime.combine(date(2023, 9, 5), time(11, 0))
    MW = ModelWrapper('test_dspec.json')
    result = MW.make_and_save_prediction(tim)
    print(result)
    print(result.data)


run_test(False)