Files
notifications-api/tests/app/v2/broadcast/sample_cap_xml_documents.py

235 lines
186 KiB
Python
Raw Normal View History

import re
WAINFLEET = """
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
<identifier>50385fcb0ab7aa447bbd46d848ce8466E</identifier>
<sender>www.gov.uk/environment-agency</sender>
<sent>2020-02-16T23:01:13-00:00</sent>
<status>Actual</status>
<msgType>Alert</msgType>
<source>Flood warning service</source>
<scope>Public</scope>
<references>www.gov.uk/environment-agency,4f6d28b10ab7aa447bbd46d85f1e9effE,2020-02-16T19:20:03+00:00</references>
<info>
<language>en-GB</language>
<category>Met</category>
<event>053/055 Issue Severe Flood Warning EA</event>
<urgency>Immediate</urgency>
<severity>Severe</severity>
<certainty>Likely</certainty>
<expires>2020-02-26T23:01:14-00:00</expires>
<senderName>Environment Agency</senderName>
<description>A severe flood warning has been issued. Storm Dennis has resulted in significant rainfall in the Steeping River catchment with several bands of heavy rain passing through the area during today (Sunday 16 Feb). River levels along the Steeping River and the Wainfleet relief channel are expected to be similar to those in June 2019. This could result in flood embankments being overtopped. Should this happen, there is an increased risk that flood embankments could breach. It is expected that peak levels along the Steeping River in Wainfleet will be between midnight and 3am tonight. A multi-agency meeting is taking place this evening. Further messages will be issued should this be required. Do not walk on flood embankments and avoid riverside paths. Our staff are out in the area to check the flood defences and assist the emergency services and council. We will be closely monitoring the situation throughout the night. </description>
<instruction># To check the latest information for your area - Visit [GOV.UK](https://flood-warning-information.service.gov.uk) to see the current flood warnings, view river and sea levels or check the 5-day flood risk forecast: https://flood-warning-information.service.gov.uk - Follow [@EnvAgency](https://twitter.com/EnvAgency) and [#floodaware](https://twitter.com/hashtag/floodaware) on Twitter. - Tune into weather, news and travel bulletins on local television and radio. - For access to flood warning information offline call Floodline on 0345 988 1188 using quickdial code: 307052. # What you should consider doing now - Call 999 if you are in immediate danger. - Co-operate with the emergency services and evacuate your property if told to do so. Most evacuation centres will let you bring your pets. - Act on your flood plan if you have one. - Move your family and pets to a safe place with a means of escape. - Use flood protection equipment (such as flood barriers, air brick covers and pumps) to protect your property. Unless you have proper equipment do not waste valuable time trying to keep the water out. - Move important items upstairs or to a safe place in your property, starting with cherished items of personal value that you will not be able to replace (such as family photographs). Next move valuables (such as computers), movable furniture and furnishings. - You may need to leave your property, so pack a bag with enough items for a few nights away. Include essential items including a torch with spare batteries, mobile phone and charger, warm clothes, home insurance information, water, food, first aid kit and any prescription medicines or baby care items you may need. - Turn off gas, electricity and water mains supplies before flood water starts to enter your property. Never touch an electrical switch if you are standing in water. - If it is safe to do so, make sure neighbours are aware of the situation and offer help to anyone who may need it. - Avoid walking, cycling or driving through flood water - 30 cm of fast-flowing water can move a car and 6 inches can knock an adult off their feet. - Flood water is dangerous and may be polluted. Wash your hands thoroughly if youve been in contact with it. ##### Businesses - Act on your business flood plan if you have one. - Move your staff and customers to a safe place with a means of escape. - Move stock and other valuable items upstairs or to a safe place in your building. For media enquiries please contact our media teams: https://www.gov.uk/government/organisations/environment-agency/about/media-enquiries </instruction>
<web>https://flood-warning-information.service.gov.uk</web>
<contact>0345 988 1188</contact>
<area>
<areaDesc>River Steeping in Wainfleet All Saints</areaDesc>
<polygon>53.10569,0.24453 53.10593,0.24430 53.10601,0.24375 53.10615,0.24349 53.10629,0.24356 53.10656,0.24336 53.10697,0.24354 53.10684,0.24298 53.10694,0.24264 53.10721,0.24302 53.10752,0.24310 53.10777,0.24308 53.10805,0.24320 53.10803,0.24187 53.10776,0.24085 53.10774,0.24062 53.10702,0.24056 53.10679,0.24088 53.10658,0.24071 53.10651,0.24049 53.10656,0.24022 53.10642,0.24022 53.10632,0.24052 53.10629,0.24082 53.10612,0.24093 53.10583,0.24133 53.10564,0.24178 53.10541,0.24282 53.10569,0.24453</polygon>
<geocode>
<valueName>TargetAreaCode</valueName>
<value>053FWFSTEEP4</value>
</geocode>
</area>
</info>
</alert>
"""
WAINFLEET_CANCEL = """
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
<identifier>5fc99d720abb86020b233422a503af78E</identifier>
<sender>www.gov.uk/environment-agency</sender>
<sent>2020-02-16T23:02:26-00:00</sent>
<status>Actual</status>
<msgType>Cancel</msgType>
<source>Flood warning service</source>
<scope>Public</scope>
<code></code>
<references>www.gov.uk/environment-agency,50385fcb0ab7aa447bbd46d848ce8466E,2020-02-16T23:01:13-00:00</references>
<info>
<language>en-GB</language>
<category>Met</category>
<event><![CDATA[Remove Severe Flood Warning - Cell Broadcast]]></event>
<urgency>Immediate</urgency>
<severity>Severe</severity>
<certainty>Likely</certainty>
<expires>2020-02-16T23:30:13-00:00</expires>
<senderName>Environment Agency</senderName>
<description>Cancel Warning</description>
<web>https://flood-warning-information.service.gov.uk</web>
<contact>0345 988 1188</contact>
<area>
<areaDesc>River Steeping in Wainfleet All Saints</areaDesc>
<polygon>53.10569,0.24453 53.10593,0.24430 53.10601,0.24375 53.10615,0.24349 53.10629,0.24356 53.10656,0.24336 53.10697,0.24354 53.10684,0.24298 53.10694,0.24264 53.10721,0.24302 53.10752,0.24310 53.10777,0.24308 53.10805,0.24320 53.10803,0.24187 53.10776,0.24085 53.10774,0.24062 53.10702,0.24056 53.10679,0.24088 53.10658,0.24071 53.10651,0.24049 53.10656,0.24022 53.10642,0.24022 53.10632,0.24052 53.10629,0.24082 53.10612,0.24093 53.10583,0.24133 53.10564,0.24178 53.10541,0.24282 53.10569,0.24453</polygon>
<geocode>
<valueName>TargetAreaCode</valueName>
<value>053FWFSTEEP4</value>
</geocode>
</area>
</info>
</alert>
"""
UPDATE = """
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
<identifier>PAAQ-4-mg5a94</identifier>
<sender>wcatwc@noaa.gov</sender>
<sent>2013-01-05T10:58:23-00:00</sent>
<status>Actual</status>
<msgType>Update</msgType>
<source>WCATWC</source>
<scope>Public</scope>
<code>IPAWSv1.0</code>
<references>wcatwc@noaa.gov,PAAQ-1-mg5a94,2013-01-05T09:01:16-00:00 wcatwc@noaa.gov,PAAQ-2-mg5a94,2013-01-05T09:30:16-00:00 wcatwc@noaa.gov,PAAQ-3-mg5a94,2013-01-05T10:17:31-00:00</references>
<incidents>mg5a94</incidents>
<info>
<category>Geo</category>
<event>Tsunami Cancellation</event>
<responseType>None</responseType>
<urgency>Past</urgency>
<severity>Unknown</severity>
<certainty>Unlikely</certainty>
<onset>2013-01-05T10:58:23-00:00</onset>
<expires>2013-01-05T10:58:23-00:00</expires>
<senderName>NWS West Coast/Alaska Tsunami Warning Center Palmer AK</senderName>
<headline>The tsunami Warning is canceled for the coastal areas of British Columbia and Alaska from the north tip of Vancouver Island, British Columbia to Cape Fairweather, Alaska (80 miles SE of Yakutat).</headline>
<description>The tsunami Warning is canceled for the coastal areas of British Columbia and Alaska from the north tip of Vancouver Island, British Columbia to Cape Fairweather, Alaska (80 miles SE of Yakutat). - Event details: Preliminary magnitude 7.5 (Mw) earthquake / Lat: 55.300, Lon: -134.900 at 2013-01-05T08:58:20Z Tsunami cancellations indicate the end of the damaging tsunami threat. A cancellation is issued after an evaluation of sea level data confirms that a destructive tsunami will not impact the alerted region, or after tsunami levels have subsided to non-damaging levels. </description>
<instruction>Recommended Actions: Do not re-occupy hazard zones until local emergency officials indicate it is safe to do so. This will be the last West Coast/Alaska Tsunami Warning Center message issued for this event. Refer to the internet site ntwc.arh.noaa.gov for more information. </instruction>
<web>http://ntwc.arh.noaa.gov/events/PAAQ/2013/01/05/mg5a94/4/WEAK51/WEAK51.txt</web>
<parameter>
<valueName>EventLocationName</valueName>
<value>95 miles NW of Dixon Entrance, Alaska</value>
</parameter>
<parameter>
<valueName>EventPreliminaryMagnitude</valueName>
<value>7.5</value>
</parameter>
<parameter>
<valueName>EventPreliminaryMagnitudeType</valueName>
<value>Mw</value>
</parameter>
<parameter>
<valueName>EventOriginTime</valueName>
<value>2013-01-05T08:58:20-00:00</value>
</parameter>
<parameter>
<valueName>EventDepth</valueName>
<value>5 kilometers</value>
</parameter>
<parameter>
<valueName>EventLatLon</valueName>
<value>55.300,-134.900 0.000</value>
</parameter>
<parameter>
<valueName>VTEC</valueName>
<value>/O.CAN.PAAQ.TS.W.0001.000000T0000Z-000000T0000Z/</value>
</parameter>
<parameter>
<valueName>NWSUGC</valueName>
<value>BCZ220-210-922-912-921-911-110-AKZ026&gt;029-023-024-019&gt;022-025-051258-</value>
</parameter>
<parameter>
<valueName>ProductDefinition</valueName>
<value>Tsunami cancellations indicate the end of the damaging tsunami threat. A cancellation is issued after an evaluation of sea level data confirms that a destructive tsunami will not impact the alerted region, or after tsunami levels have subsided to non-damaging levels. </value>
</parameter>
<parameter>
<valueName>WEAK51</valueName>
<value>Public Tsunami Warnings, Watches, and Advisories for AK, BC, and US West Coast</value>
</parameter>
<parameter>
<valueName>EAS-ORG</valueName>
<value>WXR</value>
</parameter>
<resource>
<resourceDesc>Event Data as a JSON document</resourceDesc>
<mimeType>application/json</mimeType>
<uri>http://ntwc.arh.noaa.gov/events/PAAQ/2013/01/05/mg5a94/4/WEAK51/PAAQ.json</uri>
</resource>
<area>
<areaDesc>95 miles NW of Dixon Entrance, Alaska</areaDesc>
<circle>55.3,-134.9 0.0</circle>
</area>
</info>
</alert>
"""
WITH_PLACEHOLDER_FOR_CONTENT = """
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
<identifier>50385fcb0ab7aa447bbd46d848ce8466E</identifier>
<sender>www.gov.uk/environment-agency</sender>
<sent>2020-02-16T23:01:13-00:00</sent>
<status>Actual</status>
<msgType>Alert</msgType>
<source>Flood warning service</source>
<scope>Public</scope>
<references>www.gov.uk/environment-agency,4f6d28b10ab7aa447bbd46d85f1e9effE,2020-02-16T19:20:03+00:00</references>
<info>
<language>en-GB</language>
<category>Met</category>
<event>053/055 Issue Severe Flood Warning EA</event>
<urgency>Immediate</urgency>
<severity>Severe</severity>
<certainty>Likely</certainty>
<expires>2020-02-26T23:01:14-00:00</expires>
<senderName>Environment Agency</senderName>
<description>{}</description>
<web>https://flood-warning-information.service.gov.uk</web>
<contact>0345 988 1188</contact>
<area>
<areaDesc>River Steeping in Wainfleet All Saints</areaDesc>
<polygon>53.10569,0.24453 53.10593,0.24430 53.10601,0.24375 53.10615,0.24349 53.10629,0.24356 53.10656,0.24336 53.10697,0.24354 53.10684,0.24298 53.10694,0.24264 53.10721,0.24302 53.10752,0.24310 53.10777,0.24308 53.10805,0.24320 53.10803,0.24187 53.10776,0.24085 53.10774,0.24062 53.10702,0.24056 53.10679,0.24088 53.10658,0.24071 53.10651,0.24049 53.10656,0.24022 53.10642,0.24022 53.10632,0.24052 53.10629,0.24082 53.10612,0.24093 53.10583,0.24133 53.10564,0.24178 53.10541,0.24282 53.10569,0.24453</polygon>
<geocode>
<valueName>TargetAreaCode</valueName>
<value>053FWFSTEEP4</value>
</geocode>
</area>
</info>
</alert>
"""
WINDEMERE = """
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
<identifier>4f6d28b10ab7aa447bbd46d85f1e9effE</identifier>
<sender>www.gov.uk/environment-agency</sender>
<sent>2020-02-16T23:01:13-00:00</sent>
<status>Actual</status>
<msgType>Alert</msgType>
<source>Flood warning service</source>
<scope>Public</scope>
<references>www.gov.uk/environment-agency,4f6d28b10ab7aa447bbd46d85f1e9effE,2020-02-16T19:20:03+00:00</references>
<info>
<language>en-GB</language>
<category>Met</category>
<event>053/055 Issue Severe Flood Warning EA</event>
<urgency>Immediate</urgency>
<severity>Severe</severity>
<certainty>Likely</certainty>
<expires>2020-02-26T23:01:14-00:00</expires>
<senderName>Environment Agency</senderName>
<description>This area has a lot of coordinates</description>
<web>https://flood-warning-information.service.gov.uk</web>
<contact>0345 988 1188</contact>
<area>
<areaDesc>Windemere</areaDesc>
<polygon>
54.377851258,-2.919733855 54.377769915,-2.919793618 54.377786831,-2.919932556 54.37784985,-2.91991857 54.377832816,-2.919795025 54.377851258,-2.919733855
</polygon>
<polygon>
54.423831395,-2.972442701 54.423742778,-2.972286474 54.423771844,-2.972025144 54.423880789,-2.971889007 54.42367635,-2.971606737 54.423474264,-2.971031684 54.42333879,-2.96999583 54.423865901,-2.969268464 54.424060196,-2.967454321 54.423890968,-2.966140238 54.423666078,-2.966165772 54.423494486,-2.966269624 54.423476638,-2.966253791 54.423305415,-2.966311413 54.423151671,-2.966431096 54.4230079,-2.966427712 54.422739437,-2.966282682 54.422561818,-2.966016492 54.422434539,-2.966198446 54.422353544,-2.966211952 54.42219365,-2.965977006 54.421955594,-2.965401156 54.421888265,-2.964829324 54.421865246,-2.964335595 54.421887523,-2.963796694 54.421844808,-2.963518273 54.421711374,-2.96334561 54.421657828,-2.963298117 54.42161462,-2.963081335 54.42149842,-2.96300155 54.42146346,-2.962877435 54.421365476,-2.962767254 54.421366091,-2.962690208 54.421296047,-2.962457388 54.42102979,-2.962035029 54.42088479,-2.962185749 54.420759849,-2.96207494 54.420779048,-2.961921273 54.420844403,-2.961614569 54.42076623,-2.961273681 54.420559067,-2.961330478 54.420100057,-2.961412202 54.419714406,-2.961310706 54.419347462,-2.961117183 54.418926358,-2.960953218 54.418610752,-2.961084531 54.417331183,-2.960376531 54.41670218,-2.960361823 54.416702792,-2.960284787 54.416523077,-2.960280585 54.41652369,-2.960203549 54.416164259,-2.960195146 54.416164872,-2.960118111 54.416119943,-2.96011706 54.416120555,-2.960040025 54.416030698,-2.960037925 54.41603131,-2.959960889 54.415986381,-2.959959839 54.415986994,-2.959882804 54.415897136,-2.959880704 54.415897748,-2.959803669 54.415762962,-2.959800519 54.415763574,-2.959723484 54.415628788,-2.959720335 54.4156294,-2.9596433 54.415449685,-2.959639102 54.415450297,-2.959562067 54.41531551,-2.959558919 54.415316123,-2.959481885 54.415136407,-2.959477687 54.415137019,-2.959400653 54.415047162,-2.959398554 54.415047774,-2.959321521 54.414957916,-2.959319422 54.414958528,-2.959242389 54.41486867,-2.95924029 54.414869282,-2.959163257 54.414824353,-2.959162208 54.414824965,-2.959085175 54.414780037,-2.959084126 54.414780648,-2.959007093 54.414735719,-2.959006044 54.414736331,-2.958929011 54.414691402,-2.958927962 54.414693849,-2.95861983 54.414738778,-2.958620879 54.414740001,-2.958466813 54.41478493,-2.958467861 54.414787375,-2.958159729 54.414832304,-2.958160777 54.414837803,-2.957467479 54.414792874,-2.957466432 54.414797149,-2.9569272 54.41475222,-2.956926153 54.414753441,-2.956772087 54.414708512,-2.956771041 54.414709122,-2.956694008 54.414754051,-2.956695054 54.414755882,-2.956463955 54.414710953,-2.956462909 54.414712173,-2.956308843 54.414577387,-2.956305705 54.414577997,-2.956228672 54.41444321,-2.956225534 54.41444382,-2.956148502 54.414398891,-2.956147456 54.414399501,-2.956070424 54.414354572,-2.956069378 54.414355182,-2.955992346 54.414265325,-2.955990254 54.414265934,-2.955913222 54.414221005,-2.955912177 54.414221615,-2.955835145 54.414176686,-2.955834099 54.414179125,-2.955525971 54.414089267,-2.955523881 54.414088048,-2.955677945 54.41399819,-2.955675854 54.4139988,-2.955598823 54.413864013,-2.955595687 54.413865232,-2.955441624 54.413820304,-2.955440579 54.413820913,-2.955363548 54.413865842,-2.955364593 54.413870107,-2.954825373 54.41373532,-2.95482224 54.413736538,-2.954668178 54.413781467,-2.954669222 54.413783294,-2.954438128 54.413648507,-2.954434996 54.413654594,-2.953664686 54.413699523,-2.953665729 54.413700739,-2.953511667 54.413745668,-2.95351271 54.413746276,-2.953435678 54.413925992,-2.95343985 54.413927209,-2.953285787 54.413972137,-2.953286829 54.413972746,-2.953209798 54.41419739,-2.953215011 54.414198606,-2.953060947 54.414153677,-2.953059904 54.414154893,-2.95290584 54.414199822,-2.952906882 54.41420043,-2.95282985 54.414245359,-2.952830893 54.414245967,-2.95275386 54.414290896,-2.952754902 54.414291503,-2.95267787 54.414336432,-2.952678912 54.41433704,-2.95260188 54.414292111,-2.952600838 54.414293327,-2.952446773 54.414248398,-2.952445732 54.414249005,-2.952368699 54.414114218,-2.952365574 54.414113611,-2.952442606 54.413799108,-2.952435314 54.413799716,-2
</polygon>
<polygon>
54.40579318,-2.964651635 54.405792565,-2.964728652 54.405837493,-2.964729706 54.405838109,-2.96465269 54.40579318,-2.964651635
</polygon>
<geocode>
<valueName>TargetAreaCode</valueName>
<value>011FWFNC34</value>
</geocode>
</area>
</info>
</alert>
"""
LONG_GSM7 = WITH_PLACEHOLDER_FOR_CONTENT.format('a' * 1396)
LONG_UCS2 = WITH_PLACEHOLDER_FOR_CONTENT.format('ŵ' * 616)
MISSING_AREA_NAMES = re.sub("<areaDesc>.*</areaDesc>", "<areaDesc> </areaDesc>", WAINFLEET)