mirror of
https://github.com/Sosokker/HomieCare.git
synced 2025-12-19 02:04:03 +01:00
Add pydantics models and sqlAlchemy
This commit is contained in:
parent
82a0d0d405
commit
83ab4c56b0
@ -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')
|
||||
@ -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)
|
||||
27
StreamServer/src/scheme.py
Normal file
27
StreamServer/src/scheme.py
Normal file
@ -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
|
||||
@ -2,4 +2,7 @@ minio>=7.2.5
|
||||
fastapi[all]
|
||||
opencv-python
|
||||
sqlalchemy
|
||||
python-decouple
|
||||
python-decouple
|
||||
tqdm
|
||||
scipy
|
||||
matplotlib
|
||||
Loading…
Reference in New Issue
Block a user