Skip to content

Administration guide

Scott Veirs edited this page Oct 13, 2024 · 25 revisions

How-to guides for Orcasite administration

Orcasite is deployed (as of late 2018) via the Heroku Git (use heroku CLI = command line interface). Each Heroku app (for live, beta, and dev.orcasound.net) has a distinct Postgres database and host URL.

The databases have an evolving number of tables. As of September 2023 they include:

  1. feeds - one live feed for each hydrophone location
  2. detections - a new detection is created when a human listener indicates they hear something interesting
  3. candidates - a new candidate is defined when a new detection occurs more than 3 min after a previous candidate’s last detection
  4. users - users are initially network admins and moderators, but may have other roles (e.g. hydrophone host organization)
  5. subscribers - are entities who would like to subscribe to some type of notification
  6. subscriptions - options for subscribers include emails upon 2 types of events: new human detection, and/or candidate confirmed by a moderator
  7. notifications - communication events with subscribers via subscriptions

How-to: play in the "Graphical" playground!

As of orcasite UI version 3, a GraphiQL playground has been implemented at live.orcasound.net/graphiql. (Thanks, Skander!) Below are a couple screenshots of the playground and current data schemes, as well as some sample queries.

** The playground in v3 **

Screenshot 2023-12-01 at 3 53 23 PM

** Example data Schema view **

graphiql-schema

Here are some handy links for learning more, and then some example queries:

Example GraphiQL queries

View production feeds

query {
  feeds {
    name
    slug
    location_point
  }
}

Count current candidates

query {
  candidates {
    count
  }
}

Returns 3989 on 12/1/2023; 4373 on 2/10/24.

Count current detections

query {
  detections {
    count
  }
}

Returns 7062 on 12/1/2023; 7655 on 2/10/24.

Show 5 most-recent detections in the WHALE category

{
  detections (limit: 5, filter: {category: {eq: WHALE}} ) {
    results {
      timestamp
      description
      feed {
        slug
      }
    }
  } 
}

Returns this on 2/10/24 at 00:30 Pacific:

Screenshot 2024-02-10 at 12 30 57 AM

How-to: add a node (in a live network)

Overview

Each hydrophone location is a node in the physical network. Within a deployed version of orcasite, the node represented by a row in the feeds table. That table is part of this Postgres database schema (as of 2022):

Orcasite-Postgres-scheme

For example, the feeds table as of 5/5/2022 (with three hydrophone locations in Washington State) looks like this:

Orcasite-Postgres-feed-dump

Here's a description of the 7 fields in the feeds table:

  1. id = a unique index associated with this row in the table
  2. name = A human readable description of the location. In v2 this text string is used to populate the drop-down feed list.
  3. node_name = a string with format device_location_name that uniquely identifies the location within the S3 buckets used to store audio data from this location. Note that rpi stands for Raspberry Pi, the device type currently running at each Orcasound location. Sometimes node_name is also used to organize other content for the node, like text and images in the orcasite S3 bucket used within each feed page of the v2 UI.
  4. slug = a string used at the end of live.orcasound.net or beta.orcasound.net to complete the URL of a given feed page, e.g. https://live.orcasound.net/orcasound-lab
  5. inserted_at = a timestamp when the row was created
  6. updated_at = a timestamp when the row was updated most recently
  7. location_point = the latitude and longitude of the node location, encoded in Well Known Binary format

So, as an example, to add a new node at Sunset Bay (between Mukilteo and Edmonds in Puget Sound), you will need the following fields and values:

  • name = Sunset Bay
  • node_name = rpi_sunset_bay
  • slug = sunset-bay
  • location_point = 010100000073f757355f955ec09b50246fb7ee4740 (based entering the Well Known Text = WKT POINT(-122.33393605795372 47.86497296593844) into this handy WKB-point converter site

Current feed table values

Last update 8/13/24 live nodes (via the "View production feeds" Graphiql query executed at live.orcasound.net/graphiql)

{
  "data": {
    "feeds": [
      {
        "location_point": {
          "coordinates": [
            -123.058779,
            48.591294
          ],
          "crs": {
            "properties": {
              "name": "EPSG:4326"
            },
            "type": "name"
          },
          "type": "Point"
        },
        "name": "North San Juan Channel",
        "slug": "north-sjc"
      },
      {
        "location_point": {
          "coordinates": [
            -122.6040035,
            48.0336664
          ],
          "crs": {
            "properties": {
              "name": "EPSG:4326"
            },
            "type": "name"
          },
          "type": "Point"
        },
        "name": "Bush Point",
        "slug": "bush-point"
      },
      {
        "location_point": {
          "coordinates": [
            -122.33393605795372,
            47.86497296593844
          ],
          "crs": {
            "properties": {
              "name": "EPSG:4326"
            },
            "type": "name"
          },
          "type": "Point"
        },
        "name": "Beach Camp at Sunset Bay",
        "slug": "sunset-bay"
      },
      {
        "location_point": {
          "coordinates": [
            -123.1735774,
            48.5583362
          ],
          "crs": {
            "properties": {
              "name": "EPSG:4326"
            },
            "type": "name"
          },
          "type": "Point"
        },
        "name": "Orcasound Lab",
        "slug": "orcasound-lab"
      },
      {
        "location_point": {
          "coordinates": [
            -122.760614,
            48.135743
          ],
          "crs": {
            "properties": {
              "name": "EPSG:4326"
            },
            "type": "name"
          },
          "type": "Point"
        },
        "name": "Port Townsend",
        "slug": "port-townsend"
      }
    ]
  }
}

Last update 8/13/24 for beta nodes (via the "View production feeds" Graphiql query executed at beta.orcasound.net/graphiql)

 "data": {
    "feeds": [
      {
        "location_point": {
          "coordinates": [
            -122.37267,
            47.388383
          ],
          "crs": {
            "properties": {
              "name": "EPSG:4326"
            },
            "type": "name"
          },
          "type": "Point"
        },
        "name": "Point Robinson",
        "slug": "point-robinson"
      },
      {
        "location_point": {
          "coordinates": [
            -122.32512,
            47.34922
          ],
          "crs": {
            "properties": {
              "name": "EPSG:4326"
            },
            "type": "name"
          },
          "type": "Point"
        },
        "name": "MaST Center Aquarium",
        "slug": "mast-center"
      }
    ]
  }
}

Adding a new feed manually

Currently (May 2022), the only way to add a new feed is by manually connecting to the running app. First, you need to have installed the Heroku CLI. After logging in with the CLI, you can connect to the Elixir interactive shell (IEx) by running:

heroku run POOL_SIZE=2 iex -S mix -a orcasite

In this case we're connecting directly to the production app (orcasite) but we could easily connect to another app (e.g. orcasite-beta):

heroku run POOL_SIZE=2 iex -S mix -a orcasite-beta

Once IEx is up and running you should see something like this

image

From here, we'll use Ecto to directly make changes to the database (be careful!). Entering the following will create a new entry in the database for the Sunset Bay hydrophone.

alias Orcasite.Repo
alias Orcasite.Radio.Feed

feed = %Feed{
  location_point: Geo.WKT.decode!("SRID=4326;POINT(-122.33393605795372 47.86497296593844)"),
  name: "Sunset Bay",
  node_name: "rpi_sunset_bay",
  slug: "sunset-bay"
}
Repo.insert!(feed)

We're done! The new feed should show up in the database and on the site. Don't forget to update S3 bucket with the HTML content and images, and of course, make sure the node is streaming to the streaming-orcasound-net bucket.

How-to: send an email to subscribers (as of 2023, post-MailChimp)

  1. Review reports from Orcasound listeners (while authenticated and approved as a moderator)

  2. Listen to the candidate event until you are 100% sure the listener heard a whale.

  3. Select the NOTIFY SUBSCRIBERS button (in gray on right side of the screenshot below), if all these conditions are met:

    3a. the signal to noise ratio is currently good enough for an exciting and compelling live-listening session;

    3b. you believe that the acoustic event is likely to continue for at least 5-10 more minutes (e.g. the signals are not rapidly fading out); and,

    3c. you expect noise levels to not increase rapidly during the event (e.g. you've checked for approaching vessels via vesseltraffic.com

Screenshot 2024-02-27 at 1 15 54 PM
  1. In the modal, add some text that will customize the top header within the email template. For example, type Southern Resident Killer Whales are currently being heard near the Sunset Bay hydrophones in north Puget Sound (between Edmonds and Mukilteo)! and you'll get this type of result:
Screenshot 2024-02-27 at 2 10 56 PM
  1. Select the SUBMIT button.
  2. If you want to cancel the sending of your notification, select the CANCEL button.
  3. If you so desire, watch the progress of your notification sending process. It is throttled to 14 sends/s to stay below AWS SES low-cost threshold, so for a list of ~4000 subscribers it will take about 5 minutes.

Associated resources:

Current template (Feb 2024)

One mjml editor: (https://mjml.io/try-it-live) and some other options as well (desktop app, vs code extension).

Another mjml wysiwyg editor: https://grapesjs.com/demo-mjml.html