Skip to contents

The code that turns landing surveys and boat GPS tracks from Mozambique into checked fisheries data.

See the results at Peskas Mozambique, the Peskas Management Platform and the Peskas Fishery Data API.

What it is

This pipeline collects, checks and summarises small-scale fisheries data from Mozambique. It serves the fisheries managers, survey teams and researchers who use Peskas Mozambique. It runs automatically every two days.

What it produces

  • Downloads the landing surveys of two programmes, DINAPA and Lurio, and the GPS tracks of boats that carry a tracker.
  • Estimates the weight of each catch from the fish lengths recorded, or from the number of buckets landed when no length is recorded.
  • Flags records that look wrong, such as a fish longer than its species allows or a price per kilo far out of range, and sends the flags to the Peskas Management Platform for survey teams to review.
  • Publishes DINAPA landing records, before and after the checks, to the Peskas Fishery Data API.
  • Builds the monthly, district, species and gear summaries shown on Peskas Mozambique.
  • Writes separate summaries of Lurio landings to the pipeline’s own database.

Where the data comes from

Two survey programmes record landings in Mozambique, each with its own survey form:

  • DINAPA (National Directorate of Fisheries and Aquaculture), Mozambique’s national fisheries authority, formerly ADNAP. Only DINAPA data reaches Peskas Mozambique and the Peskas Fishery Data API. Where a DINAPA boat carries a GPS tracker, its landings are linked to its tracked trips.
  • Lurio. Lurio landings go through the same checks as DINAPA’s but end in their own export. They do not appear on Peskas Mozambique or in the Peskas Fishery Data API.

Other sources: GPS trackers from Pelagic Data Systems; reference lists of species, gear, boats and landing sites; and length-weight formulas from FishBase and SeaLifeBase.

The data updates every two days. Known limits:

  • Catch weights are estimates, not scale readings.
  • A record with any flag is left out of the validated data until it is corrected, or until a reviewer approves it in the Peskas Management Platform or in KoboToolbox. A record a reviewer rejects is left out too.
  • Prices are in local currency (Mozambican meticais).
  • GPS tracks cover only boats that carry a tracker.

Key terms:

  • Landing: a boat’s return to shore with its catch, recorded by an enumerator.
  • Enumerator: a trained data collector who records landings at landing sites.
  • KoboToolbox: the free mobile survey app enumerators use to record landings.
  • GPS trackers (Pelagic Data Systems): small solar-powered devices on boats that record where they travel.

Who runs it

WorldFish develops and runs this pipeline. DINAPA collects the landing surveys that feed Peskas Mozambique.

For questions, write to .

Part of Peskas

Peskas is WorldFish’s open-source platform for monitoring small-scale fisheries (https://peskas.org).

For developers

The pipeline is an R package. Each step is an exported function, and the GitHub Actions workflow calls them in order. Shared code (cloud storage, KoboToolbox, GPS tracker ingestion, dashboard summaries) lives in peskas.coasts and is called as coasts::. The function reference is at https://worldfishcenter.github.io/peskas.mozambique.data.pipeline/.

Requirements: R with the geospatial system libraries (production uses the rocker/geospatial:4.5 image), and the credentials listed in .env.example.

Setup:

# Copy .env.example to .env and fill in the values (ask the Peskas team).
remotes::install_deps(dependencies = TRUE)  # installs peskas.coasts from GitHub
devtools::load_all()

read_config() loads .env and reads inst/config.yml. The default profile points at the -dev buckets and databases; production is used only by the workflow on main. Never log the whole config object: it holds the credentials.

Main commands:

devtools::load_all()    # load the package
devtools::document()    # rebuild man/ after changing roxygen comments
devtools::check()       # R CMD check
peskas.mozambique.data.pipeline::validate_surveys_adnap()  # run one step

How it runs in production: .github/workflows/data-pipeline.yaml runs every two days and on every push. Pushes to main write to production; other branches run the whole pipeline against the development resources. The first job builds a container with the latest peskas.coasts release (see DESCRIPTION for the minimum version); every other job runs inside it:

build-container
├── ingest-preprocess-adnap ─► validate-adnap ─► export-api-validated ─► summarize-model-data ─► export-surveys-portal
│                          └─► export-api-raw
├── ingest-preprocess-lurio ─► validate-lurio ─► export-lurio-data
└── ingest-preprocess-pds ─► merge-trips-adnap (also needs validate-adnap)
                         └─► summarize-model-data

Releases: bump Version: in DESCRIPTION and add a block at the top of NEWS.md. On a push to main, release.yaml turns that block into a GitHub release.

Tests: no automated tests yet. Check a change by running the function against the default profile, or by pushing a branch other than main.

AI-assisted work: see CLAUDE.md.

Licence

GPL (>= 3). See LICENSE.md.