Compare commits
No commits in common. "94e12a41f7dd913d26617c484e58d6611634b353" and "ff15f20b556d0338240be0b45bcf587659ca6c7c" have entirely different histories.
94e12a41f7
...
ff15f20b55
44
README.md
44
README.md
|
@ -1,44 +0,0 @@
|
||||||
# 💩📈
|
|
||||||
|
|
||||||
A better web UI for COVID wastewater data
|
|
||||||
|
|
||||||
💩📈 is a simple web server that periodically downloads a data
|
|
||||||
PDF from the Massachusetts Water Resources Authority, parses it to
|
|
||||||
extract the data, and serves the data as CSV and JSON along with
|
|
||||||
a simple Chart.js-based web frontend.
|
|
||||||
|
|
||||||
## Environment variables
|
|
||||||
|
|
||||||
- `CACHED_PDF_PATH`: file path to save the PDF to. Default: `./data.pdf`.
|
|
||||||
- `STATIC_DIR`: directory containing static files to serve. Default: `./static/`.
|
|
||||||
|
|
||||||
## Running
|
|
||||||
|
|
||||||
### Nix Flakes
|
|
||||||
|
|
||||||
```
|
|
||||||
nix run git+https://git.xeno.science/xenofem/poop-graph?ref=main
|
|
||||||
```
|
|
||||||
|
|
||||||
(The Nix package is wrapped with `STATIC_DIR` set automatically to the
|
|
||||||
correct Nix store path, so it'll serve the static files properly
|
|
||||||
no matter what directory you run it from.)
|
|
||||||
|
|
||||||
### Non-Nix
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://git.xeno.science/xenofem/poop-graph
|
|
||||||
cd poop-graph
|
|
||||||
cargo run
|
|
||||||
```
|
|
||||||
|
|
||||||
## Other setup
|
|
||||||
|
|
||||||
- 💩📈 serves HTTP on `127.0.0.1:8080`, and is meant to be used behind
|
|
||||||
a reverse proxy (e.g. Nginx), ideally with SSL certificates
|
|
||||||
(e.g. Let's Encrypt). If you prefer, you could also use that web
|
|
||||||
server to serve the static files, and only pass requests for
|
|
||||||
`/data.csv` and `/data.json` to 💩📈.
|
|
||||||
- You'll probably want to set up a service (systemd or whatever your
|
|
||||||
OS uses) to start 💩📈 automatically with environment
|
|
||||||
variables set appropriately.
|
|
|
@ -73,7 +73,7 @@ async fn main() -> std::io::Result<()> {
|
||||||
HttpServer::new(move || {
|
HttpServer::new(move || {
|
||||||
App::new()
|
App::new()
|
||||||
.app_data(state.clone())
|
.app_data(state.clone())
|
||||||
.wrap(Logger::new(r#"%{r}a "%r" %s %b "%{Referer}i" "%{User-Agent}i" %T"#))
|
.wrap(Logger::default())
|
||||||
.service(csv)
|
.service(csv)
|
||||||
.service(json)
|
.service(json)
|
||||||
.service(actix_files::Files::new("/", static_dir.clone()).index_file("index.html"))
|
.service(actix_files::Files::new("/", static_dir.clone()).index_file("index.html"))
|
||||||
|
|
|
@ -49,14 +49,14 @@
|
||||||
<div>
|
<div>
|
||||||
Download data: <a href="/data.csv">CSV</a> <a href="/data.json">JSON</a>
|
Download data: <a href="/data.csv">CSV</a> <a href="/data.json">JSON</a>
|
||||||
</div>
|
</div>
|
||||||
<h5>
|
<div>
|
||||||
<a href="https://www.mwra.com/biobot/biobotdata.htm">Data source: Massachusetts Water Resources Authority</a>
|
<a href="https://www.mwra.com/biobot/biobotdata.htm">Data source: Massachusetts Water Resources Authority</a>
|
||||||
</h5>
|
</div>
|
||||||
<h5>
|
<div>
|
||||||
<a href="https://git.xeno.science/xenofem/poop-graph">Source code</a>
|
<a href="https://git.xeno.science/xenofem/poop-graph">Source code</a>
|
||||||
</h5>
|
</div>
|
||||||
<h5>
|
<div>
|
||||||
(c) 2022 xenofem, MIT License
|
<h5>(c) 2022 xenofem, MIT License</h5>
|
||||||
</h5>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue