Compare commits

..

61 commits

Author SHA1 Message Date
769e835411 Log geometry to DB, track if geometry has been modified 2024-11-23 17:07:02 -08:00
2f9c408751 Merge branch 'main' into log-outage-location 2024-11-23 16:15:35 -08:00
fbdc85bc29 Merge pull request 'Update dependency numpy to v2.1.3' (#66) from renovate/numpy-2.x into main
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline failed
Reviewed-on: #66
2024-11-20 11:14:22 -08:00
7f4e8232dc Update dependency numpy to v2.1.3
Some checks failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline failed
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-11-06 19:16:31 +00:00
14f217a91e Update dependency SQLAlchemy to v2.0.36
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-11-02 03:10:47 +00:00
ab112abeed quieter-restoration-time (#64)
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
Closes #62

Reviewed-on: #64
2024-10-27 12:30:44 -07:00
13e08bb890 Only count estimated restoration as different if they're 30+m apart (#63)
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
Initial attempt at solving #62.

Currently setting to 30m, can adjust if needed.

Reviewed-on: #63
2024-10-27 10:54:56 -07:00
5075e73494 Move declarations to the right spot
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-10-27 10:30:54 -07:00
1aa5ea0975 Log city and neighborhood to the database for upcoming post editing
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline failed
2024-10-27 08:49:32 -07:00
b98a39629c Update "no longer exists" response to not say the outage is resolved.
All checks were successful
ci/woodpecker/manual/lint Pipeline was successful
ci/woodpecker/manual/vulnerability-scan Pipeline was successful
2024-10-27 08:18:42 -07:00
6a728e9668 Merge pull request 'Update dependency pillow to v11' (#61) from renovate/pillow-11.x into main
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
Reviewed-on: #61
2024-10-15 08:19:02 -07:00
b31609a5d3 Update dependency idna to v3.10
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-10-15 08:17:34 -07:00
d74947c5e1 Update dependency pillow to v11
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-10-15 15:16:54 +00:00
742cf48466 Update dependency charset-normalizer to v3.4.0
Some checks are pending
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/vulnerability-scan Pipeline is pending
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-10-15 15:16:49 +00:00
edc9a2259e Update dependency greenlet to v3.1.1
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-10-05 20:00:14 +00:00
8649c2476f Update dependency numpy to v2.1.2
Some checks failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-10-05 19:00:14 +00:00
aa02f14f66 Update dependency greenlet to v3.1.0
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-09-20 08:01:43 -07:00
de88c7c918 Update dependency SQLAlchemy to v2.0.35
Some checks are pending
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/vulnerability-scan Pipeline is pending
2024-09-20 08:01:23 -07:00
d99da387b2 Update dependency urllib3 to v2.2.3
Some checks are pending
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/vulnerability-scan Pipeline is pending
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-09-20 15:00:23 +00:00
f72d9260f0 Update dependency numpy to v2.1.1
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-09-20 14:00:24 +00:00
c3b1952a79 Handle replying to aa missing post
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-09-11 19:16:52 -07:00
48390aa3f2 Update dependency certifi to v2024.8.30
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-09-03 13:55:04 +00:00
afd40616ea Merge pull request 'Improve map image generation' (#50) from image-improvements into main
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
Reviewed-on: #50
2024-08-25 12:04:51 -07:00
004373034a Map image improvements
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-08-25 11:58:41 -07:00
453cc9105e Add Public Sans font for attribution 2024-08-25 11:58:24 -07:00
aae40e22ad Update dependency idna to v3.8
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-08-23 17:00:15 +00:00
d2a91aea0e Update dependency numpy to v2.1.0
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-08-20 02:42:09 +00:00
245f1d2e92 Update dependency shapely to v2.0.6
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-08-20 02:41:35 +00:00
bc86e5c3de Update dependency numpy to v2.0.1
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-08-13 10:01:34 -07:00
76ed8ab991 Update dependency SQLAlchemy to v2.0.32
Some checks are pending
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/vulnerability-scan Pipeline is pending
2024-08-13 10:01:12 -07:00
d13e4cf1b2 Update dependency PyYAML to v6.0.2
Some checks are pending
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/vulnerability-scan Pipeline is pending
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-08-13 17:00:22 +00:00
27895f63da Update requirements.txt
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-08-13 09:38:59 -07:00
85985594e9 Merge pull request 'Update dependency shapely to v2.0.5' (#42) from renovate/shapely-2.x into main
Some checks failed
ci/woodpecker/push/lint Pipeline failed
ci/woodpecker/push/vulnerability-scan Pipeline was successful
Reviewed-on: #42
2024-08-13 09:37:29 -07:00
895e8a42c6 Update dependency shapely to v2.0.5
Some checks failed
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline failed
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-07-13 11:00:18 +00:00
a8b080372d Merge pull request 'Update dependency numpy to v2' (#40) from renovate/numpy-2.x into main
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
Reviewed-on: #40
2024-07-08 06:26:25 -07:00
078940f15c Merge branch 'main' into renovate/numpy-2.x
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-07-08 06:26:12 -07:00
ee4c58877b Update dependency certifi to v2024.7.4
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-07-04 02:00:21 +00:00
b13faf2cce Update dependency numpy to v2
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
2024-07-01 18:00:23 +00:00
a1d0bbcb49 Update dependency pillow to v10.4.0
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-07-01 10:02:05 -07:00
ec58fd5017 Update dependency SQLAlchemy to v2.0.31
Some checks are pending
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/vulnerability-scan Pipeline is pending
2024-07-01 10:01:43 -07:00
e4fa3ac8fd Update dependency certifi to v2024.6.2
Some checks are pending
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/vulnerability-scan Pipeline is pending
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-07-01 17:00:19 +00:00
62bbe27385 Update dependency urllib3 to v2.2.2
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-07-01 16:31:50 +00:00
7ea7b461b2 Update dependency typing_extensions to v4.12.2
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-06-13 14:05:55 -07:00
114328b204 Update dependency requests to v2.32.3
Some checks are pending
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/vulnerability-scan Pipeline is pending
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-06-13 21:04:17 +00:00
d99f514dfc Don't inlcude estimated restoration times in the past
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-06-02 18:30:15 -07:00
8d70c82d99 Don't include outage number in resolved post 2024-06-02 18:21:15 -07:00
0ecc4577c2 Update dependency typing_extensions to v4.12.0
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-05-27 19:04:14 -07:00
45656c7cb9 Update dependency shapely to v2.0.4
Some checks are pending
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/vulnerability-scan Pipeline is pending
2024-05-27 19:03:54 -07:00
8698d58fb8 Update dependency SQLAlchemy to v2.0.30
Some checks are pending
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline is pending
ci/woodpecker/push/vulnerability-scan Pipeline is pending
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
2024-05-28 02:02:47 +00:00
293a1a3ecb Update dependency pillow to v10.3.0
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-05-28 02:01:06 +00:00
f19bd91a13 Merge pull request 'Update dependency requests to v2.32.2' (#33) from renovate/requests-2.x into main
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline failed
Reviewed-on: #33
2024-05-27 19:00:14 -07:00
620d82b833 Update dependency requests to v2.32.2
Some checks failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline failed
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline failed
2024-05-28 01:58:44 +00:00
a742be98a9 Merge pull request 'Update dependency idna to v3.7' (#30) from renovate/idna-3.x into main
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline failed
Reviewed-on: #30
2024-05-27 18:56:32 -07:00
9970e36e6d Update dependency idna to v3.7
Some checks failed
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline failed
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline failed
2024-04-26 07:00:19 +00:00
459e948a60 Add another sample data
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline failed
2024-04-20 18:23:43 -07:00
3e064c6e63 Always set city from the geocoding (#27)
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline failed
Reviewed-on: #27
2024-04-20 17:18:37 -07:00
5003ed04de Add neighborhood hashtag (#26)
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline failed
Initial implementation for #22

Reviewed-on: #26
2024-04-20 16:56:10 -07:00
4accc75c06 Fix center of outage calculation (#24)
Some checks failed
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline failed
Solves #23

Reviewed-on: #24
2024-04-20 15:03:16 -07:00
8b54a4b78c Update dependency SQLAlchemy to v2.0.28
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-03-04 14:00:21 +00:00
db70ead219 Update dependency python-dateutil to v2.9.0.post0
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-03-01 19:00:27 +00:00
d46174b66b Update dependency python-dateutil to v2.9.0
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/vulnerability-scan Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
ci/woodpecker/pull_request_closed/vulnerability-scan Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/vulnerability-scan Pipeline was successful
2024-03-01 04:00:23 +00:00
7 changed files with 21580 additions and 116 deletions

View file

@ -2,7 +2,7 @@ when:
branch: main
steps:
- name: lint
image: python:3-alpine
image: python:3-slim
commands:
- python -m pip install --upgrade pip
- python -m pip install -r requirements.txt

115
fonts/LICENSE.md Normal file
View file

@ -0,0 +1,115 @@
This repository is a fork of Libre Franklin: https://github.com/impallari/Libre-Franklin
## License for USWDSs Modified Version
This repository contains both the original font software for Libre Franklin (the “Original Version”) and font software modifications made by the General Services Administration (GSA). This repository combines the Original Version and these GSA modifications into a piece of font software called Public Sans, which is a “Modified Version” of Libre Franklin.
As a work of the United States Government, the font software modifications made by GSA are not subject to copyright within the United States. Additionally, GSA waives copyright and related rights in its font software modifications worldwide through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).
The Original Version (as defined in the SIL Open Font License, Version 1.1) remains subject to copyright under the SIL Open Font License, Version 1.1.
This Modified Version (Public Sans) contains both software under the SIL Open Font License, Version 1.1 and software modifications by GSA released as CC0. As a work of the United States Government, the software modifications made by GSA are not subject to copyright within the United States. Additionally, GSA waives copyright and related rights in its software modifications worldwide through the [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/). It is a “joint work” made of the original software and modifications combined into a single work.
**In practice, users of this Modified Version (Public Sans) should use Public Sans according to the terms of the SIL Open Font License, Version 1.1, below.** This is because this font is a combination of work subject to copyright and work not subject to copyright, so the more restrictive requirements apply to using the combined work.
## License of project USWDSs Modified Version is based on
- Libre Franklin is licensed under the SIL Open Font License, Version 1.1 (<http://scripts.sil.org/OFL>)
- To view the copyright and specific terms and conditions of Libre Franklin, please refer to [OFL.txt](https://github.com/impallari/Libre-Franklin/blob/master/OFL.txt)
## SIL Open Font License, Version 1.1
Copyright 2015 The Public Sans Project Authors (https://github.com/uswds/public-sans)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at http://scripts.sil.org/OFL
```
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
```

Binary file not shown.

30
geospatial.py Normal file
View file

@ -0,0 +1,30 @@
from shapely import MultiPolygon, Polygon, Geometry, to_wkb, from_wkb
from sqlalchemy.types import TypeDecorator, LargeBinary
def convert_outage_geometry(event) -> MultiPolygon:
assert event["polygons"]["type"] == "polygon"
assert event["polygons"]["hasZ"] is False
assert event["polygons"]["hasM"] is False
polygon_list = []
for ring in event["polygons"]["rings"]:
polygon_list.append(Polygon(ring))
return MultiPolygon(polygon_list)
class DBGeometry(TypeDecorator):
impl = LargeBinary
cache_ok = True
def process_bind_param(self, value, dialect):
if isinstance(value, Geometry):
value = to_wkb(value)
return value
def process_result_value(self, value, dialect):
if value is None:
return value
else:
if not isinstance(value, Geometry):
value = from_wkb(value)
return value

View file

@ -1,20 +1,20 @@
blurhash==1.1.4
certifi==2024.2.2
charset-normalizer==3.3.2
certifi==2024.8.30
charset-normalizer==3.4.0
decorator==5.1.1
greenlet==3.0.3
idna==3.6
install==1.3.5
greenlet==3.1.1
idna==3.10
pip-install==1.3.5
Mastodon.py==1.8.1
numpy==1.26.4
pillow==10.2.0
python-dateutil==2.8.2
numpy==2.1.3
pillow==11.0.0
python-dateutil==2.9.0.post0
python-magic==0.4.27
PyYAML==6.0.1
requests==2.31.0
shapely==2.0.3
PyYAML==6.0.2
requests==2.32.3
shapely==2.0.6
six==1.16.0
SQLAlchemy==2.0.27
SQLAlchemy==2.0.36
staticmap==0.5.7
typing_extensions==4.10.0
urllib3==2.2.1
typing_extensions==4.12.2
urllib3==2.2.3

File diff suppressed because it is too large Load diff

250
scl.py
View file

@ -1,20 +1,21 @@
import io
import math
from datetime import datetime
from typing import Optional
import mastodon
import requests
import sqlalchemy.types as types
import shapely
import staticmap
import yaml
from mastodon import Mastodon
from PIL import Image, ImageDraw, ImageFont
from shapely import Geometry, MultiPolygon, Point, Polygon, from_wkb, to_wkb
from shapely import Geometry
from sqlalchemy import create_engine, select
from sqlalchemy.exc import NoResultFound
from sqlalchemy.orm import DeclarativeBase, Mapped, Session, mapped_column
from geospatial import DBGeometry, convert_outage_geometry
post_datetime_format = "%b %e %l:%M %p"
scl_events_url = "https://utilisocial.io/datacapable/v2/p/scl/map/events"
@ -45,10 +46,7 @@ class AttribStaticMap(staticmap.StaticMap, object):
super(AttribStaticMap, self)._draw_features(image)
txt = Image.new("RGBA", image.size, (255, 255, 255, 0))
# get a font
# fnt = ImageFont.truetype('FreeMono.ttf', 12)
fnt = ImageFont.load_default()
# get a drawing context
fnt = ImageFont.truetype("fonts/PublicSans-Regular.otf", 24)
d = ImageDraw.Draw(txt)
textSize = fnt.getbbox(self.attribution)
@ -99,24 +97,32 @@ def classify_event_size(num_people: int) -> dict[str, str | bool]:
def get_hashtag_string(event) -> str:
hashtag_string = "#SeattleCityLightOutage #SCLOutage #SCLOutage{}".format(
event["identifier"]
city = str()
try:
city = event["geoloc_city"]
except KeyError:
city = event["city"]
neighborhood_text = str()
try:
neighborhood = event["neighborhood"]
if neighborhood != city:
neighborhood_text = " #{}".format(neighborhood.title().replace(" ", ""))
except KeyError:
pass
hashtag_string = "#SeattleCityLightOutage #SCLOutage{} #{}".format(
neighborhood_text, city.title().replace(" ", "")
)
return hashtag_string
def convert_outage_geometry(event) -> MultiPolygon:
assert event["polygons"]["type"] == "polygon"
assert event["polygons"]["hasZ"] is False
assert event["polygons"]["hasM"] is False
polygon_list = []
for ring in event["polygons"]["rings"]:
polygon_list.append(Polygon(ring))
return MultiPolygon(polygon_list)
def do_initial_post(
event, event_class, start_time: datetime, estimated_restoration_time: datetime
event,
event_class,
start_time: datetime,
estimated_restoration_time: datetime,
outage_geometries: shapely.MultiPolygon,
) -> dict[str, str | None]:
post_id = None
map_media_post_id = None
@ -124,10 +130,11 @@ def do_initial_post(
area_text = event["city"]
try:
map = AttribStaticMap(
512,
512,
url_template="https://tiles.stadiamaps.com/tiles/outdoors/{z}/{x}/{y}.png?api_key="
1024,
1024,
url_template="https://tiles.stadiamaps.com/tiles/outdoors/{z}/{x}/{y}@2x.png?api_key="
+ stadiamaps_api_key,
tile_size=512,
)
assert event["polygons"]["type"] == "polygon"
for ring in event["polygons"]["rings"]:
@ -139,30 +146,22 @@ def do_initial_post(
simplify=True,
)
map.add_polygon(polygon)
map_image = map.render()
try:
outage_center: shapely.Point = outage_geometries.centroid
def num2deg(xtile, ytile, zoom):
n = 1 << zoom
lon_deg = xtile / n * 360.0 - 180.0
lat_rad = math.atan(math.sinh(math.pi * (1 - 2 * ytile / n)))
lat_deg = math.degrees(lat_rad)
return lat_deg, lon_deg
center_lat_lon = num2deg(map.x_center, map.y_center, map.zoom)
assert outage_center.geom_type == "Point"
# Check to make sure the calculated lat and lon are sane enough
# NW Corner
assert center_lat_lon[0] < 48 and center_lat_lon[1] > -122.6
assert outage_center.y < 48 and outage_center.x > -122.6
# SE Corner
assert center_lat_lon[0] > 47.2 and center_lat_lon[1] < -122
assert outage_center.y > 47.2 and outage_center.x < -122
# Zoom level 17 ensures that we won't get any building/POI names, just street names
geocode_url = "{nominatim_url}/reverse?lat={lat}&lon={lon}&format=geocodejson&zoom=17".format(
nominatim_url=nominatim_url,
lat=center_lat_lon[0],
lon=center_lat_lon[1],
lat=outage_center.y,
lon=outage_center.x,
)
geocode_headers = {"User-Agent": "seattlecitylight-mastodon-bot"}
geocode_response = requests.get(geocode_url, headers=geocode_headers)
@ -172,15 +171,15 @@ def do_initial_post(
print("JSON could not be loaded from nominatim API")
raise
if geocode["features"][0]["properties"]["geocoding"]["city"] != "Seattle":
city_not_seattle_text = " of {}".format(
geocode["features"][0]["properties"]["geocoding"]["city"]
)
city = geocode["features"][0]["properties"]["geocoding"]["city"]
street = geocode["features"][0]["properties"]["geocoding"]["name"]
event["geoloc_city"] = city
if city != "Seattle":
city_not_seattle_text = " of {}".format(city)
else:
city_not_seattle_text = ""
street = geocode["features"][0]["properties"]["geocoding"]["name"]
if (
"locality" in geocode["features"][0]["properties"]["geocoding"]
and event_class["size"] != "Large"
@ -195,35 +194,37 @@ def do_initial_post(
city_not_seattle_text,
)
area_text = "the {} area{}".format(locality, city_not_seattle_text)
event["neighborhood"] = locality
elif "district" in geocode["features"][0]["properties"]["geocoding"]:
district = geocode["features"][0]["properties"]["geocoding"]["district"]
alt_text = "A map showing the location of the outage, centered around {} in the {} area{}.".format(
street,
geocode["features"][0]["properties"]["geocoding"]["district"],
district,
city_not_seattle_text,
)
area_text = "the {} area{}".format(
geocode["features"][0]["properties"]["geocoding"]["district"],
district,
city_not_seattle_text,
)
event["neighborhood"] = district
else:
alt_text = "A map showing the location of the outage, centered around {} in {}.".format(
street,
geocode["features"][0]["properties"]["geocoding"]["city"],
city,
)
area_text = geocode["features"][0]["properties"]["geocoding"]["city"]
area_text = city
except Exception:
alt_text = "A map showing the location of the outage."
map_image = map.render()
with io.BytesIO() as map_image_file:
map_image.save(map_image_file, format="PNG", optimize=True)
if __debug__:
print("Would have uploaded the map media here")
else:
map_media_post = mastodon_client.media_post(
map_image_file.getvalue(),
mime_type="image/png",
description=alt_text,
)
map_image.save(map_image_file, format="WebP", method=6)
map_media_post = mastodon_client.media_post(
map_image_file.getvalue(),
mime_type="image/png",
description=alt_text,
)
map_media_post_id = map_media_post["id"]
except Exception as e:
@ -234,17 +235,22 @@ def do_initial_post(
map_media_post = None
hashtag_string = get_hashtag_string(event)
est_restoration_post_text = str()
if estimated_restoration_time > datetime.now():
est_restoration_post_text = "\nEst. Restoration: {}\n".format(
estimated_restoration_time.strftime(post_datetime_format)
)
post_text = """Seattle City Light is reporting a {} outage in {}.
Start Date: {}
Est. Restoration: {}
Start Date: {}{}
Cause: {}
{}""".format(
event_class["size"].lower(),
area_text,
start_time.strftime(post_datetime_format),
estimated_restoration_time.strftime(post_datetime_format),
est_restoration_post_text,
event["cause"],
hashtag_string,
)
@ -255,31 +261,21 @@ Cause: {}
)
)
post_result = mastodon_client.status_post(
status=post_text,
media_ids=map_media_post,
visibility="public",
language="en",
)
post_result = {"id": "0123"}
# post_result = mastodon_client.status_post(
# status=post_text,
# media_ids=map_media_post,
# visibility="public",
# language="en",
# )
post_id = post_result["id"]
return {"post_id": post_id, "map_media_post_id": map_media_post_id}
class GeometryWkb(types.TypeDecorator):
impl = types.LargeBinary
cache_ok = True
def process_bind_param(self, value, dialect):
return to_wkb(value)
def process_result_value(self, value, dialect):
return from_wkb(value)
class Base(DeclarativeBase):
type_annotation_map = {
Geometry: GeometryWkb,
Geometry: DBGeometry,
}
@ -298,10 +294,13 @@ class SclOutage(Base):
start_time: Mapped[datetime] = mapped_column()
num_people: Mapped[int] = mapped_column()
max_num_people: Mapped[int] = mapped_column()
outage_geometries: Mapped[Geometry] = mapped_column()
neighborhood: Mapped[Optional[str]] = mapped_column()
city: Mapped[Optional[str]] = mapped_column()
outage_geometries: Mapped[Optional[Geometry]] = mapped_column()
geometries_modified: Mapped[Optional[bool]] = mapped_column()
def __repr__(self) -> str:
return f"SclOutage(scl_outage_id={self.scl_outage_id!r}, most_recent_post_id={self.most_recent_post_id!r}, initial_post_id={self.initial_post_id!r}, map_media_post_id={self.map_media_post_id!r}, last_updated_time={self.last_updated_time!r}, no_longer_in_response_time={self.no_longer_in_response_time!r}), start_time={self.start_time!r}), num_people={self.num_people!r}), max_num_people={self.max_num_people!r}), outage_geometries={self.outage_geometries!r}"
return f"SclOutage(scl_outage_id={self.scl_outage_id!r}, most_recent_post_id={self.most_recent_post_id!r}, initial_post_id={self.initial_post_id!r}, map_media_post_id={self.map_media_post_id!r}, last_updated_time={self.last_updated_time!r}, no_longer_in_response_time={self.no_longer_in_response_time!r}, start_time={self.start_time!r}, num_people={self.num_people!r}, max_num_people={self.max_num_people!r}, neighborhood={self.neighborhood!r}, city={self.city!r}, outage_geometries={self.outage_geometries!r}, geometries_modified={self.geometries_modified!r})"
engine = create_engine("sqlite:///scl.db")
@ -327,21 +326,33 @@ with Session(engine) as session:
status = None
outage_geometries = convert_outage_geometry(event)
scl_outage_location = Point(event["latitude"], event["longitude"])
try:
hashtag_string = get_hashtag_string(event)
existing_record = lookup_result.one()
updated_properties = []
updated_entries = []
if estimated_restoration_time != existing_record.estimated_restoration_time:
existing_record.estimated_restoration_time = estimated_restoration_time
updated_properties.append("estimated restoration")
updated_entries.append(
"Est. Restoration: {}".format(
estimated_restoration_time.strftime(post_datetime_format)
)
est_restoration_diff_mins = (
abs(
(
estimated_restoration_time
- existing_record.estimated_restoration_time
).total_seconds()
)
/ 60
)
# Only post if estimated restoration time has changed by 60m or more
if est_restoration_diff_mins >= 60:
existing_record.estimated_restoration_time = estimated_restoration_time
if estimated_restoration_time > datetime.now():
# New estimated restoration time is in the future, so likely to be a real time
updated_properties.append("estimated restoration")
updated_entries.append(
"Est. Restoration: {}".format(
estimated_restoration_time.strftime(post_datetime_format)
)
)
if event["cause"] != existing_record.cause:
existing_record.cause = event["cause"]
updated_properties.append("cause")
@ -362,9 +373,9 @@ with Session(engine) as session:
existing_record.max_num_people = event["numPeople"]
max_event_class = classify_event_size(existing_record.max_num_people)
if existing_record.outage_geometries != outage_geometries:
print("updating geometries")
print("Geometries modified")
existing_record.outage_geometries = outage_geometries
existing_record.geometries_modified = True
if updated_properties:
updated_properties.sort()
@ -385,20 +396,41 @@ with Session(engine) as session:
),
)
if max_event_class["is_postable"] and existing_record.initial_post_id:
post_result = mastodon_client.status_post(
status="\n".join(updated_entries),
in_reply_to_id=existing_record.most_recent_post_id,
visibility="unlisted",
language="en",
)
existing_record.most_recent_post_id = post_result["id"]
try:
post_result = mastodon_client.status_post(
status="\n".join(updated_entries),
in_reply_to_id=existing_record.most_recent_post_id,
visibility="unlisted",
language="en",
)
existing_record.most_recent_post_id = post_result["id"]
except mastodon.MastodonNotFoundError:
print(
"Could not post a reply to the existing post, skip this update"
)
elif max_event_class["is_postable"]:
print(
"Posting an event that grew above the threshold required to post"
)
initial_post_result = do_initial_post(
event, event_class, start_time, estimated_restoration_time
event,
event_class,
start_time,
estimated_restoration_time,
outage_geometries,
)
try:
existing_record.neighborhood = initial_post_result[
"neighborhood"
]
except KeyError:
pass
try:
existing_record.city = initial_post_result["city"]
except KeyError:
pass
existing_record.initial_post_id = initial_post_result["post_id"]
existing_record.most_recent_post_id = initial_post_result["post_id"]
existing_record.map_media_post_id = initial_post_result[
@ -412,6 +444,8 @@ with Session(engine) as session:
print("Existing record not found")
post_id = None
map_media_post_id = None
neighborhood = None
city = None
if not event_class["is_postable"]:
print(
"Outage is {} considered postable, will not post".format(
@ -420,11 +454,25 @@ with Session(engine) as session:
)
else:
initial_post_result = do_initial_post(
event, event_class, start_time, estimated_restoration_time
event,
event_class,
start_time,
estimated_restoration_time,
outage_geometries,
)
post_id = initial_post_result["post_id"]
map_media_post_id = initial_post_result["map_media_post_id"]
try:
neighborhood = initial_post_result["neighborhood"]
except KeyError:
pass
try:
city = initial_post_result["city"]
except KeyError:
pass
new_outage_record = SclOutage(
scl_outage_id=event["id"],
outage_user_id=event["identifier"],
@ -438,6 +486,8 @@ with Session(engine) as session:
start_time=start_time,
num_people=event["numPeople"],
max_num_people=event["numPeople"],
neighborhood=neighborhood,
city=city,
outage_geometries=outage_geometries,
)
session.add(new_outage_record)
@ -455,9 +505,7 @@ with Session(engine) as session:
if active_outage.most_recent_post_id:
try:
post_result = mastodon_client.status_post(
status="This outage is reported to be resolved.\n\n#SeattleCityLightOutage #SCLOutage #SCLOutage{}".format(
active_outage.outage_user_id
),
status="This outage is no longer in the SCL feed, which usually means it's either been resolved, or split into multiple smaller outages.\n\n#SeattleCityLightOutage #SCLOutage",
in_reply_to_id=active_outage.most_recent_post_id,
visibility="public",
language="en",