Create neighbourhood and amenities Pydantic schemas #53

Closed
opened 2026-01-16 15:49:06 +00:00 by lmiranda · 2 comments
Owner

Overview

Create Pydantic schemas for Toronto neighbourhood, census, crime, and amenities data validation.

Files to Create

portfolio_app/toronto/schemas/neighbourhood.py

  • NeighbourhoodRecord - Toronto neighbourhood boundary data (AREA_ID, AREA_NAME, geometry)
  • CensusRecord - Census profile data (neighbourhood_id, census_year, population, median_household_income, etc.)
  • CrimeRecord - Crime statistics (neighbourhood_id, year, crime_type enum, count, rate_per_100k)
  • CrimeType - Enum for crime types

portfolio_app/toronto/schemas/amenities.py

  • AmenityType - Enum (park, school, childcare, transit_stop)
  • AmenityRecord - Amenity records (neighbourhood_id, amenity_type, amenity_name, lat/lon)

Update portfolio_app/toronto/schemas/__init__.py

  • Export all new schemas

Acceptance Criteria

  • All schemas use Pydantic 2.0 style with Field descriptions
  • Python 3.10+ type hints (e.g., list[str], dict[str, Any] | None)
  • Import tests pass
  • Linter passes

Labels

Type/Feature, Priority/High, Component/Backend, Tech/Python

## Overview Create Pydantic schemas for Toronto neighbourhood, census, crime, and amenities data validation. ## Files to Create ### `portfolio_app/toronto/schemas/neighbourhood.py` - `NeighbourhoodRecord` - Toronto neighbourhood boundary data (AREA_ID, AREA_NAME, geometry) - `CensusRecord` - Census profile data (neighbourhood_id, census_year, population, median_household_income, etc.) - `CrimeRecord` - Crime statistics (neighbourhood_id, year, crime_type enum, count, rate_per_100k) - `CrimeType` - Enum for crime types ### `portfolio_app/toronto/schemas/amenities.py` - `AmenityType` - Enum (park, school, childcare, transit_stop) - `AmenityRecord` - Amenity records (neighbourhood_id, amenity_type, amenity_name, lat/lon) ### Update `portfolio_app/toronto/schemas/__init__.py` - Export all new schemas ## Acceptance Criteria - [ ] All schemas use Pydantic 2.0 style with Field descriptions - [ ] Python 3.10+ type hints (e.g., `list[str]`, `dict[str, Any] | None`) - [ ] Import tests pass - [ ] Linter passes ## Labels `Type/Feature`, `Priority/High`, `Component/Backend`, `Tech/Python`
Author
Owner

Starting implementation of Pydantic schemas for neighbourhood, census, crime, and amenities data.

Starting implementation of Pydantic schemas for neighbourhood, census, crime, and amenities data.
Author
Owner

Implementation complete:

  • Created schemas/neighbourhood.py with NeighbourhoodRecord, CensusRecord, CrimeRecord, CrimeType
  • Created schemas/amenities.py with AmenityType, AmenityRecord, AmenityCount
  • Updated schemas/__init__.py with exports
  • Import test passed
Implementation complete: - Created `schemas/neighbourhood.py` with `NeighbourhoodRecord`, `CensusRecord`, `CrimeRecord`, `CrimeType` - Created `schemas/amenities.py` with `AmenityType`, `AmenityRecord`, `AmenityCount` - Updated `schemas/__init__.py` with exports - Import test passed
lmiranda added this to the Launch: Host, Bio and Toronto House Market Analysis project 2026-01-16 16:06:20 +00:00
lmiranda self-assigned this 2026-01-16 16:06:30 +00:00
lmiranda moved this to Done in Launch: Host, Bio and Toronto House Market Analysis on 2026-01-16 16:06:45 +00:00
Sign in to join this conversation.