Source code for sonicdb.database.sensor

from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy.orm import relationship

from .base import Base


[docs] class Sensor(Base): # type: ignore """ Represents a sensor in the database. Attributes: id (int): Unique identifier for the sensor. name (str): Name of the sensor. subname (str): Subname of the sensor. manufacturer (str): Manufacturer of the sensor. type_class (str): Type class of the sensor. number_of_channels (int): Number of channels the sensor supports. channels (list): List of channels associated with the sensor. samples (list): List of samples generated by the sensor audio files. files (list): List of files recorded by the sensor. """ __tablename__ = "sensor" id = Column(Integer, primary_key=True) """int: Unique identifier for the sensor.""" name = Column(String) """str: Name of the sensor.""" subname = Column(String) """str: Subname of the sensor.""" manufacturer = Column(String) """str: Manufacturer of the sensor.""" type_class = Column(String) """str: Type class of the sensor.""" number_of_channels = Column(Integer) """int: Number of channels the sensor supports.""" channels = relationship( "sonicdb.database.channel.Channel", back_populates="sensor", enable_typechecks=False, ) """list: List of channels associated with the sensor.""" samples = relationship( "sonicdb.database.sample.Sample", back_populates="sensor", enable_typechecks=False ) """list: List of samples generated by the sensor audio files.""" files = relationship( "sonicdb.database.file.File", back_populates="sensor", enable_typechecks=False ) """list: List of files recorded by the sensor.""" __mapper_args__ = {"polymorphic_identity": "sensor"} def __repr__(self) -> str: # pragma: no cover return f"Sensor: {self.name} - {self.subname}"