Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git/
.github/
screenshots/
README.md
10 changes: 0 additions & 10 deletions .pre-commit-config.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions .sqlfluff

This file was deleted.

94 changes: 82 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,91 @@
# GitHub Blueprint
# Seismic Monitor — Screenly Edge App

Blueprint for GitHub repos.
A live earthquake map for digital signage. It pulls the public **USGS** earthquake
feed (no API key), plots every event on a dark world map sized and coloured by
magnitude, and lists the most recent quakes in a side rail. Built to the Screenly
Edge App spec: `screenly.yml` manifest + `index.html` entrypoint + the injected
`screenly.js` bridge. Fully self-contained — no tile CDN, no JS CDN, no fonts CDN.

## Usage
## What each file is

- `screenly.yml` — the Edge App manifest: entrypoint, metadata, and the
user-configurable settings.
- `index.html` — the entrypoint the player loads (`entrypoint.type: file`).
- `static/js/app.js` — the whole app: reads the settings, fetches the feed,
draws the map, the dots, the label and the rail.
- `static/css/style.css` — the signage styling (dark, no cursor, scales with the
screen).
- `static/js/leaflet.js` + `static/css/leaflet.css` — Leaflet 1.9.4, vendored.
- `static/data/world.js` — Natural Earth country polygons: the built-in offline
basemap. The app renders its own dark cartography (land fill, cased
coastlines) with no network dependency at all.
- `static/data/plates.js` — tectonic plate boundaries (Bird 2003); the quakes
visibly trace the plate edges.

## Behaviour

- **Map focus** — by default the map centres on the screen's own coordinates
(from `screenly.metadata.coordinates`) and drops a marker at that spot; set it
to `world` for the whole-globe frame instead.
- **Label** — one quake on screen is named, picked by magnitude with a penalty
for age. The pick rotates every 5 minutes.

## See it running (no player needed)

Open `index.html` in any browser. Off a player there's no `screenly` bridge, so
the app falls back to its defaults (whole-world view) and fetches live USGS
data directly (USGS allows cross-origin use).

## Deploy to your screens (Screenly CLI)

```bash
# one-time
screenly login

# from inside this folder — registers the app and writes the id into screenly.yml
screenly edge-app create --name "Seismic Monitor" --in-place

# upload the code + settings
screenly edge-app deploy

# create an instance (a configured copy you can put in a playlist)
screenly edge-app instance create --name "Seismic Monitor"

# optional: override any default at the instance level
screenly edge-app setting set magnitude_threshold=4.5
screenly edge-app setting set time_window=week
screenly edge-app setting set map_focus=auto
```

Then add the resulting asset to a playlist in the usual way — in the web UI, or:

```bash
$ rsync -aP .github /path/to/repo/
screenly playlist append <PLAYLIST_UUID> <ASSET_UUID> <DURATION_SECONDS>
```

## Repo Configuration
## Settings

| Setting | Values | Default | Effect |
| --- | --- | --- | --- |
| `magnitude_threshold` | `1.0`, `2.5`, `4.5`, `significant` | `4.5` | Smallest quake plotted. |
| `time_window` | `hour`, `day`, `week`, `month` | `week` | How far back to show. |
| `refresh_minutes` | number | `5` | How often to re-pull USGS. |
| `map_focus` | `auto`, `world` | `auto` | `auto` centres on the screen's own coordinates; `world` shows the whole map. |
| `units` | `miles`, `km` | `miles` | Units for distances and depths in the event list. |

## How it uses the Screenly bridge

* Default branch should be `master`
* If relevant, `production` is used as the production branc h
* Branch protection should be enabled on master and production with:
* `Require a pull request before merging`, `Require approvals` and `Require review from Code Owners`
* `Require status checks to pass before merging`
- `screenly.settings.*` — the settings above (with fallbacks for browser use).
- `screenly.metadata.coordinates` — to centre the map on the screen's location
(both the object and array coordinate shapes are supported).
- `screenly.cors_proxy_url` — the USGS request is routed through it on a player;
it falls back to a direct fetch when the bridge isn't present.
- `screenly.signalReadyForRendering()` — called once the first data render lands
(`ready_signal` is off, so the player never waits on it).

## Code Owner
## Data & attribution

Adjust `.github/CODEOWNERS` to the squad that owns the repo.
- Earthquake data: **USGS Earthquake Hazards Program** GeoJSON feeds
(`earthquake.usgs.gov/earthquakes/feed/v1.0/`) — U.S. public domain, no key.
- Basemap: **Natural Earth** vectors, public domain, shipped with the app.
- Plate boundaries: **Bird (2003)**, public domain, shipped with the app.
47 changes: 47 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>Seismic Monitor</title>
<style>html, body { margin: 0; background: #0a0f1c; }</style>
<link rel="stylesheet" href="static/css/leaflet.css" />
<link rel="stylesheet" href="static/css/style.css" />
</head>
<body>
<div id="map"></div>

<aside id="rail">
<div class="metrics">
<div class="metric">
<div class="metric-value" id="stat-count">–</div>
<div class="metric-label" id="label-count">events</div>
</div>
<div class="metric">
<div class="metric-value"><span class="max-dot" id="max-dot"></span><span id="stat-max">–</span></div>
<div class="metric-label">strongest</div>
</div>
</div>
<div class="rail-head">
<span class="rail-title">Latest events</span>
</div>
<ul id="event-list"></ul>
<div id="empty-state" hidden>No qualifying events in this window.</div>
</aside>

<div id="toast" hidden></div>

<div id="splash">
<div class="splash-box">
<div class="splash-line"><span></span></div>
<div class="splash-text">Connecting</div>
</div>
</div>

<script src="static/js/leaflet.js"></script>
<script src="static/data/world.js"></script>
<script src="static/data/plates.js"></script>
<script src="screenly.js?version=1"></script>
<script src="static/js/app.js"></script>
</body>
</html>
12 changes: 0 additions & 12 deletions pyrightconfig.json

This file was deleted.

57 changes: 0 additions & 57 deletions ruff.toml

This file was deleted.

93 changes: 93 additions & 0 deletions screenly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
syntax: manifest_v1
id: 01KZ77RN8V1GWCGTYG53HP1V0T
description: >-
Live global earthquake monitor. Plots real-time USGS seismic events on a dark
world map, sized and coloured by magnitude, with a feed of the most recent
significant quakes. No API key required.
author: Will Cornforth
homepage_url: https://earthquake.usgs.gov
categories:
- Dashboards
entrypoint:
type: file
ready_signal: false
settings:
magnitude_threshold:
type: string
default_value: '4.5'
title: Minimum magnitude
optional: true
help_text:
properties:
help_text: Only plot quakes at or above this magnitude.
options:
- label: All (M1.0+)
value: '1.0'
- label: Minor (M2.5+)
value: '2.5'
- label: Light (M4.5+)
value: '4.5'
- label: Significant only
value: significant
type: select
schema_version: 1
map_focus:
type: string
default_value: auto
title: Map focus
optional: true
help_text:
properties:
help_text: Auto centres on this screen's location; World shows the whole globe.
options:
- label: Auto (screen location)
value: auto
- label: Whole world
value: world
type: select
schema_version: 1
refresh_minutes:
type: string
default_value: '5'
title: Refresh interval (minutes)
optional: true
help_text:
properties:
help_text: How often to pull fresh data from USGS.
type: number
schema_version: 1
time_window:
type: string
default_value: week
title: Time window
optional: true
help_text:
properties:
help_text: How far back to show earthquakes.
options:
- label: Past hour
value: hour
- label: Past day
value: day
- label: Past 7 days
value: week
- label: Past 30 days
value: month
type: select
schema_version: 1
units:
type: string
default_value: miles
title: Distance units
optional: true
help_text:
properties:
help_text: Units for the distances and depths in the event list.
options:
- label: Miles
value: miles
- label: Kilometres
value: km
type: select
schema_version: 1
Binary file added screenshots/focused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/world.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading