Skip to main content

Outdoor air quality data

Project description

Testing Status

Fetch outdoor air quality data from multiple resources, the system is made of the following components:

  • fetching: fetches resources to create the raw material for air quality data. That material is saved to create a history and possibility to fix errors after the fact.

  • data extraction: extract the data from the raw material to create data feeds.

  • data reliability: determine which data source is the most reliable at any given time.

Architecture

The data flow from online resource to reliable data point is broken down as follow:

  • sources: online resources that provide the data, polled at regular interval and cached for archive purpose

  • feeds: extracted data from sources, feeds are saved as time series in a database

  • datapoint: extracted from feeds using an election algorithm to provide the most reliable data

Configuration

The default local configuration file is okqconfig.py, this can be changed using the environment variable OKQ_CONFMODULE. The okqconfig.py file should define a dict called settings, this dict can be used to overwrite any configuration option defined in the global_settings of openkongqi.conf.

Station UUID

Each station needs to be attached to a unique identier, a station identifier is of the following formats:

CC/STATION
CC/CITY/STATION
CC/STATE/CITY/STATION

The following fragments compose the UUID:

  • CC: country code - a two letter country code as defined by ISO 3166-1 alpha-2, mandatory.

  • STATE: state name - state name

  • CITY: city name - city name

  • STATION: stations name - station name, mandatory.

All names have to be expressed in Uppercase or lowercase or numeric latin letters.

Install

Make sure the lxml package is installed, on debian:

$ apt-get install python-lxml

Install the code:

$ pip install -U pip
$ pip install pip-tools
$ pip-sync requirements.txt

Development

Install development environment:

$ pip install -r requirements-dev.txt

Create necessary database & tables:

(openkongqi)$ python -c "import openkongqi.bin; openkongqi.bin.okq_init()"

Run celery:

(openkongqi)$ python openkongqi/bin.py worker --loglevel=debug --concurrency=1 --autoreload -B

Test

Test the package:

$ python -m unittest discover

Automatic testing in various environments:

$ tox

Versioning

Openkongqi tries to follow the PEP 440 / Semver conventions as defined by PyPA

To update the version of the package, use the following command:

$ bumpr -b -p

Packaging

Create packages:

$ python setup.py sdist bdist_wheel

Push package:

$ twine upload dist/*
$ twine upload -r pypi dist/*

Name origin

Kōngqì (空气) is the Chinese word for air/atmosphere.

License

This software is licensed under the Apache License 2.0. See the LICENSE file in the top distribution directory for the full license text.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openkongqi-0.2.1.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

openkongqi-0.2.1-py2.py3-none-any.whl (32.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file openkongqi-0.2.1.tar.gz.

File metadata

  • Download URL: openkongqi-0.2.1.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.3

File hashes

Hashes for openkongqi-0.2.1.tar.gz
Algorithm Hash digest
SHA256 9c69c387d5d501e6d2bb6c171e3a990d0b725c2aa1b065dc4e8297f2a2d5d7e1
MD5 12bf028268dfd14a266b5596a7c3296d
BLAKE2b-256 005db595e3318f1f9f6f8ad39b04af7d1ab18d34db5e7c33f973c52ee1986d25

See more details on using hashes here.

File details

Details for the file openkongqi-0.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: openkongqi-0.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 32.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.3

File hashes

Hashes for openkongqi-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bb67ff7dd3c9662af829512f230f5568513ca3ee93f85e6909854b6c5e50a33c
MD5 5d703ca18902ac2da62bf2fcb988706c
BLAKE2b-256 279ce94dbf5e30885bf3af07542aea696ffc553e46fa73add7e32a51786df18e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page