Speeding up database handling in initial populations#249
Merged
andrewbaxter439 merged 23 commits intodevelopfrom Sep 25, 2025
Merged
Speeding up database handling in initial populations#249andrewbaxter439 merged 23 commits intodevelopfrom
andrewbaxter439 merged 23 commits intodevelopfrom
Conversation
Code changes to accommodate Daria's changes to the data. To make the model run, the Excel files also have to be changed (country prefix + typo in reg_fertility).
These updates work with Daria's new estimates for the UK.
I reverted the change in this commit: 913f783#diff-5519d2b0765548d40a1806f7a0acf6db8f8205065f51e0d696eea2edd111c26c, which was preventing the persister to work.
Signed-off-by: Andy Baxter <andrewbaxter439@gmail.com>
Signed-off-by: Andy Baxter <andrewbaxter439@gmail.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes database handling for initial population loading to reduce simulation startup time, particularly for early years and models with more numeric variables. The changes improve performance by converting numeric variables to appropriate database types and optimizing database fetch strategies.
Key Changes
- Converts numeric input variables (mental/physical health scores, satisfaction indices) to proper database types (DOUBLE/INT) and changes ID columns to BIGINT for consistency
- Optimizes database queries by removing eager JOINs from initial population loading and switching to lazy loading with SUBSELECT fetch mode
- Updates regression types from OrderedRegression to GeneralisedOrderedRegression for health and education models
Reviewed Changes
Copilot reviewed 13 out of 31 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/META-INF/persistence.xml | Adds new entity mappings and ORM configuration file |
| src/main/java/simpaths/model/enums/Ethnicity.java | Adds Missing ethnicity category |
| src/main/java/simpaths/model/SimPathsModel.java | Updates time trend parameters and simplifies initial population query |
| src/main/java/simpaths/model/Person.java | Adds partner health variables, new lag variables, and extensive enum additions |
| src/main/java/simpaths/model/Household.java | Changes fetch strategy from EAGER to LAZY with SUBSELECT |
| src/main/java/simpaths/model/BenefitUnit.java | Changes fetch strategy from EAGER to LAZY with SUBSELECT |
| src/main/java/simpaths/experiment/SimPathsMultiRun.java | Fixes missing country assignment in initialization logic |
| src/main/java/simpaths/experiment/SimPathsCollector.java | Adds null check for median calculation |
| src/main/java/simpaths/data/startingpop/DataParser.java | Updates database schema with proper data types and column conversions |
| src/main/java/simpaths/data/RegressionName.java | Changes regression types to GeneralisedOrderedLogit |
| src/main/java/simpaths/data/Parameters.java | Updates regression objects and column counts for new model parameters |
| src/main/java/simpaths/data/ManagerRegressions.java | Moves regression handling from OrderedRegression to GeneralisedOrderedRegression |
| config/default.yml | Reduces default population size for testing |
Files not reviewed (1)
- .idea/sqldialects.xml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
andrewbaxter439
commented
Sep 22, 2025
Collaborator
Author
andrewbaxter439
left a comment
There was a problem hiding this comment.
If this pull request was ablet o be tidied and resolved actually that would supersede #226 whilst solving problems?
Closed
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
andrewbaxter439
commented
Sep 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Note, includes changes in David's branch in #226
What
Why
loadInitialPopulationstime to ~2 minsPlease review and see if this is a sensible amendment @dav-sonn @justin-ven @igelstorm @Mariia-Var