Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 332bab8500
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| p = repo.project_path(active) | ||
| if filename.endswith(".zip"): | ||
| with zipfile.ZipFile(io.BytesIO(decoded), "r") as zf: | ||
| zf.extractall(p) |
There was a problem hiding this comment.
Import ZIP contents into the active project files
The import callback extracts uploaded ZIPs directly into project_path(active), but the export callback stores files under a top-level <project>/... prefix. Importing an exported archive therefore creates .../<active>/<active>/observations.csv instead of replacing .../<active>/observations.csv, so the UI reports success while subsequent reads still use the old project data.
Useful? React with 👍 / 👎.
| if selected.empty: | ||
| return selected | ||
|
|
||
| counts = selected.groupby("subcriterion_id")["country"].nunique() |
There was a problem hiding this comment.
Require non-null values in completeness filtering
Completeness is currently based only on whether each selected country has a row for a subcriterion, not whether each row has a numeric raw_value. If one selected country has a blank value, that subcriterion remains eligible, produces NaN normalized values, and later score aggregation silently drops those NaNs, so countries are compared using different effective criteria.
Useful? React with 👍 / 👎.
| "level": "category", | ||
| "category_id": cid, | ||
| "subcriterion_id": "", | ||
| "weight_value": float(cweight), |
There was a problem hiding this comment.
Normalize category weights during matrix ingestion
Ingestion normalizes subcriterion weights from percentages (>1) to fractions, but category weights are written as-is. When category rows are percentages (for example 33), later global normalization divides all weights by 100, including already-normalized subcriterion weights, which scales them down a second time and distorts score magnitudes.
Useful? React with 👍 / 👎.
Motivation
data/projects/<project_slug>with CSV-backed persistence and tooling to create, duplicate, import, and export projects.weights.csvfor a project.Description
src/app/theme.pyandsrc/app/ui/with pages forprojects,data_editor,weights, andviz, plus the app entrysrc/app/main.pywiring Dash callbacks and controls (country limit, raw vs normalized toggle, profile selector, snapshot/project export/import).src/app/domain/includingnormalization.py(min-max per subcriterion withdirectioninversion and completeness exclusion),scoring.py(sub -> category -> overall aggregation and percentage weight normalization), andvalidation.py(schema and sum-to-1 checks).CSVProjectRepositoryinsrc/app/data/csv_repo.pyplus a repository interfaceProjectRepository, default project seeding underdata/projects/default, and a skeletonsqlite_repo.pyfor V2.src/app/services/ingest_matrix.pyto parse the matrix CSV into longobservations.csvandweights.csv, andsrc/app/services/snapshot_export.pyto build the snapshot CSV used by the Visualizations page.scripts/start.pyto launch the server and open a browser, README and ARCHITECTURE docs, and unit tests intests/for normalization, scoring/weights, and ingestion.Testing
python -m compileall src testswhich completed successfully and verified modules compile without syntax errors.pytest -qin this environment but collection/execution failed because runtime dependencypandas(and other packages) were not installed, so unit tests could not execute here.pip install -e .[dev]to install dependencies but the environment blocked network access (proxy error) so dependency installation failed and prevented running the test suite in this run.Codex Task