relsa-severity-assessment

Multivariate severity assessment and humane endpoint prediction for laboratory animal studies using the RELSA (RELative Severity Assessment) score and ARIMA-based foRcast forecasting. Use when combining welfare readouts — body weight or weight loss, body temperature, clinical or nesting scores, biom

By k-dense-ai · 398 installs

npx skills add k-dense-ai/scientific-agent-skills --skill relsa-severity-assessment

Source repository · Upstream listing

RELSA severity assessment and exploratory score forecasting Overview This skill computes reference relative multivariate scores and exploratory ARIMA forecasts. It targets the equations and printed example of [RELSA 0.0.1.9000](https://github.com/mytalbot/RELSA) (commit e68e8451e8719ccc3600179f55900cd7254ede9d , current upstream at review), plus the published [foRcast methodology](https://doi.org/10.3389/fphys.2026.1869563). The Python forecast helper is an independent nonseasonal approximation, not an exact R port. RELSA is the RMS of directional deviations divided by each variable's reference maximum deviation . Zero means no measured worsening in those directions; it does not establish normal welfare. One is a reference scale unit, not a universal endpoint or an upper bound. Different variables may attain their reference extrema in different animals or at different times, so the reference cohort need not contain a score of exactly one. Forecasts estimate a score at a specified time , not time to endpoint or probability of death. Keep the approved study's observation schedule and humane endpoint criteria separate from these exploratory outputs. See [Boundaries]( boundaries state these when you report). When to use this skill Combining weight loss, temperature, clinical scoring, biomarkers, or telemetry into a single per animal severity score Asking which animals in a cohort are at risk of reaching a humane endpoint, or predicting the severity score at a coming time point Comparing severity between treatment groups, interventions, or animal models on a common relative scale Defining thresholds or zones on a severity scale from the data Writing the severity assessment section of an animal welfare report, a 3Rs/refinement analysis, or an application under EU Directive 2010/63/EU For general forecasting of a time series that is not a severity score, use timesfm forecasting or statsmodels . For study design and sample size, use experimental design and statistical power . Installation Run the examples from this skill directory. relsa score.py needs numpy/pandas; kde thresholds.py additionally needs scipy; statsmodels is required for forecasting and matplotlib only for figures. Data format One row per animal per time point, in a CSV: id treatment condition day temp weight score il6 M01 treated endpoint 1 37.15 25.17 0 35.1 M01 treated endpoint 0 37.26 25.25 0 39.5 M01 treated endpoint 1 35.83 23.12 4 162.0 id and a time column ( day , time , hour , …) are required; treatment and condition are optional labels used for grouping and for selecting the reference set. Time must be finite, with one consistent unit and origin across cohorts. Forecast training and target times must align with the chosen regular grid; disable interpolation only on regular observations. The RELSA convention codes the baseline time point as 1 . One row per animal per time point. Average hourly telemetry to one value per interval first (the published models average heart rate, HRV, and temperature, and sum activity). Preserve lexical animal IDs (including leading zeros). Duplicate IDs/times, nonnumeric measurements and infinities are rejected. Leave missing measurements empty. They are dropped from the score, never imputed — a missing value treated as "no deviation" biases severity downward. assets/example cohort.csv is a small synthetic cohort (6 mice, 9 days, temperature, body weight, an 0–8 clinical score, and an IL 6 like biomarker) used by every command below, so each one is runnable as written. The four decisions that determine the result Make these explicitly and write them into the methods. Nothing else about the procedure matters as much. 1. Directionality — which variables rise under worsening? Falling is the default (body weight, activity, food intake, burrowing, wheel running). Variables that rise must be declared as turned : clinical scores, inflammatory biomarkers, fever, tachycardia. Get this wrong and the variable contributes nothing at all, silently, because deviations in the "wrong" direction are floored at zero. Body temperature is model dependent — it falls in sepsis and endotoxaemia, rises in fever models. Nothing in the data can settle this for you: in the published sepsis model activity legitimately swings further above baseline than below, so only a variable that never once moves the declared way is detectable, and build reference() warns about exactly that case. 2. The reference set — relative to what? RELSA scores mean nothing without it. Choose a scientifically characterized reference and document its burden; the 2026 forecasting study uses the group assumed to carry the greatest burden in each model. A mild reference can push new scores above 1; too severe compresses everything toward 0. Save it with save reference and reuse it with load reference so later cohorts stay on the same scale. New CLI reference files also store and reuse normalization, ordinal mappings, baseline selection and rounding; conflicting options are rejected. Legacy references lack that contract and require the original options. 3. Scores with a zero baseline. A clinical score of 0 in a healthy animal cannot be ratio normalized — 0/0 is undefined. Use score scale score=8 to map the score's scale instead (healthy → 100%, worst possible → 200%), which also marks it as turned. This assumes meaningful numeric spacing between ordinal categories. An affine rescaling applied identically to reference and target cancels in the weight ratio before rounding; the category encoding, healthy anchor and reference cohort still matter. State those choices. The alternative is to keep the score out of RELSA and use it as an independent endpoint criterion. 4. Which variables are measured throughout. Because the score averages over whichever variables are available, a variable that appears or disappears mid trajectory moves the score by itself. An intermittent measure joining only at the endpoint can lower or raise the composite without any change in the other observed measures. relsa scores() warns when composition changes; score the variables present throughout. Workflow Step 1 — compute RELSA scores The reference model is echoed so the scale is auditable: relsa scores.csv holds each variable's weight alongside the score, which is what makes a score explainable — here M01 deteriorating to its endpoint, M03 peaking on day 3 and recovering: A weight of 1.00 means that variable hit the reference maximum; n vars is how many variables entered the score at that time point. Same thing from Python, when you need the objects: Step 2 — forecast a score at a known evaluation time For retrospective evaluation, use recorded endpoint times and train only on earlier observations. This synthetic example predicts scores at designated times; it does not validate humane endpoint detection: The CSV includes the selected order, point forecast and bounds. Numerical values can change with the fitted model and library release. Report RMSE, PICP and MPIW together, including counts and forecast failures. High coverage with wide intervals can be uninformative. For prospective evaluation, freeze the RELSA reference set and any KDE thresholds using a separate development cohort before forecasting held out animals. Do not estimate normalization maxima or thresholds from their future endpoint observations. Label analyses that reuse endpoint data to define the scale as retrospective; use an animal level split so repeated observations from one animal do not cross evaluation partitions. For rolling retrospective evaluation, forecast each next observed time using only its history: Interpolation defaults to 0.1 input time units for published method exploration. It creates no independent information, changes autocorrelation and can narrow intervals without valid calibration. Use interpolate step 0 for regular observed data and compare interpolation sensitivity on held out animals. Off grid targets and irregular uninterpolated observations are rejected rather than silently relabeled. Unconverged fits are not selected. Bounds are Gaussian model intervals clipped at zero, conditional on fitted parameters and the frozen scale; they exclude reference, preprocessing and model selection uncertainty. ARIMA represents linear dependence after differencing; it does not anticipate abrupt unobserved deterioration. Inspect both interval width and upper bound alongside observed welfare signs and approved criteria. No bound is an automatic intervention rule. Step 3 — put the score in context with severity zones The example deliberately filters to treated animals; choose the target population explicitly. Thresholds are the minima of the score density — the sparse valleys between clusters of scores. A development population may include endpoint animals, survivors and shams, but sampling frequency, follow up duration and their proportions change the density. Freeze that choice before evaluation; do not pool incompatible reference frames. Check bandwidth and sampling sensitivity. See references/thresholds and zones.md . An empty threshold list is legitimate. Minima are properties of the sampled score density; zone names do not establish welfare states. The thin zone filter is this implementation's heuristic, not a published validated threshold rule. Boundaries: state these when you report RELSA and forecasts support assessment; observed distress and approved humane endpoint criteria take precedence. No low score authorizes delaying care or extending a procedure. KDE zones are not EU severity categories. The [Commission severity framework](https://environment.ec.europa.eu/topics/chemicals/animals science en) distinguishes prospective classification, monitoring and actual experienced severity; there is no official RELSA to category conversion. Comparisons require the same frozen reference, variable panel, encoding, baseline and measurement methods. The original paper explored cross model comparisons in a common frame; independently scaled models cannot be ranked by their raw RELSA numbers. The 2026 paper evaluates 13 endpoint time forecasts. Its reported 96% PICP is consistent with averaging seven model rows (six 100%, one 75%), not pooled animal coverage: 12/13 is 92.3%. Its 1.69 MPIW is likewise a model row mean; this helper pools predictions. False negatives and false positives can both matter. Predefine monitoring responses with the study's responsible personnel; do not turn a candidate KDE minimum into an endpoint. Reporting checklist A severity analysis is reproducible only if all of this is stated: 1. Outcome measures, their units, and their directionality (which were turned, and why). 2. The baseline time point or window, and which variables were normalized. 3. Any score mapping applied to ordinal variables, with its scale. 4. The reference set : which animals, which group, how many, and why they are assumed to carry the greatest burden. 5. Humane endpoint criteria actually applied in the study, separately from the RELSA score. 6. For forecasts: interpolation step, the selected ARIMA order per animal, and RMSE, PICP, and MPIW. 7. For thresholds: the bandwidth, the number of scores, and a bandwidth sensitivity sweep. 8. Software versions, and the statement that thresholds are model specific and not regulatory gradings. Common pitfalls 1. Wrong directionality — a rising variable not listed in turned contributes exactly zero, silently, and no warning is possible unless it never once falls. Check the reference model table yourself: max reached should be below 100 for a falling variable and above 100 for a turned one,