-- Staging model: Income Deprivation Affecting Children Index
-- The IDACI tap resolves postcode → LSOA and joins to IoD2019 data,
-- so each row already has a URN.

with source as (
    select * from {{ source('raw', 'idaci') }}
),

renamed as (
    select
        cast(urn as integer)            as urn,
        lsoa_code,
        cast(idaci_score as numeric)    as idaci_score,
        cast(idaci_decile as integer)   as idaci_decile
    from source
    where urn is not null
)

select * from renamed
