This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

geokey-airquality

GeoKey extension for Air Quality functionality.

Install

geokey-airquality requires:

  • Python version 2.7
  • GeoKey version 1.0 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/
Release History

Release History

1.2.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
geokey-airquality-1.2.0.tar.gz (20.1 kB) Copy SHA256 Checksum SHA256 Source Sep 19, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting