From d22d9209ac060c1f1d1ada8fe03f154e4d97c27f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Gru=CC=88ndger?= Date: Tue, 1 Jan 2019 20:12:25 +0100 Subject: [PATCH] Update model --- ogn/model/airport.py | 2 ++ ogn/model/device_stats.py | 9 +++++---- ogn/model/flights2d.py | 1 + ogn/model/receiver_stats.py | 19 ++++++++----------- ogn/model/takeoff_landing.py | 3 --- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/ogn/model/airport.py b/ogn/model/airport.py index 85b1b79..b69d265 100644 --- a/ogn/model/airport.py +++ b/ogn/model/airport.py @@ -22,6 +22,8 @@ class Airport(Base): runway_length = Column(SmallInteger) frequency = Column(Float(precision=2)) + border = Column('border', Geometry('POLYGON', srid=4326)) + def __repr__(self): return "" % ( self.name, diff --git a/ogn/model/device_stats.py b/ogn/model/device_stats.py index 4d0d2dd..be56e7f 100644 --- a/ogn/model/device_stats.py +++ b/ogn/model/device_stats.py @@ -27,10 +27,10 @@ class DeviceStats(Base): jumps = Column(SmallInteger) ambiguous = Column(Boolean) quality = Column(Float(precision=2)) - + # Relation statistic data quality_offset = Column(Float(precision=2)) - + # Ranking data max_altitude_ranking_worldwide = Column(Integer) max_altitude_ranking_country = Column(Integer) @@ -44,7 +44,7 @@ class DeviceStats(Base): # Relations device_id = Column(Integer, ForeignKey('devices.id', ondelete='SET NULL'), index=True) device = relationship('Device', foreign_keys=[device_id], backref=backref('stats', order_by='DeviceStats.date.asc()')) - + def __repr__(self): return "" % ( self.date, @@ -52,4 +52,5 @@ class DeviceStats(Base): self.aircraft_beacon_count, self.max_altitude) -Index('ix_device_stats_date_device_id', DeviceStats.date, DeviceStats.device_id) \ No newline at end of file + +Index('ix_device_stats_date_device_id', DeviceStats.date, DeviceStats.device_id) diff --git a/ogn/model/flights2d.py b/ogn/model/flights2d.py index 1e6fde2..fd595e1 100644 --- a/ogn/model/flights2d.py +++ b/ogn/model/flights2d.py @@ -11,6 +11,7 @@ class Flight2D(Base): date = Column(Date, primary_key=True) path_wkt = Column('path', Geometry('MULTILINESTRING', srid=4326)) + path_simple_wkt = Column('path_simple', Geometry('MULTILINESTRING', srid=4326)) # this is the path simplified with ST_Simplify(path, 0.0001) # Relations device_id = Column(Integer, ForeignKey('devices.id', ondelete='SET NULL'), primary_key=True) diff --git a/ogn/model/receiver_stats.py b/ogn/model/receiver_stats.py index 1253033..2dcedae 100644 --- a/ogn/model/receiver_stats.py +++ b/ogn/model/receiver_stats.py @@ -25,22 +25,19 @@ class ReceiverStats(Base): aircraft_count = Column(SmallInteger) max_distance = Column(Float) quality = Column(Float(precision=2)) - + # Relation statistic data quality_offset = Column(Float(precision=2)) - + # Ranking data - aircraft_beacon_count_ranking_worldwide = Column(SmallInteger) - aircraft_beacon_count_ranking_country = Column(SmallInteger) - aircraft_count_ranking_worldwide = Column(SmallInteger) - aircraft_count_ranking_country = Column(SmallInteger) - max_distance_ranking_worldwide = Column(SmallInteger) - max_distance_ranking_country = Column(SmallInteger) - quality_ranking_worldwide = Column(Integer) - quality_ranking_country = Column(Integer) + aircraft_beacon_count_ranking = Column(SmallInteger) + aircraft_count_ranking = Column(SmallInteger) + max_distance_ranking = Column(SmallInteger) + quality_ranking = Column(Integer) # Relations receiver_id = Column(Integer, ForeignKey('receivers.id', ondelete='SET NULL'), index=True) receiver = relationship('Receiver', foreign_keys=[receiver_id], backref=backref('stats', order_by='ReceiverStats.date.asc()')) -Index('ix_receiver_stats_date_receiver_id', ReceiverStats.date, ReceiverStats.receiver_id) \ No newline at end of file + +Index('ix_receiver_stats_date_receiver_id', ReceiverStats.date, ReceiverStats.receiver_id) diff --git a/ogn/model/takeoff_landing.py b/ogn/model/takeoff_landing.py index fcb8e85..88ef14c 100644 --- a/ogn/model/takeoff_landing.py +++ b/ogn/model/takeoff_landing.py @@ -18,6 +18,3 @@ class TakeoffLanding(Base): # Relations airport = relationship('Airport', foreign_keys=[airport_id], backref='takeoff_landings') device = relationship('Device', foreign_keys=[device_id], backref='takeoff_landings') - -Index('ix_takeoff_landings_date_device_id_airport_id_timestamp', func.date(TakeoffLanding.timestamp), TakeoffLanding.device_id, TakeoffLanding.airport_id, TakeoffLanding.timestamp) -Index('ix_takeoff_landings_date_device_id_timestamp_airport_id', func.date(TakeoffLanding.timestamp), TakeoffLanding.device_id, TakeoffLanding.timestamp, TakeoffLanding.airport_id) \ No newline at end of file