The Melbourne Water Macroinvertebrate Dabase User’s Manual (Walsh 2023) provides full technical details on the provenance of the data and its usage, available here.

This page provides a brief overview of the structure of the database, how to access and use the data, and a list of useful links to sections of the manual

Database structure

The following is a table-relationships diagram derived from the postgreSQL database.

Accessing the data

If you are unfamiliar with manipulating related tables using SQL or in R (or another code-based program), you may find downloading subsets of the data from the data explorer app the easiest approach to accessing the data.

To access the full database, see Section 2.2 of the database user’s manual.

Once you have access to the database, you need to create a connection to it to read its tables. Here is an example of creating a connection to the gpkg version of the database in R, having downloaded it to a subfolder ‘data’ of the working directory.

db_m <- RSQLite::dbConnect(drv = RSQLite::SQLite(),"data/mwbugs.gpkg")

The two spatial tables in the database (sites and site_photos) can be loaded individually into GIS software from the gpkg file. However, their data and that of the non-saptial tables can be more efficiently extracted from the gpkg file using SQL queries, or through equivalent manipulations in R. The database is small enough that all its tables can be quickly loaded into an R environment using a single command load_all_mwbugs_tables() from bug_database_functions.R.

source(paste0("https://tools.thewerg.unimelb.edu.au/data/mwbugs/",
              "bug_database_functions.R"))
load_all_mwbugs_tables(db_m)

# Always remember to disconnect from database once data is accessed
DBI::dbDisconnect(db_m)

Having connected to the database, you can find examples of how to use the data in the user’s manual:

  • Compiling a taxon-by-sample matrix for a subset of samples Section 8.1

  • Creating a map of occurrences of a given taxon Secton 8.2

  • Plotting a time series of LUMaR scores - Section 4.2

References

Walsh, C J. 2023. “The Melbourne Water Macroinvertebrate Database: User’s Manual. Version 2. Melbourne Water Research Practice Partnership Technical Report 20.1a.” Melbourne Water Research Practice Partnership Technical Report 20.1a. School of Ecosystem; Forest Sciences, The University of Melbourne. https://tools.thewerg.unimelb.edu.au/mwbugs_manual/.