From 804a03e19ef237b4edbf29b8d97e4fcf07079b7f Mon Sep 17 00:00:00 2001 From: gwen windflower Date: Sun, 23 Jun 2024 17:21:58 -0500 Subject: [PATCH] feat(evidence): add species page --- .github/workflows/build.yml | 2 +- .vscode/settings.json | 12 +++++++++++ models/marts/species.sql | 5 ++++- reports/pages/index.md | 3 +++ reports/pages/map.md | 3 --- reports/pages/species.md | 42 +++++++++++++++++++++++++++++++++++++ 6 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 .vscode/settings.json delete mode 100644 reports/pages/map.md create mode 100644 reports/pages/species.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbd7b5a..5cfc561 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5.0.0 with: - python-version: "3.11.x" + python-version: "3.12.x" - name: Install Python dependencies run: | python3 -m pip install uv diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..686115c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,12 @@ +{ + "sqltools.connections": [ + { + "name": "dbtree", + "accessMode": "Read Only", + "previewLimit": 50, + "driver": "DuckDB", + "databaseFilePath": "/Users/winnie/dev/dbtree/dbtree.db" + } + ], + "sqltools.useNodeRuntime": true +} diff --git a/models/marts/species.sql b/models/marts/species.sql index 4b316fe..7dcbbe1 100644 --- a/models/marts/species.sql +++ b/models/marts/species.sql @@ -10,11 +10,14 @@ species as ( select species_friendly_name, + species_scientific_name, + 'https://wikipedia.org/wiki/' + || replace(species_scientific_name, ' ', '_') as wikipedia_link, count(*) as count_of_trees, from trees - group by 1 + group by 1, 2 ) diff --git a/reports/pages/index.md b/reports/pages/index.md index ab53118..cd6c277 100644 --- a/reports/pages/index.md +++ b/reports/pages/index.md @@ -48,6 +48,7 @@ order by count_of_trees desc data={trees_planted_years} value="year" /> + an title="Planted between dates" dates=planted_at_month /> + an title="Filter by species" multiple=true /> + + let myColors = [ + "#D7E4C0", + "#C6DCBA", + "#BBC3A4", + "#B3A398", + "#638889" + ] + + +This page lets you scope the data to a single species of tree. It's a bit of a work in progress, but I'm excited to see where it goes! + +**NB:** This list is filtered to species with a scientific name in the data, to support the Wikipedia links. + + + +The is an amazing tree! + + + Read more on Wikipedia! + + +The Wikipedia links are inferred from the listed scientific name in the data, so they're not perfect and may take you to a non-existent page. Sorry! Hopefully I'll find a way around this soon. + +```sql selected_species +select * from species where species_friendly_name = '${inputs.species_select.value}' +``` + +```sql species +select * from dbtree.species +where species_scientific_name is not null +```