refactor: Remove unsupported growthRate for demography. #438
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.
Problem
While reading some age structure code, I encountered an unexpected XML attribute.
This attribute is related to population growth.
For at least 10 years, OpenMalaria has just thrown an exception if this attribute is used with any nonzero value. So the code is not really useful.
Solution
This PR removes schema-level support for the XML attribute and deletes code related to it.
Testing
(macOS CI fails but this is addressed in a separate PR #437)
Nonzero values for the growthRate attribute were not supported before this PR anyway.
Before:
When one added growthRate="0.1" to the node in the example, XML, the output when running OpenMalaria is:
Error: Population growth rate provided.
In: example_scenario.xml
After:
Now, if one adds growthRate="0.1" to the node in the example, XML, the output when running OpenMalaria is:
XSD error: instance document parsing failed
:29:83 error: attribute 'growthRate' is not declared for element 'demography'
Documentation
Wiki docs are already consistent with the behaviour before and after this PR, no update is needed.
https://github.com/SwissTPH/openmalaria/wiki/ModelDemography
Notes
I chose to leave a variable called
rhoinstead of just hardcoding a value of 0 everywhere it's used because that seems more readable to me.