Stored Product Insect Database

The Stored Product Insect Database (SPIDB) is a comprehensive Python package and command-line tool for managing and analyzing acoustic and microwave recordings of stored product insects. It provides both a powerful database interface and an elegant CLI for downloading datasets from Kaggle and building structured databases for analysis.

Key Features

  • Command-line interface for downloading datasets and building databases

  • Database management with support for SQLite, MySQL, and PostgreSQL

  • Organized data structure linking audio files with rich metadata

  • Extended models for subjects, materials, events, records, and samples

  • Built on SONICDB framework for acoustic data management

  • Python API for advanced querying and analysis

Quick Start

Using the CLI

# Install with CLI support
pip install "git+https://github.com/dkadyrov/spidb.git#egg=spidb[cli]"

# Download datasets and build database
spidb download --build

# Or download only
spidb download --dataset aspids

Using Python

from spidb import Database

# Open database
db = Database("data/spi.db")

# Query data
samples = db.session.query(db.Sample).all()

Background

Stored products, such as grains, seeds, nuts, and processed foods, make up a large portion of the global food supply and trade are susceptible to infestation by a variety of insects. These insects, known as stored product pests (SPPs), can cause significant agricultural, environmental, and economic losses when they contaminate materials at any stage of the supply chain from farming, storage, processing, and distribution. When traded internationally, SPPs can also be a vector for the spread of invasive species and pathogens.

Stored product pests are grouped as internal, external, and secondary pests based on their feeding habits and the damage they cause. Internal feeders, such as the rice weevil, Sitophilus oryzae, bury into the kernel as larvae and eat the endosperm until they emerge as adults. External feeders, such as the red flour beetle, Tribolium castaneum, break down the surface of the kernel. Scavengers, such as the sawtoothed grain beetle Oryzaephilus surinamensis, feed on the broken kernels and other debris. Secondary pests, such as the mealworm, Tenebrio molitor, feed on the waste and debris left by the primary pests [1].

The ISO 6639 standard specifies that a container is infested if an insect is found within a one kilogram sample [2]. The USDA determines an infestation is one kilogram of product contains two or more live insects [3]. Although the main method for inspecting infestation is visual inspection, often with tools such as magnifying glasses and sieves, it is time-consuming and labor-intensive. Physical methods include probe traps, Berlese funnels, and pitfall traps, often used in conjunction with pheromones and light attractants. Automated sieves, electronic counters, electrical conductance machines, and flotation methods allow faster inspection of larger samples. Chemical methods include monitoring for CO2 and uric acid levels as well as employing the electric nose to detect for volatile compounds. Spectral imaging includes hyperspectral imaging, near-infrared spectroscopy, and X-ray imaging. Acoustic methods include the use of microphones, accelerometers, and acoustic emission sensors to detect the sounds of insects moving, feeding, and mating [4]. These methods need to balance accurate detection and classification pests of various life stages with ensuring product quality, minimizing costs, and assuring efficiency of supply chain movement while limiting the amount of damage or loss during examination.

The Acoustic Stored Product Insect Detection System (A-SPIDS) and the Microwave Stored Product Insect Detection System (M-SPIDS) were developed as a low-cost, portable, and non-destructive alternative method for detecting stored product insects.