Skip to content

enhance insights API models, documentation, and test coverage#59

Open
lykmapipo wants to merge 4 commits intofeature/docsfrom
feature/insights
Open

enhance insights API models, documentation, and test coverage#59
lykmapipo wants to merge 4 commits intofeature/docsfrom
feature/insights

Conversation

@lykmapipo
Copy link
Copy Markdown
Collaborator

This:

  • Improve Insights request models and vessel input to accept list of vessel IDs (List[str])
  • Align documentation and terminology with official API documentation
  • Expand integration tests and examples for additional insight types
  • Update usage guides and notebook with fishing, coverage, gap, and vessel identity insights examples

…cumentation

This:
- align Insights API documentation with official Global Fishing Watch API terminology
- enhance docstrings with official documentation references and data caveats
- update `VesselInsightDatasetVessel` model to use `VesselDataset` enum for dataset identifiers
- improve `VesselInsightBody` request model with explicit field aliases and clearer parameter documentation
- extend `get_vessel_insights()` to accept vessel IDs directly (`List[str]`)
- add validation tests for invalid request payload scenarios
- add unit tests verifying request serialization and default dataset handling
- improve test coverage for resource behavior when vessel IDs are passed directly
This:
- update integration tests to pass vessel IDs directly instead of `{dataset_id, vessel_id}` objects
- add integration tests for `VESSEL-IDENTITY-FLAG-CHANGES` insight type
- add integration tests for `VESSEL-IDENTITY-MOU-LIST` insight type
This:
- update caveat references and dataset examples in documentation
- update vessel input examples to use vessel ID strings instead of `{dataset_id, vessel_id}` objects
- expand examples for `FISHING`, `VESSEL-IDENTITY-IUU-VESSEL-LIST`, and `COVERAGE` insights
- expand examples for `GAP`,  `VESSEL-IDENTITY-FLAG-CHANGES`, and `VESSEL-IDENTITY-MOU-LIST` insights
- add example showing retrieval of multiple insights for multiple vessels
@lykmapipo lykmapipo self-assigned this Mar 31, 2026
@lykmapipo lykmapipo added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 31, 2026
Copy link
Copy Markdown
Collaborator

@giselamo giselamo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added small comments

This guide provides detailed instructions on how to use the [gfw-api-python-client](https://github.com/GlobalFishingWatch/gfw-api-python-client) to access aggregated insights about vessel activities. Currently, the [Insights API](https://globalfishingwatch.org/our-apis/documentation#insights-api) focuses on providing summaries related to specific vessels over a defined time range. Here is a [Jupyter Notebook](https://github.com/GlobalFishingWatch/gfw-api-python-client/blob/develop/notebooks/usage-guides/insights-api.ipynb) version of this guide with more usage examples.

> **Note:** See the [Insights Data Caveats](https://globalfishingwatch.org/our-apis/documentation#insights-api-fishing-detected-in-no-take-mpas)—it is critical to avoid misinterpreting the insights. You can find the [Datasets](https://globalfishingwatch.org/our-apis/documentation#api-dataset), and [Terms of Use](https://globalfishingwatch.org/our-apis/documentation#terms-of-use) pages in the [GFW API documentation](https://globalfishingwatch.org/our-apis/documentation#introduction) for details on GFW data, API licenses, and rate limits.
> **Note:** See the [Fishing detected in no-take MPAs](https://globalfishingwatch.org/our-apis/documentation#insights-api-fishing-detected-in-no-take-mpas), [Fishing event detected outside known authorized areas](https://globalfishingwatch.org/our-apis/documentation#insights-api-fishing-event-detected-outside-known-authorized-areas), [Coverage](https://globalfishingwatch.org/our-apis/documentation#insights-api-coverage), [AIS off event (aka GAP)](https://globalfishingwatch.org/our-apis/documentation#insights-api-ais-off-event-aka-gap), and [RFMO IUU vessel list](https://globalfishingwatch.org/our-apis/documentation#insights-api-rfmo-iuu-vessel-list) Data Caveats — it is critical to avoid misinterpreting the insights. You can find the [Datasets](https://globalfishingwatch.org/our-apis/documentation#api-dataset), and [Terms of Use](https://globalfishingwatch.org/our-apis/documentation#terms-of-use) pages in the [GFW API documentation](https://globalfishingwatch.org/our-apis/documentation#introduction) for details on GFW data, API licenses, and rate limits.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add "Apparent fishing event detected in no-take MPAs"...

```

## Getting Flag Changes Insights (`VESSEL-IDENTITY-FLAG-CHANGES`)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add "In order to enable your token to get this insight, please send an email to apis@globalfishingwatch.org including the email that has created the API tokens."

```

## Getting Flag State Presence under Tokyo/Paris MOU black or grey Lists Insights (`VESSEL-IDENTITY-MOU-LIST`)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add "In order to enable your token to get this insight, please send an email to apis@globalfishingwatch.org including the email that has created the API tokens."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants