Skip to content

Add data validation to Resort Pydantic model #83

@jonathanstelman

Description

@jonathanstelman

Background

The Resort Pydantic model in backend/models.py (added in Issue #55) currently has no field-level validation beyond types. This issue tracks adding more rigorous constraints.

Candidates for validation

  • Non-negative numeric fields: acres, num_trails, num_lifts, vertical, vertical_meters, vertical_base_ft, vertical_summit_ft, vertical_elevation_ft, snowfall_average_in, snowfall_high_in, trail_length_mi, trail_length_km — add ge=0
  • Percentage/score fields: difficulty_beginner, difficulty_intermediate, difficulty_advanced — verify range and add ge=0, le=100 if appropriate
  • Peak Rankings scores: pr_* numeric fields — verify scale (0–10? 0–100?) and add range constraints
  • URL fields: website, indy_page, reservation_url — consider AnyUrl or regex validation after auditing the data for edge cases

Notes

  • Audit actual data ranges before adding constraints to avoid unexpected load failures on edge-case CSV values
  • Validation failures in load_resorts() should be handled gracefully (log and skip vs. raise)

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic-2-backendEpic 2: Backend — Resort Data API

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions