A set of tools that can pull data from Biogents BG-Counter smart mosquito traps and convert them into a Darwin Core compliant format.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
download_graph.png
smart_trap_download_data.py
smart_trap_json_parser.py
smart_trap_update_metadata.py

README.md

BG-Counter Tools

BG-Counter Tools is a set of tools that can pull data from Biogents BG-Counter smart mosquito traps and convert them into a Darwin Core compliant format.

Usage

Downloading Data

To download smart trap data, use smart_trap_download_data.py. You'll need to provide the API key associated with your (or someone else's) Biogents account. Note that you need to have the Python requests module installed in order for this script to work.

python3 smart_trap_download_data.py -k [API key] -s [start time] -e [end time] -o [output filename]

Dates are entered in one of the following formats, where “T” is literal: YYYY-MM-DD, YYYY-MM-DDTHH-MM, or YYYY-MM-DDTHH-MM-SS. This dumps the data into one or more JSON files, depending on the options used.

The download script, by default, shows a graphical display of its progress. A detailed description of this display can be found on the Wiki.

Converting to Darwin Core

Creating and Updating Metadata

To generate Darwin Core files from the JSON, first you need to create a metadata file and add your API key to it. Use smart_trap_update_metadata.py for this.

python3 smart_trap_update_metadata.py add-key [API key] [entity name] [prefix]

Entity name is the name of the person or organization that owns the traps, and prefix is the string that will form the beginning of the event and occurrence IDs. Note that you only need to add an API key once.

Next, you'll need to add the new traps in the JSON output file to the API key's metadata.

python3 smart_trap_update_metadata.py update-traps [API key] [output filename]

You should do this each time you have new data, just in case new traps were added.

Generating Darwin Core files

Finally, to generate the Darwin Core files, use smart_trap_json_parser.py.

python3 smart_trap_json_parser.py [output filename]

This will create two files: sampling_events.csv and associated_occurrences.csv. These files use Darwin Core terms and are adapted from the GBIF formats outlined here.

More Information

More information about each script can be found on the Wiki.