Package: geokey-airquality
geokey-airqualityGeoKeyextension forAir Qualityfunctionality.Installgeokey-airquality requires:Python version 2.7GeoKey version 1.6 or greaterInstall the geokey-airquality from PyPI:pip install geokey-airqualityOr 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_airqualityCopy static files:python manage.py collectstaticSetup a Cron job for checking measurements that due to finish by running:crontab -eAnd adding:15 0 * * * python local_settings/manage.py check_measurementsYou’re now ready to go!UpdateUpdate the geokey-airquality from PyPI:pip install -U geokey-airqualityMigrate the models into the database:python manage.py migrate geokey_airqualityCopy static files:python manage.py collectstaticDevelop & TestClone the repository:git clone git@github.com:ExCiteS/geokey-airquality.gitInstall 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_airqualityCopy static files:python manage.py collectstaticWhen database structure has changed, make migrations file (migrate after that to alter local database):python manage.py makemigrations geokey_airqualityRun tests:python manage.py test geokey_airqualityCheck code coverage:coverage run --source=geokey_airquality manage.py test geokey_airquality
coverage report -m --omit=*/tests/*,*/migrations/*APISign 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 locationPOST /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 locationPOST /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/