Jump to content

Module:RiskLadder/doc

From RiskiPedia

This is the documentation page for Module:RiskLadder

Template:Documentation subpage

Description

This module provides a "risk context" for small probabilities. It is designed to be called by the {{RiskLadder}} template.

When given a fractional probability, it finds a "risk equivalent" from a predefined list and displays it to the user. This helps make abstract, small numbers (like "1-in-100,000") feel more tangible by comparing them to a more familiar risk (e.g., "your risk of a fatal incident on a single skydive").

The module logic: 1. Converts the probability (e.g., `0.00001`) into its "1-in-X" form (e.g., `100,000`). 2. Searches Module:RiskLadder/Data to find the comparison risk with the closest "X" value. 3. Randomly selects one comparison from that risk's "pool" (if there are multiple). 4. Displays the comparison in a formatted box.

Usage

Via Template (Recommended)

The primary way to use this module is through the {{RiskLadder}} template.

{{RiskLadder|PROBABILITY|SEED}}
  • `PROBABILITY` (required): The fractional probability. E.g., `0.00005` or `5.0E-5`.
  • `SEED` (optional): A number. Use this if you have multiple `RiskLadder` calls on the same page and want them to show different comparisons.

Via #invoke (for testing)

You can also call the module directly from wikitext.

{{#invoke:RiskLadder|main
  | prob = PROBABILITY
  | seed = SEED
}}

Examples

Wikitext Result
{{#invoke:RiskLadder|main|prob=0.00005|debug=1}} (1-in-20,000) Template:RiskLadder
{{#invoke:RiskLadder|main|prob=0.00005|seed=1}} (1-in-20,000, seed 1) Template:RiskLadder
{{#invoke:RiskLadder|main|0.00005|2}} (1-in-20,000, seed 2) Template:RiskLadder
{{RiskLadder|0.0000011}} (1-in-909,091) Template:RiskLadder
{{RiskLadder|0.005}} (1-in-200) Template:RiskLadder
{{RiskLadder|0.05}} (Out of range) Template:RiskLadder
{{RiskLadder|}} (No probability) Template:RiskLadder


See Also