A database backend for the Open Glider Network
 
 
 
 
 
 
Go to file
Fabian P. Schmidt 3a0a91527f Add setup.py to create a package
Fixes glidernet/ogn-python#16.
2016-01-12 13:56:18 +01:00
alembic adjust db scheme 2015-11-28 10:52:41 +01:00
ogn Add setup.py to create a package 2016-01-12 13:56:18 +01:00
tests Cleanup 2016-01-06 00:23:45 +01:00
.gitignore Update README, CONTRIBUTORS. 2015-11-15 10:01:57 +01:00
.travis.yml Add setup.py to create a package 2016-01-12 13:56:18 +01:00
CONTRIBUTORS Update README, CONTRIBUTORS. 2015-11-15 10:01:57 +01:00
LICENSE Create LICENSE 2015-11-14 22:47:25 +01:00
README.md CLI: Remove celery dependency for simple tasks 2015-12-09 12:07:55 +01:00
alembic.ini Added Alembic 2015-11-16 08:31:32 +01:00
manage.py Add common CLI manage.py. 2015-11-15 09:59:48 +01:00
requirements.txt Add setup.py to create a package 2016-01-12 13:56:18 +01:00
setup.cfg Travis CI: Replace pep8 with flake8 2016-01-06 00:37:47 +01:00
setup.py Add setup.py to create a package 2016-01-12 13:56:18 +01:00

README.md

ogn-python

[Build Status] (https://travis-ci.org/glidernet/ogn-python) [Coverage Status] (https://coveralls.io/r/glidernet/ogn-python)

A python module for the Open Glider Network. The submodule 'ogn.gateway' is an aprs client, saving all received beacons into a database with SQLAlchemy. Other submodules process this data.

To schedule tasks like fetching ddb data, Celery with Redis is used.

Installation and Setup

  1. Install python requirements

    pip install -r requirements.txt
    
  2. Install redis for asynchronous tasks ('ogn.collect.*')

    apt-get install redis-server
    
  3. Create database

    ./manage.py db.init
    alembic stamp head
    

Running the aprs client and task server

This scripts run in the foreground and should be deamonized (eg. use supervisord).

# start aprs client
$ ./manage.py gateway.run

# start task server (make sure redis is up and running)
$ celery -A ogn.collect worker -l info

manage.py - CLI options

usage: manage.py [<namespace>.]<command> [<args>]

positional arguments:
  command     the command to run

optional arguments:
  -h, --help  show this help message and exit

available commands:

  [db]
    import_ddb             Import registered devices from the DDB.
    import_file            Import registered devices from local file.
    init                   Initialize the database.

  [gateway]
    run                    Run the aprs client.

  [logbook]
    compute                Compute takeoffs and landings.
    show                   Show a logbook for <airport_name> located at given position.

  [show.devices]
    stats                  Show some stats on registered devices.

  [show.receiver]
    hardware_stats         Show some statistics of receiver hardware.
    list_all               Show a list of all receivers.
    software_stats         Show some statistics of receiver software.

Only the command logbook.compute requires a running task server (celery) at the moment.

TODO

  • Write celery backend and add task 'fetchddb'
  • Rewrite manage.py with https://github.com/Birdback/manage.py or flask-script
  • Rename existing cli commands
  • Document/Improve cli commands
  • Separate settings from module (currently at ogn/command/dbutils.py)
  • Enable granular data acquisition (eg. store receiver beacons only)
  • Future Database-Migrations: Use Alembic?
    • Rename 'Flarm' to 'Device'?
    • Rename self.heared_aircraft_IDs (lowercase) in aircraft_beacon
    • Rename self.heared_aircraft_IDs
  • Fix command/logbook.py (@Meisterschueler?)
  • Introduce scheduled tasks with 'celery beat' (eg. updateddb)

Scheduled tasks

  • ogn.collect.database
    • import_ddb - Import registered devices from the ddb
    • import_file - Import registered devices from a local file
  • ogn.collect.receiver
    • populate - generate Receiver table (not implemented)
  • ogn.collect.logbook
    • compute - generate TakeoffLanding table

How to use virtualenv

$ sudo apt-get install python-virtualenv

$ virtualenv env
$ source env/bin/activate