Address #15; Lay Validation Foundation; Light Cleanup Work#17
Address #15; Lay Validation Foundation; Light Cleanup Work#17olivia-banks wants to merge 19 commits intoEpiForeSITE:edward_branchfrom
Conversation
|
There's still some more cleanup I have to do on the YAML side. |
There was a problem hiding this comment.
Pull request overview
This PR restructures the Streamlit app into a src/epicc/ package layout and introduces a format read/write + validation foundation (Pydantic-backed) for loading parameters and model/config YAML/XLSX in a uniform way, with accompanying unit tests.
Changes:
- Migrates the app from top-level
app.py+utils/+models/intosrc/epicc/(new__main__.py,config/,formats/,model/,models/,utils/). - Adds a new FRW (format read/write) layer for YAML/XLSX plus Pydantic validation and template generation.
- Adds pytest-based tests for the formats and model loader, and updates dependencies (PyYAML → ruamel-yaml, adds Pydantic).
Reviewed changes
Copilot reviewed 35 out of 43 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Updates locked dependencies (adds Pydantic + ruamel-yaml; removes PyYAML). |
| pyproject.toml | Updates runtime deps (adds pydantic[email], ruamel-yaml; removes PyYAML). |
| .gitignore | Adds ignores for common dev/build artifacts. |
| app.py | Removes old top-level Streamlit entrypoint. |
| config/app.yaml | Removes old app config file (migrated). |
| config/global_defaults.yaml | Removes old global defaults file (migrated). |
| config/paths.yaml | Removes old model path config (no longer used). |
| models/tb_isolation.py | Removes old dynamic python-file model module. |
| models/measles_outbreak.py | Removes old dynamic python-file model module. |
| utils/model_loader.py | Removes old model discovery/dynamic import loader. |
| utils/parameter_loader.py | Removes old YAML/XLSX parameter loader utilities. |
| utils/parameter_ui.py | Removes old Streamlit parameter UI renderer. |
| utils/section_renderer.py | Removes old section renderer. |
| src/epicc/main.py | New Streamlit app entrypoint using the new package structure. |
| src/epicc/web/sidebar.css | Adds CSS for sidebar styling. |
| src/epicc/config/init.py | Adds config loader (resource-based) and exports CONFIG. |
| src/epicc/config/schema.py | Adds Pydantic config schema models. |
| src/epicc/config/default.yaml | Adds default app config YAML. |
| src/epicc/formats/init.py | Adds format registry, validation wrapper, and read_from_format. |
| src/epicc/formats/base.py | Introduces the BaseFormat FRW interface. |
| src/epicc/formats/yaml.py | Adds YAML FRW backend (ruamel-yaml). |
| src/epicc/formats/xlsx.py | Adds XLSX FRW backend (openpyxl). |
| src/epicc/formats/template.py | Adds template generation from Pydantic models. |
| src/epicc/model/init.py | Adds model loader for schema-based YAML models. |
| src/epicc/model/base.py | Adds BaseSimulationModel ABC for Python-based models. |
| src/epicc/model/schema.py | Adds Pydantic schema for YAML-defined models. |
| src/epicc/models/tb_isolation.py | Ports TB Isolation model to BaseSimulationModel. |
| src/epicc/models/tb_isolation.yaml | Adds default parameters for TB Isolation model. |
| src/epicc/models/measles_outbreak.py | Ports Measles Outbreak model to BaseSimulationModel. |
| src/epicc/models/measles_outbreak.yaml | Adds default parameters for Measles Outbreak model. |
| src/epicc/utils/model_loader.py | Defines built-in model registry (returns model instances). |
| src/epicc/utils/parameter_loader.py | Adds typed parameter loading + flattening via FRW. |
| src/epicc/utils/parameter_ui.py | Adds updated Streamlit parameter UI rendering helpers. |
| src/epicc/utils/section_renderer.py | Adds updated section rendering utilities. |
| src/epicc/utils/excel_model_runner.py | Refactors existing Excel runner (style cleanup; reuses shared flatten_dict). |
| tests/epicc/test_formats.py | Adds tests for format selection + read_from_format. |
| tests/epicc/test_formats_yaml.py | Adds YAMLFormat tests (read/write, error cases). |
| tests/epicc/test_formats_xlsx.py | Adds XLSXFormat tests (read/write, error cases). |
| tests/epicc/test_formats_template.py | Adds template generation integration tests (YAML + XLSX). |
| tests/epicc/test_model_loader.py | Adds tests for schema-based model loader. |
| sample/TB Isolation.xlsx | Adds sample Excel file for TB Isolation. |
| sample/Measles Outbreak.xlsx | Adds sample Excel file for Measles Outbreak. |
| sample/~$TB Isolation.xlsx | Adds an Excel temp/lock file (artifact). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I'm sure #21 will be ready before this one, but I want to merge this one after so that I can resolve conflicts instead of the other way around since that seems like the least complicated path. |
So, merge 21 and then this? |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…treamlit into ob-organize
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…treamlit into ob-organize
- Use Pyodide-recommended stlite detection (sys.platform/sys.modules) - Remove duplicate running_in_stlite() definition (F811) - Escape HTML labels with html.escape() in parameter_ui.py - Fix Makefile: UV ?= for env override, smelected typo, inline mkdir - Remove -> None from build_index.py main() - Fix AGENTS.md function contract for render_parameters_with_indent - Fix Excel reset callback to use consistent model_key Agent-Logs-Url: https://github.com/EpiForeSITE/epiworldPythonStreamlit/sessions/60bec289-6a09-4711-a403-13e7f0eb4742 Co-authored-by: gvegayon <893619+gvegayon@users.noreply.github.com>
|
We're moving over from one bundled HTML to a bunch of hashed fragments so that we can fetch in parallel and load quite a bit faster (we need to download megabytes of data, so I think this is worth it). Bundle structure is now like this: This is for all resource files and whatnot. The mapping is in Previously, we were also duplicating the needed packages between the build script and This should be ready for another review, then merging into |
|
@EddW1219, you really wanted to do a forced-push? |
|
I just started resolving, I'm not sure why there are vastly more conflicts this time around. Maybe because of the force-push? Regardless, looking at the patches of the commits, it looks like I should just be able to merge in the changes piecewise. |
|
@gvegayon Resolved, moved over the requisite changes and did a |
Address #15 and lay foundation for validation; light cleanup work. Running list of changes:
./app.py→./src/epicc/).importlib.resourcesfor increased flexibility under differing deployment conditions (necessary for when we package withmicropipfor WASM/stlite).standardtype checking.validate_yaml#15 for dealing with arbitrary opaque dictionaries in various formats (YAML/XLSX) while preserving non-semantic (trivia) elements.BaseModel).pytest.Rename fromepicc(Epi Cost Calculator) to the new project name, once decided upon.We're introducing some dependencies here, but they are already baked into
pyodide, which is whatstliteuses under the hood, so there's no extra overhead!Discussion for the FRW may be found here.