geokey-airquality
GeoKey extension for Air Quality functionality.
Install
geokey-airquality requires:
Python version 2.7
GeoKey version 1.6 or greater
Install the geokey-airquality from PyPI:
pip install geokey-airquality
Or from cloned repository:
cd geokey-airquality
pip install -e .
Add the package to installed apps:
INSTALLED_APPS += (
...
'geokey_airquality',
)
Migrate the models into the database:
python manage.py migrate geokey_airquality
Copy static files:
python manage.py collectstatic
Setup a Cron job for checking measurements that due to finish by running:
crontab -e
And adding:
15 0 * * * python local_settings/manage.py check_measurements
You’re now ready to go!
Update
Update the geokey-airquality from PyPI:
pip install -U geokey-airquality
Migrate the models into the database:
python manage.py migrate geokey_airquality
Copy static files:
python manage.py collectstatic
Develop & Test
Clone the repository:
git clone git@github.com:ExCiteS/geokey-airquality.git
Install the extension for development:
cd geokey-airquality
pip install -e .
Add the package to installed apps:
INSTALLED_APPS += (
...
'geokey_airquality',
)
Migrate the models into the database:
python manage.py migrate geokey_airquality
Copy static files:
python manage.py collectstatic
When database structure has changed, make migrations file (migrate after that to alter local database):
python manage.py makemigrations geokey_airquality
Run tests:
python manage.py test geokey_airquality
Check code coverage:
coverage run --source=geokey_airquality manage.py test geokey_airquality
coverage report -m --omit=*/tests/*,*/migrations/*
API
Sign the request with the OAuth access token to authenticate a user.
Sends a CSV sheet via email:
GET /api/airquality/sheet/
Get added projects:
GET /api/airquality/projects/
Response:
[
{
"id": 12,
"name": "Air Quality in London"
}
]
Get personal added locations:
GET /api/airquality/locations/
Response:
[
{
"id": 115,
"type": "Feature",
"geometry": {
// GeoJSON point
},
"name": "South Bank",
"created": "2015-09-15T09:40:01.747Z",
"properties": {
"height": 2 // height from ground
"distance": 3.5 // distance from road,
"characteristics": null // site characteristics
},
"measurements": [
// a list of measurements
]
}
]
Add new location
POST /api/airquality/locations/
Request body:
{
"type": "Feature",
"geometry": {
// GeoJSON point
},
"name": "My new location",
"properties": {
"height": 4.2,
"distance": 7
}
}
Response:
{
"id": 117,
"type": "Feature",
"geometry": {
// GeoJSON point
},
"name": "My new location",
"created": "2015-09-22T07:22:08.147Z",
"properties": {
"height": 4.2,
"distance": 7,
"characteristics": null
},
"measurements": []
}
Update your location:
PATCH /api/airquality/locations/:location_id/
Request body:
{
"type": "Feature",
"geometry": {
// GeoJSON point
},
"name": "My updated location",
"properties": {
"height": 4.2,
"distance": 12
}
}
Response:
{
"id": 117,
"type": "Feature",
"geometry": {
// GeoJSON point
},
"name": "My updated location",
"created": "2015-09-22T07:22:08.147Z",
"properties": {
"height": 4.2,
"distance": 12,
"characteristics": null
},
"measurements": []
}
Delete your location:
DELETE /api/airquality/locations/:location_id/
Add new measurement to your location
POST /api/airquality/locations/:location_id/measurements/
Request body:
{
"barcode": 145023
"called": "2015-12-22T07:08:08.121Z",
"started": "2015-12-23T09:12:02.247Z"
}
Response:
{
"id": 115,
"barcode": "145023",
"started": "2015-12-23T09:12:02.247Z",
"finished": null,
"properties": {
"results": null, // measurement results
"additional_details": null // additional details (per measurement)
}
}
Update your measurement:
PATCH /api/airquality/locations/:location_id/measurements/:measurement_id/
Request body:
{
"barcode": 145023,
"called": "2015-12-23T09:22:01.147Z",
"finished": "2015-12-23T09:22:01.147Z",
"project": "45",
"properties": {
"results": 64.78,
"additional_details": null
}
}
If “finished” is being described, “called” should be also present to calculate actual time difference. Otherwise current time will be used.
If measurement has “started”, “finished” and “results” collected, it is still saved until “project” is being attached to measurement. When attached, a new contribution gets created, also current measurement is removed completely.
Response (when no project):
{
"id": 154,
"barcode": "451001",
"started": "2015-11-29T12:01:04.178Z",
"finished": "2015-12-23T09:22:01.147Z",
"properties": {
"results": 64.78,
"additional_details": null
}
}
Delete your measurement:
DELETE /api/airquality/locations/:location_id/measurements/:measurement_id/
Metadata
Release files for geokey-airquality 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| geokey-airquality-1.2.1.tar.gz | 21.3 kB | Without provenance | Details for geokey-airquality-1.2.1.tar.gz |
Release files / geokey-airquality-1.2.1.tar.gz
| Download URL | geokey-airquality-1.2.1.tar.gz |
|---|---|
| Size | 21.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba715c2b99feb2b4e2e5dd59e2ce66d24aee82ef1f5c4c153533c2a2dfd38646
|
|
BLAKE2b-256 checksum How to use checksums |
01e158525b74b7a0fe664f0b292b5c7797cb52656037a4d9aa4d9b02f701e5ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.6
|
Security for geokey-airquality 1.2.1
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.