Overview
How to read the API
The API is arranged upstream-to-downstream. Materials and operating data support scenario selection. Scenario selection drives source models. Source models generate release information for dispersion, fire, explosion, and effect modules. Those outputs then support hazard-analysis workflows and map-facing application layers.
materials -> scenario -> source -> dispersion/effects -> hazard evaluation
Module
Materials
Material records provide upstream physical properties, toxicological data, flammability information, and reactivity screening inputs. These records are packaged as registry data rather than embedded directly in model code.
| Endpoint | Purpose | Notes |
|---|---|---|
GET /materials |
List or search material records. | Use first when building selector UIs and notebook workflows. |
GET /materials/{materialId} |
Fetch a material record with physical-property context. | Use as the canonical record for source-term setup. |
GET /materials/{materialId}/toxicity |
Fetch toxic criteria starter data for the material. | Supports AEGL, ERPG, IDLH, TLV, PEL, and toxic endpoint workflows. |
GET /materials/{materialId}/flammability |
Fetch flammability-relevant material details. | Useful upstream of ignition and fire calculations. |
Module
Health and Industrial Hygiene
These routes support concentration conversion, exposure screening, probit evaluation, TWA calculations, ventilation screening, and occupational-style interpretations that often sit beside consequence models in applications.
| Representative endpoints | Inputs | Outputs |
|---|---|---|
POST /health/convert-concentration |
ppm, mg/m3, molecular weight, temperature | converted concentration and unit-aware metadata |
POST /health/probit/evaluate |
dose variable, coefficients, exposure duration | probit value and estimated response probability |
POST /industrial-hygiene/ventilation/dilution |
generation rate, room volume, air changes | steady-state screening concentration |
ppm to mg/m^3 conversion
\[ C_{\mathrm{mg/m^3}} = C_{\mathrm{ppm}} \cdot MW \cdot \frac{P}{R_{\mathrm{atm}} T} \cdot 10^{-3} \]Generic probit
\[ Y = k_1 + k_2 \ln(V) \]Time-weighted average
\[ \mathrm{TWA} = \frac{\sum_i C_i t_i}{\sum_i t_i} \]Dilution ventilation screening
\[ Q_{\mathrm{required}} = \frac{G}{C_{\mathrm{target}}} \cdot \mathrm{mixing\_factor} \]Symbol meaning and units
| Symbol | Meaning | Expected unit |
|---|---|---|
C_mg/m3 | Concentration expressed as mass per unit volume. | mg/m^3 |
C_ppm | Concentration expressed as parts per million by volume. | ppm(v/v) |
MW | Molecular weight of the material. | g/mol |
P | Absolute pressure used for gas-volume conversion. | Pa |
R_atm | Gas constant used in the concentration conversion relation. | J/(mol*K) |
T | Absolute temperature. | K |
Y | Probit variable before conversion to response probability. | dimensionless |
k1 | Empirical probit intercept supplied by the selected toxicological, thermal, or blast correlation. | dimensionless |
k2 | Empirical probit slope multiplying the natural logarithm of the dose variable. | dimensionless when paired with the coefficient source's required dose units |
V | Generic dose variable used by the selected probit model. | model-dependent; must match the units assumed by k1 and k2 |
TWA | Time-weighted average exposure. | same concentration unit as the input samples |
C_i | Concentration during interval i. | mg/m^3, ppm, or the chosen concentration basis |
t_i | Duration of interval i. | min, s, or h; use one consistent time unit within the sum |
Q_required | Required ventilation flow rate. | m^3/s |
G | Contaminant generation rate. | mg/s or kg/s, consistent with the concentration basis |
C_target | Target airborne concentration to maintain by ventilation. | mg/m^3 or kg/m^3 |
mixing_factor | Dimensionless allowance for imperfect mixing or local inefficiency. | dimensionless |
10^-3 | Conversion factor used to align ppm, g/mol, Pa, and SI gas-constant units with mg/m^3 output. | dimensionless conversion factor |
Module
Scenario and Source Models
This family converts inventory, geometry, pressure, temperature, and failure assumptions into release rate, release duration, total released mass, and phase-state information. Realistic-case, worst-case, and conservative analysis are first-class API choices.
Choked gas release
\[ \dot{m} = C_d A P_0 \sqrt{ \frac{k}{ZRT_0} \left(\frac{2}{k+1}\right)^{\frac{k+1}{k-1}} } \]| Endpoint family | Examples | Why it matters |
|---|---|---|
scenario |
POST /scenario-engine/define, POST /source-models/scenario/select |
Separates realistic and worst-case assumptions explicitly. |
gas release |
POST /source-models/gas-hole, POST /source-models/gas-pipe |
Pipe and hole discharge with choked and non-choked screening. |
liquid release |
POST /source-models/liquid-hole, POST /source-models/tank-hole |
Hydrostatic and pipe-based outflow. |
phase change |
POST /source-models/flashing-liquid, POST /source-models/conservative-analysis |
Flashing fraction, rainout, and conservative release handling. |
scenario templates |
GET /scenario-library/templates |
Provides application-ready starting points for common release scenarios. |
Hole or orifice area
\[ A = \frac{\pi d^2}{4} \]Pipe friction screening multiplier
\[ M_f = \frac{1}{\sqrt{1 + fL/D}} \]Liquid tank-hole release velocity
\[ v = C_d \sqrt{2gh} \]Liquid pipe release velocity
\[ v = C_d \sqrt{\frac{2\Delta P}{\rho}} \]Volumetric and mass release rate
\[ Q = Av \qquad \dot{m} = \rho Q \]Inventory-limited release mass
\[ m_{\mathrm{total}} = \min \left(\dot{m} \, t_{\mathrm{release}}, \, m_{\mathrm{inventory}}\right) \]Flash fraction screening
\[ f_{\mathrm{flash}} = \frac{c_{p,\mathrm{liquid}} \left(T_{\mathrm{storage}} - T_{\mathrm{boil}}\right)}{\Delta H_{\mathrm{vap}}} \]Pool area screening
\[ A_{\mathrm{pool}} = \frac{m_{\mathrm{liquid}}}{\rho \, \mathrm{thickness}} \cdot \mathrm{spreading\_factor} \]Symbol meaning and units
| Symbol | Meaning | Expected unit |
|---|---|---|
m_dot | Mass release rate. | kg/s |
C_d | Discharge coefficient representing contraction and dissipative losses at the opening. | dimensionless |
A | Hole or effective discharge area. | m^2 |
P0 | Upstream absolute stagnation or storage pressure. | Pa |
k | Ratio of specific heats c_p/c_v for the gas. | dimensionless |
Z | Compressibility factor accounting for deviation from ideal-gas behavior. | dimensionless |
R | Gas constant used in the choked-flow relation. | J/(kg*K) or J/(mol*K), matching the implementation basis |
T0 | Upstream absolute temperature. | K |
pi | Geometric constant for circular area calculation. | dimensionless |
d | Hole or orifice diameter. | m |
M_f | Pipe-friction screening multiplier applied to ideal discharge. | dimensionless |
f | Darcy friction factor for the pipe. | dimensionless |
L | Pipe length from source to breach. | m |
D | Internal pipe diameter. | m |
v | Exit velocity of liquid or gas at the breach. | m/s |
g | Gravitational acceleration used for hydrostatic discharge. | m/s^2 |
h | Liquid head above the hole centerline. | m |
DeltaP | Driving pressure difference across the opening. | Pa |
rho | Fluid density. | kg/m^3 |
Q | Volumetric release rate. | m^3/s |
m_total | Total released mass over the modeled duration. | kg |
t_release | Release duration. | s |
m_inventory | Available inventory that caps the release. | kg |
f_flash | Estimated flash fraction of the released liquid. | dimensionless fraction |
cp_liquid | Liquid specific heat capacity. | J/(kg*K) |
T_storage | Storage temperature before release. | K |
T_boil | Boiling temperature at the downstream pressure basis. | K |
DeltaH_vap | Latent heat of vaporization. | J/kg |
A_pool | Estimated liquid pool surface area. | m^2 |
m_liquid | Mass of liquid available to form the pool. | kg |
thickness | Assumed average pool thickness. | m |
spreading_factor | Empirical factor representing spreading tendency or containment effects. | dimensionless |
Module
Dispersion
Dispersion routes transform source-term outputs into concentration fields, threshold-distance screens, isopleths, and map-ready payloads. Continuous releases, puff releases, and dense-gas screening are separated so applications can choose the proper release interpretation.
Gaussian plume
\[ C = \frac{\dot{Q}}{2 \pi u \sigma_y \sigma_z} \exp\!\left(-\frac{y^2}{2\sigma_y^2}\right) \left[ \exp\!\left(-\frac{(z-H)^2}{2\sigma_z^2}\right) + \exp\!\left(-\frac{(z+H)^2}{2\sigma_z^2}\right) \right] \]| Representative endpoints | Typical inputs | Typical outputs |
|---|---|---|
POST /dispersion/gaussian-plume |
release rate, wind speed, stability class, receptor location | concentration at receptor and supporting metadata |
POST /dispersion/gaussian-puff |
released mass, wind speed, stability class, receptor location | instantaneous puff concentration screening |
POST /dispersion/isopleth |
source term plus selected toxic threshold | distance and contour-ready values |
POST /dispersion/toxic-endpoints/evaluate |
stored dispersion result and one or more toxic criteria | max threshold distances and exceeded-area screening |
POST /dispersion/prevention-mitigation |
release rate and mitigation factor | revised scenario parameters after mitigation screening |
Gaussian plume
\[ C = \frac{\dot{Q}}{2 \pi u \sigma_y \sigma_z} \exp\!\left(-\frac{y^2}{2\sigma_y^2}\right) \left[ \exp\!\left(-\frac{(z-H)^2}{2\sigma_z^2}\right) + \exp\!\left(-\frac{(z+H)^2}{2\sigma_z^2}\right) \right] \]Gaussian puff screening
\[ C = \frac{M}{(2\pi)^{3/2} \sigma_y^2 \sigma_z} \exp\!\left[ -\frac{1}{2} \left( \frac{y^2}{\sigma_y^2} + \frac{z^2}{\sigma_z^2} \right) \right] \]Dense-gas map screening
\[ C(x,y) \approx \frac{M_{\mathrm{release}}}{R_{\mathrm{cloud}} L_{\mathrm{cloud}}} \exp\!\left[-\left(\frac{|y|}{R_{\mathrm{cloud}}}\right)^2\right] \exp\!\left[-\left(\frac{x}{L_{\mathrm{cloud}}}\right)^2\right] \]Mitigated release
\[ \dot{m}_{\mathrm{revised}} = \dot{m}\left(1-\mathrm{mitigation\_factor}\right) \]Symbol meaning and units
| Symbol | Meaning | Expected unit |
|---|---|---|
C | Predicted airborne concentration at the receptor or map location. | kg/m^3 or mg/m^3, consistent with the source term |
Q_dot | Continuous emission rate used by the plume model. | kg/s |
u | Mean wind speed at the release height. | m/s |
sigma_y | Lateral dispersion parameter. | m |
sigma_z | Vertical dispersion parameter. | m |
y | Crosswind offset from the plume centerline. | m |
z | Vertical receptor elevation above ground. | m |
H | Effective release height, including physical and plume-rise effects if modeled. | m |
M | Total mass instantaneously released for the puff model. | kg |
x | Downwind distance from the release point. | m |
R_cloud | Characteristic lateral spread radius for the dense-gas cloud screen. | m |
L_cloud | Characteristic downwind cloud length scale for the dense-gas screen. | m |
M_release | Total mass available to the dense-gas cloud. | kg |
m_dot_revised | Release rate after prevention or mitigation credit is applied. | kg/s |
m_dot | Original or unmitigated release rate. | kg/s |
mitigation_factor | Fractional reduction credited to a mitigation measure. | dimensionless fraction between 0 and 1 |
pi | Geometric constant from the Gaussian normalization term. | dimensionless |
exp(...) | Exponential attenuation term used to represent Gaussian spread in space. | dimensionless function |
Module
Fire and Explosion
These routes convert flammable releases into ignition, fire, explosion, blast, and BLEVE screening outputs. They are structured so applications can chain flammability, source, ignition, and damage calculations without collapsing everything into one call.
Thermal radiation
\[ q = \frac{\tau_a \chi_r \dot{m} \Delta H_c}{4 \pi r^2} \]| Submodule | Representative endpoints | Notes |
|---|---|---|
| Fire | POST /fire-explosion/bleve, plus /fire-explosion-models/solve for jet_fire and pool_fire |
Jet fire, pool fire, and fireball/BLEVE screening are supported. |
| Explosion | POST /fire-explosion/tnt-equivalency, POST /fire-explosion/multi-energy, POST /fire-explosion/vce |
VCE severity is driven by cloud size, ignition delay, and congestion. |
| Flammability | POST /fire-explosion/flammability/mixture, POST /fire-explosion/loc, POST /fire-explosion/ignition-energy |
Supports ignition and inerting-oriented integrations. |
Jet or pool fire radiation
\[ q = \frac{\chi_r \dot{m} \Delta H_c}{4 \pi r^2} \]Pool burning rate
\[ \dot{m}_{\mathrm{pool}} = A_{\mathrm{pool}} m^{\prime\prime}_{\mathrm{burn}} \]Fireball diameter and duration screening
\[ D_{\mathrm{fb}} = 5.8 \, m_{\mathrm{fuel}}^{0.325} \qquad t_{\mathrm{fb}} = 0.45 \, m_{\mathrm{fuel}}^{0.26} \]TNT equivalency
\[ W_{\mathrm{TNT}} = \frac{m_{\mathrm{fuel}} \Delta H_c \eta}{\Delta H_{\mathrm{TNT}}} \]Scaled distance
\[ Z = \frac{R}{W_{\mathrm{TNT}}^{1/3}} \]Overpressure screening
\[ P = \frac{1772}{Z^3} + \frac{114}{Z^2} + \frac{10.4}{Z} \]VCE yield factor screening
\[ \eta_{\mathrm{vce}} = \min \left(0.3,\; 0.03 + 0.005 t_{\mathrm{delay}} + 0.05 \, \mathrm{congestion} \right) \]Symbol meaning and units
| Symbol or coefficient | Meaning | Expected unit |
|---|---|---|
q | Incident thermal radiation or heat flux at the receptor. | kW/m^2 or W/m^2, consistent with DeltaH_c |
tau_a | Atmospheric transmissivity between flame and receptor. | dimensionless fraction |
chi_r | Radiative fraction of the combustion energy release. | dimensionless fraction |
m_dot | Burning or release mass rate feeding the fire model. | kg/s |
DeltaH_c | Heat of combustion of the fuel. | kJ/kg or J/kg, consistent with the selected heat-flux unit basis |
r | Distance from flame center or source to receptor. | m |
A_pool | Pool surface area contributing to burning. | m^2 |
m''_burn | Pool burning flux, meaning mass burned per unit area per unit time. | kg/(m^2*s) |
D_fb | Estimated fireball diameter. | m |
t_fb | Estimated fireball duration. | s |
m_fuel | Mass of fuel participating in the fireball or explosion screen. | kg |
5.8 | Empirical fireball diameter coefficient for the current screening correlation. | m/kg^0.325 |
0.325 | Empirical exponent relating fuel mass to fireball diameter. | dimensionless exponent |
0.45 | Empirical fireball duration coefficient for the current screening correlation. | s/kg^0.26 |
0.26 | Empirical exponent relating fuel mass to fireball duration. | dimensionless exponent |
W_TNT | Equivalent TNT mass for blast estimation. | kg TNT equivalent |
eta | Explosion yield efficiency used to convert fuel energy to blast energy. | dimensionless fraction |
DeltaH_TNT | Reference specific energy of TNT. | kJ/kg or J/kg |
Z | Sachs scaled distance. | m/kg^(1/3) |
R | Stand-off distance from the explosion center. | m |
P | Peak overpressure predicted by the screening correlation. | kPa in the current fitted form |
1772, 114, 10.4 | Empirical blast-fit coefficients used with the current scaled-distance overpressure screen. | chosen so that P is returned in kPa when Z is in m/kg^(1/3) |
eta_vce | Estimated vapor-cloud-explosion yield factor. | dimensionless fraction |
0.3 | Upper cap on the screening VCE yield factor. | dimensionless |
0.03 | Base VCE yield factor before delay and congestion adjustments. | dimensionless |
0.005 | Ignition-delay sensitivity coefficient in the VCE yield screen. | 1/s |
t_delay | Ignition delay between release and ignition. | s |
0.05 | Congestion sensitivity coefficient in the VCE yield screen. | dimensionless per congestion unit |
congestion | Congestion severity factor representing obstructed geometry within the flammable cloud. | dimensionless |
Module
Effects and Toxic Criteria
Effect models convert concentration, radiation, or overpressure into consequence metrics such as fatality probability, burn probability, and dose-response curves. Toxic criteria endpoints provide the threshold values these downstream calculations are typically compared against.
| Family | Representative endpoints | Purpose |
|---|---|---|
effect-models |
POST /effect-models/solve with toxic_probit, thermal_probit, explosion_probit, and dose-response variants |
Converts physical exposure variables into human-impact screening outputs. |
toxic criteria |
POST /toxic-criteria/lookup, GET /materials/{materialId}/toxicity |
Returns AEGL, ERPG, IDLH, TLV, PEL, and toxic endpoint starter values. |
population summaries |
included in effect responses through population_distribution or population_count |
Estimates expected fatalities or burn cases by exposure zone. |
Toxic load and toxic probit
\[ L_{\mathrm{toxic}} = C^n t \qquad Y = a + b \ln\!\left(L_{\mathrm{toxic}}\right) \]Thermal load and thermal probit
\[ L_{\mathrm{thermal}} = q^{4/3} t \qquad Y = a + b \ln\!\left(L_{\mathrm{thermal}}\right) \]Explosion probit
\[ Y = a + b \ln\!\left(P_{\mathrm{pa}}\right) \]Probability from probit
\[ \Pr(\mathrm{response}) = \frac{1}{2}\left[1 + \operatorname{erf}\!\left(\frac{Y-5}{\sqrt{2}}\right)\right] \]Expected cases
\[ E[\mathrm{cases}] = \mathrm{population} \cdot \Pr(\mathrm{response}) \]Symbol meaning and units
| Symbol or coefficient | Meaning | Expected unit |
|---|---|---|
L_toxic | Toxic dose load used by the selected toxic probit model. | concentration^n * time, matching the source correlation |
C | Airborne toxic concentration at the receptor. | ppm, mg/m^3, or the unit required by the selected correlation |
n | Empirical concentration exponent governing how toxicity scales with concentration. | dimensionless exponent |
t | Exposure duration. | s or min, matching the source correlation |
Y | Probit value before conversion to response probability. | dimensionless |
a | Empirical probit intercept from the selected toxic, thermal, or explosion response dataset. | dimensionless |
b | Empirical probit slope multiplying the natural logarithm of the dose variable. | dimensionless when dose units match the correlation source |
L_thermal | Thermal dose load used by the thermal probit relation. | (kW/m^2)^(4/3) * s or the equivalent chosen basis |
q | Incident thermal radiation at the receptor. | kW/m^2 |
P_pa | Overpressure expressed in pascals for the explosion probit relation. | Pa |
Pr(response) | Predicted response probability, such as fatality or injury probability. | dimensionless fraction between 0 and 1 |
5 | Standard median probit value corresponding to 50 percent response. | dimensionless |
sqrt(2) | Normalization constant from the normal-distribution transform used to convert probit to probability. | dimensionless |
E[cases] | Expected number of affected people in the exposed population. | persons |
population | Population count or equivalent represented by the exposure zone. | persons |
Module
Prevention, Reactivity, and Relief
These modules support inerting, static electricity screening, area classification, relief selection and sizing, and reactivity screening so teams can connect consequence outputs back to design and safeguard decisions.
| Family | Representative endpoints | Use |
|---|---|---|
| Prevention | POST /prevention/inerting/purge, POST /prevention/area-classification |
Supports design review and ignition-risk reduction. |
| Reactivity | POST /reactivity/calorimetry/interpret, POST /reactivity/screening |
Supports reactive-chemistry screening and control framing. |
| Relief | POST /relief/devices/select, POST /relief/sizing/gas-vapor |
Supports discharge-path and emergency-relief analysis. |
| Prevention-response screening | POST /prevention-response-models/solve |
Bundles fire triangle, inerting, ignition energy, release prevention, and emergency response screens. |
Purge gas requirement screening
\[ V_{\mathrm{purge}} = \frac{V_{\mathrm{vessel}} \cdot \mathrm{cycles}}{\mathrm{purity}} \]Liquid relief sizing
\[ A_{\mathrm{relief}} = \frac{\dot{m}}{C_d \sqrt{2 \rho \Delta P}} \]Gas or vapor relief sizing
\[ A_{\mathrm{relief}} = \frac{\dot{m}} {C_d P_{\mathrm{set}} \sqrt{ \frac{k}{R_{\mathrm{specific}} T} \left(\frac{2}{k+1}\right)^{\frac{k+1}{k-1}} }} \]Two-phase relief screening
\[ A_{\mathrm{relief}} = \frac{\dot{m}}{25 \sqrt{\mathrm{quality} + 0.1}} \]External fire relief screening
\[ A_{\mathrm{relief}} = \mathrm{wetted\_area} \cdot 2.5 \times 10^{-5} \]Thermal expansion relief screening
\[ A_{\mathrm{relief}} = V_{\mathrm{blocked}} \beta \Delta T \cdot 10^{-4} \]Deflagration vent screening
\[ A_{\mathrm{vent}} = V_{\mathrm{enclosure}}^{2/3} \left[\frac{K}{P_{\max} P_{\mathrm{red}}}\right] \cdot 0.1 \]Symbol meaning and units
| Symbol or coefficient | Meaning | Expected unit |
|---|---|---|
V_purge | Total purge gas volume required. | m^3 |
V_vessel | Internal free volume of the vessel being purged. | m^3 |
cycles | Number of complete gas-exchange cycles assumed by the purge strategy. | dimensionless |
purity | Target inert-gas purity or displacement effectiveness expressed as a fraction. | dimensionless fraction between 0 and 1 |
A_relief | Required relief flow area. | m^2 |
m_dot | Mass rate that must be discharged through the relief path. | kg/s |
C_d | Relief-device discharge coefficient. | dimensionless |
rho | Liquid density for liquid relief sizing. | kg/m^3 |
DeltaP | Pressure drop available across the relief device. | Pa |
P_set | Relief valve set pressure or upstream relieving pressure basis. | Pa |
k | Ratio of specific heats for gas or vapor relief sizing. | dimensionless |
R_specific | Specific gas constant of the relieved fluid. | J/(kg*K) |
T | Absolute relieving temperature. | K |
quality | Vapor mass fraction used in the two-phase sizing screen. | dimensionless fraction |
25 | Empirical denominator coefficient in the current two-phase relief screening relation. | kg/(s*m^2) scaled to the adopted quality basis |
0.1 | Empirical offset preventing the two-phase quality term from collapsing to zero at very low quality. | dimensionless |
wetted_area | Externally heated vessel area exposed to the fire. | m^2 |
2.5e-5 | Empirical external-fire relief area coefficient used by the current screening model. | m^2 relief area per m^2 wetted area |
V_blocked | Blocked-in liquid volume subject to thermal expansion. | m^3 |
beta | Volumetric thermal expansion coefficient of the liquid. | 1/K |
DeltaT | Temperature increase applied to the blocked-in system. | K |
1e-4 | Empirical conversion coefficient used by the current thermal-expansion relief screen. | m^2/m^3 |
A_vent | Required deflagration vent area. | m^2 |
V_enclosure | Enclosure volume subject to deflagration venting. | m^3 |
K | Vent sizing severity coefficient representing enclosure and fuel reactivity effects. | model-specific coefficient |
Pmax | Maximum explosion pressure for the vented deflagration basis. | bar(g) or kPa, consistent with the chosen venting standard basis |
Pred | Reduced pressure target after venting. | same pressure unit as Pmax |
0.1 in A_vent | Empirical scaling coefficient used by the current deflagration vent screening relation. | m^2/m^2 after the pressure term basis is applied |
Module
Hazard Evaluation
Hazard-evaluation routes are meant to consume the physical outputs of upstream models rather than stand alone as isolated templates. This keeps scenario-based workflows anchored to the same source, dispersion, and effect assumptions used elsewhere in the API.
| Endpoint | Purpose | Typical application |
|---|---|---|
POST /hazard-evaluation/hazop |
Guideword-driven node review with explicit consequence hooks. | PHA workshops and structured design review. |
POST /hazard-evaluation/fmea |
Failure mode oriented hazard review. | Equipment-focused integrity and controls review. |
POST /hazard-evaluation/what-if |
What-if scenario generation from inputs and assumptions. | Fast early-stage or field review workflows. |
POST /hazard-evaluation/information-requirements/validate |
Checks whether the material, equipment, procedure, and operating-condition basis is complete enough for hazard review. | Useful before running structured reviews or agent workflows at scale. |
Integration Contracts
POST endpoint families, expected JSON, and governing formulas
These tables are designed as implementation contracts. Each row shows the expected top-level JSON shape and the primary physics relation the endpoint family applies.
Scenario and source controllers
| Endpoint family | Expected JSON keys | Primary formula(s) |
|---|---|---|
POST /scenario-engine/define |
incident_type, classification, inventory, equipment, failure_mode, meteorology, topography |
Scenario assumptions selection; source formulas applied downstream. |
POST /source-models/* |
Model-specific payload. Typical keys: geometry/area, pressure, temperature, density, duration, inventory. | m_dot_choked, m_dot_nonchoked, v = C_d * sqrt(2gh), v = C_d * sqrt(2*DeltaP/rho), f_flash |
POST /source-models/solve |
{\"model_type\": \"...\", \"inputs\": {...}} |
Dispatches to source formulas above by model_type. |
Dispersion controllers
| Endpoint family | Expected JSON keys | Primary formula(s) |
|---|---|---|
POST /dispersion/gaussian-plume |
releaseRate, windSpeed, stabilityClass, releaseHeight, receptorGrid |
C_plume = Q_dot / (2*pi*u*sigma_y*sigma_z) * ... |
POST /dispersion/gaussian-puff |
releasedMass, windSpeed, stabilityClass, receptorGrid |
C_puff = M / ((2*pi)^(3/2)*sigma_y^2*sigma_z) * ... |
POST /dispersion/dense-gas |
releasedMass or releaseRate, gasDensityKgM3, releaseDurationS, windSpeed, receptorGrid |
Dense-gas slumping screening relation (reduced-gravity style proxy). |
POST /dispersion/isopleth |
dispersionResultId, threshold |
Threshold contour extraction from computed concentration field. |
POST /dispersion/toxic-endpoints/evaluate |
dispersionResultId, criteria[] |
Distance extraction where C >= criterion. |
POST /dispersion/prevention-mitigation |
releaseRate, mitigationFactor, windSpeed |
m_dot_revised = m_dot * (1 - mitigation_factor) |
POST /dispersion-models/solve |
{\"model_type\": \"...\", \"inputs\": {...}} |
Dispatches plume/puff/dense-gas relations by model_type. |
Fire, explosion, and effects controllers
| Endpoint family | Expected JSON keys | Primary formula(s) |
|---|---|---|
POST /fire-explosion/* |
Depends on controller. Typical keys: fuel/cloud mass, heat of combustion, distance, ignition/congestion terms. | q = chi_r*m_dot*DeltaH_c/(4*pi*r^2), W_TNT, Z, P(Z) |
POST /fire-explosion-models/solve |
{\"model_type\": \"jet_fire|pool_fire|...\", \"inputs\": {...}} |
Dispatches fire/explosion submodel formulas by model_type. |
POST /effect-models/solve |
{\"model_type\": \"toxic_probit|thermal_probit|...\", \"inputs\": {...}} |
Y = a + b*ln(dose), Pr = 0.5*(1+erf((Y-5)/sqrt(2))) |
POST /toxic-criteria/lookup |
{\"model_type\": \"toxic_criteria_lookup\", \"inputs\": {...}} or direct criteria payload |
Registry lookup/merge (criteria retrieval, not transport formula). |
Prevention, reactivity, relief, and hazard controllers
| Endpoint family | Expected JSON keys | Primary formula(s) |
|---|---|---|
POST /prevention/* |
Method-specific payload (for example purge, static-risk, area-classification fields). | V_purge = V_vessel * cycles / purity and screening score relations. |
POST /reactivity/* |
Calorimetry/screening/control payloads with chemistry and process context. | Screening relations and rule-based control logic. |
POST /relief/* |
Service/sizing payloads: required mass rate, density, pressure, temperature, quality, enclosure terms. | A_relief_liquid, A_relief_gas, A_relief_two_phase, A_vent |
POST /hazard-evaluation/* |
Study payload (nodes/modes/guidewords/checklists/context fields). | Structured workflow controllers that consume upstream model outputs. |
POST /prevention-response-models/solve |
{\"model_type\": \"...\", \"inputs\": {...}} |
Dispatches prevention-response screening relations by model_type. |
GIS, visualization, and sign controllers
| Endpoint family | Expected JSON keys | Primary formula(s) |
|---|---|---|
POST /gis/scenarios/evaluate |
scenario_type, source, receptors[], model_id, inputs, constants |
Applies selected model per receptor with haversine distance pre-processing. |
POST /gis/impact-zones |
scenario_type, source, asset, criteria[], constants |
Impact radius relation from selected impact model, then geodesic circle polygon mapping. |
POST /visualization/solve |
{\"layer_type\": \"plume_map|heatmap|...\", \"inputs\": {...}} |
Transforms modeled outputs into layer-specific map payloads. |
POST /signs/analyze |
observed_text and/or image payload, optional locale/site context fields |
Text classification heuristics to seed scenario and impact workflows. |
POST JSON templates
Use these templates as controller-level payload contracts.
Service solver template
{
"model_type": "gaussian_plume",
"inputs": {
"...": "model-specific input fields"
}
}
Model calculate template
{
"inputs": { "...": "model input fields" },
"constants": { "constant.name": 123.0 }
}
GIS scenario evaluation template
{
"scenario_type": "leak",
"source": { "latitude": 0.0, "longitude": 0.0, "label": "Source" },
"receptors": [
{ "id": "r1", "latitude": 0.0, "longitude": 0.0, "label": "Receptor 1" }
],
"model_id": "dispersion.gaussian_puff_ground",
"inputs": { "...": "scenario/model inputs" },
"constants": { "constant.name": 123.0 }
}
GIS impact-zones template
{
"scenario_type": "fire",
"source": { "latitude": 0.0, "longitude": 0.0, "label": "Source" },
"asset": { "...": "asset fields" },
"criteria": [
{ "label": "Primary ring", "threshold": 12.5, "unit": "kW/m^2" },
{ "label": "Awareness ring", "threshold": 4.0, "unit": "kW/m^2" }
],
"constants": { "fire.default_radiative_fraction": 0.35 }
}
Sign analysis template
{
"observed_text": "High pressure gas pipeline",
"site_context": "roadside corridor",
"topography": "urban",
"stability_class": "D",
"wind_speed_m_s": 3.0
}
Analytical Reference
Analytical formulas used across the API
This section collects the main screening equations surfaced by the current endpoint families. These are intentionally visible so downstream applications can show the mathematical basis directly in the user interface.
Scenario and source terms
\[ \begin{aligned} A &= \frac{\pi d^2}{4} \\ v_{\mathrm{liquid}} &= C_d \sqrt{2gh} \\ v_{\mathrm{pipe}} &= C_d \sqrt{\frac{2\Delta P}{\rho}} \\ Q &= Av \\ \dot{m} &= \rho Q \\ m_{\mathrm{total}} &= \min\!\left(\dot{m} t_{\mathrm{release}}, m_{\mathrm{inventory}}\right) \\ f_{\mathrm{flash}} &= \frac{c_{p,\mathrm{liquid}}(T_{\mathrm{storage}}-T_{\mathrm{boil}})}{\Delta H_{\mathrm{vap}}} \\ A_{\mathrm{pool}} &= \frac{m_{\mathrm{liquid}}}{\rho \, \mathrm{thickness}} \cdot \mathrm{spreading\_factor} \end{aligned} \]Gas release
\[ \begin{aligned} \dot{m}_{\mathrm{choked}} &= C_d A P_0 \sqrt{ \frac{k}{ZRT_0} \left(\frac{2}{k+1}\right)^{\frac{k+1}{k-1}} } \\ \dot{m}_{\mathrm{nonchoked}} &= C_d A P_0 \sqrt{ \frac{2k}{ZRT_0(k-1)} \left[ r^{2/k} - r^{(k+1)/k} \right] } \end{aligned} \]Dispersion
\[ \begin{aligned} C_{\mathrm{plume}} &= \frac{\dot{Q}}{2\pi u \sigma_y \sigma_z} \exp\!\left(-\frac{y^2}{2\sigma_y^2}\right)\mathrm{image\_term} \\ C_{\mathrm{puff}} &= \frac{M}{(2\pi)^{3/2}\sigma_y^2\sigma_z} \exp\!\left[-\frac{1}{2}\left(\frac{y^2}{\sigma_y^2}+\frac{z^2}{\sigma_z^2}\right)\right] \\ C_{\mathrm{dense}} &\approx \frac{M_{\mathrm{release}}}{R_{\mathrm{cloud}}L_{\mathrm{cloud}}} \exp\!\left[-\left(\frac{|y|}{R_{\mathrm{cloud}}}\right)^2\right] \exp\!\left[-\left(\frac{x}{L_{\mathrm{cloud}}}\right)^2\right] \end{aligned} \]Fire and explosion
\[ \begin{aligned} q &= \frac{\chi_r \dot{m}\Delta H_c}{4\pi r^2} \\ \dot{m}_{\mathrm{pool}} &= A_{\mathrm{pool}} m^{\prime\prime}_{\mathrm{burn}} \\ D_{\mathrm{fb}} &= 5.8\,m_{\mathrm{fuel}}^{0.325} \\ t_{\mathrm{fb}} &= 0.45\,m_{\mathrm{fuel}}^{0.26} \\ W_{\mathrm{TNT}} &= \frac{m_{\mathrm{fuel}}\Delta H_c \eta}{\Delta H_{\mathrm{TNT}}} \\ Z &= \frac{R}{W_{\mathrm{TNT}}^{1/3}} \\ P &= \frac{1772}{Z^3} + \frac{114}{Z^2} + \frac{10.4}{Z} \end{aligned} \]Effects and exposure
\[ \begin{aligned} C_{\mathrm{mg/m^3}} &= C_{\mathrm{ppm}} MW \frac{P}{R_{\mathrm{atm}}T}10^{-3} \\ \mathrm{TWA} &= \frac{\sum_i C_i t_i}{\sum_i t_i} \\ Y &= a + b\ln(C^n t) \\ Y &= a + b\ln(q^{4/3} t) \\ Y &= a + b\ln(P_{\mathrm{pa}}) \\ \Pr(\mathrm{response}) &= \frac{1}{2}\left[1+\operatorname{erf}\!\left(\frac{Y-5}{\sqrt{2}}\right)\right] \\ E[\mathrm{cases}] &= \mathrm{population}\cdot\Pr(\mathrm{response}) \end{aligned} \]Relief and prevention
\[ \begin{aligned} V_{\mathrm{purge}} &= \frac{V_{\mathrm{vessel}}\cdot\mathrm{cycles}}{\mathrm{purity}} \\ A_{\mathrm{relief,liquid}} &= \frac{\dot{m}}{C_d\sqrt{2\rho\Delta P}} \\ A_{\mathrm{relief,gas}} &= \frac{\dot{m}} {C_d P_{\mathrm{set}} \sqrt{ \frac{k}{R_{\mathrm{specific}}T} \left(\frac{2}{k+1}\right)^{\frac{k+1}{k-1}} }} \\ A_{\mathrm{relief,two\mathchar`-phase}} &= \frac{\dot{m}}{25\sqrt{\mathrm{quality}+0.1}} \\ A_{\mathrm{vent}} &= V_{\mathrm{enclosure}}^{2/3}\left[\frac{K}{P_{\max}P_{\mathrm{red}}}\right]\cdot 0.1 \end{aligned} \]The symbol definitions above apply to these summary formulas as well. In practice, the API expects request payloads to use the units listed in the symbol tables for each module section so the fitted coefficients and empirical constants remain unambiguous.
Provenance
Constants and physical meaning
Deep Safety keeps shared constants and starter screening defaults in packaged JSON registries. The intention is to make hard-coded assumptions explicit and inspectable.
| Constant | Physical meaning | Where it is used |
|---|---|---|
shared.gravity_standard |
Standard terrestrial gravitational acceleration. | Hydrostatic liquid outflow and tank discharge relations. |
shared.universal_gas_constant |
Ideal-gas proportionality between pressure, molar volume, and temperature. | Compressible gas discharge and gas-state conversions. |
fire.default_radiative_fraction |
Fraction of combustion energy treated as radiant heat. | Jet fire, pool fire, fireball, and heat-flux screening. |
gis.earth_radius_m |
Mean Earth radius used in map-distance approximations. | GIS impact-zone calculations and map overlays. |