Repository navigation
Restructure standard UI into Portfolios / Models / Analyses, upgrade to 2.5.9, add HTTPS - #55
Open
benhayes21 wants to merge 37 commits into
Open
benhayes21 wants to merge 37 commits into
benhayes21 wants to merge 37 commits into
Conversation
- Dashboard: import handle_login, add page to ui-config, fix README page list - Analyses: allow regenerating inputs after INPUTS_GENERATION_ERROR - Analyses: auto-refresh also tracks analyses generating inputs on page load - Analyses: confirm before deleting an analysis - Key cached input/output fetches on modified time so re-runs aren't stale - Settings form: keep PSEPT selection when editing a level; fix PLT label - Portfolio enrichment: don't crash on missing files; remove debug output Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 2.5.9 api_server image no longer ships curl or a shell, so the curl-based healthchecks (and install.sh's wait loop) always failed and the UI/worker never started. Check /healthcheck/ via python3 instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- mocks: add the settings / setting_templates sub-endpoints ClientInterface wraps, look records up by id, support search/delete, and deep-copy fixture data so tests can't leak state into each other - test_app: use monkeypatch instead of pytest-mock's mocker (not a dependency) and give the mock client the endpoints ClientInterface needs - test_analyses: update for the current page layout (portfolio dialog, Run/Create Analysis tabs, enriched analyses table) and test the create-portfolio form via a standalone fixture app, since AppTest closes dialogs on rerun Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Standard UI navigation is now Analyses / Portfolios / Models; the Dashboard page is removed (results open within Analyses). Scenarios keeps its own ui-config. - Portfolios: create with auto-detected OED file types, view/attach/ replace/remove files, exposure summary and map, linked analyses. - Models: schema-labelled overview, run options, parameters, perils and raw settings, plus the analyses that used the model. - Analyses: filterable list with live progress, detail with results, settings, inputs and logs; create/edit settings from platform templates, defaults files, previous analyses, uploads or model defaults. - New schema-driven analysis settings editor: controls generated from the ODS-tools analysis settings schema and the model's settings, validated with ods_tools before saving. - Shared page setup, API error messages and persistent toasts. - Remove the old settings form from create.py (Scenarios only needs create_analysis_form). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…HTTPS - Results: choose which summary level to view per perspective; output fragments read the selected level instead of always S1 - Download all outputs as .zip (repacked from the API's .tar.gz) - EP charts: full uncertainty first/default, then MeanDR; linear return period axis for all EP curves - Live run progress polls every 2s and shows 'x of y events' from num_events_complete/num_events_total (task counts otherwise); model workers now report progress via OASIS_ANALYSIS_STATUS_URL - HTTPS through Traefik: certificate from scripts/generate-certs.sh (mkcert if available, else a local CA), websecure on :443 so the server's internal IdP calls resolve, Keycloak secure route, and browser-facing http routes redirect to https when OASIS_PROTOCOL=https (now the default). /api stays available over http for API clients. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Traefik's file provider only reloads on config changes, so a regenerated certs/ui.crt wasn't served until a manual restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Streamlit's largest logo size (2rem) leaves the Oasis wordmark cramped; use 3rem, which fills Streamlit's 200px logo width without distortion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings editor: - Ground-up loss threshold moved under Advanced - Events field (ids and ranges, e.g. '1, 5, 100-120') mapped to event_ids / event_ranges - Group losses by any column of the portfolio's location/accounts files (common fields first, case-insensitive de-duplication) - 'Ceded to reinsurance (RL)' perspective alongside net of RI; RL follows the model's RI support (the model schema has no 'rl') - ALCT can only be selected with PALT: oasislmf only writes the ALCT as part of the period ALT step, so ALCT alone produced nothing Results: - SELT/SPLT default to the true mean of samples (sum / number of samples); the ORD -1 analytical mean is a separate, labelled option. Previously 'Mean (All Samples)' showed the -1 analytical mean. - RL/RI outputs with inuring priority prefixes (rl_IP1_S1_...), with an inuring priority selector; missing summary-info falls back to SummaryId instead of failing - Outputs requested but not produced show a message instead of an error - ALCT shown as a convergence chart (mean loss and CI vs samples) plus the key statistics Run progress shows the sub-task currently being worked on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes the remaining pages in #6. Also keys the Comparison page's cached inputs/outputs on the analysis modified time, so re-runs aren't stale. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#7 - outputs driven by model settings: - Honour the model's valid_output_metrics and the selected event set's valid_metrics / valid_perspectives: unsupported outputs and perspectives are disabled with an explanation, and new summary levels start with supported outputs only - Bundled defaults/ files are only offered as a settings template when the platform has no setting templates for the model #3 - pytools join-summary-info: - join_summary_info on by default in the settings editor (a template that sets it false is respected) and for Scenarios runs - Results use fields already joined into the outputs instead of joining again (no duplicate columns), and don't fail without a summary-info file Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mechanical cleanup ahead of the code quality CI: - autopep8 formatting (150 character lines) - remove unused imports and variables (incl. 19 leftover imports in scenariosGuide.py and two never-used st.container() placeholders) - docstring style (triple double quotes, summary on the first line, one-line docstrings) - document missing parameters; fix docstrings that named the wrong parameter (generate_eltcalc_fragment) or listed reinsurance_scope_file twice (PortfoliosEndpointInterface.create) No behaviour changes: 113 tests pass and all pages render against a live 2.5.9 platform. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mirrors OasisLMF's code-quality workflow: ruff (rules in pyproject.toml) and autopep8 --diff --exit-code at 150 characters. Ruff selects all pyflakes (F) checks, as flake8 did, plus OasisLMF's docstring rules. Also runs the pytest suite, which had no CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 tasks done
Add code quality CI (ruff, autopep8, pytest)
The UI and setup scripts now take the service account from OASIS_SERVICE_USERNAME_OR_ID / OASIS_SERVICE_PASSWORD_OR_SECRET (exported by install.sh from .env), falling back to .streamlit/secrets.toml. A deployment's credentials only need setting in .env, and secrets.toml can't drift from the platform's admin password. quiet_login also handles failed logins instead of crashing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The output views are Streamlit fragments, which display their own exceptions, so the earlier try/except never caught a missing output and users saw a stack trace. Results now check the file exists first. OutputInterface also finds .parquet outputs (ORD parquet_format), which were previously reported as missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A separate, credential-free app (scenarios_app.py, pages in scenarios_ui/) for showing newcomers how to run models: visitors run pre-loaded scenarios against pre-loaded exposure and explore the results, but cannot upload or delete anything. - st.navigation registers only the Scenarios pages, so the standard UI's pages are unreachable from this app (it ignores pages/) - Run a scenario: choose a scenario (cards), check its exposure (figures and map), choose samples and a loss breakdown, run with live progress, and see results on the page; 'Your runs' lists the visitor's runs - Showcase: pre-computed runs (tagged [showcase]) to explore without waiting - Compare: two runs side by side, from the showcase and the visitor's own runs (moved from pages/comparison.py; skips outputs a run didn't produce) - Guide: rewritten for newcomers, incl. samples vs analytical mean (#30) - Visitors are identified by an id in the URL (?v=...), carried on every link; runs are tagged with it, so visitors only see their own runs - Limits from the 'scenarios' config section: max samples, active runs per visitor and overall - Reuses the standard UI's results, progress and exposure components Removes the old Scenarios pages (pages/scenarios.py, scenariosGuide.py) and modules only they used, and the old guide screenshots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves the hosted demo from the separate oasis-scenarios-*.yml stack to the installer stack (2.5.9, Traefik, HTTPS): - .env.scenarios: public demo template (OASIS_PUBLIC_DEMO=true, scenarios model set, simple auth, CHANGE_ME passwords) - docker-compose.public.yml (added when OASIS_PUBLIC_DEMO=true): the UI runs the Scenarios app; only Traefik's http/https ports are published and only the UI is routed (no public API, websocket, database or broker ports); a scenarios-prune service removes visitors' runs older than OASIS_PRUNE_DAYS, keeping showcase runs - docker-compose.acme.yml (added when OASIS_ACME_EMAIL is set): Let's Encrypt certificate for the public hostname - scenarios-setup one-shot (scripts/scenarios_setup.sh): loads portfolios, settings templates and showcase runs; idempotent, runs on every deploy - install.sh: --yes for unattended redeploys; refuses a public demo with non-simple auth or CHANGE_ME placeholders; public-aware summary - scripts: add_showcase_analyses.py (new); prune_analysis.py --keep-tag; add_settings_template.py updates an existing template instead of adding duplicates; add_test_portfolios.py skips portfolios whose files are missing - scenarios/deploy_scenarios_ui.sh (run by the CD workflow) now uses install.sh - Removes oasis-scenarios-platform.yml, oasis-scenarios-ui.yml and deploy-scenarios.sh (published the API on :8000 with default admin credentials and used :latest images) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scenarios-setup waited for a single model, so on a fresh deploy it went ahead as soon as PiWind registered and skipped the settings templates and showcase runs of scenario workers still starting up. It now waits for all 14 workers' models (SCENARIOS_MIN_MODELS), and carries on with whatever has registered if some never do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Starting every showcase run at once took down a 62GB laptop: each worker ran one Celery process per CPU, and each run used every core for the lookup and the loss calculation. - Scenario and showcase runs cap their processes (kernel_num_processes / lookup_num_processes) at scenarios.processes_per_run (default 2) - Scenario workers run one task at a time (OASIS_WORKER_CONCURRENCY, default 1) with a container memory limit (OASIS_WORKER_MEM_LIMIT, default 6g), so a run that outgrows it is killed in its container - Showcase runs are started one at a time (--max-concurrent), waiting for each to finish; failed or cancelled showcase runs are replaced - Site-wide concurrent visitor runs default to 3 (was 10) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A generate-and-run passes through READY between input generation and the loss run. The showcase script took READY as finished and started the next scenario alongside it, and the Scenarios app could stop refreshing a visitor's progress and undercount active runs at that point. - add_showcase_analyses.py waits for a final status (completed, error, cancelled) - The Scenarios app counts a READY run updated in the last two minutes as still active (is_active), so a run stuck at READY doesn't block forever Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OasisPlatform's record_input_files always sets READY after input generation, ignoring its analysis_finish_status argument (generate-and-run passes RUN_STARTED). Until a worker picks up the loss run, the Analyses page stopped refreshing progress and offered a Run button for an analysis that was about to run anyway. The READY-grace rule from the Scenarios app moves to modules/status.py and is used by both apps: a READY analysis updated in the last two minutes counts as running, keeps progress refreshing, disables Run/Settings/Delete, and is labelled 'Inputs ready, starting run'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 of 8 tasks
- install.sh: the CHANGE_ME check also matched the comment in .env.scenarios that mentions CHANGE_ME, so a public deploy was always refused even with every password set. Only settings lines are checked. - prune_analysis.py built its own APIClient without an auth type, which oasislmf 2.5.9 can't authenticate (server_info 403), so the daily prune retried for 30 minutes and never deleted anything. It now uses the shared service-account login (env vars, then secrets.toml), so the password is no longer passed on the command line where it showed in the process list. The prune service also runs Python unbuffered so its log appears. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It built and pushed coreoasis/oasis_scenarios, which nothing uses since the hosted demo is deployed with install.sh: scenarios/deploy_scenarios_ui.sh builds the UI image on the server from the checked-out code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Feedback from reviewing the Scenarios app: - Choosing a scenario: a filterable, sortable table (search, peril, country, provider, type) instead of text-heavy cards. Curated titles, perils, countries and types come from scenario_info in the Scenarios config, falling back to the exposure (OED peril and country names from the ods_tools OED spec). Fixes the missing Ghana-E760461 name (#28). - PiWind removed from the Scenarios set (worker, portfolios, template, model_map): it isn't a scenario - Sample results are the default in every output, with Analytical as the second option (MELT, MPLT, ALT/PALT, legacy ELT/AAL/PLT, comparisons) - MELT, SELT and QELT get an Event selector when there's more than one event, applied to the table and the map - Showcase runs break losses down by location (level 1, with maps) where the exposure has coordinates, plus the template's totals (level 2); add_showcase_analyses.py --replace rebuilds existing showcase runs - Visitor runs default to a location breakdown when the exposure can be mapped Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Treat 0,0 as not geocoded: one coordinate check (modules.oed.has_coordinates) for the maps, the showcase script and the run page's default breakdown - Showcase runs break losses down by location when the exposure has coordinates, else by country when it spans several (EUWS), and are named with the curated scenario title - Run summary as plain text, so long scenario names aren't truncated - Key the summary level selector by analysis, so its labels update when switching runs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Showcase runs left over from scenarios removed from the config (PiWind) no longer appear on the Showcase and Compare pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…to map - Heatmaps centre and zoom on the locations with a loss, using the north-south as well as the east-west spread (Philippines-Taiwan was centred on open sea, zoomed too far in) - MELT, QELT, SELT and eltcalc only offer a Map tab when losses are grouped by location (with coordinates) or country, instead of 'No map to display.' Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scenario data lives with the scenarios: remove scenario_info from the UI config. Titles and descriptions come from each model's settings (updated in the Scenarios repo), peril and countries from its exposure. Drops the historical/synthetic type, which had no source in the scenario data. Showcase runs are labelled with their scenario's current name, so renaming a scenario doesn't need its showcase rebuilt. The test fixture's exposure and settings now match its Moroccan earthquake scenario. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Public Scenarios app on the installer stack
EUWS has an event set per storm, but ran as one scenario with only the Ciarán event set (OasisLMF/Scenarios: Ciarán is now EUWS, Domingos is added on the same model data). - euws-domingos-worker: the EUWS model folder with the Domingos config and model settings (OASIS_OASISLMF_CONFIG, OASIS_MODEL_SETTINGS_FILE) - Domingos settings template, and the EUWS portfolio for it in model_map - Setup waits for 14 models Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add Storm Domingos as its own scenario
Scenarios describe their vulnerability functions in their model settings (data_settings.vulnerability). Show them: - Run a scenario: in the chosen scenario's details - Showcase: under the scenario description - Compare: for each run, with a note that losses depend on the vulnerability functions as well as the hazard - Guide: what vulnerability functions are, which each scenario uses (from the model settings), and how to run a scenario with different ones Scenarios that don't describe them say so. Addresses #27. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vinulw
self-requested a review
November 6, 2026 16:55
Show each scenario's vulnerability functions
vinulw
reviewed
Nov 6, 2026
Numeric OED fields such as PiWind's LocNumber were cast to strings before grouping, so the bars sorted lexically, and Plotly then read the numeric-looking strings as a continuous axis. Group on the raw values and force a category axis so each value gets its own labelled bar in numeric order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Reworks the standard Oasis Python UI around three pages — Analyses, Portfolios and Models — with a schema-driven analysis settings editor, richer results, live run progress, and HTTPS. Also upgrades the stack to OasisPlatform / PiWind / oasislmf 2.5.9 and fixes the issues that upgrade exposed.
Also includes the separate, credential-free Scenarios app for the public demo (#57), Storm Domingos as its own scenario (#58) and vulnerability information for each scenario (#59), merged into this branch. See those PRs for details.
Issues
Closes #3, closes #6, closes #7, closes #16, closes #17, closes #28, closes #30, closes #51, closes #27
valid_output_metricsand event-setvalid_metrics/valid_perspectives;defaults/files are only a fallback when the platform has no templatesStandard UI
Navigation is now just Analyses / Portfolios / Models (
ui-config.json). The Dashboard page is removed — results open within Analyses.Portfolios
Models
Analyses
defaults/file, a previous analysis, an uploaded JSON or model defaults, then Create and runSettings editor (
pages/components/settings_editor.py) — controls generated from the ODS-tools analysis settings schema and the model's settings:1, 5, 100-120), peril filter, join summary infovalid_output_metrics/ event setvalid_metricsare disabled; summary levels with group-by (any column in the portfolio's OED files) and ORD outputs labelled from the schema; ALCT requires PALT (oasislmf only writes the ALCT with the period ALT)join_summary_infoon by default, so group-by fields are written into the outputsResults
rl_IP1_S1_…)-1analytical mean is a separate, labelled option (previously "Mean (All Samples)" showed the-1analytical mean)Run progress polls every 2s and shows the current sub-task and x of y events. This needs
OASIS_ANALYSIS_STATUS_URLon the model workers (added to the PiWind/Scenarios compose files) — without it the platform reports 0/0 events.Platform / deployment
api_serverhas no shell orcurl: healthchecks and theinstall.shwait loop now usepython3OASIS_PROTOCOL=https):scripts/generate-certs.shcreatescerts/ui.crtwith mkcert if installed (locally trusted), otherwise a local CA; your own cert can be dropped in:443so the server's internal IdP calls (remapped totraefik:443) work; Keycloak secure route added/apistays on http for scriptsinstall.shrestarts Traefik when the certificate changeshttps://, so http-only Keycloak logins already went through Traefik's default self-signed cert — this is what caused the browser warningBug fixes
handle_loginimport)INPUTS_GENERATION_ERRORNotes / follow-ups
event_setvalues when a model has parameters, and its dropdownoneOfnever validates, so settings are validated against the analysis schema only (model options are constrained by the controls). Worth raising with ODS-tools.summary-infofile and join-summary-info doesn't apply to RL outputs, so RL results can't be broken down by group-by fields (shown per SummaryId) - an oasislmf gap..tar.zst) can't be read by Python 3.12, so the zip download would fail for those.mkcert -installonce for a warning-free HTTPS cert.Test plan
pytest— 143 tests (page tests with mocks, settings editor incl. every parameter type, results/level selection, SELT/SPLT means, ALCT, RL prefixes, zip conversion, progress, Scenarios app)🤖 Generated with Claude Code