Skip to main content

Plant Village Survey Export: Simple CLI

Project description

plantpy: Plant Village Survey Export Simple CLI

DOI PyPI version Build Status CI plantpy

This is an application to programmatically export Survey results from Plant Village surveys. The tool will be extended to include multiple surveys and data sources but for now it exports only the Locust survey datasets. This tools access will depend on your access with plantvillage.

Simple citation:

Samapriya Roy. (2020, May 24). samapriya/plantpy: plantpy: Plant Village Survey Simple Export CLI (Version 0.0.3). Zenodo.
http://doi.org/10.5281/zenodo.3842118

Table of contents

Installation

This assumes that you have native python3 & pip installed in your system, you can test this by going to the terminal (or windows command prompt) and trying

python and then pip list

To install Plant Village Simple CLI for Survey Access you can install using two methods.

pip install plantpy

or you can also try

git clone https://github.com/samapriya/plantpy.git
cd plantpy
python setup.py install

For Linux use sudo or try pip install plantpy --user.

I recommend installation within a virtual environment.

Getting started

As usual, to print help:

plantpy -h
usage: plantpy [-h] {auth,locust,extract} ...

Plant Village Survey Export: Simple CLI

positional arguments:
  {auth,locust,extract}
    auth                Saves your username and password
    locust              Export locust survey data
    extract             Export and filter locust survey to geometry

optional arguments:
  -h, --help            show this help message and exit

To obtain help for specific functionality, simply call it with help switch, e.g.: plantpy auth -h.

plantpy auth

For now this stores the username and password as a JSON file which eliminates the need for users to input authentication details again and again.

plantpy auth -h
usage: plantpy auth [-h]

optional arguments:
  -h, --help  show this help message and exit

plantpy_auth


plantpy locust

This allows you to export the locust reports based on country, start and end date into a CSV file. Use country as "all" to get report on all countries in current survey list. It has some inherent features, it looks for your country in existing country list and will let you know if returned CSV is empty. Usage is simply

plantpy locust -h
usage: plantpy locust [-h] --start START --end END --country COUNTRY --report
                      REPORT

optional arguments:
  -h, --help         show this help message and exit

Required named arguments.:
  --start START      Start Date YYYY-MM-DD
  --end END          End date YYYY-MM-DD
  --country COUNTRY  Select country to get data or use 'all'
  --report REPORT    full path to CSV report file

plantpy_locust


plantpy extract

This tool will allow you to work with the extracted CSV file and generate a point GeoJSON file containing the location and properties of the survey report. The tool also allows you to pass a geometry GeoJSON file to filter by geometry.

plantpy extract -h
usage: plantpy extract [-h] --input INPUT --output OUTPUT
                       [--geometry GEOMETRY]

optional arguments:
  -h, --help           show this help message and exit

Required named arguments.:
  --input INPUT        Path to input CSV survey data file
  --output OUTPUT      Path to output GeoJSON file or Shapefile

Optional named arguments:
  --geometry GEOMETRY  Path to filter geometry as a GeoJSON file

pyplant_extract


Changelog

v0.0.4

  • Extract CSV report to GeoJSON or Shapefile.

v0.0.3

  • Used pandas for efficient reporting.
  • Extract and export CSV report to geometry file and filter by geometry.

v0.0.2

  • Added version check for automatic release notification.
  • Now export locust report for all countries.
  • General improvements to handle country lists and exports.

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

plantpy-0.0.4.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

plantpy-0.0.4-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file plantpy-0.0.4.tar.gz.

File metadata

  • Download URL: plantpy-0.0.4.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.32.1 CPython/2.7.17

File hashes

Hashes for plantpy-0.0.4.tar.gz
Algorithm Hash digest
SHA256 2b32c76623723a9a11c64d80142529fbcb0bc0aa674f8ee00d9a35c198db65cb
MD5 8385d355828a60a77f87bfb5e8d97fd2
BLAKE2b-256 e134bbe24e0d369d814a45c3f7177d00f2c44cd466640eb59d2baabe7d377052

See more details on using hashes here.

File details

Details for the file plantpy-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: plantpy-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.32.1 CPython/2.7.17

File hashes

Hashes for plantpy-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6b89cd6f992940f3aa28e6d6f74546d38ae550de58c4b6c6a2d94ecabfe45418
MD5 8894d9d643f8137961721a931bc96760
BLAKE2b-256 c2349a75bcbeb97fdc54fccc505e85c4b59f6ee94a360ff019860010bf6c1280

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