Updated Map app

This commit is contained in:
Khalim Conn-Kowlessar 2024-07-23 20:07:34 +01:00
parent c9af04de73
commit 3ac9dcd366
4 changed files with 32 additions and 40 deletions

View file

@ -1 +1 @@
[{"EPC": "D", "count": 1718}, {"EPC": "C", "count": 1343}, {"EPC": "E", "count": 538}, {"EPC": "F", "count": 80}, {"EPC": "B", "count": 52}, {"EPC": "G", "count": 3}, {"EPC": "A", "count": 2}] [{"EPC": "D", "count": 332}, {"EPC": "C", "count": 68}, {"EPC": "E", "count": 44}, {"EPC": "F", "count": 6}]

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
[{"is_real_epc": true, "count": 3736}, {"is_real_epc": false, "count": 1509}] [{"index": true, "is_real_epc": 3736}, {"index": false, "is_real_epc": 1509}]

View file

@ -31,7 +31,8 @@ def make_epc_rating_piechart(epc_rating_breakdown):
labels = [x["EPC"] for x in epc_rating_breakdown] labels = [x["EPC"] for x in epc_rating_breakdown]
values = [x["count"] for x in epc_rating_breakdown] values = [x["count"] for x in epc_rating_breakdown]
marker_colors = ["#117d58", "#2da55c", "#8dbd40", "#f7cd14", "#f3a96a", "#ef8026", "#e41e3b"] # marker_colors = ["#117d58", "#2da55c", "#8dbd40", "#f7cd14", "#f3a96a", "#ef8026", "#e41e3b"]
marker_colors = ["#8dbd40", "#f7cd14", "#f3a96a", "#ef8026", "#e41e3b"]
fig = go.Figure( fig = go.Figure(
data=[go.Pie(labels=labels, values=values, marker_colors=marker_colors, sort=False)], data=[go.Pie(labels=labels, values=values, marker_colors=marker_colors, sort=False)],
@ -53,7 +54,10 @@ def make_map(locations):
# Create custom hover text # Create custom hover text
df['hover_text'] = df.apply( df['hover_text'] = df.apply(
lambda row: f"UPRN: {int(row['uprn'])}<br>Address: {row['standardised_address']}<br>Postcode: " lambda row: f"UPRN: {int(row['uprn'])}<br>Address: {row['standardised_address']}<br>Postcode: "
f"{row['standardised_postcode']}<br>Latitude: {row['LATITUDE']}<br>Longitude: {row['LONGITUDE']}", f"{row['standardised_postcode']}<br>Latitude: {row['LATITUDE']}<br>Longitude: "
f"{row['LONGITUDE']}<br>Walls: {row['Walls']}<br>Roofs: {row['Roofs']}<br>Main Fuel: "
f"{row['Main Fuel']}<br>Heating: {row['Heating']}<br>Age: {row['Age']}<br>Property Type: "
f"{row['Property Type']}",
axis=1) axis=1)
data = [ data = [
@ -93,8 +97,8 @@ def layout():
locations = json.load(file) locations = json.load(file)
# Get the EPC breakdown data # Get the EPC breakdown data
with open("Stonewater real EPC breakdown.json") as file: # with open("Stonewater real EPC breakdown.json") as file:
real_epc_breakdown = json.load(file) # real_epc_breakdown = json.load(file)
# Get the EPC ratings data # Get the EPC ratings data
with open("Stonewater EPC rating breakdown.json") as file: with open("Stonewater EPC rating breakdown.json") as file:
@ -149,7 +153,8 @@ def layout():
style={"font-size": "2.5rem", "font-weight": "bold", "margin-bottom": "20px"} style={"font-size": "2.5rem", "font-weight": "bold", "margin-bottom": "20px"}
), ),
html.P( html.P(
"This map shows the location of the properties that are to be surveyed by Osmosis.", "This map shows the location of the properties that are to be surveyed by Osmosis. "
"These properties span across 30 counties and 155 postal regions",
style={"font-size": "1.25rem", "margin-bottom": "40px"} style={"font-size": "1.25rem", "margin-bottom": "40px"}
), ),
], ],
@ -170,22 +175,22 @@ def layout():
), ),
dbc.Row( dbc.Row(
[ [
dbc.Col( # dbc.Col(
[ # [
html.Div( # html.Div(
"Breakdown of real EPCs", # "Breakdown of real EPCs",
style={"fontSize": "1.5rem", "fontWeight": "bold", "marginBottom": "1em"}, # style={"fontSize": "1.5rem", "fontWeight": "bold", "marginBottom": "1em"},
className='text-center' # className='text-center'
), # ),
html.Div( # html.Div(
"This pie chart shows the proportion of real EPCs in the asset list. Currently, " # "This pie chart shows the proportion of real EPCs in the asset list. Currently, "
"there are EPCs for 3736 of the 5245 properties that have a UPRN in the asset list", # "there are EPCs for 3736 of the 5245 properties that have a UPRN in the asset list",
style={"marginBottom": "1em"} # style={"marginBottom": "1em"}
), # ),
make_real_epc_piechart(real_epc_breakdown), # make_real_epc_piechart(real_epc_breakdown),
], # ],
width={"size": 5}, # width={"size": 5},
), # ),
dbc.Col( dbc.Col(
[ [
html.Div( html.Div(
@ -195,22 +200,9 @@ def layout():
), ),
html.Div( html.Div(
[ [
"This pie chart shows the breakdown of EPC ratings, for properties that currently " "This pie chart shows the breakdown of expected and real EPC ratings, "
"have an EPC. " "for properties "
"The ratings range from A to G, where surprisingly, there are two EPC properties " "that have been selected for sample",
"that were initially "
"expected by Parity's modelled SAP, to be EPC D or below. These properties can be"
" seen ",
html.A("here",
href="https://find-energy-certificate.service.gov.uk/energy-certificate"
"/2708-5001-7327-6090-7284",
target="_blank"),
" and ",
html.A("here",
href="https://find-energy-certificate.service.gov.uk/energy-certificate"
"/1037-4032-1009-0361-7292",
target="_blank"),
"."
], ],
style={"marginBottom": "1em"} style={"marginBottom": "1em"}
), ),