Skip to content

dataforgoodfr/12_bloom

Repository files navigation

banner

What is Trawl Watch

Trawl Watch is an initiative launched by the * Bloom Association* to track and expose the most destructive fishing vessels. Inspired by L’Avion de Bernard, which monitors the movements of private jets, Trawl Watch aims to make visible the impact of these massive trawlers on our oceans. These vessels, often referred to as mégachalutiers, deploy gigantic nets that can engulf marine life from the surface down to the ocean floor. The consequences are both ecological—as they devastate crucial nursery and breeding areas for marine animals—and social, as they deprive artisanal fishermen of a healthy marine ecosystem. The solution proposed by Bloom is to dismantle these industrial fishing ships and redistribute their quotas to small-scale fishers. A petition has been launched, and Bloom continues to track these megatrawlers while awaiting action from European institutions.

Did you know that, in Europe, the largest fishing vessels, which represent 1% of the fleet, catch half of the fish? These factory-vessels can measure up to 144 meters in length and catch 400,000 kilos of fish per day! This is as much as 1,000 small-scale fishing vessels in one day at sea.

These veritable sea monsters are devastating Europe’s biodiversity and coastlines. It is important to measure the scale of the damage: about 20 of these factory-vessels can obliterate hundreds of thousands of marine animals and biodiversity treasures in one day, including in the so-called ‘Marine Protected Areas’ of French territorial waters, which are not protected at all.

What is Bloom Association

BLOOM is a non-profit organization founded in 2005 that works to preserve the marine environment and species from unnecessary destruction and to increase social benefits in the fishing sector. BLOOM wages awareness and advocacy campaigns in order to accelerate the adoption of concrete solutions for the ocean, humans and the climate. BLOOM carries out scientific research projects, independent studies and evaluations that highlight crucial and unaddressed issues such as the financing mechanisms of the fishing sector. BLOOM’s actions are meant for the general public as well as policy-makers and economic stakeholders.

Table of contents

Principles

#TODO

Requirements

Bloom is tested with:

Main version (dev) Stable version (1.0.0)
Python 3.11 3.11
Platform AMD64/ARM64(*) AMD64/ARM64(*)
Docker 24 24
PostgreSQL 14 14

Getting started

Clone the Bloom application repository

    # clone git repository
    git clone https://github.com/dataforgoodfr/12_bloom.git
    # change to project root directory
    cd 12_bloom

Installation with Docker/Docker Compose stack (Recommended)

Prerequistes

  • Docker Engine (version >= 18.06.0) with Compose plugin

Building image

    docker compose build

When official Docker image will be available, the building step could be optionnal for user as docker compose up will pull official image from repository

Starting the application

    docker compose up

Load demonstration data

To use Trawl Watch application, some data have to be initialy loaded for demonstration. As these data are protected and can't be publicly published, you just have to contact the Trawl Watch application team. Informations on Who maintains Trawl Watch?

After having filled 12_bloom/data folder with data files get from project team, rename files as following:

  • data/chalutiers_pelagiques.csv
  • data/spire_positions_subset.csv
  • data/vessels_subset.csv
  • data/zones_subset.csv
  • data/ports.csv
  • data/geometries/*.json

Then launch docker compose stack using docker compose file extension to add loading data service

docker compose -f docker-compose.yaml -f docker-compose-load-data.yaml up

You can now jump to Use the Bloom Application

Installation on local machine

Prerequistes

  • Python: 3.11
  • Python-pip: >=20
  • Postgresql: 14, 15, 16

You must have a functionnal PostgreSQL instance with connexion informations (database server hostname or ip, user, password, database name, port to use)

Install Backend Application with Poetry

    # From project diretory
    cd ./backend
    # Install uv
    curl -LsSf https://astral.sh/uv/install.sh | sh
    # Install project and dependencies
    uv sync

Initial configuration

    # From project root diretory
    # Create initial ocnfiguration
    cp .env.template .env
    # Edit .env file
    # Replace POSTGRES_HOSTNAME/PORT with the postgres server hostname:port (localhost if local default port server)
    # Replace POSTGRES_USER/PASSWORD with already configured user on serverside

Loading initial data for backend

    # From project root diretory
    cd ./backend
    # Check if database is up to date with alembic revisions
    alembic upgrade head
    # If upgrade is successful you can load the data
    # Demonstration data must be recovered from TrawlWatch Project Team
    # and put in <project>/data/ folder with correct names
    # * data/chalutiers_pelagiques.csv
    # * data/spire_positions_subset.csv
    # * data/vessels_subset.csv
    # * data/zones_subset.csv
    $ python3 bloom/tasks/load_dim_vessel_from_csv.py 
    $ python3 bloom/tasks/load_dim_port_from_csv.py
    $ python3 bloom/tasks/load_dim_zone_amp_from_csv.py
    $ python3 bloom/tasks/compute_port_geometry_buffer.py

Starting the application

//TO UPDATE

You can now jump to Use the Bloom Application

Database migration

Trawlwatch DB model has been refactored during DataForGood season 12. If you run a version of Trawlwactch using the old model follow next steps to upgrade.

  • Upgrade DB model:
$ alembic upgrade head
  • Run data conversion from the old model to the new model (actually copy data from spire_vessel_positions to spire_ais_data). This may take long if you have a long positions history:
$ python backend/bloom/tasks/convert_spire_vessels_to_spire_ais_data.py
  • Load new references data (AMP zone, ports, vessels):
$ /venv/bin/python3 backend/bloom/tasks/load_dim_vessel_from_csv.py 
$ /venv/bin/python3 backend/bloom/tasks/load_dim_port_from_csv.py
$ /venv/bin/python3 backend/bloom/tasks/load_dim_zone_amp_from_csv.py
$ /venv/bin/python3 backend/bloom/tasks/compute_port_geometry_buffer.py
  • If you feel it, drop old tables:
DROP TABLE mpa_fr_with_mn;
DROP TABLE spire_vessel_positions;
DROP TABLE vessels;

Use the Bloom Application

Access Web Interface

After having succeed with With Docker/Docker Compose stack or On local machine installation and managed to Load demonstration data you should now access the Bloom application with you favorite web browser

  • Access to http://localhost:8501 Home
  • Navigate to "Vessel Exploration"
  • Enter MMSI 261084090 as example
  • Clic on "Load"
  • You can select voyage_id and view track of vessel Loaded

Official source code

You cna find official source code on Github Repository

Contributing

Want to help build Bloom Application Check out our contributing documentation.

Official Docker (container) images for Bloom Application are described in images.

Who uses Trawl Watch?

What goes into the next release?

#TODO

Can I use the Trawl Watch logo in my presentation?

#TODO

Links

#TODO

More information can be found there

  1. Database initialisation
  2. Development environment # outdated
  3. Architecture description
  4. Useful SQL examples

FAQ

#todo