Skip to content

Dpg#6

Open
yolile wants to merge 27 commits into
mainfrom
dpg
Open

Dpg#6
yolile wants to merge 27 commits into
mainfrom
dpg

Conversation

@yolile
Copy link
Copy Markdown
Collaborator

@yolile yolile commented May 31, 2026

closes #2
closes #4
closes #1

See the commits for the detailed changes.

The tool is now a library, so it is easier to reuse. The library includes generating sample config files and synthetic data for testing in a new geography. I kept the Indian examples and specific scripts under contrib/india, however, I'm not sure if they are needed.

I'm also not sure if the hazard plot is needed (or all the prints).

Note that this changes the final output columns and format (for time_period). Also, the input column names.
The output column names are still kebab-cased and not snake_case; I'm not sure if this is needed.

A pypi.yml github action is still needed to automate the package publication

yolile added 14 commits May 31, 2026 18:56
- Move scripts in assets to contrib/india/maps, as they are India specific
- Remove test, as not relevant for DPG
- Move district_objectid.csv to data
- Update docs accordingly
- remove assets
…kebab-case for output/display columns

- fix generic topsis script
Note: the new outputs must be udpated at https://github.com/CivicDataLab/IDS-DRR-Data-Management/tree/main/layer/assets/indicators
- Remove Topsis class, convert to topsis fuction inside topsis_riskscore
- Calculate the worst condition only (was the only method used)
- User higher is better always (criteria was always True, True, True, True
- Output names don't need to be configurable, change them to const in common
- topsis_riskscore.py now derives the factor columns and weight vector from one ordered FACTOR_WEIGHTS list
- one spelling per config file
yolile and others added 12 commits June 1, 2026 13:32
…del` package

Move the flat scripts/ collection and config/loader.py into a src/-layout
package and add packaging so the project is pip-installable, eliminating the
sys.path.insert hack every script previously carried.

- src/disaster_risk_score_model/: the four factor modules, topsis (was
  topsis_riskscore), sample_data (was generate_sample_data), dea, common, and a
  rewritten config loader. Intra-package absolute imports replace the
  sys.path manipulation; __main__ blocks are removed.
- New cli.py exposes a single `drsm` console command (also runnable as
  `python -m disaster_risk_score_model`) with subcommands per stage plus
  init-config / generate-sample-data / run.
- config.py gains command-generated-only config resolution (--config-dir /
  RISK_MODEL_CONFIG_DIR / ./config, else a clear error), an init_config
  scaffolder, and resolve_data_dir/resolve_input_file so I/O locations come
  from the CLI/env rather than the repo root. Factor/topsis main() functions
  take config_dir/data_dir/input_file; data paths resolve under --data-dir.
- pyproject.toml (setuptools, deps, `drsm` entry point, bundled config
  templates as package data); requirements*.txt reduced to `-e .` / `-e .[dev]`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the six per-script config files (base + one per factor + topsis) with
two files that `drsm init-config` scaffolds:

- scores_config.toml: a shared [columns] table (single source of truth) plus a
  nested section per factor ([hazard.*], [exposure.*], [vulnerability.*],
  [govtresponse.*]).
- topsis_config.toml: [weights] and [classification] (required) with the
  indicators/rounding/cumulative_vars/derivations/renames sections now optional.

I/O locations leave the config entirely: [paths] is dropped: the data folder and
input filename come from --data-dir/--input-file, and the TOPSIS district lookup
and outputs are fixed names resolved under the data dir. The generic set ships
as bundled package-data templates; the India example is migrated to the same
two-file layout.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Rewrite README, getting_started, the per-factor/topsis methodology docs, the
  India example README, CONTRIBUTING and SECURITY to use the `drsm` commands and
  the two-file config, replacing the old `python scripts/*.py` + per-file config
  references.
- Drive the smoke test through the CLI (`python -m disaster_risk_score_model`) in
  a temp working dir; point test_dea at the package import; delete the obsolete
  sys.path conftest.
- CI installs the package (`pip install -e .[dev]`) and sets MPLBACKEND=Agg.
- Move data_dictionary.csv to docs/ (it is reference documentation, not data) and
  gitignore the top-level data/ wholesale: it is now just the default --data-dir
  scratch space, with MASTER_VARIABLES.csv / district_objectid.csv regenerated by
  `drsm generate-sample-data`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…non-configurable

To more standard and generic names. Add checks to ensure they are present
@yolile yolile marked this pull request as ready for review June 2, 2026 00:31
@yolile yolile requested a review from saurabhlevin June 2, 2026 00:31
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.

Replace Gurobi solver with PuLP for linear programming Update README and create documentation Update risk-score-model scripts for reuse

1 participant