Skip to content

Commit

Permalink
Include area names in the dashboards on vacant home pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-strange committed Jul 25, 2024
1 parent 4289de7 commit 9544b2c
Show file tree
Hide file tree
Showing 10 changed files with 15,854 additions and 15,848 deletions.
2,568 changes: 1,284 additions & 1,284 deletions data/vacant-homes/AllCombined_Cleaned_2024.csv

Large diffs are not rendered by default.

15,499 changes: 7,790 additions & 7,709 deletions data/vacant-homes/absolute.csv

Large diffs are not rendered by default.

13,424 changes: 6,672 additions & 6,752 deletions data/vacant-homes/percentages.csv

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions pipelines/vacant-homes/areas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,35 +107,35 @@
" <td>2023</td>\n",
" <td>2023.0</td>\n",
" <td>True</td>\n",
" <td>Hartlepool UA</td>\n",
" <td>Hartlepool</td>\n",
" </tr>\n",
" <tr>\n",
" <th>E06000002</th>\n",
" <td>2023</td>\n",
" <td>2023.0</td>\n",
" <td>True</td>\n",
" <td>Middlesbrough UA</td>\n",
" <td>Middlesbrough</td>\n",
" </tr>\n",
" <tr>\n",
" <th>E06000003</th>\n",
" <td>2023</td>\n",
" <td>2023.0</td>\n",
" <td>True</td>\n",
" <td>Redcar and Cleveland UA</td>\n",
" <td>Redcar and Cleveland</td>\n",
" </tr>\n",
" <tr>\n",
" <th>E06000004</th>\n",
" <td>2023</td>\n",
" <td>2023.0</td>\n",
" <td>True</td>\n",
" <td>Stockton-on-Tees UA</td>\n",
" <td>Stockton-on-Tees</td>\n",
" </tr>\n",
" <tr>\n",
" <th>E06000005</th>\n",
" <td>2023</td>\n",
" <td>2023.0</td>\n",
" <td>True</td>\n",
" <td>Darlington UA</td>\n",
" <td>Darlington</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
Expand Down Expand Up @@ -199,19 +199,19 @@
"E12000009 2023 2023.0 True \n",
"E92000001 2023 2023.0 True \n",
"\n",
" name \n",
"AreaCode \n",
"E06000001 Hartlepool UA \n",
"E06000002 Middlesbrough UA \n",
"E06000003 Redcar and Cleveland UA \n",
"E06000004 Stockton-on-Tees UA \n",
"E06000005 Darlington UA \n",
"... ... \n",
"E12000006 East of England \n",
"E12000007 London \n",
"E12000008 South East \n",
"E12000009 South West \n",
"E92000001 England \n",
" name \n",
"AreaCode \n",
"E06000001 Hartlepool \n",
"E06000002 Middlesbrough \n",
"E06000003 Redcar and Cleveland \n",
"E06000004 Stockton-on-Tees \n",
"E06000005 Darlington \n",
"... ... \n",
"E12000006 East of England \n",
"E12000007 London \n",
"E12000008 South East \n",
"E12000009 South West \n",
"E92000001 England \n",
"\n",
"[381 rows x 4 columns]"
]
Expand Down
34 changes: 18 additions & 16 deletions pipelines/vacant-homes/transform.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,23 @@
" <tr>\n",
" <th>1271</th>\n",
" <td>E06000005</td>\n",
" <td>Darlington UA</td>\n",
" <td>Darlington</td>\n",
" <td>2004</td>\n",
" <td>45449.2</td>\n",
" <td>Dwellings</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1272</th>\n",
" <td>E06000001</td>\n",
" <td>Hartlepool UA</td>\n",
" <td>Hartlepool</td>\n",
" <td>2004</td>\n",
" <td>40407.9</td>\n",
" <td>Dwellings</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1273</th>\n",
" <td>E06000002</td>\n",
" <td>Middlesbrough UA</td>\n",
" <td>Middlesbrough</td>\n",
" <td>2004</td>\n",
" <td>58698.8</td>\n",
" <td>Dwellings</td>\n",
Expand Down Expand Up @@ -151,18 +151,18 @@
"</div>"
],
"text/plain": [
" AreaCode AreaName Year Value Measure\n",
"1269 E92000001 England 2004 21684360.255307 Dwellings\n",
"1270 E12000001 North East 2004 1129975.05432 Dwellings\n",
"1271 E06000005 Darlington UA 2004 45449.2 Dwellings\n",
"1272 E06000001 Hartlepool UA 2004 40407.9 Dwellings\n",
"1273 E06000002 Middlesbrough UA 2004 58698.8 Dwellings\n",
"... ... ... ... ... ...\n",
"9724 E10000033 Wiltshire 2023 [x] Dwellings\n",
"9725 E07000230 Kennet 2023 [x] Dwellings\n",
"9726 E07000231 North Wiltshire 2023 [x] Dwellings\n",
"9727 E07000232 Salisbury 2023 [x] Dwellings\n",
"9728 E07000233 West Wiltshire 2023 [x] Dwellings\n",
" AreaCode AreaName Year Value Measure\n",
"1269 E92000001 England 2004 21684360.255307 Dwellings\n",
"1270 E12000001 North East 2004 1129975.05432 Dwellings\n",
"1271 E06000005 Darlington 2004 45449.2 Dwellings\n",
"1272 E06000001 Hartlepool 2004 40407.9 Dwellings\n",
"1273 E06000002 Middlesbrough 2004 58698.8 Dwellings\n",
"... ... ... ... ... ...\n",
"9724 E10000033 Wiltshire 2023 [x] Dwellings\n",
"9725 E07000230 Kennet 2023 [x] Dwellings\n",
"9726 E07000231 North Wiltshire 2023 [x] Dwellings\n",
"9727 E07000232 Salisbury 2023 [x] Dwellings\n",
"9728 E07000233 West Wiltshire 2023 [x] Dwellings\n",
"\n",
"[8460 rows x 5 columns]"
]
Expand Down Expand Up @@ -195,6 +195,8 @@
" 'SOUTH WEST': 'South West',\n",
" 'ENGLAND': 'England'}, inplace=True)\n",
"dwelling_stock = dwelling_stock.loc[dwelling_stock['Year'].astype(int) >= 2004]\n",
"dwelling_stock['AreaName'] = dwelling_stock['AreaName'].str.replace('UA', '')\n",
"dwelling_stock['AreaName'] = dwelling_stock['AreaName'].str.strip()\n",
"dwelling_stock"
]
},
Expand Down Expand Up @@ -714,7 +716,7 @@
"metadata": {},
"outputs": [],
"source": [
"pivoted = combined.pivot(index=[\"AreaCode\", \"Year\"], columns=\"Measure\", values=\"Value\")\n",
"pivoted = combined.pivot(index=[\"AreaCode\", \"AreaName\", \"Year\"], columns=\"Measure\", values=\"Value\")\n",
"pivoted.to_csv('data/vacant-homes/absolute.csv')"
]
},
Expand Down
14 changes: 7 additions & 7 deletions src/_includes/template/vacanthomes.vto
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ visualisation: true
{{ if percentage_chart_data.length == 0 }}
<p>Vacant homes data are not published for this area.</p>
{{ else }}
{{ set head = headlines(areacode, vacantsLastPublished)}}
{{ set head = headlines(title, vacantsLastPublished)}}
{{# {{ head |> JSON.stringify }} #}}
{{ comp.oi.dashboard({ config: {
title: "AreaCode",
title: "AreaName",
value: "LongTermVacants_pct",
note: 'footnote',
columns: [{
Expand All @@ -39,16 +39,16 @@ visualisation: true
units: { postfix: 'Post' },
panels: [
{
name: 'E92000001',
name: 'England',
colour: '#F9BC26'},
{
name: areacode,
name: title,
colour: '#F9BC26'}]
}
})
}}
{{ comp.oi.dashboard({ config: {
title: "AreaCode",
title: "AreaName",
value: "AllVacants_pct",
note: 'footnote',
columns: [{
Expand All @@ -62,10 +62,10 @@ visualisation: true
units: { postfix: 'Post' },
panels: [
{
name: 'E92000001',
name: 'England',
colour: '#722EA5'},
{
name: areacode,
name: title,
colour: '#722ea5'}]
}
})
Expand Down
Loading

0 comments on commit 9544b2c

Please sign in to comment.