Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ent per pathogen [skip ci] The best-case arrangement of combined failure events longer than a day is chosen separately for each reference pathogen; failure days stay shared. Recorded in the C2 Spec and in CONTEXT.md (Combined failure). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Each treatment step of an assessment gets a failure frequency (failure days per year, 0-365, default 0) and a failure duration (whole minutes, 1-1440, default 30). The configurator shows both fields with their units below the LRVs, rejects values outside the ranges with a message, and keeps the values with their step through save, reopen and edit. Existing steps get the defaults via the migration. The calculation is unchanged, so results and export packages stay the same (C2 adds the effect). Tidy-up: the min <= max LRV check duplicated in the configurator and the personal treatment step form is now one shared rule, which also holds the failure ranges. The two existing treatment form tests pass the two new required fields in their input data; their assertions are unchanged. Adds the first HTTP-level tests (Django test client, logged-in user). Refs #21 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…sts (#22) A treatment step can have a failure frequency above 0 only if at least one of its six LRVs is positive (an empty LRV counts as 0), since a failure removes only positive LRVs (D4). The shared treatment step rule rejects it with a message on the failure frequency field. Guests: an invalid guest result now answers 422 with the error messages keyed by input name instead of an empty body. The configurator marks the affected inputs and treatment step and explains in the result pane why nothing ran; the marks clear on the next run. Registered users keep their path (the saved configurator re-renders with the errors). This also makes existing LRV errors visible to guests. Also fixes the treatments section from #21: its fixed height hid the failure fields and their messages under the footer; it now grows with its content. Refs #22 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tor copies them in (#23) A personal treatment step gets a failure frequency (failure days per year) and a failure duration (minutes), with the same shared rule as the configurator: ranges, whole minutes, a positive LRV for a frequency above 0 (D4), and minimum <= maximum LRV. Existing personal steps get 0 and 30 via the migration. Invalid input now shows the messages in the form (422 with the rendered form), like the duplicate-name error already did. The owner's list of personal treatment steps includes both values, and adding a personal step in the configurator copies them into the new step card together with its LRVs. Bundled steps carry no failure inputs, so their card keeps 0 and 30. The copy can be changed in the assessment without touching the personal step. Refs #23 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ts (#24) Tidy-up before treatment failures enter the calculation (C2). - The inflow concentration samples and the exposure events of the simulated years are drawn once per reference pathogen and shared by best-case and worst-case. Each event picks its sample by position, which uses exactly the same random numbers as picking it by value. - Each exposure event has its own LRV. For now every event gets the same LRV; the dose-response is evaluated once per distinct LRV and concentration sample and then looked up per event. - Summary statistics and the reference-level exceedance are computed in one place for both cases and both risk measures. The public entry point keeps its interface. Results are bit-identical: 28 scenarios (3 exposures x 3 treatment trains x 3 inflow ranges, plus a step with negative and empty LRVs) compared with exact equality before and after, 1932 values, no difference. The existing regression test only compares with a tolerance, so this was checked with a script outside the repository. A new test checks that the same scenario gives identical results. Refs #24 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…' positive LRVs (#25) For every simulated exposure event and every treatment step with a failure frequency above 0, the step fails that day with probability failure frequency / 365 (ADR-0001). The draws come from their own fixed-seed generator, one stream per step position, and are shared by both cases and all reference pathogens, so raising a failure frequency only adds failure days. Without failures no draws are made and results are exactly today's (checked on 28 scenarios, 1932 values). On a failure day, worst-case loses the positive minimum LRVs of every failing step for the whole day, whatever the failure duration. LRVs of 0 or below stay (D4). Best-case is unchanged until the mixed-water assumption (#26). The C1 test that required unchanged results with failure inputs is split: with failure frequency 0, results and export stay identical; with failures, the export keeps its files and table layout and only the values change. Refs #25 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
On a failure day, best-case uses the mixed water: water treated during the failure events and in normal operation, in proportion to the failure durations. Only positive maximum LRVs are lost (D4), and each combination of failing steps is calculated once. Combined failures of one day, counting only the steps that lose LRV for the pathogen group: - durations that fit into 1,440 minutes do not overlap (one step: Eq. 5); - two steps longer than a day in total overlap by the extra minutes; - three or more steps longer than a day in total count like worst-case: all these steps are down for the whole day. The last rule replaces the lowest-concentration arrangement decided on 2026-09-24. That needed a linear program, and scipy's solver failed when the failing steps lose about 16 LRV or more together; such days are a rare exception. The C2 Spec, CONTEXT.md (Combined failure), decision 6 of the failure approach, the roadmap, the vision and ticket 09 / #26 are updated. Without failures results are exactly today's (28 scenarios, 1932 values). Local timing, drinking water with 3 pathogens and 5 bundled steps: 0.07 s without failures, 0.13 s at 10 and 0.19 s at 100 failure days per year on every step. Refs #26 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Sep 25, 2026
…n ticket 09 [skip ci] Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ng) [skip ci] Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Results now include treatment failures (ADR-0001). The calculation module is the only code that changes: the result page, the reference-level exceedance, saved results, the assessment comparison and the export's result table show whatever it returns, with unchanged layout.
The combined-failure rule changed during implementation (decided 2026-09-25). The lowest-concentration arrangement for three or more steps needed a linear program, and the standard solver failed when the failing steps lose about 16 LRV or more together. Such days are a rare exception, so they now count like worst-case. This is updated in:
CONTEXT.md(Combined failure);docs/QMRA_Failure_Approach.md;C5's independent benchmark script must implement this rule.
A C1 test that required unchanged results with failure inputs was split:
Spec and Tickets
docs/specs/c2-failure-calculation.md(Change C2 indocs/failure_roadmap.md)docs/tickets/07–09)Checks
Scientific correctness: the internal checks from the Spec pass:
Agreement with an independent calculation is C5.
Reproducibility: the same scenario gives identical results every time (fixed seeds), and assessments without failures keep their exact results.
Export stability: the export keeps its files and CSV layout; only the result values of assessments with failures change (HTTP test).
Manual check on dev
Dev currently runs C1 (#28). This deploy replaces it with C1 + C2, so please tell the team.
Definition of Done
code-reviewfindings are handled (fixed, or answered in this PR)CONTEXT.mdCombined failure, vision MVP item 3, failure approach decision 6)🤖 Generated with Claude Code