Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
GPS-Tracking-of-On-Campus-Walking-Project/API/DataObjects.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
40 lines (33 sloc)
1.55 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import create_engine | |
from sqlalchemy import Column, Integer, String, Binary, Float | |
from sqlalchemy.orm import relationship, sessionmaker, deferred | |
from sqlalchemy.orm.collections import attribute_mapped_collection | |
from sqlalchemy.ext.declarative import declarative_base | |
from datetime import datetime | |
Base = declarative_base() | |
class LocationData(Base): | |
""" | |
Location Data for HuskyTrack | |
Attributes: | |
uuid: The Location Data's universally unique identifier | |
uid: The user ID of the user this data belongs to | |
latitude: The latitude of the device when this measurement was taken | |
longitude: The longitude of the device when this measurement was taken | |
accuracy: The accuracy of the measurement as reported by the device | |
speed: The speed of the device when this measurement was taken | |
heading: The heading of the device when this measurement was taken | |
altitude: The altitude of the device when this measurement was taken | |
timestamp: The time at which this measurement was taken [ISO-8601 UTC] | |
""" | |
__tablename__ = 'location_data' | |
uuid = Column('uuid', String, primary_key=True) | |
uid = Column('uid', String, nullable=False) | |
latitude = Column('latitude', Float, nullable=False) | |
longitude = Column('longitude', Float, nullable=False) | |
accuracy = Column('accuracy', Float, nullable=False) | |
speed = Column('speed', Float, nullable=False) | |
heading = Column('heading', Float, nullable=False) | |
altitude = Column('altitude', Float, nullable=False) | |
timestamp = Column('timestamp', String, nullable=False) | |
def __repr__(self): | |
return self.uuid |