Skip to content

Fix leave parental home process - #510

Merged
Mariia-Var merged 10 commits into
simpaths:developfrom
Mariia-Var:MV-fix-leavePH-process
Aug 25, 2026
Merged

Fix leave parental home process#510
Mariia-Var merged 10 commits into
simpaths:developfrom
Mariia-Var:MV-fix-leavePH-process

Conversation

@Mariia-Var

Copy link
Copy Markdown
Collaborator

No description provided.

…50), i.e. individuals not in a continuous education spell. SimPaths excluded students on current activity status (les_c4 == Student) instead. The two differ for people who re-entered education, who have labC4 = Student but eduSpellFlag = False: they are in the estimation sample but were blocked from leaving home.

  - Use eduSpellFlag == True instead of les_c4 == Student, so the filter matches ded == 0. Re-entrant students can now leave home.
  - Move the process out of aging() into its own Person.Processes.ConsiderLeavingHome event, scheduled after EducationLevelAlignment so the spell flag is current for the simulated year.
  - Move the age and adult-child conditions from the aging() call site into the process.
  - Add Parameters.MIN_AGE_LEAVE_PH and
    MAX_AGE_ADULT_CHILD for future configurability.

  Output will shift, as the household split now happens after the education module.
Copilot AI lite review requested due to automatic review settings August 25, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the “leave parental home” logic to run as its own yearly process (rather than being triggered from aging), specifically positioning it after education updates so continuous-education cases are excluded consistently. As a result, the integration-test expected outputs are updated to reflect the changed simulation trajectory.

Changes:

  • Add a dedicated yearly scheduled event to evaluate adult children leaving the parental home after education processes run.
  • Refactor Person.considerLeavingHome() eligibility rules (age bounds, only process adult children above minimum age, exclude continuous education).
  • Update integration-test expected CSV outputs to match the new simulation results.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/java/simpaths/model/SimPathsModel.java Schedules the new ConsiderLeavingHome process after education steps.
src/main/java/simpaths/model/Person.java Adds the process hook and refines the leaving-home logic/filters.
src/main/java/simpaths/data/Parameters.java Introduces MIN_AGE_LEAVE_PH / MAX_AGE_ADULT_CHILD and initializes the max-age bound.
src/test/java/simpaths/integrationtest/expected/Statistics21.csv Updates expected demographics/health/labour aggregate outputs for integration tests.
src/test/java/simpaths/integrationtest/expected/Statistics1.csv Updates expected distributional statistics outputs for integration tests.
src/test/java/simpaths/integrationtest/expected/HealthStatistics1.csv Updates expected health-related outputs for integration tests.
src/test/java/simpaths/integrationtest/expected/EmploymentStatistics1.csv Updates expected employment-transition outputs for integration tests.
src/test/java/simpaths/integrationtest/expected/AlignmentAdjustmentFactors1.csv Updates expected alignment-factor outputs for integration tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main/java/simpaths/model/Person.java Outdated
Comment on lines 915 to +916
maxAge = maxAgeModel;
MAX_AGE_ADULT_CHILD = maxAge;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That is intentional.

Mariia-Var and others added 7 commits August 25, 2026 15:29
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
  -Drop the entity-id suffix from output filenames (Statistics21.csv ->
  DemographicStatistics.csv) by exporting singleton collections rather
  than bare objects. Row values are unchanged.

  -Split Statistics2, which held 51 columns across four domains, and
  rename the outputs for what they contain:
    Statistics                 -> WealthIncomeStatistics
    Statistics2                -> DemographicStatistics
    EmploymentStatistics       -> LabourStatistics
    AlignmentAdjustmentFactors -> AlignmentStatistics
    HealthStatistics           -> WellbeingByGender

  -HealthStatistics is now a new output for population health by age band.
  AgeBandAggregates computes the shared age-band statistics once per year,
  so the independently-toggled outputs cannot drift apart.

  -Remove 12 calibration residuals reporting simulated minus an outdated
  2019 UKHLS target; nothing read them.

  -Add OutputReadme, writing README.md beside the CSVs with the run
  configuration (population size, years, runs, alignment, bootstrapAll).

  -Config keys follow the field renames; old keys are silently ignored.
  -Drop the entity-id suffix from output filenames (Statistics21.csv ->
  DemographicStatistics.csv) by exporting singleton collections rather
  than bare objects. Row values are unchanged.

  -Split Statistics2, which held 51 columns across four domains, and
  rename the outputs for what they contain:
    Statistics                 -> WealthIncomeStatistics
    Statistics2                -> DemographicStatistics
    EmploymentStatistics       -> LabourStatistics
    AlignmentAdjustmentFactors -> AlignmentStatistics
    HealthStatistics           -> WellbeingByGender

  -HealthStatistics is now a new output for population health by age band.
  AgeBandAggregates computes the shared age-band statistics once per year,
  so the independently-toggled outputs cannot drift apart.

  -Remove 12 calibration residuals reporting simulated minus an outdated
  2019 UKHLS target; nothing read them.

  -Add OutputReadme, writing README.md beside the CSVs with the run
  configuration (population size, years, runs, alignment, bootstrapAll).

  -Config keys follow the field renames; old keys are silently ignored.
  - Guard both denominators in AgeBandAggregates: empty age bands and
    bands with no workers no longer divide by zero. Non-empty bands are
    unchanged.
  - Give WellbeingByGender a distinct entity id per gender group
    (Total=1, Male=2, Female=3); the constant id collided on the JPA
    primary key across the three rows written each year.
  - Rename setStats/getStats2/setStats2 to match their fields.
  - Fix stale Statistics.csv reference in default.yml.
…ender.java

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Mariia-Var Mariia-Var closed this Aug 25, 2026
@Mariia-Var Mariia-Var reopened this Aug 25, 2026
@Mariia-Var
Mariia-Var merged commit 6aee02b into simpaths:develop Aug 25, 2026
6 checks passed
@Mariia-Var
Mariia-Var deleted the MV-fix-leavePH-process branch August 28, 2026 15:21
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