-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Préavis – Récupérer données manquantes #2484
Comments
Données à récupérer pour l'affichage des préavis dans la vue liste:
|
Autre point à récupérer : les zones CGPM. Ne fait pas partie du standard ERS, mais parfois ajouté dans une balise
Dans l'exemple ci-dessus, |
Pour la question de savoir comment déterminer les engins et donc les segments associés à un PNO :
WITH t AS (
SELECT
flag_state,
report_id,
xpath('//ers:SPE/@GE', rw.xml_message::xml, ARRAY[ARRAY['ers', 'http://ec.europa.eu/fisheries/schema/ers/v3']])::VARCHAR[] AS gears,
xpath('//ers:SPE/@SN', rw.xml_message::xml, ARRAY[ARRAY['ers', 'http://ec.europa.eu/fisheries/schema/ers/v3']])::VARCHAR[] AS species,
xpath('//ers:SPE/@WL', rw.xml_message::xml, ARRAY[ARRAY['ers', 'http://ec.europa.eu/fisheries/schema/ers/v3']])::VARCHAR[]::DOUBLE PRECISION[] AS weights
FROM logbook_reports r
JOIN logbook_raw_messages rw
ON rw.operation_number = r.operation_number
WHERE
log_type = 'PNO'
AND operation_datetime_utc >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '1 month'
),
t2 AS (
SELECT
report_id,
flag_state,
COALESCE(array_length(gears, 1) > 0, false) AS has_gear_info,
COALESCE((SELECT SUM(s) FROM unnest(weights) s), 0) AS weight
FROM t
)
SELECT
flag_state,
has_gear_info AS pno_has_gear_info,
SUM(weight) AS weight,
COUNT(DISTINCT report_id) AS nb_pnos
FROM t2
GROUP BY flag_state, has_gear_info
WITH pnos_and_fars AS (
SELECT
pnos.report_id AS pno_report_id,
pnos.flag_state,
pnos.cfr,
pnos.value->'catchOnboard' IS NOT NULL AS pno_has_catches,
COUNT(DISTINCT fars.report_id) AS number_of_far_reports,
ARRAY_AGG(DISTINCT haul->>'gear') AS far_gears,
COUNT(DISTINCT haul->>'gear') AS number_of_far_gears
FROM logbook_reports pnos
LEFT JOIN logbook_reports fars
LEFT JOIN jsonb_array_elements(fars.value->'hauls') haul ON true
ON
pnos.cfr = fars.cfr
AND pnos.trip_number = fars.trip_number
AND fars.log_type = 'FAR'
AND fars.operation_datetime_utc > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '1 month' - INTERVAL '2 weeks'
WHERE
pnos.operation_datetime_utc > CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '1 month'
AND pnos.log_type = 'PNO'
AND pnos.trip_number IS NOT NULL
GROUP BY
pnos.flag_state,
pnos.cfr,
pnos.report_id,
pnos.value->'catchOnboard' IS NOT NULL
ORDER BY COUNT(DISTINCT fars.report_id), COUNT(DISTINCT haul->>'gear')
),
t AS (
SELECT
flag_state,
COUNT(DISTINCT pno_report_id) AS nb_pnos,
COUNT(DISTINCT CASE WHEN pno_has_catches THEN pno_report_id END) AS nb_pnos_with_catches,
COUNT(DISTINCT CASE WHEN pno_has_catches AND number_of_far_gears >=1 THEN pno_report_id END) AS nb_pnos_with_catches_and_far_gears
FROM pnos_and_fars
GROUP BY flag_state
)
SELECT
*,
nb_pnos_with_catches_and_far_gears / nb_pnos_with_catches::DOUBLE PRECISION AS share_of_pno_with_catches_having_gear_info_in_fars
FROM t Donc sans aucun doute on se basera sur les engins des FAR de la marée. |
Créé #3012 pour les histoires d'espèces à bord VS à débarquer sur lesquelles il reste des questions non tranchées.
|
## Linked issues - Resolve #2484 - Resolve #2843 - Resolve #2844 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a comprehensive system for monitoring fishing activities through prior notifications, including vessel information, catches, and risk assessments. - Added functionality to retrieve and filter prior notifications and logbook reports based on various criteria such as dates, locations, and vessel details. - Implemented a new frontend component for displaying a list of prior notifications with capabilities for filtering, sorting, and accessing detailed views. - **Enhancements** - Enhanced the retrieval of prior notifications with additional details like port names and seafront information. - Refined the vessel entity representation in the frontend to improve data handling and presentation. - **Bug Fixes** - Fixed issues related to the incorrect handling of null values in vessel identity properties. - **Tests** - Added unit and integration tests to ensure the reliability of new functionalities related to prior notifications and logbook reports. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
@VincentAntoine où en est-on de ce ticket ? c'est reviewable ? |
Vu avec Vincent, les dates de préavis et les engins de la marée pour le calcul des segments ont bien été récupérés, je ferme ce ticket. |
No description provided.
The text was updated successfully, but these errors were encountered: