Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Remove deprecated features #189

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 19 additions & 52 deletions README.md

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions api/models/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ class AppDTO(SnakeModel):
maxProcesses: int = Field(1)
dashboardURL: str = Field("http://0.0.0.0:8000")
dashboardAuthorizationToken: str = Field("", example="token")
slackChannel: Optional[str] = Field("", example="lanthorn-notifications")
occupancyAlertsMinInterval: int = Field(0, example=180)
maxThreadRestarts: int = Field(5)
globalReportingEmails: Optional[str] = Field("", example="email@email,email2@email")
globalReportTime: str = Field("06:00")
dailyGlobalReport: bool = Field(False)
weeklyGlobalReport: bool = Field(False)
heatmapResolution = Field("150,150")
logPerformanceMetrics: bool = Field(False)
logPerformanceMetricsDirectory: str = Field("", example="/repo/data/processor/static/data/performace-metrics")
Expand Down
18 changes: 0 additions & 18 deletions api/models/area.py

This file was deleted.

31 changes: 0 additions & 31 deletions api/models/area_logger.py

This file was deleted.

9 changes: 0 additions & 9 deletions api/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ class EntityConfigDTO(SnakeModel):
name: str = Field(example='Kitchen')


class NotificationConfig(SnakeModel):
violationThreshold: Optional[int] = Field(0, example=100)
notifyEveryMinutes: Optional[int] = Field(0, example=15)
emails: Optional[str] = Field("", example='[email protected],[email protected]')
enableSlackNotifications: Optional[bool] = Field(False, example=False)
dailyReport: Optional[bool] = Field(False, example=True)
dailyReportTime: Optional[str] = Field('06:00', example='06:00')


class OptionalSectionConfig(SnakeModel):
name: str = Field(example="objects_filtering")
enabled: bool
44 changes: 3 additions & 41 deletions api/models/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
import cv2 as cv

from pydantic import BaseModel, Field, validator
from typing import List, Optional, Tuple
from typing import List, Optional

from .base import EntityConfigDTO, NotificationConfig, SnakeModel
from .base import EntityConfigDTO, SnakeModel


class CameraDTO(EntityConfigDTO, NotificationConfig):
class CameraDTO(EntityConfigDTO):
videoPath: str = Field(example='/repo/data/softbio_vid.mp4')
tags: Optional[str] = Field("", example='kitchen,living_room')
image: Optional[str] = Field("", example='Base64 image')
distMethod: Optional[str] = Field("", example='CenterPointsDistance')
liveFeedEnabled: bool = Field(True, example=True)
hasBeenCalibrated: bool = Field(False, example=False)
hasDefinedRoi: bool = Field(False, example=False)
hasInOutBorder: bool = Field(False, example=False)


class CreateCameraDTO(CameraDTO):
Expand Down Expand Up @@ -56,39 +54,3 @@ class Config:

class VideoLiveFeedModel(BaseModel):
enabled: bool


class ContourRoI(BaseModel):
contour_roi: List[Tuple[int, int]]

class Config:
schema_extra = {
'example': {
'contour_roi': [[88, 58], [90, 284], [279, 284], [281, 58]]
}
}


class InOutBoundary(BaseModel):
name: Optional[str] = Field("", example="Left Door")
in_out_boundary: Tuple[Tuple[int, int], Tuple[int, int]]


class InOutBoundaries(BaseModel):
in_out_boundaries: List[InOutBoundary]

class Config:
schema_extra = {
"example": {
"in_out_boundaries": [
{
"name": "Left Door",
"in_out_boundary": [[5, 5], [5, 240]]
},
{
"name": "Right Door",
"in_out_boundary": [[280, 5], [280, 240]]
},
]
}
}
21 changes: 0 additions & 21 deletions api/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

from .app import AppDTO
from .api import ApiDTO
from .area import AreaConfigDTO
from .area_logger import AreaLoggerDTO
from .base import SnakeModel
from .camera import CameraDTO
from .classifier import ClassifierDTO
Expand All @@ -23,33 +21,14 @@ class ConfigDTO(SnakeModel):
api: ApiDTO
core: CoreDTO
cameras: List[CameraDTO]
areas: Optional[List[AreaConfigDTO]] = []
detector: DetectorDTO
classifier: Optional[ClassifierDTO]
tracker: TrackerDTO
sourcePostProcessors: List[SourcePostProcessorDTO]
sourceLoggers: List[SourceLoggerDTO]
areaLoggers: Optional[List[AreaLoggerDTO]] = []
periodicTasks: Optional[List[PeriodicTaskDTO]] = []


class GlobalReportingEmailsInfo(BaseModel):
emails: Optional[str] = Field("", example='[email protected],[email protected]')
time: Optional[str] = Field("06:00")
daily: Optional[bool] = Field(False, example=True)
weekly: Optional[bool] = Field(False, example=True)

class Config:
schema_extra = {
"example": {
"emails": "[email protected],[email protected]",
"time": "06:00",
"daily": True,
"weekly": True
}
}


class ConfigMetrics(BaseModel):
social_distancing: bool
facemask: bool
Expand Down
16 changes: 4 additions & 12 deletions api/models/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,10 @@

class ExportDataType(str, Enum):
raw_data = "raw_data"
occupancy = "occupancy"
social_distancing = "social-distancing"
facemask_usage = "facemask-usage"
in_out = "in-out"
dwell_time = "dwell-time"
all_data = "all_data"


class ExportDTO(SnakeModel):
areas: Optional[List[str]] = Field([], example=["area1", "area2", "area3"])
all_areas: Optional[bool] = Field(False, example=True)
cameras: Optional[List[str]] = Field([], example=["camera1", "camera2"])
all_cameras: Optional[bool] = Field(False, example=True)
from_date: Optional[date] = Field(None, example="2020-12-01")
Expand All @@ -44,9 +37,8 @@ def validate_dates(cls, values):

@root_validator
def validate_entities(cls, values):
if not any([values.get("areas"), values.get("all_areas"), values.get("cameras"),
values.get("all_cameras")]):
logger.info("No cameras or areas were provided.")
raise ValueError("No cameras or areas were provided. You need to provide unless one camera or "
"area to call the export endpoint.")
if not any([values.get("cameras"), values.get("all_cameras")]):
logger.info("No cameras were provided.")
raise ValueError("No cameras were provided. You need to provide unless one camera "
"to call the export endpoint.")
return values
Loading