-- Mart: Deprivation index — one row per URN -- Joins school postcode → LSOA → IDACI score with school_postcodes as ( select urn, postcode from {{ ref('stg_gias_establishments') }} where status = 'Open' and postcode is not null ) -- Note: The join between postcode and LSOA requires a postcode-to-LSOA -- lookup table. This will be populated by the geocode script or a seed. -- For now, this model serves as a placeholder that will be completed -- once the IDACI tap provides the postcode→LSOA mapping. select i.lsoa_code, i.idaci_score, i.idaci_decile from {{ ref('stg_idaci') }} i