Bump utils

This new version of utils implements the transformation of our polygons
to a Cartesian plane. In other words, it converts them from being
defined in spherical degrees to metres.

For the API this means our simplification will be slightly more
accurate.
This commit is contained in:
Chris Hill-Scott
2021-08-18 17:22:35 +01:00
parent 5cb97253ac
commit a6135fb8ab
4 changed files with 20 additions and 13 deletions

View File

@@ -43,7 +43,10 @@ def create_broadcast():
validate(broadcast_json, post_broadcast_schema) validate(broadcast_json, post_broadcast_schema)
polygons = Polygons(list(chain.from_iterable(( polygons = Polygons(list(chain.from_iterable((
area['polygons'] for area in broadcast_json['areas'] [
[[y, x] for x, y in polygon]
for polygon in area['polygons']
] for area in broadcast_json['areas']
)))) ))))
template = BroadcastMessageTemplate.from_content( template = BroadcastMessageTemplate.from_content(
@@ -70,7 +73,7 @@ def create_broadcast():
'areas': [ 'areas': [
area['name'] for area in broadcast_json['areas'] area['name'] for area in broadcast_json['areas']
], ],
'simple_polygons': polygons.smooth.simplify.as_coordinate_pairs_long_lat, 'simple_polygons': polygons.smooth.simplify.as_coordinate_pairs_lat_long,
}, },
status=BroadcastStatusType.PENDING_APPROVAL, status=BroadcastStatusType.PENDING_APPROVAL,
api_key_id=api_user.id, api_key_id=api_user.id,

View File

@@ -38,7 +38,7 @@ notifications-python-client==6.0.2
# PaaS # PaaS
awscli-cwlogs==1.4.6 awscli-cwlogs==1.4.6
git+https://github.com/alphagov/notifications-utils.git@44.5.1#egg=notifications-utils==44.5.1 git+https://github.com/alphagov/notifications-utils.git@45.0.1#egg=notifications-utils==45.0.1
# gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains # gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains
prometheus-client==0.10.1 prometheus-client==0.10.1

View File

@@ -40,7 +40,7 @@ notifications-python-client==6.0.2
# PaaS # PaaS
awscli-cwlogs==1.4.6 awscli-cwlogs==1.4.6
git+https://github.com/alphagov/notifications-utils.git@44.5.1#egg=notifications-utils==44.5.1 git+https://github.com/alphagov/notifications-utils.git@45.0.1#egg=notifications-utils==45.0.1
# gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains # gds-metrics requires prometheseus 0.2.0, override that requirement as 0.7.1 brings significant performance gains
prometheus-client==0.10.1 prometheus-client==0.10.1
@@ -51,16 +51,16 @@ alembic==1.6.5
amqp==1.4.9 amqp==1.4.9
anyjson==0.3.3 anyjson==0.3.3
attrs==21.2.0 attrs==21.2.0
awscli==1.20.8 awscli==1.20.24
bcrypt==3.2.0 bcrypt==3.2.0
billiard==3.3.0.23 billiard==3.3.0.23
bleach==3.3.0 bleach==3.3.0
blinker==1.4 blinker==1.4
boto==2.49.0 boto==2.49.0
boto3==1.18.8 boto3==1.18.24
botocore==1.21.8 botocore==1.21.24
certifi==2021.5.30 certifi==2021.5.30
charset-normalizer==2.0.3 charset-normalizer==2.0.4
click==8.0.1 click==8.0.1
colorama==0.4.3 colorama==0.4.3
dnspython==1.16.0 dnspython==1.16.0
@@ -68,8 +68,9 @@ docutils==0.15.2
flask-redis==0.4.0 flask-redis==0.4.0
geojson==2.5.0 geojson==2.5.0
govuk-bank-holidays==0.9 govuk-bank-holidays==0.9
greenlet==1.1.0 greenlet==1.1.1
idna==3.2 idna==3.2
importlib-metadata==4.6.4
Jinja2==3.0.1 Jinja2==3.0.1
jmespath==0.10.0 jmespath==0.10.0
kombu==3.0.37 kombu==3.0.37
@@ -78,11 +79,12 @@ MarkupSafe==2.0.1
mistune==0.8.4 mistune==0.8.4
orderedset==2.0.3 orderedset==2.0.3
packaging==21.0 packaging==21.0
phonenumbers==8.12.28 phonenumbers==8.12.30
pyasn1==0.4.8 pyasn1==0.4.8
pycparser==2.20 pycparser==2.20
pyparsing==2.4.7 pyparsing==2.4.7
PyPDF2==1.26.0 PyPDF2==1.26.0
pyproj==3.0.1
pyrsistent==0.18.0 pyrsistent==0.18.0
python-dateutil==2.8.2 python-dateutil==2.8.2
python-editor==1.0.4 python-editor==1.0.4
@@ -98,5 +100,7 @@ six==1.16.0
smartypants==2.0.1 smartypants==2.0.1
soupsieve==2.2.1 soupsieve==2.2.1
statsd==3.3.0 statsd==3.3.0
typing-extensions==3.10.0.0
urllib3==1.26.6 urllib3==1.26.6
webencodings==0.5.1 webencodings==0.5.1
zipp==3.5.0

View File

@@ -103,9 +103,9 @@ def test_valid_post_cap_xml_broadcast_returns_201(
assert response_json['personalisation'] is None assert response_json['personalisation'] is None
assert response_json['service_id'] == str(sample_broadcast_service.id) assert response_json['service_id'] == str(sample_broadcast_service.id)
assert len(response_json['simple_polygons']) == 1 assert len(response_json['simple_polygons']) == 1
assert len(response_json['simple_polygons'][0]) == 23 assert len(response_json['simple_polygons'][0]) == 27
assert response_json['simple_polygons'][0][0] == [53.10562, 0.244127] assert response_json['simple_polygons'][0][0] == [53.10635, 0.240159]
assert response_json['simple_polygons'][0][-1] == [53.10562, 0.244127] assert response_json['simple_polygons'][0][-1] == [53.10635, 0.240159]
assert response_json['starts_at'] is None assert response_json['starts_at'] is None
assert response_json['status'] == 'pending-approval' assert response_json['status'] == 'pending-approval'
assert response_json['template_id'] is None assert response_json['template_id'] is None