# Seattle Overdose Deaths • Interactive Policy Model

**Standalone distribution** for the postscript interactive model in the FOJE campaign issues paper:

> **The Compounding Homelessness, Addiction & Overdose Problem in Seattle**

This is a self-contained browser-based simulation of exponential/compounding overdose death growth, with policy sliders for migration discouragement and enforcement levels. It demonstrates how the observed ~28.7% CAGR can be bent using the two core drivers.

## Files in this distribution

| File                              | Purpose |
|-----------------------------------|---------|
| `seattle_overdose_model.html`    | The complete interactive model. All UI, logic, Chart rendering, T_d / half-life calculations, table, and "How it works" footnote are inside this one file. Tailwind v3 CSS is inlined; no production build warnings or external tracking. |
| `chart.umd.min.js`               | Local copy of Chart.js (UMD build, ~208 KB). Required sibling for the live chart. Kept external so the main HTML stays reasonably sized and editable. |
| `T_dvsHalfLife-dark.jpg`         | Diagram of the T_double / half-life equations (from the paper). Referenced inside the model’s "How the Model Works" section. Relative path keeps everything portable. |
| `LICENSE.txt`                    | Full text of the GNU Affero General Public License v3.0. |
| `README.md`                      | This file — usage instructions, embedding, license, and reuse notes. |

(The source of truth is the same folder inside the FOJE Blazor site repository: `FOJE/wwwroot/models/compounding-crisis/`.)

## Quick start — standalone use (offline)

1. Extract all files from the zip (or copy the folder) into **one directory**.
2. Double-click (or open) `seattle_overdose_model.html` in any modern desktop browser.
3. Everything works locally:
   - Drag the sliders → live updates to metrics, table (with per-row cumulative T_d), and chart.
   - "How it works" button reveals the footnote + math explanation + diagram.
   - Keyboard: Press **R** to reset sliders; **Esc** hides the note panel.
4. No internet required after the files are on disk.

The model is ~560 KB total (zipped smaller). It is designed so the four runtime files (`*.html`, `*.js`, `*.jpg`) plus the legal files travel together.

## Using on your own website (self-hosting or embedding)

Upload the entire folder (or just the five files) to any web server under a path of your choice.

Example iframe embed (exact pattern used on the live campaign site):

```html
<iframe 
    src="/models/compounding-crisis/seattle_overdose_model.html"
    title="Washington State Overdose Deaths — Interactive Policy Simulation"
    style="width:100%; height:1050px; border:1px solid #475569; border-radius:12px; background-color:#0f172a;"
    loading="lazy">
</iframe>

<p><a href="/models/compounding-crisis/seattle_overdose_model.html" target="_blank">Open full interactive model in a new tab →</a></p>
```

- Relative asset references (`chart.umd.min.js`, `T_dvsHalfLife-dark.jpg`) resolve correctly when the HTML and its two siblings stay in the same directory on the server.
- The model detects when it is inside an iframe and applies minor style tweaks automatically.

## Portable mathematics (MathUtils)

Inside the `<script>` of `seattle_overdose_model.html` you will find a reusable pure-JS port of the campaign’s C# `MathUtils`:

```js
const MathUtils = {
    Td(v1, v2, dt = 1.0) { ... },   // Time to double (positive) or half-life (negative)
    // plus helpers used by the projection loop
};
```

- Matches the formulas and behavior from the included diagram and the C# implementation used for other campaign modeling.
- Core: `T_d = dt * ln(2) / ln(ratio)` (or negative for decay).
- Easy to extract into future models (energy abundance ↔ GDP, population dynamics, etc.).
- The table column shows *cumulative* T_d from baseline year 0 to the current row (dt = row index).

Comments in the source explain the port and the year math (2019 as Y0 through 2023 as Y4, 4-year observed ratio raised to 1/4).

## License and copyright

Copyright (C) 2026 Friends of Jillian England (AKA FOJE).

This entire distribution (the HTML model, the supporting JS and image, and all embedded logic) is licensed under the **GNU Affero General Public License v3.0 (AGPL-3.0-or-later)**.

- SPDX-License-Identifier: `AGPL-3.0-or-later`
- Full license: see the included `LICENSE.txt`
- Official reference: https://www.gnu.org/licenses/agpl-3.0.html

The top of `seattle_overdose_model.html` also contains a detailed license header comment.

**Strong copyleft notice**: If you run a modified version of this software as a public web service (or otherwise make it available over a network), you must make the complete corresponding source code available to the users interacting with it.

The model (and the paper it accompanies) was paid for by Friends of Jillian England, the committee to elect Jillian England for Washington State Senate, Legislative District 36.

See also the visible legal footer inside the running model and the campaign site footers.

## Development & maintenance notes

- The **single source of truth** for the model is `seattle_overdose_model.html`. Edit it directly in any text editor.
- Tailwind v3 CSS is inlined (no CDN, no tracking, no v4 graphics issues).
- Chart.js is deliberately a local sibling file (same reason).
- After any edit:
  1. Test by opening the .html directly from disk and via the site iframe.
  2. Rebuild the distribution zip (see below).
- The live campaign site serves these exact files statically from `wwwroot` at `/models/compounding-crisis/...`.
- Future models for other issues papers should follow the same `wwwroot/models/<slug>/` + sibling assets + zip pattern.

### Rebuilding the standalone zip (for distribution)

From the model folder:

```powershell
Compress-Archive -Path `
    seattle_overdose_model.html, `
    chart.umd.min.js, `
    T_dvsHalfLife-dark.jpg, `
    LICENSE.txt, `
    README.md `
    -DestinationPath seattle-overdose-model-standalone.zip -Force
```

(Or use any zip tool; the important thing is that the HTML + its two runtime dependencies + license + this README travel together.)

## Acknowledgments

- Math foundation ported from internal C# utilities (T_d / DblPredict) used in other campaign analysis.
- Visual & interaction design tuned for policy communication on campaign sites.
- Built as a "continuous ad machine" companion piece to the written issues paper.

---

**Paid for by Friends of Jillian England. Legislative District 36 • Washington State.**

This is a simplified exponential model for illustrative and educational purposes. Real-world outcomes depend on many variables.

For the full policy paper and campaign context, visit the issues section of the site.
