# API & Data Indexes

[![Machine-readable data indexes and APIs for building tools, agents, or integrations with the Disease Eradication Plan.](../../assets/infographics/knowledge/appendix/api-and-data-infographic-bw-academic.jpg)](../../assets/infographics/knowledge/appendix/api-and-data-infographic-bw-academic.jpg)

Machine-readable data indexes and APIs for building tools, agents, or integrations with the Disease Eradication Plan.

This page documents the data indexes and APIs available for programmatic access to the book’s content, parameters, images, and chat functionality.

## Parameters & Shareable Snippets

Every numeric value in this book lives in a single Python file and is auto-generated into two public artifacts on each build. Use these if you want the live numbers, the citations behind them, or ready-to-embed prose for the most important sections of the book.

### JSON (language-agnostic)

**URL:** `/assets/json/parameters.json`

[\$27.2 billion](../../knowledge/appendix/parameters-and-calculations.llms.md#sec-treaty_annual_funding), [604 (90% CI: 453-888)](../../knowledge/appendix/parameters-and-calculations.llms.md#sec-military_to_government_clinical_trials_spending_ratio), [150 thousand deaths/day](../../knowledge/appendix/parameters-and-calculations.llms.md#sec-global_disease_deaths_daily), and every other numeric value used in the book, in one file. Each parameter includes its raw value, formatted display string, unit, description, source, confidence, confidence interval, and a link to the chapter where it appears most.

**Top-level schema:**

``` json
{
  "sourceFile": "dih_models/parameters.py",
  "parameters": {
    "TREATY_ANNUAL_FUNDING": {
      "value": 27180000000,
      "formatted": "$27.2B",
      "unit": "USD/year",
      "description": "Annual funding from 1% of global military spending",
      "sourceType": "calculated",
      "sourceRef": "",
      "confidence": "high",
      "formula": "GLOBAL_MILITARY_SPENDING * 0.01",
      "confidenceInterval": [25100000000, 29300000000],
      "chapterUrl": "https://manual.warondisease.org/knowledge/solution/1-percent-treaty.html"
    }
  },
  "shareableSnippets": {
    "whyOptimizationIsNecessary": {
      "markdown": "Governments were created to promote the general welfare...",
      "sourceFile": "knowledge/strategy/declaration-of-optimization.qmd",
      "originalName": "why-optimization-is-necessary"
    },
    "declarationOfOptimization": { "markdown": "...", "sourceFile": "...", "originalName": "declaration_of_optimization" }
  },
  "citations": {
    "sipri-milex-2024": { "type": "report", "title": "SIPRI Military Expenditure Database 2024", "..." }
  }
}
```

**Parameter fields:**

| Field | Description |
|----|----|
| `value` | Raw numeric value (float) |
| `formatted` | Display string with auto-scaled units (e.g. “\$27.2B”, “150K deaths”) |
| `unit` | Canonical unit (USD, years, deaths, ratio, etc.) |
| `description` | Human-readable explanation |
| `sourceType` | `external` (cited data), `calculated` (formula-derived), or `definition` (policy assumption) |
| `sourceRef` | BibTeX citation key for external sources |
| `confidence` | `high`, `medium`, `low`, or `estimated` |
| `formula` | Formula string for calculated parameters |
| `confidenceInterval` | `[lower, upper]` for statistical parameters |
| `chapterUrl` | URL of the manual chapter where this parameter appears most often |

### TypeScript (with types)

**URL:** `/assets/js/parameters-calculations-citations.ts`

Same data as the JSON file plus full TypeScript interfaces (`Parameter`, `Citation`, `ShareableSnippet`, `SourceType`, `Confidence`), typed exports, and helper unions (`ParameterName`, `ShareableSnippetKey`). Import it directly into any Next.js, Remix, or SvelteKit project:

``` ts
import {
  parameters,
  citations,
  shareableSnippets,
  type ParameterName,
} from './parameters-calculations-citations';

// Get a formatted display value
const funding = parameters.TREATY_ANNUAL_FUNDING.formatted; // "$27.2B"

// Render a pre-built prose snippet in a React Markdown component
import ReactMarkdown from 'react-markdown';
<ReactMarkdown>{shareableSnippets.declarationOfOptimization.markdown}</ReactMarkdown>
```

### Shareable Snippets

The `shareableSnippets` block contains ready-to-embed markdown for the most important sections of the book. Variable references are pre-resolved to their current values and wrapped as markdown links pointing to the manual chapter where each parameter appears most. Citations are stripped (readers click through for sources), and all relative paths are absolutized. Drop the markdown directly into any markdown renderer.

**Currently available snippets:**

| Key | Source | Description |
|----|----|----|
| `whyOptimizationIsNecessary` | [declaration-of-optimization.qmd](../../knowledge/strategy/declaration-of-optimization.llms.md) | The opening pitch of the Declaration. Best for blog posts, social embeds, and op-ed framing. |
| `declarationOfOptimization` | [declaration-of-optimization.qmd](../../knowledge/strategy/declaration-of-optimization.llms.md) | The full formal declaration (Jefferson-style grievances and resolution). Best for signature pages and long-form reprints. |

All data is regenerated from `dih_models/parameters.py` on every deploy. If a parameter changes here, it changes everywhere the TS or JSON is consumed on next fetch.

### Versioning & Stability

**There is no stable API version.** Both files always reflect the current `HEAD` of the `develop` branch and update on every deploy. Parameter names, units, and values can change between versions when sources update or someone notices a naming-convention violation.

If your application cannot tolerate breaking changes, **pin a specific commit**:

    https://raw.githubusercontent.com/wishonia/earth-optimization-protocol/COMMIT_SHA/assets/json/parameters.json

Replace `COMMIT_SHA` with any full or short commit hash from the repository. The entire git history is your version archive, giving infinite granularity with no infrastructure needed. For the absolute safest path, **download the file once and commit it to your own repo**, then update deliberately when you review what changed.

TypeScript consumers get an additional safety net: if a parameter is renamed or removed, `parameters.RENAMED_NAME` becomes a compile error at build time, not a runtime bug. JSON consumers do not get this and should defensively check for the presence of fields they depend on.

## Search Index

**URL:** `/assets/json/search-index.json`

Full-text search index generated from all 76 chapters in the manual. Used by the chat widget for retrieval-augmented generation (RAG). Each entry includes resolved parameter values, section headings, and structured metadata for every referenced calculation.

**Entry schema:**

``` json
{
  "path": "knowledge/solution/1-percent-treaty.qmd",
  "url": "/solution/1-percent-treaty.html",
  "title": "A 1% Treaty",
  "description": "Each nation redirects 1% of military spending...",
  "tags": ["1-percent-treaty", "military-spending"],
  "sections": ["The Treaty", "Funding", "Why It Works"],
  "published": true,
  "lastmod": "2026-03-20",
  "text": "Full chapter text with variables resolved to display values...",
  "parameters": {
    "treaty_annual_funding": {
      "display": "$27.2B",
      "href": "/knowledge/appendix/parameters-and-calculations.html#sec-treaty_annual_funding",
      "formula": "MILITARY_SPENDING * 1%",
      "source_ref": "",
      "source_type": "calculated",
      "confidence": "high",
      "unit": "USD/year",
      "latex": "$$\\begin{gathered}Funding_{treaty} = Spending_{mil} \\times 1\\% = \\$27.2B\\end{gathered}$$"
    }
  },
  "figures": [
    {
      "path": "assets/images/1-percent-treaty/treaty-flow-diagram.jpg",
      "caption": "How the 1% Treaty funds flow from military budgets to clinical trials"
    }
  ]
}
```

**Parameter metadata fields:**

| Field | Description |
|----|----|
| `display` | Rendered value (e.g. “\$27.2B”) |
| `href` | Link to calculation details page |
| `formula` | Human-readable formula |
| `source_ref` | BibTeX citation key for external sources |
| `source_type` | `external` (cited data), `calculated` (derived), or `definition` (assumption) |
| `confidence` | `high`, `medium`, or `low` |
| `unit` | Parameter unit (USD, rate, multiplier, etc.) |
| `latex` | Full LaTeX equation with intermediate steps |

## Image Index

**URL:** `/assets/image-index.json`

Catalog of 2,757 images with dimensions, semantic types, keywords, and descriptions. Used by the chat widget to show relevant figures alongside responses.

**Entry schema:**

``` json
{
  "path": "assets/images/1-percent-treaty/treaty-flow-diagram.jpg",
  "filename": "treaty-flow-diagram.jpg",
  "extension": "jpg",
  "sizeBytes": 187508,
  "size": "183.1 KB",
  "width": 1248,
  "height": 832,
  "format": "jpeg",
  "aspectRatio": "3:2",
  "modified": "2026-03-16T01:52:55.946Z",
  "imageType": "infographic",
  "style": "bw-academic",
  "title": "Treaty Fund Flow",
  "description": "How military budget redirections flow through the DIH",
  "keywords": ["treaty", "funding", "flow", "military", "clinical trials"]
}
```

**Image types:** `cover`, `icon`, `og`, `chart`, `infographic`, `slide`, `other`

## Sites Metadata

**URL:** `/assets/json/sites-metadata.json`

Publication manifest for all 19 research papers and sites in the project. Includes abstracts, DOIs, PDF download URLs, page counts, and publishing status across platforms.

**Top-level schema:**

``` json
{
  "totalSites": 19,
  "totalPages": 145,
  "sites": [
    {
      "id": "1-pct-treaty-impact",
      "title": "The 1% Treaty: An Incentive-Compatible Approach to Ending War and Disease",
      "siteUrl": "https://manual.warondisease.org/knowledge/economics/1-pct-treaty-impact.html",
      "pdfUrl": "https://...",
      "doi": "10.5281/zenodo.14827947",
      "abstract": "...",
      "keywords": ["war-on-disease", "1-percent-treaty", "clinical-trials"],
      "pageCount": 42,
      "publishing": { "...platform status..." }
    }
  ]
}
```

## Chat API

**Base URL:** `https://transmit.warondisease.org`

### POST /api/chat

Streaming chat endpoint. Responds as Wishonia (an alien observer teaching humans about the plan).

**Request:**

``` json
{
  "question": "How does the 1% treaty work?",
  "context": "Optional RAG context from search index",
  "history": [
    {"role": "user", "content": "Previous question"},
    {"role": "assistant", "content": "Previous answer"}
  ]
}
```

**Response:** Streaming `text/plain` (chunks arrive as they’re generated).

For best results, include RAG context from the search index. The chat widget does this automatically using client-side TF-IDF scoring.

### POST /api/tts

Text-to-speech using Gemini TTS with the Kore voice.

**Request:**

``` json
{
  "text": "Text to convert to speech"
}
```

**Response:** `audio/wav`

### GET /api/voice-token

Returns credentials for the Gemini Live API WebSocket connection (bidirectional voice chat).

**Response:**

``` json
{
  "key": "API key for WebSocket connection"
}
```

## Help Your Visitors Learn How to End War and Disease

150,000 people die from preventable diseases every day. The plan to fix this exists, but most people don’t know about it yet. You can change that by adding Wishonia to your website.

Wishonia Love, CEO and President of Universe Optimization Services, teaches your visitors how to help end war and disease, starting with the [1% Treaty](https://manual.warondisease.org/knowledge/solution/1-percent-treaty.html)^([1](../references.llms.md#ref-1-percent-treaty-paper-2025)) ^([2](../references.llms.md#ref-1-pct-treaty-impact-paper-2025)) (redirecting 1% of global military spending to clinical trials). She answers questions, explains the math, cites sources, and shows relevant charts. Every conversation is one more person who understands how to end the largest unnecessary cause of death on the planet.

### Embed the Chat Widget

Add three lines of HTML to any website. A floating chat bubble appears in the bottom-right corner. No API key, no server setup, no framework required.

``` html
<link rel="stylesheet" href="https://transmit.warondisease.org/assets/css/chat-widget.css">
<meta name="dih-api-base" content="https://transmit.warondisease.org">
<script src="https://transmit.warondisease.org/assets/js/chat-widget.js" defer></script>
```

Your visitors can ask about the treaty, the economics, the governance model, or why humanity spends 604 times more on killing capacity than testing medicines. Every answer is grounded in peer-reviewed research with linked sources.

### Why Organizations Should Embed This

The [Earth Optimization Prize](../../knowledge/strategy/earth-optimization-prize.llms.md)^([3](../references.llms.md#ref-earth-optimization-prize-paper-2025)) has two targets by [2040](../../knowledge/appendix/parameters-and-calculations.llms.md#sec-destructive_economy_50pct_year): global HALE reaching [79.4 years (90% CI: 70.2 years-90.7 years)](../../knowledge/appendix/parameters-and-calculations.llms.md#sec-prize_target_hale_year_15) and median income reaching [\$4,381 (90% CI: \$3,292-\$5,411)](../../knowledge/appendix/parameters-and-calculations.llms.md#sec-prize_target_median_income_year_15). Every person who learns about the 1% Treaty and registers a vote earns you an Earth Optimization Point. Targets met, the prize pool goes to Earth Optimization Points holders. Targets missed, depositors still beat their retirement accounts.

Embedding Wishonia is how you play. Every visitor who asks a question and decides to support the treaty is a point. The widget does the teaching. You paste three lines of HTML.

The upside per person is [\$2.93 million (90% CI: \$1.29 million-\$4.91 million)](../../knowledge/appendix/parameters-and-calculations.llms.md#sec-treaty_personal_upside_income_plus_health) in a world that stops wasting [\$101 trillion (90% CI: \$59.6 trillion-\$161 trillion)](../../knowledge/appendix/parameters-and-calculations.llms.md#sec-political_dysfunction_global_opportunity_cost_total)/year on political dysfunction. The downside is three lines of HTML.

### Or Just Link to It

Send people to [transmit.warondisease.org](https://transmit.warondisease.org) for the full chat experience with conversation history, voice chat, and the robot.

## Put the Scoreboard on Your Website

The arcade mortality scoreboard (the bar pinned to the bottom of this site, counting the deaths that research could eventually prevent) is embeddable. Same deal as the widget: paste HTML, no API key, no build step. The [embed configurator](https://manual.warondisease.org/assets/scoreboard-embed.html) previews all five bar designs live and generates the code for you.

### The Full Scoreboard

One line. You get the pinned HUD, the fullscreen math screen when a visitor clicks the score, and the button pointing at the vote:

``` html
<script src="https://manual.warondisease.org/assets/js/mortality-counters.js" defer></script>
```

The script loads its own stylesheet, derives the manual’s address from its own URL, and fetches live parameter values. If the parameter fetch fails, the counters fall back to values hard-coded in the script; they tick either way.

Pick a layout and a visual theme with one more line each (options and live previews in the [configurator](https://manual.warondisease.org/assets/scoreboard-embed.html)):

``` html
<meta name="dih-scoreboard-variant" content="instrument-panel">
<meta name="dih-scoreboard-theme" content="arcade">
```

Every interaction fires a `dih-scoreboard` CustomEvent on `document` (`bar-shown`, `bar-dismissed`, `overlay-opened`, `overlay-closed`, `cta-clicked`, `variant-changed`, `theme-changed`, each tagged with the active `variant` and `theme`), so you can measure which design converts with whatever analytics you already run.

### Counters Without the Bar

If you want live numbers inside your own prose without our scoreboard eating the bottom of your screen, keep the script tag and add one more meta tag, then write spans wherever you want numbers:

``` html
<meta name="dih-disable-features" content="delay-counter-hud">
<script src="https://manual.warondisease.org/assets/js/mortality-counters.js" defer></script>

<p>Since the plan went public,
<span data-dih-delay-value="since-publication">counting</span>
people have died of diseases that research could eventually prevent,
at <span data-dih-delay-value="per-second">1.6</span> per second.</p>
```

The span’s text content is replaced and re-rendered about eight times a second. Whatever you put inside is the loading state.

**Counter types (`data-dih-delay-value`):**

| Value | Renders |
|----|----|
| `since-publication` | Preventable deaths since the plan’s publication date, live |
| `per-day` | Preventable deaths per day of delay |
| `per-minute` | Per minute |
| `per-second` | Per second |
| `suffering-hours-since-publication` | Hours of healthy life lost since publication, live |
| `suffering-hours-per-second` | Hours of healthy life lost per second |
| `money-since-publication` | Dollars burned on war + disease since publication, live |
| `money-per-second` | Dollars burned per second |
| `timeline-lives` | Projected lives saved by the accelerated timeline |
| `timeline-dalys` | Projected healthy life-years saved |
| `publication-date` | The publication date the clocks count from |

Add `data-dih-delay-compact="true"` to any span for compact notation (“139K” instead of “138,942”).

### How the Numbers Stay Honest

Every figure the scoreboard renders is computed from the same [parameters.json](#json-language-agnostic) that generates this book, and the fullscreen rules screen links each number to [its source and math](../../knowledge/appendix/parameters-and-calculations.llms.md). If you embed the scoreboard, you inherit the receipts. Disputes are welcome; rigged machines do not publish their wiring.

1\.

Sinn, M. P. *The 1% Treaty*. <https://manual.warondisease.org/knowledge/solution/1-percent-treaty.html> (2025) doi:[10.5281/zenodo.20076511](https://doi.org/10.5281/zenodo.20076511)

*Your governments possess nuclear weapons sufficient to end civilization 122 times but have not cured Alzheimer’s once. This treaty asks them to be 1% more rational.*

2\.

Sinn, M. P. *The 1% Treaty: An Incentive-Compatible Approach to Ending War and Disease*. <https://manual.warondisease.org/knowledge/economics/1-pct-treaty-impact.html> (2025) doi:[10.5281/zenodo.18161560](https://doi.org/10.5281/zenodo.18161560)

*6,650 diseases have zero FDA-approved treatments; at current trial capacity, exploring them takes  443 years. Redirecting 1% of military spending scales capacity 12.3x, cutting the timeline to  36 years and preventing 10.7 billion deaths. At \$0.02/DALY, 9.3kx more cost-effective than the best existing interventions. The result holds across every specified adoption pathway.*

3\.

Sinn, M. P. *The Earth Optimization Prize*. <https://manual.warondisease.org/knowledge/strategy/earth-optimization-prize.html> (2025) doi:[10.5281/zenodo.19076597](https://doi.org/10.5281/zenodo.19076597)

*Reward humanity for raising healthy life years and median income within 15 years. PRIZE keeps depositors on the failure branch, VOTE rewards recruiters on the success branch, and Earth Optimization Protocol v1 is only the current instruction manual for trying to win.*

4\.

World Health Organization. WHO global health estimates 2024. *World Health Organization* <https://www.who.int/data/gho/data/themes/mortality-and-global-health-estimates> (2024)

*Comprehensive mortality and morbidity data by cause, age, sex, country, and year Global mortality:  55-60 million deaths annually Lives saved by modern medicine (vaccines, cardiovascular drugs, oncology):  12M annually (conservative aggregate) Leading causes of death: Cardiovascular disease (17.9M), Cancer (10.3M), Respiratory disease (4.0M) Note: Baseline data for regulatory mortality analysis. Conservative estimate of pharmaceutical impact based on WHO immunization data (4.5M/year from vaccines) + cardiovascular interventions (3.3M/year) + oncology (1.5M/year) + other therapies. Additional sources: https://www.who.int/data/gho/data/themes/mortality-and-global-health-estimates*

.
