TSX

Provides reliable and robust measures of change in the relative abundance of Australia's threatened and near-threatened species at national, state and regional levels.
https://github.com/nesp-tsr3-1/tsx

Category: Biosphere
Sub Category: Terrestrial Wildlife

Keywords from Contributors

optimize archiving measur transforms observation animals generic projection compose conversion

Last synced: about 23 hours ago
JSON representation

Repository metadata

Australian Threatened Species Index

README.rst

          ===================================================================
Welcome to the Australian Threatened Species Index (TSX) Repository
===================================================================

For information about the Australian Threatened Species Index project, see https://tsx.org.au

The code in this repository is responsible for data import and pre-processing of data, and visualsation of the generated trend graphs and associated data.


User Guide
==========

The easiest way to learn about running the TSX workflow is to check out the User Guide at https://tsx.org.au/user-guide/

Overview
========

The TSX consists of several components

- MySQL database:
    - For storage of raw data, which is either uploaded via the data interface, or imported via the command line scripts
    - For storage for the data interface (e.g. user accounts, custodian feedback data, etc.)
    - For processing of data using SQL queries and storing the results
    - database schema is found under `db/sql/create.sql`

- Python scripts:
    - For running the TSX workflow that transforms raw data into time series
    - For importing data such as taxonomic lists and species range polygons
    - For generating trend permutations to be displayed by the TSX visualiser
    - Found in the `tsx` directory

- LPI R package (https://github.com/Zoological-Society-of-London/rlpi)
    - Developed by Zoological Society of London
    - For producing trends from time series using the Living Planet Index method
    - We maintain a fork at https://github.com/nesp-tsr3-1/rlpi for bugfixes

- API backend:
    - Implemented in Python as a Flask app
    - Backend for TSX Data Interface and TSX Visualiser
    - Code lives under `tsx/api`

- Data interface front-end (https://tsx.org.au/data)
    - Implemented using the Vue Javascript framework
    - Provides an interface for users to upload, manage and analyse datasets
    - Requires login access (data custodians can self-register)
    - Code lives under `web/data`

- TSX Visualiser (https://tsx.org.au/tsx)
    - Implemented using the Vue Javascript framework
    - A single-page application that allows users to explore a set of trend permutations
    - A separate instance is deployed for each new version of the TSX
    - Code lives under `web/tsx`


Setup
=====

Prerequisites
-------------

- MySQL 8.x
- Python 3.12+
- Node 22+
- R 3.6+
- `uv `_

Clone this repository
---------------------

git clone https://github.com/nesp-tsr3-1/tsx.git


Native install vs Docker Compose
--------------------------------

There are two main options for getting a TSX development environment up and running:

1. Installing dependencies natively as per instructions below

2. Use the supplied Docker Compose configuation to automatically build containers with the necessary dependencies included. This is quicker to get up and running, but is arguably more complicated to use for development and requires some familiarity with Docker. (See `Docker Compose Instructions`_.)


Install native packages
-----------------------

Install development libraries (Ubuntu/Debian):

.. code:: bash

 sudo apt-get update
 sudo apt-get install -y --no-install-recommends libgdal-dev r-base r-base-dev git build-essential libharfbuzz-dev libfribidi-dev  libfontconfig1-dev libgit2-dev libssl-dev  default-mysql-client libbz2-dev curl

On macOS, we recommend using homebrew to install packages as needed while following the steps below.

Create MySQL database
---------------------

By default, the TSX software is configured to use a database called 'tsx' with a username of 'tsx' and a password of 'tsx'. This is configured in the `tsx.conf` file.

To create this database and user, connect to MySQL as root and run the following commands:

.. code:: sql

 CREATE USER 'tsx'@'%' IDENTIFIED BY 'tsx';
 CREATE DATABASE tsx;
 GRANT ALL PRIVILEGES ON tsx.* TO 'tsx'@'%';


Alternatively, you can avoid installing MySQL and instead run it via Docker (https://hub.docker.com/_/mysql/):

.. code:: bash

 docker run -d --name tsx-mysql -e MYSQL_DATABASE=tsx -e MYSQL_USER=tsx -e MYSQL_PASSWORD=tsx \
   -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 mysql:8.3.0


Initialise MySQL database
--------------------------

Initialise the database using the provided scripts:

.. code:: bash

 mysql -u root -p tsx < db/sql/create.sql
 mysql -u root -p tsx < db/sql/init.sql
 mysql -u root -p tsx < sample-data/seed.sql


Copy example configuration
--------------------------

.. code:: bash

 cp tsx.conf.example tsx.conf

If necessary edit the ``[database]`` section in tsx.conf to match the database you just created.

Install R dependencies
------------------------

R dependencies are managed using `renv `_.

Install R dependencies by running:

.. code:: bash

  Rscript -e 'renv::restore()'

Install Python dependencies
----------------------------------

Python dependencies are managed using `uv `_.

Install uv: https://docs.astral.sh/uv/getting-started/installation/

Use uv to install Python and packages:

.. code:: bash

 uv sync


Install node and Javascript dependencies
----------------------------------------

Install Javascript dependencies:

.. code:: bash

 cd web
 npm install


Run API backend
---------------

This is required for the Data Interface and/or TSX Visualiser to function

.. code:: bash

  # Native environment
  uv run ./dev-server.sh

  # Docker compose (note this also runs the Data Interface front end)
  docker compose --profile webapp up


Run Data Interface
------------------

.. code:: bash

  cd web
  npm run dev-data


Run TSX Visualiser
------------------

.. code:: bash

  cd web
  npm run dev-tsx


Note: the TSX Visualiser will not function properly until time series and trend permutations have been generated.


Docker Compose Instructions
===========================

The following command will build necessary Docker containers and start a shell for running the workflow:

.. code:: bash

  docker compose run --build --rm workflow_cli

It will take a while to download the necessary packages and build the containers.

Important notes:

- When running via Docker Compose, ``tsx.conf`` must be configured with a database hostname of ``mysql``. (i.e. set ``host=mysql`` under ``[database]``)
- The project root directory is mounted to the default working directory (``/tsx/``) inside each container. In order to import your own files using the workflow, you will need to first put them within the project directory tree so that the container can see them.

To run the Data Interface and TSX Visualiser, use:

.. code:: bash

  docker compose --profile webapp up


Generate time series and permutations for sample data
=====================================================

A script is provided that will perform a full workflow run using the sample data and generate trend permutations for the TSX visualiser.

.. code:: bash

 uv run setup/test-workflow.sh

(Make sure you have completed `Initialise MySQL database`_ first.)

        

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 3 days ago

Total Commits: 1,144
Total Committers: 7
Avg Commits per committer: 163.429
Development Distribution Score (DDS): 0.203

Commits in past year: 168
Committers in past year: 1
Avg Commits per committer in past year: 168.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
James Watmuff j****s@p****u 912
James Watmuff j****s@J****l 144
James Watmuff j****s@J****y 54
hoangnguyen177 h****7@g****m 23
Ubuntu u****u@n****u 8
Ubuntu u****u@n****u 2
dependabot[bot] 4****] 1

Committer domains:


Issue and Pull Request metadata

Last synced: 13 days ago

Total issues: 3
Total pull requests: 37
Average time to close issues: almost 2 years
Average time to close pull requests: about 1 year
Total issue authors: 2
Total pull request authors: 1
Average comments per issue: 1.0
Average comments per pull request: 3.27
Merged pull request: 1
Bot issues: 0
Bot pull requests: 37

Past year issues: 0
Past year pull requests: 4
Past year average time to close issues: N/A
Past year average time to close pull requests: 22 days
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 0.25
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 4

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/nesp-tsr3-1/tsx

Top Issue Authors

  • ammojamo (2)
  • gakindler (1)

Top Pull Request Authors

  • dependabot[bot] (39)

Top Issue Labels

Top Pull Request Labels

  • dependencies (39)
  • javascript (22)
  • python (15)

Dependencies

web/package-lock.json npm
  • @vitejs/plugin-vue 1.10.2 development
  • anymatch 3.1.2 development
  • binary-extensions 2.2.0 development
  • braces 3.0.2 development
  • chokidar 3.5.3 development
  • esbuild 0.14.42 development
  • esbuild-android-64 0.14.42 development
  • esbuild-android-arm64 0.14.42 development
  • esbuild-darwin-64 0.14.42 development
  • esbuild-darwin-arm64 0.14.42 development
  • esbuild-freebsd-64 0.14.42 development
  • esbuild-freebsd-arm64 0.14.42 development
  • esbuild-linux-32 0.14.42 development
  • esbuild-linux-64 0.14.42 development
  • esbuild-linux-arm 0.14.42 development
  • esbuild-linux-arm64 0.14.42 development
  • esbuild-linux-mips64le 0.14.42 development
  • esbuild-linux-ppc64le 0.14.42 development
  • esbuild-linux-riscv64 0.14.42 development
  • esbuild-linux-s390x 0.14.42 development
  • esbuild-netbsd-64 0.14.42 development
  • esbuild-openbsd-64 0.14.42 development
  • esbuild-sunos-64 0.14.42 development
  • esbuild-windows-32 0.14.42 development
  • esbuild-windows-64 0.14.42 development
  • esbuild-windows-arm64 0.14.42 development
  • fill-range 7.0.1 development
  • fsevents 2.3.2 development
  • function-bind 1.1.1 development
  • glob-parent 5.1.2 development
  • has 1.0.3 development
  • immutable 4.1.0 development
  • is-binary-path 2.1.0 development
  • is-core-module 2.9.0 development
  • is-extglob 2.1.1 development
  • is-glob 4.0.3 development
  • is-number 7.0.0 development
  • normalize-path 3.0.0 development
  • path-parse 1.0.7 development
  • picomatch 2.3.1 development
  • readdirp 3.6.0 development
  • resolve 1.22.0 development
  • rollup 2.75.3 development
  • sass 1.52.1 development
  • supports-preserve-symlinks-flag 1.0.0 development
  • to-regex-range 5.0.1 development
  • vite 2.9.9 development
  • @babel/parser 7.18.4
  • @babel/runtime 7.18.3
  • @popperjs/core 2.11.5
  • @vue/compiler-core 3.2.36
  • @vue/compiler-dom 3.2.36
  • @vue/compiler-sfc 3.2.36
  • @vue/compiler-ssr 3.2.36
  • @vue/devtools-api 6.1.4
  • @vue/reactivity 3.2.36
  • @vue/reactivity-transform 3.2.36
  • @vue/runtime-core 3.2.36
  • @vue/runtime-dom 3.2.36
  • @vue/server-renderer 3.2.36
  • @vue/shared 3.2.36
  • @vueform/multiselect 2.4.2
  • bulma 0.9.4
  • chart.js 3.8.0
  • csstype 2.6.20
  • estree-walker 2.0.2
  • heatmap.js 2.0.5
  • leaflet 1.8.0
  • leaflet-easybutton 2.4.0
  • magic-string 0.25.9
  • nanoid 3.3.4
  • picocolors 1.0.0
  • postcss 8.4.14
  • regenerator-runtime 0.13.9
  • source-map 0.6.1
  • source-map-js 1.0.2
  • sourcemap-codec 1.4.8
  • tippy.js 6.3.7
  • underscore 1.13.3
  • vue 3.2.36
  • vue-autofocus-directive 1.0.4
  • vue-router 4.0.15
  • vue-simple-spinner 1.2.10
  • vue-tippy 6.0.0-alpha.58
web/package.json npm
  • @vitejs/plugin-vue ^1.6.0 development
  • @vue/compiler-sfc ^3.0.5 development
  • sass ^1.38.1 development
  • vite ^2.5.1 development
  • @vueform/multiselect ^2.4.2
  • bulma ^0.9.3
  • chart.js ^3.5.1
  • heatmap.js ^2.0.5
  • leaflet ^1.7.1
  • leaflet-easybutton ^2.4.0
  • underscore ^1.13.1
  • vue ^3.2.6
  • vue-autofocus-directive ^1.0.4
  • vue-router ^4.0.11
  • vue-simple-spinner ^1.2.10
  • vue-tippy ^6.0.0-alpha.43
setup.py pypi
  • Flask >=1.1.1
  • Flask-Cors >=3.0.6
  • Flask-Session >=0.3.1
  • GeoAlchemy2 >=0.4.0
  • SQLAlchemy >=1.1.14
  • Shapely >=1.6.2.post1
  • Twisted >=17.9.0
  • configparser >=3.7.4
  • mysql-connector *
  • openpyxl >=2.4.9
  • pandas >=0.21.0
  • passlib >=1.7.1
  • pyOpenSSL >=17.5.0
  • pyproj >=1.9.5.1
  • python-dateutil >=2.6.1
  • tqdm >=4.19.4
.github/workflows/publish-docker-image.yml actions
  • actions/attest-build-provenance v1 composite
  • actions/checkout v4 composite
  • docker/build-push-action v5 composite
  • docker/login-action v3 composite
  • docker/setup-buildx-action v3 composite
  • docker/setup-qemu-action v3 composite
containers/Dockerfile docker
  • base latest build
  • prod latest build
  • python 3.9-slim build
containers/docker-compose.yml docker
  • ghcr.io/nesp-tsr3-1/tsx-workflow latest
  • mysql 8.3.0
  • phpmyadmin latest
Pipfile pypi
  • argon2-cffi *
  • cachelib *
  • cartopy *
  • fiona *
  • flask *
  • flask-cors *
  • flask-executor *
  • flask-headers *
  • flask-session *
  • fpdf2 *
  • matplotlib *
  • mysql-connector-python *
  • numpy *
  • openpyxl *
  • pandas *
  • passlib *
  • pyproj *
  • pytest *
  • rpy2 *
  • scipy *
  • shapely *
  • sqlacodegen ==3.0.0rc5
  • sqlalchemy *
  • tqdm *
  • watchdog *
Pipfile.lock pypi
  • argon2-cffi ==23.1.0
  • argon2-cffi-bindings ==21.2.0
  • attrs ==24.2.0
  • blinker ==1.8.2
  • cachelib ==0.13.0
  • cartopy ==0.23.0
  • certifi ==2024.8.30
  • cffi ==1.17.1
  • click ==8.1.7
  • click-plugins ==1.1.1
  • cligj ==0.7.2
  • contourpy ==1.3.0
  • cycler ==0.12.1
  • defusedxml ==0.7.1
  • et-xmlfile ==2.0.0
  • exceptiongroup ==1.2.2
  • fiona ==1.10.1
  • flask ==3.0.3
  • flask-cors ==5.0.0
  • flask-executor ==1.0.0
  • flask-headers ==1.0
  • flask-session ==0.8.0
  • fonttools ==4.54.1
  • fpdf2 ==2.8.1
  • importlib-metadata ==8.5.0
  • importlib-resources ==6.4.5
  • inflect ==7.4.0
  • iniconfig ==2.0.0
  • itsdangerous ==2.2.0
  • jinja2 ==3.1.4
  • kiwisolver ==1.4.7
  • markupsafe ==3.0.2
  • matplotlib ==3.9.2
  • more-itertools ==10.5.0
  • msgspec ==0.18.6
  • mysql-connector-python ==9.1.0
  • numpy ==2.0.2
  • openpyxl ==3.1.5
  • packaging ==24.1
  • pandas ==2.2.3
  • passlib ==1.7.4
  • pillow ==11.0.0
  • pluggy ==1.5.0
  • pycparser ==2.22
  • pyparsing ==3.2.0
  • pyproj ==3.6.1
  • pyshp ==2.3.1
  • pytest ==8.3.3
  • python-dateutil ==2.9.0.post0
  • pytz ==2024.2
  • rpy2 ==3.5.16
  • scipy ==1.13.1
  • shapely ==2.0.6
  • six ==1.16.0
  • sqlacodegen ==3.0.0rc5
  • sqlalchemy ==2.0.36
  • tomli ==2.0.2
  • tqdm ==4.66.6
  • typeguard ==4.4.0
  • typing-extensions ==4.12.2
  • tzdata ==2024.2
  • tzlocal ==5.2
  • watchdog ==5.0.3
  • werkzeug ==3.0.6
  • zipp ==3.20.2

Score: 4.143134726391533