Skip to content

fix: validate mid-parental height inputs - #107

Merged
pacharanero merged 1 commit into
livefrom
fix/mid-parental-height-validation
Sep 4, 2026
Merged

pacharanero merged 1 commit into
livefrom
fix/mid-parental-height-validation

Conversation

@pacharanero

Copy link
Copy Markdown
Member

Summary

Recreates and updates the validation contributed by Dr Akanimoh Osutuk (@FibrinLab) in #78 on a clean branch from current live.

  • Validate maternal and paternal heights before calculation.
  • Reject None, booleans, non-numeric values, and non-finite values with clear ValueError messages.
  • Reject heights outside the existing -8 to +8 SDS error limits.
  • Validate sex and reference values explicitly.
  • Preserve the existing public function signatures and results for valid inputs.
  • Add coverage for invalid inputs and accepted boundary values.

The stale Quickstart.ipynb runtime-output changes and the unused absolute maximum-height constant from the original branch are intentionally omitted.

API compatibility

This does not change valid API output. The API server currently computes the same parental-height SDS values and rejects values outside -8 to +8 SDS before calling mid_parental_height_z(). Valid requests therefore reach the same calculation with unchanged output. This package-level validation protects direct Python consumers and provides the same guard at the source.

Attribution

The implementation commit retains FibrinLab <fibrinlab@gmail.com> as its author and includes Marcus Baw as co-author for the current-tree recreation and refinements. The separate documentation attribution is in rcpch/digital-growth-charts-documentation#184.

Supersedes #78.
Closes #53.

Verification

  • s/test --running -q: 145151 passed
  • Focused mid-parental-height tests: 11 passed
  • Ruff fatal-error checks on changed files: passed
  • git diff --check: passed

Recreated from PR #78 by Dr Akanimoh Osutuk, with the stale notebook changes omitted. Validate types, finite values, reference and sex, and reject parental heights outside the established SDS error limits.

Co-authored-by: Marcus Baw <marcus@marcusbaw.com>
@pacharanero
pacharanero merged commit e021c94 into live Sep 4, 2026
4 checks passed
@pacharanero
pacharanero deleted the fix/mid-parental-height-validation branch September 5, 2026 17:18
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.

mid-parental-height has no minimum/maximum parental height validation

2 participants