Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
33d3e83
this shows the format for storing db credentials
LewisStaples Jun 30, 2020
b715cb6
ignore file with database credentials
LewisStaples Jun 30, 2020
941423c
gitignore will ignore Pipfile.lock
LewisStaples Jun 30, 2020
424b1d2
Implemented creating db schema (also includes a Python file for testing)
LewisStaples Jul 6, 2020
3d11f3c
Improved comments to the functions
LewisStaples Jul 6, 2020
de24969
Merge branch 'master' of https://github.com/LewisStaples/flagging int…
dwreeves Jul 6, 2020
e3c04f9
Horrific bugfix. Issue is explained in comments
dwreeves Jul 8, 2020
c47af8b
MVP of database
dwreeves Jul 19, 2020
b280273
Homepage data comes in from the db now
dwreeves Jul 19, 2020
b6bcb20
updated dev scripts
dwreeves Jul 19, 2020
e4d6c2b
bugfix
dwreeves Jul 19, 2020
066d690
remove prints
dwreeves Jul 19, 2020
71eaab0
Installed flask_sqlalchemy
LewisStaples Jul 23, 2020
3592d56
preliminary design of widget on front page
edsun123 Jul 26, 2020
0564c7f
first design of widget on front page
edsun123 Jul 26, 2020
b79a805
added define_boathouse.sql and create new boathouse table
edsun123 Jul 27, 2020
d00ce9e
edited README.md; added database.md to /docs
edsun123 Jul 28, 2020
2594b0e
corrected reach_model for henderson
edsun123 Jul 29, 2020
9832aa1
corrected reach model for henderson in sql file
edsun123 Jul 29, 2020
64a407d
fixed issues in the docs, sql file, and database.py
edsun123 Jul 29, 2020
24e423f
49: allowing 1 or 48 hrs of data to be pulled from db; 50: displaying…
LewisStaples Aug 4, 2020
6edc594
Issue#49 complete: latest_model_outputs returns 1 thru 48, depending …
LewisStaples Aug 4, 2020
99f70a6
Fix to get full 48 hours of numeric data populated
LewisStaples Aug 5, 2020
b1d5e64
cleaned up code (print statements)
LewisStaples Aug 5, 2020
dd5ee06
cleaned up comments in sql query
LewisStaples Aug 5, 2020
57aaa0d
Merge pull request #67 from LewisStaples/dev_postgres
dwreeves Aug 9, 2020
d8b6837
Merge branch 'dev_postgres' into dev_postgres
dwreeves Aug 9, 2020
a6c092a
Merge pull request #64 from edsun123/dev_postgres
dwreeves Aug 9, 2020
c367d94
param. of single-reach display restored; Issue#50 implemented for API
LewisStaples Aug 10, 2020
2e8d5c2
Cleaned up comments, removed commented-out code
LewisStaples Aug 10, 2020
d4dfdbb
Make functions available in Flask shell (#61)
bancona Aug 11, 2020
05546a7
verifying db isn't there, creating db
LewisStaples Aug 14, 2020
341a378
creating flagging user
LewisStaples Aug 15, 2020
ea67ea3
early attempt at modifying flagging password
LewisStaples Aug 16, 2020
243203a
Merge pull request #70 from bancona/61-add-shell-context
dwreeves Aug 18, 2020
01e3f6b
Merge pull request #71 from dwreeves/master
dwreeves Aug 18, 2020
569b3e5
fix to environment variable error
LewisStaples Aug 19, 2020
81299cf
revised tests
Aug 20, 2020
ac02838
Add cyanobacteria override administration
bancona Aug 19, 2020
35b2fdf
Make / code clearer
bancona Aug 22, 2020
013a1bc
Add documentation
bancona Aug 22, 2020
8da2d8e
Add reason field
bancona Aug 22, 2020
8d21276
unused import
bancona Aug 22, 2020
5fbb120
initial commit
Aug 23, 2020
eabb0dd
Time Scheduler Directions Added
Aug 23, 2020
d71d7a6
revised md
Aug 23, 2020
020c585
revised md
Aug 23, 2020
0a333e5
removing flagging user
LewisStaples Aug 24, 2020
050d09c
removed reach as a superfluous displayed column
LewisStaples Aug 24, 2020
d70d303
Add newlines at end of files, and add basic auth config
bancona Aug 25, 2020
f9224ee
Fix config
bancona Aug 25, 2020
56738d5
revised
edsun123 Aug 25, 2020
d83e6fe
Merge pull request #69 from LewisStaples/dev_postgres
dwreeves Aug 26, 2020
8e256af
merged dev and dev_postgres
LewisStaples Aug 30, 2020
2c5631e
Fixing to allow merge to run
LewisStaples Aug 31, 2020
17d5e2f
merge continued: brought in api logic
LewisStaples Sep 1, 2020
85c25c3
Merge branch 'dev_postgres' into admin-page
dwreeves Sep 2, 2020
09551b7
Merge pull request #79 from bancona/admin-page
dwreeves Sep 2, 2020
34d49d1
Fixed requirements.txt being binary and added filter over psycopg2 in…
dwreeves Sep 2, 2020
4c4cf62
Merge pull request #84 from dwreeves/dev_postgres
dwreeves Sep 2, 2020
b261f97
Updates to docs
dwreeves Sep 2, 2020
0598e9a
Bugfix
dwreeves Sep 2, 2020
c4aa43b
routing update
dwreeves Sep 2, 2020
2aca4bd
switching from bool to strtobool
LewisStaples Sep 3, 2020
1bf36c3
Merge pull request #80 from dfe325/issue53
dwreeves Sep 7, 2020
09e39e6
added back the changes
edsun123 Sep 8, 2020
993af00
cleaning: removed disused commented-out code
LewisStaples Sep 9, 2020
8204297
combined commit to debug heroku dev_postgres
edsun123 Sep 8, 2020
b2cace1
added two options between heroku uri and local uri
edsun123 Sep 10, 2020
5a8fe64
added two options between heroku uri and local uri
edsun123 Sep 10, 2020
5c17119
added two options between heroku uri and local uri
edsun123 Sep 10, 2020
361cc55
fixing pw
edsun123 Sep 10, 2020
7998098
fixing pw
edsun123 Sep 10, 2020
6c5239b
fixing pw
edsun123 Sep 10, 2020
e9599d5
Home page populated with boathouse names, reach numbers in db table (…
LewisStaples Sep 15, 2020
b62f7b2
cleaning: delete unneeded import, restore sql echoing
LewisStaples Sep 15, 2020
563aa4e
Some updates to our docs (still WIP)
dwreeves Sep 15, 2020
7fcc585
minor updates
dwreeves Sep 16, 2020
69eea32
resolved merge conflict
dwreeves Sep 16, 2020
c619e6b
Merge branch 'LewisStaples-47-merge-dev-and-dev-postgres' into dev_po…
dwreeves Sep 16, 2020
3194bc2
Merge pull request #88 from dwreeves/47-merge-dev-and-dev-postgres
dwreeves Sep 16, 2020
9a72b9c
Merge branch 'master' of https://github.com/codeforboston/flagging in…
dwreeves Sep 16, 2020
9a4b824
merge dev in
dwreeves Sep 16, 2020
afb8701
Merge branch 'dev_postgres' of https://github.com/codeforboston/flagg…
dwreeves Sep 16, 2020
08f28cd
Refactor config related stuff
dwreeves Sep 16, 2020
405b5be
added procfile comments
dwreeves Sep 16, 2020
6012d0c
gitignore pgadmin4
dwreeves Sep 16, 2020
b8aba68
single source of truth for versioning
dwreeves Sep 16, 2020
6f29187
single source of truth for versioning
dwreeves Sep 16, 2020
72de7be
refactoring data portion of code
dwreeves Sep 16, 2020
d4bf676
delete depreciated todo
dwreeves Sep 16, 2020
630d2b8
changed docs setup
dwreeves Sep 17, 2020
8a138aa
Refactors and code cleaning
dwreeves Sep 17, 2020
53eebe1
Added Twitter bot and new archiving strategy
dwreeves Sep 17, 2020
5497766
Updated docs
dwreeves Sep 17, 2020
786495a
slimmed down requirements.txt
dwreeves Sep 17, 2020
815eb9b
refactoring
dwreeves Sep 17, 2020
9ca1c20
bugfix
dwreeves Sep 17, 2020
439947d
made tweet transparent in cli
dwreeves Sep 18, 2020
8042141
Twitter bot updates and refactoring
dwreeves Sep 18, 2020
a10a25b
forgot basicauth user/pw in dev
dwreeves Sep 18, 2020
2cae6fc
More docs changes and minor touchups
dwreeves Sep 18, 2020
26b64fb
bugfix
dwreeves Sep 18, 2020
b37f6fb
fix
dwreeves Sep 18, 2020
52e20f8
modified docs
dwreeves Sep 18, 2020
cbd703d
typo
dwreeves Sep 18, 2020
4b07be9
issue 75: api for boathouse metadata
LewisStaples Sep 20, 2020
c709907
added documentation for boathouse metadata API
LewisStaples Sep 21, 2020
292a92e
Organize CSS and prettify
bancona Sep 22, 2020
7ad3a05
corrections: capitalized class Boathouses, converted API doc into a …
LewisStaples Sep 22, 2020
8aaa6df
Merge pull request #89 from dwreeves/dev_postgres
dwreeves Sep 23, 2020
88b88b4
reset
edsun123 Sep 26, 2020
2ee1d62
small add to setup Postgres
edsun123 Sep 26, 2020
c04a059
added text
edsun123 Sep 26, 2020
167dd13
removed text
edsun123 Sep 26, 2020
4c30ecc
Merge branch 'dev_postgres' of https://github.com/edsun123/flagging i…
edsun123 Sep 26, 2020
5e6ee60
added meta tag
edsun123 Sep 26, 2020
72063f9
open graph protocol
edsun123 Sep 26, 2020
f3227c6
minor changes
dwreeves Sep 27, 2020
5752688
Merge pull request #90 from bancona/prettify-site
dwreeves Sep 27, 2020
9f0c37d
Merge pull request #94 from edsun123/dev
dwreeves Sep 27, 2020
3250b61
Merge branch 'dev_postgres' of https://github.com/dwreeves/flagging i…
dwreeves Sep 27, 2020
56872fa
added twitter tags
dwreeves Sep 27, 2020
646a293
fixed typo
dwreeves Sep 27, 2020
8f3a840
merge boathouses orm and typo fixes
dwreeves Sep 27, 2020
826c27e
bugfix
dwreeves Sep 28, 2020
e5e48fb
testing
dwreeves Sep 28, 2020
1a1c5c3
test
dwreeves Sep 28, 2020
17a4819
added iframe rendering
dwreeves Sep 29, 2020
7eb8dd9
bugfix
dwreeves Sep 30, 2020
419ec8e
minor style change
dwreeves Sep 30, 2020
2f4234d
Extended the docs with macros
dwreeves Sep 30, 2020
4802e12
Minor typo fix and docstring addtitions
sameeravithanage Oct 1, 2020
edb85fd
Merge pull request #101 from sameeravithanage/dev_branch
dwreeves Oct 1, 2020
fc80e4b
Revert "Minor typo fix and doc-string additions"
dwreeves Oct 3, 2020
e7c044d
Merge pull request #102 from codeforboston/revert-101-dev_branch
dwreeves Oct 3, 2020
91b5732
Merge pull request #93 from edsun123/dev_postgres
dwreeves Oct 3, 2020
2d7476e
updated deployment docs
dwreeves Oct 4, 2020
7b002f4
Updated prod config for heroku deployment
dwreeves Oct 4, 2020
96c4574
resolved merge conflict
dwreeves Oct 4, 2020
f4cf505
update to deployment instructions
dwreeves Oct 4, 2020
2d8c024
bugfix
dwreeves Oct 4, 2020
4ada26a
Embedded social media stuff
dwreeves Oct 4, 2020
ccf93c9
Updated about
dwreeves Oct 4, 2020
c76c7be
modified readme and added new image
dwreeves Oct 4, 2020
f5245b2
Overhauled API and added endpoint for model inputs
dwreeves Oct 4, 2020
aa16c05
minor style change
dwreeves Oct 4, 2020
f12baa3
added more route tests
dwreeves Oct 4, 2020
f4576b5
Merge pull request #104 from dwreeves/master
dwreeves Oct 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .flaskenv
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
FLASK_APP=flagging_site
FLASK_APP="flagging_site:create_app"
FLASK_ENV=development
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ docs/site/
.vscode/
*.code-workspace
.idea/
keys.json
.DS_Store
Pipfile
Pipfile.lock
pgadmin4/
mkdocs_env/
secrets.json
keys.json

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -144,5 +148,3 @@ dmypy.json

# Cython debug symbols
cython_debug/l

flagging_site/keys.json
9 changes: 8 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
web: gunicorn "flagging_site:create_app()"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This file is used to deploy the website to Heroku
#
# See here for more:
# https://devcenter.heroku.com/articles/procfile
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

web: gunicorn "flagging_site:create_app('production')"
61 changes: 9 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,19 @@
# Flagging Website

This is the code base for the [Charles River Watershed Association's](https://crwa.org/) ("CRWA") flagging website. The flagging website hosts an interface for the CRWA's staff to monitor the outputs of a predictive model that determines whether it is reasonably safe to swim or boat in the Charles River.

This code base is built in Python 3.7+ and utilizes the Flask library heavily. The website can be run locally in development mode, and it can be deployed to Heroku using Gunicorn.

## For Developers

Please read the [Flagging Website wiki](https://github.com/codeforboston/flagging/wiki) for on-boarding documents, code style guide, and development requirements.

For strict documentation of the website sans project management stuff, read the docs [here](https://codeforboston.github.io/flagging/).

## Setup (Dev)

These are the steps to set the code up in development mode.

**On Windows:** open up a Command Prompt terminal window (the default in PyCharm on Windows), point the terminal to the project directory if it's not already there, and enter:

```commandline
run_windows_dev
```
![](flagging_site/static/images/og_preview.png)

If you are in PowerShell (default VSC terminal), use `start-process run_windows_dev.bat` instead.
**Our website is live at: [https://crwa-flagging.herokuapp.com/](https://crwa-flagging.herokuapp.com/)**

**On OSX or Linux:** open up a Bash terminal, and in the project directory enter:
## Overview

```shell script
sh run_unix_dev.sh
```

After you run the script for your respective OS, it will ask you if you want to use online mode. If you do not have the "vault password," say yes (`y`)

After that, it will ask if you have the vault password. If you do, enter it here. If not, you can skip this.

Note that the website will _not_ without either the vault password or offline mode turned on; you must do one or the other.

## Deploy

1. Download Heroku.

2. Set the vault password:

```shell script
heroku config:set VAULT_PASSWORD=replace_me_with_pw
```

3. Everything else should be set:
This is the code base for the [Charles River Watershed Association's](https://crwa.org/) ("CRWA") flagging website. The flagging website hosts an interface for the CRWA's staff to monitor the outputs of a predictive model that determines whether it is reasonably safe to swim or boat in the Charles River.

```shell script
heroku create crwa-flagging-staging
git push heroku master
```
This code base is built in Python 3.7+ and utilizes the Flask library heavily. The website can be run locally in development mode, and it can be deployed to Heroku using Gunicorn.

## Run tests
## For Developers and Maintainers

Tests are written in Pytest. To run tests, run the following on your command line:
**[Read our documentation here.](https://codeforboston.github.io/flagging/)** Our documentation contains information on everything related to the website, including [first time setup](https://codeforboston.github.io/flagging/setup/).

```shell script
python -m pytest ./tests -s
```
## Credits

Note: the test may require you to enter the vault password if it is not already in your environment variables.
This website was built by volunteers at [Code for Boston](https://www.codeforboston.org/) in collaboration with the Charles River Watershed Association.
27 changes: 21 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,38 @@

The full docs are available at: https://codeforboston.github.io/flagging/

### Info

The docs were made with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/).

There are a lot of extensions included in this documentation in addition to Material:

- Most of the extensions come from [PyMdown Extensions](https://facelessuser.github.io/pymdown-extensions/).
- We use a tool called [Mermaid](https://mermaid-js.github.io/mermaid-live-editor/) for our flow charts.
- We use the [macros plugin](https://squidfunk.github.io/mkdocs-material/reference/variables/) but only to parameterize the flagging website URL (the `flagging_website_url` field inside of `mkdocs.yml`).

All of these tools are added and configured inside `mkdocs.yml`. Note you need to pip install them for them to work when you deploy; see deployment script below.

### Deploying / Refreshing the Docs

If you have write permission to the upstream repository (i.e. you are a project manager), point your terminal to this directory and run the following:

```shell script
mkdocs gh-deploy --remote-branch upstream
python3 -m venv mkdocs_env
source mkdocs_env/bin/activate
pip install mkdocs pymdown-extensions mkdocs-material mkdocs-macros-plugin pygments
mkdocs gh-deploy --remote-name upstream
deactivate
source ../venv/bin/activate
```

If you do not have write permission to the upstream repository, you can do one of the following:

1. (Preferred) Ask a project manager to refresh the pages after you've made changes to the docs.
2. Run `mkdocs gh-deploy` on your own fork, and then do a pull request to `codeforboston:gh-pages`

If you are a project manager but you're having issues, you can do a more manual git approach to updating the docs:
2. Run `mkdocs gh-deploy` on your own fork, and then do a pull request to `codeforboston:gh-pages`:

```shell script
mkdocs gh-deploy
git checkout gh-pages
git push upstream gh-pages
```
git push origin gh-pages
```
32 changes: 32 additions & 0 deletions docs/docs/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# About

## Flagging Website

Of the many services that the CRWA provides to the greater Boston community, one of those is monitoring whether it is safe to swim and/or boat in the Charles River. The CRWA Flagging Program uses a system of color-coded flags to indicate whether or not the river's water quality is safe for boating at various boating locations between Watertown and Boston. Flag colors are based on E. coli and cyanobacteria (blue-green algae) levels; blue flags indicate suitable boating conditions and red flags indicate potential health risks.

See the website's [about page]({{ flagging_website_url }}/about) for more about the website functionality and how it relates to the flagging program's objectives.

See the [development resources overview](development/history) for more information on how this project started and how we came to make the design decisions that you see here today.

## Code for Boston

Code for Boston is the group that built the CRWA's flagging website. You can find a list of individual contributors [here](https://github.com/codeforboston/flagging/graphs/contributors)

Code for Boston is a volunteer Civic Technology meetup. We are part of the [Code for America Brigade network](http://www.codeforamerica.org/brigade/about), and are made up of developers, designers, data geeks, citizen activists, and many others who use creative technology to solve civic and social problems.

## Charles River

![](https://www.epa.gov/sites/production/files/styles/large/public/2015-04/cr-watershed-map.jpg)

[Via the EPA:](https://www.epa.gov/charlesriver/about-charles-river#HistoricalTimeline)

> The Charles River flows 80 miles from Hopkinton, Mass. to Boston Harbor. The Charles River is the most prominent urban river in New England. It is a major source of recreation and a readily-available connection to the natural world for residents of the Boston metropolitan area. The entire Charles River drains rain and melted snow from a watershed area of 310 square miles.

## Charles River Watershed Association (CRWA)

The Charles River Watershed Association ("CRWA") was formed in 1965, the same year that Dirty Water peaked at #11 on the Billboard singles chart. [Via the CRWA's website:](https://www.crwa.org/about.html)

> CRWA is one of the country’s oldest watershed organizations and has figured prominently in major cleanup and protection efforts. Since our earliest days of advocacy, we have worked with government officials and citizen groups from 35 Massachusetts watershed towns from Hopkinton to Boston.

The EPA also relies on sample data collected by the CRWA to construct its report card.

20 changes: 20 additions & 0 deletions docs/docs/admin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Admin Panel

???+ Note
This page discusses how to use the admin panel for the website. For how to set up the admin page username and password during deployment, see the [Heroku deployment](cloud/heroku_deployment) documentation.

The admin panel is used to manually override the model outputs during events and advisories that would adversely effect the river quality.

You can reach the admin panel by going to `/admin` after the base URL for the flagging website. (You need to it in manually.)

You will be asked a username and password, which will be provided to you by the person who deployed the website. Enter the correct credentials to enter the admin panel.

???+ note
In "development" mode, the default username is `admin` and the password is `password`. In production, the environment variables `BASIC_AUTH_USERNAME` and `BASIC_AUTH_PASSWORD` are used to set the credentials.

## Cyanobacteria Overrides

There should be a link to this page in the admin navigation bar.
On this page, one can add an override for a reach with a start time and end time,
and if the current time is between those times then the reach will be marked as
unsafe on the main website, regardless of the model data.
46 changes: 0 additions & 46 deletions docs/docs/background.md

This file was deleted.

Loading