forked from centrefornetzero/domestic-heating-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dim_household_agents.sql
51 lines (42 loc) · 1.41 KB
/
dim_household_agents.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{{ config(schema="domestic_heating", materialized="table") }}
with households as (
select * from {{ ref('dim_households') }}
),
final as (
select
address_cluster_id as id,
local_authority_district_name_2020 as location,
current_property_value_gbp as property_value_gbp,
total_floor_area_m2,
is_off_gas_grid,
construction_year_band,
property_type,
built_form,
heating_system,
epc_rating,
potential_epc_rating,
occupant_type,
is_solid_wall,
walls_energy_efficiency,
roof_energy_efficiency,
windows_energy_efficiency,
is_heat_pump_suitable_archetype
from households
where
local_authority_district_name_2020 is not null
and current_property_value_gbp is not null
and total_floor_area_m2 is not null
and construction_year_band is not null
and property_type is not null
and built_form is not null
and wall_type is not null
and epc_rating is not null
and potential_epc_rating is not null
and heating_system is not null
and occupant_type is not null
and walls_energy_efficiency is not null
and windows_energy_efficiency is not null
-- Exclude records which the ABM can't model
and (roof_energy_efficiency is not null or has_premises_above = true)
)
select * from final