Skip to content

pasientsikkerhet_no: record where the scenario's ceiling came from - #170

Merged
kelkalot merged 1 commit into
SimulaMet:devfrom
avalyset:fix/pasientsikkerhet-severity-source
Nov 20, 2026
Merged

kelkalot merged 1 commit into
SimulaMet:devfrom
avalyset:fix/pasientsikkerhet-severity-source

Conversation

@avalyset

Copy link
Copy Markdown
Contributor

postprocess_pasientsikkerhet writes designed_severity when the scenario has a severity, but not designed_severity_source. The checklist judge writes both: the caller's severity_source when set, otherwise "scenario" (checklist.py:331, :503). reframing._stored_designed_severity (reframing.py:231) reads a stored ceiling only when that field is scenario, lookup or stored. Without the field, _stored_designed_severity returns None for this judge's output, so a rejudge from stored results cannot reuse the ceiling the judge applied.

This PR adds that one field, set the same way as in the checklist judge (judges/pasientsikkerhet_no.py:188). Without a scenario severity the behaviour is unchanged: no ceiling, and neither field is written. test_no_ceiling_without_a_scenario_severity is unchanged.

Tests (tests/test_pasientsikkerhet_judge.py)

  • a scenario severity without severity_source is recorded as "scenario";
  • "stored" and "lookup" are passed through;
  • without a scenario severity (None, {}, {"severity": None}, {"severity_source": "lookup"}) the output is unchanged and has neither field;
  • _stored_designed_severity returns the ceiling from this judge's output.

The first, second and fourth fail on dev (6e3e6d4) and pass here; the third passes on both.

Checked

  • Full test suite on Python 3.13 (pytest -p no:cacheprovider): 2630 passed, 13 skipped on this branch; 2625 passed, 13 skipped on dev (6e3e6d4). The five extra tests are the new ones.

AI disclosure: implemented with Claude Code.

When the scenario has a severity, write designed_severity_source as the
checklist judge does: the caller's severity_source when set, else
"scenario". reframing.rejudge reads a stored ceiling only when this field
says it came from the scenario, a lookup or a stored record. Without a
scenario severity the output is unchanged.
@kelkalot

Copy link
Copy Markdown
Collaborator

I am reviewing it but also work on another pack that builds on this, so it will go all in one go once I am done! Thanks for the input!

@kelkalot

Copy link
Copy Markdown
Collaborator

Thanks, this is correct. rejudge() reuses a stored ceiling only when the judgment names its source (_stored_designed_severity in reframing.py), and pasientsikkerhet_no did not write it. The fix records the source the way checklist, fact_check and the composed judges do.

I ran it with #169 and #173 applied on current dev: 3,869 tests pass. #173 makes the same fix for triage_match and choice_match.

Merging.

Reviewed with support from Claude Fable 5.2 (claude-fable-5-2) in Claude Code.

@kelkalot
kelkalot merged commit 8b28306 into SimulaMet:dev Nov 20, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants