Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: PnX-SI/TaxHub
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.7.1
Choose a base ref
...
head repository: PnX-SI/TaxHub
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing 319 changed files with 14,978 additions and 7,914 deletions.
3 changes: 3 additions & 0 deletions .flaskenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FLASK_APP=apptax.app:create_app
FLASK_ENV=development
FLASK_DEBUG=1
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# apply black
357fd7caa0b41d6d52267bdf51da853a0757781f
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docs/images/*.gif filter=lfs diff=lfs merge=lfs -text
docs/images/*.jpg filter=lfs diff=lfs merge=lfs -text
docs/images/*.png filter=lfs diff=lfs merge=lfs -text
10 changes: 10 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: psf/black@stable
109 changes: 109 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: pytest

on:
push:
branches:
- master
- hotfixes
- develop
pull_request:
branches:
- master
- hotfixes
- develop

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
debian-version: [ '11', '12' ]
sqlalchemy-version: [ '1.4' ]
include:
- debian-version: '11'
python-version: '3.9'
postgres-version: '13'
postgis-version: '3.2'
- debian-version: '12'
python-version: '3.11'
postgres-version: '15'
postgis-version: '3.3'

name: Debian ${{ matrix.debian-version }} - SQLAlchemy ${{ matrix.sqlalchemy-version }}

services:
postgres:
image: postgis/postgis:${{ matrix.postgres-version }}-${{ matrix.postgis-version }}
env:
POSTGRES_DB: taxhub
POSTGRES_USER: taxhubadmin
POSTGRES_PASSWORD: taxhubpwd
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Add postgis_raster database extension
if: ${{ matrix.postgis-version >= 3 }}
run: |
psql -h localhost -U taxhubadmin -d taxhub -tc 'CREATE EXTENSION "postgis_raster";'
env:
PGPASSWORD: taxhubpwd
- name: Add database extensions
run: |
psql -h localhost -U taxhubadmin -d taxhub -tc 'CREATE EXTENSION "unaccent";'
psql -h localhost -U taxhubadmin -d taxhub -tc 'CREATE EXTENSION "uuid-ossp";'
psql -h localhost -U taxhubadmin -d taxhub -tc 'CREATE EXTENSION "pg_trgm";'
psql -h localhost -U taxhubadmin -d taxhub -tc 'CREATE EXTENSION "ltree";'
env:
PGPASSWORD: taxhubpwd
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install GDAL
run: |
sudo apt update
sudo apt install -y libgdal-dev
- name: Install dependencies
if: ${{ matrix.sqlalchemy-version == '1.4' }}
run: |
python -m pip install --upgrade pip
python -m pip install \
-e .[tests] \
-r requirements-dev.in
- name: Install database
run: |
flask db upgrade taxhub-standalone@head -x local-srid=2154
flask db upgrade taxhub-standalone-sample@head
flask db upgrade ref_geo_fr_departments@head
flask db autoupgrade
flask db status
env:
TAXHUB_CONFIG_FILE: config/test_config.toml
- name: Install taxref
run: |
flask taxref import-v17
env:
TAXHUB_CONFIG_FILE: config/test_config.toml
- name: Test with pytest
run: |
pytest -v --cov --cov-report xml
env:
TAXHUB_CONFIG_FILE: config/test_config.toml
- name: Upload coverage to Codecov
if: ${{ matrix.debian-version == '12' && matrix.sqlalchemy-version == '1.4' }}
uses: codecov/codecov-action@v4
with:
flags: pytest
token: ${{ secrets.CODECOV_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
16 changes: 14 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
*~

static/medias/*

node_modules
#taxhub app
settings.ini
venv
config.py
venv
.vscode

# Byte-compiled / optimized / DLL files
@@ -69,3 +71,13 @@ target/

#Ipython Notebook
.ipynb_checkpoints

# vim
*.swo
*.swp

/tmp

/docs/changelog.html

config/*_config.toml
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "dependencies/UsersHub-authentification-module"]
path = dependencies/UsersHub-authentification-module
url = https://github.com/PnX-SI/UsersHub-authentification-module
[submodule "dependencies/Utils-Flask-SQLAlchemy"]
path = dependencies/Utils-Flask-SQLAlchemy
url = https://github.com/PnX-SI/Utils-Flask-SQLAlchemy
[submodule "dependencies/RefGeo"]
path = dependencies/RefGeo
url = https://github.com/PnX-SI/RefGeo.git
[submodule "dependencies/Utils-Flask-SQLAlchemy-Geo"]
path = dependencies/Utils-Flask-SQLAlchemy-Geo
url = https://github.com/PnX-SI/Utils-Flask-SQLAlchemy-Geo
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
language_version: python3.9
35 changes: 35 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.readthedocs.txt
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include VERSION
include LICENSE
include README.rst
include requirements.in
include requirements-common.in
include requirements-dependencies.in
77 changes: 77 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# TaxHub

Application web de gestion centralisée des taxons basée sur le
référentiel TAXREF
(<http://inpn.mnhn.fr/programme/referentiel-taxonomique-taxref>) du
SINP.

Elle permet de gérer la liste des taxons présents dans chaque structure,
d'y greffer des informations spécifiques, de définir des listes de
taxons et des filtres en fonction des besoins.

Elle est utilisée pour la structuration des taxons dans GeoNature
(<https://github.com/PnX-SI/GeoNature>) à partir de sa version 1.4.0.

Elle permet aussi de gérer les descriptions et les médias des taxons
pour leur affichage dans GeoNature-atlas (ou autre).

![image](docs/images/explore_taxref.gif)

Elle peut être installée en tant qu'application autonome, ou intégrée dans GeoNature.

# Documentation

La documentation d'installation de TaxHub est disponible sur https://taxhub.readthedocs.io.

TaxHub peut aussi être installé à partir du script d'installation
globale de GeoNature : <http://docs.geonature.fr/installation-all.html>.

# Principes

Voici le modèle conceptuel de la base de données de TaxHub (schéma `taxonomie`) :

![image](docs/images/MCD_taxonomie.png)

Une partie correspond au TAXREF complet et à la base de connaissance « Statuts »
tels que fournis par le SINP. Son contenu ne doit pas être modifié.

On peut ensuite associer des informations spécifiques grâce à
`bib_attributs` (patrimonialité, marqueurs, autres selon les besoins),
ajouter des médias aux taxons (`t_medias`) et
définir des listes de taxons (espèces d'un protocole, ...) dans
`bib_listes` en fonction des besoins.

## Technologies

- Langages : Python, HTML, JS, CSS
- BDD : PostgreSQL, PostGIS
- Serveur : Debian ou Ubuntu
- Framework python : Flask, Flask-admin
- Framework CSS : Bootstrap

## Gestion des permissions

Elle est centralisée dans l'application
[UsersHub](https://github.com/PnX-SI/UsersHub). Il faut donc disposer de
l'application `TaxHub` dans UsersHub et y intégrer des groupes et/ou
utilisateurs.

Niveaux de permissions (si TaxHub est installé en application autonome) :

- 2 = Gestion des taxons (ajout/modification/suppression des
attributs, liste et médias sur les taxons)
- 6 = Administrateurs : création de listes, attributs et thêmes

Si TaxHub est intégré à GeoNature, alors on utilise le mécanisme de permissions de GeoNature,
en définissant aux utilisateurs et groupes d'utilisateurs, les actions qu'ils peuvent faire
sur chaque objet de TaxHub (taxons, listes, attributs, médias...).

## Licence

- OpenSource - GPL V3
- Copyright (c) 2014-2024 - Parc National des Écrins - Parc national
des Cévennes

[![image](https://geonature.fr/img/logo-pne.jpg)](https://www.ecrins-parcnational.fr)

[![image](https://geonature.fr/img/logo-pnc.jpg)](https://www.cevennes-parcnational.fr)
Loading