diff --git a/StreamServer/src/config.py b/StreamServer/src/config.py index 673351c..0703ab6 100644 --- a/StreamServer/src/config.py +++ b/StreamServer/src/config.py @@ -11,14 +11,14 @@ Attributes: MINIO_SECRET_KEY: The secret key of the MinIO storage """ -from decouple import Config, Csv +from decouple import Config config = Config('.env') -DB_HOST = config.get('DB_HOST') -DB_USER = config.get('DB_USER') -DB_PASSWD = config.get('DB_PASSWD') +DB_HOST = config.get('DB_HOST', default='localhost') +DB_USER = config.get('DB_USER', default='root') +DB_PASSWD = config.get('DB_PASSWD', default='root') DB_NAME = config.get('DB_NAME') -MINIO_ENDPOINT = config.get('MINIO_ENDPOINT') +MINIO_ENDPOINT = config.get('MINIO_ENDPOINT', default='localhost:9000') MINIO_ACCESS_KEY = config.get('MINIO_ACCESS_KEY') MINIO_SECRET_KEY = config.get('MINIO_SECRET_KEY') \ No newline at end of file diff --git a/AnalyticServer/src/main.py b/StreamServer/src/exceptions.py similarity index 100% rename from AnalyticServer/src/main.py rename to StreamServer/src/exceptions.py diff --git a/StreamServer/src/models.py b/StreamServer/src/models.py index e69de29..0a006c2 100644 --- a/StreamServer/src/models.py +++ b/StreamServer/src/models.py @@ -0,0 +1,24 @@ +""" +This file contains the SQLAlchemy model for the weather data. +""" + +from sqlalchemy import Column, Integer, Float, DateTime, Text +from sqlalchemy.orm import relationship + +from .database import Base + +class WeatherData(Base): + __tablename__ = "data" + + id = Column(Integer, primary_key=True) + timestamp = Column(DateTime) + outdoor_temp = Column(Float) + outdoor_feels_like = Column(Float) + outdoor_pressure = Column(Integer) + outdoor_humidity = Column(Integer) + outdoor_weather = Column(Text) + outdoor_description = Column(Text) + outdoor_pm25 = Column(Integer) + outdoor_pm10 = Column(Integer) + indoor_temp = Column(Float) + indoor_light = Column(Integer) \ No newline at end of file diff --git a/StreamServer/src/scheme.py b/StreamServer/src/scheme.py new file mode 100644 index 0000000..d312702 --- /dev/null +++ b/StreamServer/src/scheme.py @@ -0,0 +1,27 @@ +""" +This file contains the Pydantic model for the weather data. +""" + +from pydantic import BaseModel +from typing import Optional +from datetime import datetime + +class WeatherDataBase(BaseModel): + timestamp: Optional[datetime] + outdoor_temp: Optional[float] + outdoor_feels_like: Optional[float] + outdoor_pressure: Optional[int] + outdoor_humidity: Optional[int] + outdoor_weather: Optional[str] + outdoor_description: Optional[str] + outdoor_pm25: Optional[int] + outdoor_pm10: Optional[int] + indoor_temp: Optional[float] + indoor_light: Optional[int] + + class Config: + orm_mode = True + +class Camera(BaseModel): + rtsp_link: str + rtmp_link: str = None \ No newline at end of file diff --git a/requirements/base.txt b/requirements/base.txt index c9654ba..01a9eb4 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -2,4 +2,7 @@ minio>=7.2.5 fastapi[all] opencv-python sqlalchemy -python-decouple \ No newline at end of file +python-decouple +tqdm +scipy +matplotlib \ No newline at end of file