version: 2

models:
  - name: int_rentals__annual
    description: "Rental data enriched with time and zone dimensions"
    columns:
      - name: rental_id
        tests:
          - unique
          - not_null
      - name: zone_code
        tests:
          - not_null

  - name: int_neighbourhood__demographics
    description: "Combined census demographics with neighbourhood attributes"
    columns:
      - name: neighbourhood_id
        description: "Neighbourhood identifier"
        tests:
          - not_null
      - name: census_year
        description: "Census year"
        tests:
          - not_null
      - name: income_quintile
        description: "Income quintile (1-5, city-wide)"

  - name: int_neighbourhood__housing
    description: "Housing indicators combining census and rental data"
    columns:
      - name: neighbourhood_id
        description: "Neighbourhood identifier"
        tests:
          - not_null
      - name: year
        description: "Reference year"
      - name: rent_to_income_pct
        description: "Rent as percentage of median income"
      - name: is_affordable
        description: "Boolean: rent <= 30% of income"

  - name: int_neighbourhood__crime_summary
    description: "Aggregated crime with year-over-year trends"
    columns:
      - name: neighbourhood_id
        description: "Neighbourhood identifier"
        tests:
          - not_null
      - name: year
        description: "Statistics year"
        tests:
          - not_null
      - name: crime_rate_per_100k
        description: "Total crime rate per 100K population"
      - name: yoy_change_pct
        description: "Year-over-year change percentage"

  - name: int_neighbourhood__amenity_scores
    description: "Normalized amenities per capita and per area"
    columns:
      - name: neighbourhood_id
        description: "Neighbourhood identifier"
        tests:
          - not_null
      - name: year
        description: "Reference year"
      - name: total_amenities_per_1000
        description: "Total amenities per 1000 population"
      - name: amenities_per_sqkm
        description: "Total amenities per square km"

  - name: int_rentals__neighbourhood_allocated
    description: "CMHC rental data allocated to neighbourhoods via area weights"
    columns:
      - name: neighbourhood_id
        description: "Neighbourhood identifier"
        tests:
          - not_null
      - name: year
        description: "Survey year"
        tests:
          - not_null
      - name: avg_rent_2bed
        description: "Weighted average 2-bedroom rent"
      - name: vacancy_rate
        description: "Weighted average vacancy rate"
