mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 08:44:23 -04:00
Give estimates of the number of phones in a broadcast area
We need to give people a better feel for the consequences of broadcasting an alert. We’ve seen in research that some users will assume it is subscription based, or opt-in, rather than going to every phone in the area. I reckon that the most effective way to communicate this is to put some numbers next to the areas, to give people an idea of how many people will get alerted. We can estimate how many phones are in an area by: - taking the population of all electoral wards in that area - multiplying it by the percentage of people who own an internet connected phone[1] The Office for National Statistics publish both these datasets. The number of people who own an intenet connected phone varies a lot by age. Since the population data for each ward is broken down by age we can factor this in. Simplified, the calculation looks like this: - take the _Abbey_ ward of _Barking and Dagenham_ - in this ward there are 26 people aged 80 - 40% of people over 65 have an internet-connected phone - therefore 10 of these 80-year-olds would be likely to receive a broadcast - (repeat for all other ages) These numbers won’t be exact, but should be enough to give people a feel for the severity of what they’re about to do. We can see if they acheive this aim in user research. 1. This is a proxy for the number of people who are likely to have a 4G capable phone, because only 4G capable phones will be receiving broadcasts to begin with
This commit is contained in:
@@ -37,6 +37,7 @@ class BroadcastAreasRepository(object):
|
||||
name TEXT NOT NULL,
|
||||
broadcast_area_library_id TEXT NOT NULL,
|
||||
broadcast_area_library_group_id TEXT,
|
||||
count_of_phones INTEGER,
|
||||
|
||||
FOREIGN KEY (broadcast_area_library_id)
|
||||
REFERENCES broadcast_area_libraries(id),
|
||||
@@ -84,9 +85,10 @@ class BroadcastAreasRepository(object):
|
||||
areas_q = """
|
||||
INSERT INTO broadcast_areas (
|
||||
id, name,
|
||||
broadcast_area_library_id, broadcast_area_library_group_id
|
||||
broadcast_area_library_id, broadcast_area_library_group_id,
|
||||
count_of_phones
|
||||
)
|
||||
VALUES (?, ?, ?, ?)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
"""
|
||||
|
||||
features_q = """
|
||||
@@ -98,9 +100,9 @@ class BroadcastAreasRepository(object):
|
||||
"""
|
||||
|
||||
with self.conn() as conn:
|
||||
for id, name, area_id, group, polygons, simple_polygons in areas:
|
||||
for id, name, area_id, group, polygons, simple_polygons, count_of_phones in areas:
|
||||
conn.execute(areas_q, (
|
||||
id, name, area_id, group,
|
||||
id, name, area_id, group, count_of_phones
|
||||
))
|
||||
if not keep_old_features:
|
||||
conn.execute(features_q, (
|
||||
@@ -152,7 +154,7 @@ class BroadcastAreasRepository(object):
|
||||
|
||||
def get_areas(self, area_ids):
|
||||
q = """
|
||||
SELECT id, name
|
||||
SELECT id, name, count_of_phones
|
||||
FROM broadcast_areas
|
||||
WHERE id IN ({})
|
||||
""".format(("?," * len(area_ids))[:-1])
|
||||
@@ -160,7 +162,7 @@ class BroadcastAreasRepository(object):
|
||||
results = self.query(q, *area_ids)
|
||||
|
||||
areas = [
|
||||
(row[0], row[1])
|
||||
(row[0], row[1], row[2])
|
||||
for row in results
|
||||
]
|
||||
|
||||
@@ -179,7 +181,7 @@ class BroadcastAreasRepository(object):
|
||||
if is_multi_tier_library:
|
||||
# only interested in areas with children - eg local authorities, counties, unitary authorities. not wards.
|
||||
q = """
|
||||
SELECT id, name
|
||||
SELECT id, name, count_of_phones
|
||||
FROM broadcast_areas
|
||||
JOIN (
|
||||
SELECT DISTINCT broadcast_area_library_group_id
|
||||
@@ -191,7 +193,7 @@ class BroadcastAreasRepository(object):
|
||||
else:
|
||||
# Countries don't have any children, so the above query wouldn't return anything.
|
||||
q = """
|
||||
SELECT id, name
|
||||
SELECT id, name, count_of_phones
|
||||
FROM broadcast_areas
|
||||
WHERE broadcast_area_library_id = ?
|
||||
"""
|
||||
@@ -199,13 +201,13 @@ class BroadcastAreasRepository(object):
|
||||
results = self.query(q, library_id)
|
||||
|
||||
return [
|
||||
(row[0], row[1])
|
||||
(row[0], row[1], row[2])
|
||||
for row in results
|
||||
]
|
||||
|
||||
def get_all_areas_for_group(self, group_id):
|
||||
q = """
|
||||
SELECT id, name
|
||||
SELECT id, name, count_of_phones
|
||||
FROM broadcast_areas
|
||||
WHERE broadcast_area_library_group_id = ?
|
||||
"""
|
||||
@@ -213,7 +215,7 @@ class BroadcastAreasRepository(object):
|
||||
results = self.query(q, group_id)
|
||||
|
||||
areas = [
|
||||
(row[0], row[1])
|
||||
(row[0], row[1], row[2])
|
||||
for row in results
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user