Skip to main content

openkongqi - outdoor air quality data

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.

Metadata

Release files for openkongqi 0.2.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openkongqi 0.2.14
File Size Uploaded Provenance Actions
openkongqi-0.2.14.tar.gz 24.4 kB Without provenance Details for openkongqi-0.2.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openkongqi 0.2.14
File Interpreter ABI Platform Actions
openkongqi-0.2.14-py2.py3-none-any.whl Python 3, Python 2 none any Details for openkongqi-0.2.14-py2.py3-none-any.whl

Total release size: 58.5 kB

Release files / openkongqi-0.2.14.tar.gz

Download URL openkongqi-0.2.14.tar.gz
Size 24.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b44b366829f243a746d46cd85ce74aba59c4c8389b5e682436150eda4e7aac85
BLAKE2b-256 checksum
How to use checksums
3def17e3ad1eb651324fbf50e0223033212170246013a2eb6e476df277ba7054
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.2

Release files / openkongqi-0.2.14-py2.py3-none-any.whl

Download URL openkongqi-0.2.14-py2.py3-none-any.whl
Size 34.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ea74d6e40e88ef9e5953cfe891fec4d0cb1df1d53b8183f0fd167b9900feaa31
BLAKE2b-256 checksum
How to use checksums
a8e2fe285975d01d5115ec73c5e31c577ac16d94b52a33cd0d3eddec8e681186
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.2

Security for openkongqi 0.2.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page