Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate inputs when reading them in #8

Merged
merged 8 commits into from
Nov 27, 2024

Conversation

ChiragKumar9
Copy link
Collaborator

Provides a skeleton of checking whether inputs are valid based on our knowledge of them prior to them being used in the model in case they will not be used till later in the model running to try to catch errors early.

Copy link
Collaborator

@confunguido confunguido left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may have to make sure that remove paramters not used (already fixed in the other PRs).

// in the long term that makes sense for an arbitrary GI
if parameters.generation_interval <= 0.0 {
return Err(IxaError::IxaError(
"r_0 must be a non-negative number".to_string(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sounds like we don't know yet how to specify generation interval. Should we remove this for now and only leave r_0? Or at least change the error so that it doesn't say r_0

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops good catch, thanks! I like having this code there as a template for now and then we can change it as we decide on an input schema for the GI if you are ok with that?

#[test]
fn test_validate_r_0() {
let parameters = ParametersValues {
population: 1000,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using population

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agree -- I requested this to be removed in the population loader PR as that makes the most thematic sense, so I think we need to land that first. I will rebase this to main once we land that.

@ChiragKumar9 ChiragKumar9 changed the base branch from main to wtk_pop_loader November 26, 2024 01:06
@ChiragKumar9 ChiragKumar9 force-pushed the ckk_validate_inputs branch 2 times, most recently from ba2ebb9 to 74a4ce0 Compare November 27, 2024 16:21
@ChiragKumar9 ChiragKumar9 merged commit de31231 into wtk_pop_loader Nov 27, 2024
3 checks passed
@ChiragKumar9 ChiragKumar9 deleted the ckk_validate_inputs branch November 27, 2024 16:41
KOVALW added a commit that referenced this pull request Dec 4, 2024
* Added population loader

* Fix header and added example synth pop to read

* Fixed homeId camel case issue with precommit and added error propagation

* First test for pop loader

* Precommit fmt changes

* Census guardrail first pass

* Second test of invalid census tract

* loading population as bytes

* Add test to synth population loader

* pre-commit fixes

* Changed name of test

* Pre-commit fixes

* Comment changes and small fmt changes

* Pre-commit change

* Removed population from input json

* Fixed tests with helper fxn and proper results

* person_id temporary made

* Move clone so you're cloning less

* Import ixa error to parameters and fmt change

* Added IxaError propagation for parse

* Expected err message for test 2

* Fix header and added example synth pop to read

* Report skeleton

* Updating parameters for report

* Periodic report using add_periodic_plan_with_phase

* Remove duplicated csv dependency

* Fix index property

* input file with periodic report

* Validate inputs when reading them in (#8)

* validation fcn

* review comments

* pre-commit fixes

* new ixa syntax for validator in define_global_properties

* playing withpre-commit

* updated pathbuf syntax

* explicit error messages in tests

* add population_periodic_report to parameters values in test

* Migrated index property to main

* Add command line argument to overwrite reports (#20)

* flag for overwriting output files

* use consistent formatting of default value

* Tests: pop size and fixed unwrap

* Finished error propagation

* Last propagation in byte_headers

* Removed excess use and moved mod's

* Fixed test to cehck home id

* Migrated to use add_periodic_report

* update tests to explicitly check the error types

* Added write context arguments

* Deleted original periodic report script

* Added force_overwrite to report config

* Replace call to get_person_id

* FMT

---------

Co-authored-by: Guido Espana <[email protected]>
Co-authored-by: Guido Espana <[email protected]>
Co-authored-by: EKR <[email protected]>
Co-authored-by: Chirag Kumar <[email protected]>
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.

2 participants