conrad-blucher-institute / semaphore

Creative Commons Zero v1.0 Universal
1 stars 0 forks source link

290 create semaphore ingestion class #308

Closed matdenkas closed 4 months ago

matdenkas commented 4 months ago
import sys
sys.path.append('/app/src')

import pytest

from datetime import datetime, timedelta, time, date
from src.DataClasses import TimeDescription, SeriesDescription
from src.DataIngestion.IDataIngestion import data_ingestion_factory
from src.DataIngestion.DI_Classes.LIGHTHOUSE import LIGHTHOUSE
from dotenv import load_dotenv

load_dotenv()

sd = SeriesDescription("SEMAPHORE", "test AI|1.0.0|testSeries", 'packChan', "test_datum") 
td = TimeDescription(datetime.combine(date(2024, 4, 28), time(0, 0)), datetime.combine(date(2024, 4, 30), time(12, 0)), timedelta(seconds=3600))

lighthouse = data_ingestion_factory(sd)
result = lighthouse.ingest_series(sd, td)

print(result)
print(result.data)

Code provided for testing. I didnt make this into a test as that would rely on DB data.

Note that the information about the model has to be packed together into the series name. This was the best way I could think to do it, lmk if you think of a better way