Skip to contents

Opens a 'shiny' app, in the browser, for stages 1 and 2 of the workflow. The tabs depend on the arguments:

Usage

run_app(
  manifest = NULL,
  clips_dir = NULL,
  verdicts_file = NULL,
  reviewer = NULL,
  max_freq = 12,
  selection_dir = NULL,
  output_dir = NULL,
  recordings = NULL,
  audio_dir = NULL,
  site_pattern = NULL,
  blind = FALSE,
  classifier = NULL,
  launch.browser = interactive(),
  ...
)

Arguments

manifest

NULL, a data frame (or tibble) or a character scalar path to clip_manifest.csv: the clip manifest (from select_clips(), cut_clips() or assign_reviewers()), one row per clip. With output_dir, by default <output_dir>/clip_manifest.csv when it exists.

clips_dir

NULL or a character scalar, folder of the cut clips, with one subfolder per species (<clips_dir>/<species_folder>/<clip_file>, as written by cut_clips()). With output_dir, <output_dir>/clips by default.

verdicts_file

NULL or a character scalar, path to the CSV (.csv) where the verdicts are written. By default, verdicts.csv in output_dir or next to manifest when it is a path.

reviewer

NULL or a character scalar, name of the reviewer, written with each verdict. With a manifest from assign_reviewers(), only the clips assigned to this reviewer (as first or second reviewer) are shown.

max_freq

NULL or a numeric scalar, upper limit of the spectrogram, in kHz: 12 by default (e.g. 8 for most anuran calls). NULL shows the whole band. It can also be changed in the Review tab.

selection_dir

NULL or a character scalar, folder of the BirdNET selection tables (as in read_selection_tables()). Opens the Sampling and Export tabs.

output_dir

NULL or a character scalar, folder of the validation round: the clips, the manifest, the verdicts and the export (<output_dir>/occupancy by default) are written there.

recordings

NULL, a data frame (or tibble) of all recordings (columns site and source_audio, one row per recording) or a character scalar path to its CSV: needed by "random_recordings" and, in the export, to keep the occasions without detections (see export_occupancy_data()).

audio_dir

NULL or a character scalar, folder of the recordings, subfolders included. Every recording is listed with list_recordings() and written to the recordings CSV when it is a path, or else to <output_dir>/recordings.csv; the list is used as recordings. Can also be chosen in the app (Intro > Audio panel).

site_pattern

NULL or a character scalar, regular expression with one capture group that takes the site from the file names, when the recordings or the selection tables of several sites share a folder (see list_recordings() and read_selection_tables()). Can also be set in the Audio panel.

blind

Logical scalar. If TRUE, blind review: the Review tab hides the score, the sampling design and the clip file name (which starts with the score), and shows the clips in an order shuffled once per reviewer instead of the order of the manifest, so that the verdict does not lean on the score.

classifier

NULL or a character scalar, label of the classifier, recorded in extraction_info.csv and schema.json.

launch.browser

Logical scalar: open the app in the browser? Passed to shiny::runApp().

...

Further arguments to shiny::runApp(), e.g. port.

Value

Called for its side effect; returns when the app is closed.

Details

  • Intro: a graphical abstract of the sampling designs and an Audio panel to choose the audio folder, the BirdNET results and the validation folder (with a dialog of the system), with a summary of the recordings per site and night. Folders given to run_app() are confirmed when the app opens. Without them, the app opens on this tab.

  • Sampling (with selection_dir and output_dir): a form for the sampling design of select_clips(). Draw shows the clips per site and species and their inclusion probabilities without touching the audio; Cut clips cuts them with cut_clips() and writes clip_manifest.csv, extraction_info.csv and clips/ to output_dir, as extract_validation_clips() does (without the zip packages). The new clips go straight to the Review tab.

  • Review: the clips of a manifest one at a time, with the spectrogram and a player for each clip, its site, night, hour, score and design, and buttons to mark it positive, negative or uncertain. An optional Identity field says what a negative or uncertain clip is: free text, or one or more suggestions (the species of the manifest and identity_categories()), marked sure or probable. Fill it before clicking Negative or Uncertain; it is cleared at each verdict and ignored for positives. Each verdict is written at once to verdicts_file, so an interrupted session loses nothing and can be resumed. The tab replaces moving the clips into Positive and Negative folders in the BirdNET GUI; app_verdicts() turns verdicts_file into the table that classify_review() returns.

  • Export (with selection_dir and output_dir): calls export_occupancy_data() with the detections of selection_dir, the verdicts of the Review tab (combined by consensus_verdicts() when a clip has several reviewers) and, optionally, recordings, and shows the summary of schema.json. The score calibration is not in the app yet; call export_occupancy_data() with fit for it.

The app runs on the reviewer's computer and reads the clips from disk; nothing is uploaded.

Keyboard

In the Review tab: p positive, n negative, u uncertain, right arrow next clip, left arrow previous clip, space play or pause.

Verdicts file

A CSV with one line per click: clip_file, species_folder, reviewer, verdict ("positive", "negative" or "uncertain") and time, then identity (several separated by |) and identity_certainty ("sure" or "probable"), empty when no identity was given. Lines are only appended; when a clip is marked again, the last verdict of the reviewer counts. Several reviewers can share one file or keep one each. A file of an earlier version, without the identity columns, is rewritten once with them empty at its next verdict.

See also

app_verdicts(), vignette("review-app").

Examples

if (interactive()) {
  # Review only
  run_app("validation/clip_manifest.csv", "validation/clips",
          reviewer = "liliana")

  # Sample, cut, review and export
  run_app(selection_dir = "N:/Arara", output_dir = "validation",
          recordings = "recordings.csv", reviewer = "liliana",
          max_freq = 8)
}