pipeline.src.flows.vessels

Functions

extract_french_vessels(→ pandas.DataFrame)

Extracts french vessels from Navpro.

extract_eu_vessels(→ pandas.DataFrame)

Extracts EU vessels from Navpro.

extract_non_eu_vessels(→ pandas.DataFrame)

Extracts non-EU vessels from Navpro.

extract_vessels_operators(→ pandas.DataFrame)

Extracts vessel operators (in the sense of "the people or organisation that operate

extract_vessels_logbook_equipement(→ pandas.DataFrame)

Extracts vessels logbook equipement data

extract_french_vessels_navigation_licences(...)

Extracts the navigation licence sailing category and expiration date of french

extract_control_charters(→ pandas.DataFrame)

Extracts vessels with the information of whether they are under control charter or

concat_merge_vessels(→ pandas.DataFrame)

Concatenates french_vessels, eu_vessels and non_eu_vessels, then performs a

clean_vessels(→ pandas.DataFrame)

Combines and concatenates data of some columns as coalesced values or lists (phone

add_unknown_vessel(→ pandas.DataFrame)

Adds an "UNKNOWN" vessel to the list, to be used when reporting an action on a

load_vessels(all_vessels)

Replaces the content of the vessels table with the content of the all_vessels

vessels_flow()

Module Contents

pipeline.src.flows.vessels.extract_french_vessels() pandas.DataFrame[source]

Extracts french vessels from Navpro.

Returns:

french vessels

Return type:

pd.DataFrame

pipeline.src.flows.vessels.extract_eu_vessels() pandas.DataFrame[source]

Extracts EU vessels from Navpro.

Returns:

EU vessels

Return type:

pd.DataFrame

pipeline.src.flows.vessels.extract_non_eu_vessels() pandas.DataFrame[source]

Extracts non-EU vessels from Navpro.

Returns:

non-EU vessels

Return type:

pd.DataFrame

pipeline.src.flows.vessels.extract_vessels_operators() pandas.DataFrame[source]

Extracts vessel operators (in the sense of “the people or organisation that operate or manage the operations of the vessel”) data from Poséidon (name, contact info).

Returns:

Vessels operators

Return type:

pd.DataFrame

pipeline.src.flows.vessels.extract_vessels_logbook_equipement() pandas.DataFrame[source]

Extracts vessels logbook equipement data

Returns:

Vessels logbook equipment data

Return type:

pd.DataFrame

pipeline.src.flows.vessels.extract_french_vessels_navigation_licences() pandas.DataFrame[source]

Extracts the navigation licence sailing category and expiration date of french vessels from Gina.

Returns:

French vessels navigation licence information

Return type:

pd.DataFrame

pipeline.src.flows.vessels.extract_control_charters() pandas.DataFrame[source]

Extracts vessels with the information of whether they are under control charter or not from Monitorfish, based on historical control data.

Returns:

Vessels with a boolean column under_charter

Return type:

pd.DataFrame

pipeline.src.flows.vessels.concat_merge_vessels(french_vessels: pandas.DataFrame, eu_vessels: pandas.DataFrame, non_eu_vessels: pandas.DataFrame, vessels_logbook_equipement: pandas.DataFrame, vessels_operators: pandas.DataFrame, licences: pandas.DataFrame, control_charters: pandas.DataFrame) pandas.DataFrame[source]

Concatenates french_vessels, eu_vessels and non_eu_vessels, then performs a left join of the resulting DataFrame with vessels_operators, licences and control_charters successively.

Vessels, identified by their id should be unique :

  • accross french_vessels, eu_vessels and non_eu_vessels : a given id cannot be in more than one of the three DataFrames, and it must be present just once (a single row)

  • in vessels_operators, licences and control_charters: a given id can be in 1, 2 or all 3 DataFrames, but it cannot have more than one row in each DataFrame.

Parameters:
  • french_vessels (pd.DataFrame) – French vessels

  • eu_vessels (pd.DataFrame) – EU vessels

  • non_eu_vessels (pd.DataFrame) – non-EU vessels

  • vessels_logbook_equipement (pd.DataFrame) – vessels logbook equipment data

  • vessels_operators (pd.DataFrame) – vessels’ operators data

  • licences (pd.DataFrame) – french vessels navigation licences data

  • control_charters (pd.DataFrame) – vessels under_charter status

Raises:

ValueError – if a vessel id is duplicated

Returns:

merged vessels data

Return type:

pd.DataFrame

pipeline.src.flows.vessels.clean_vessels(all_vessels: pandas.DataFrame) pandas.DataFrame[source]

Combines and concatenates data of some columns as coalesced values or lists (phone numbers, emails…)

Parameters:

all_vessels (pd.DataFrame) – Output of concat_merge_vessels

Returns:

vessels data ready to be loaded.

Return type:

pd.DataFrame

pipeline.src.flows.vessels.add_unknown_vessel(all_vessels: pandas.DataFrame) pandas.DataFrame[source]

Adds an “UNKNOWN” vessel to the list, to be used when reporting an action on a vessel that is not part of the officiel vessels list.

Parameters:

all_vessels (pd.DataFrame) – List of vessels

Returns:

Same as input with one added “Unknown vessel”

Return type:

pd.DataFrame

Raises:
  • AssertionError – if one of the input vessels has the id reserved for the UNKNOWN

  • vessel

pipeline.src.flows.vessels.load_vessels(all_vessels: pandas.DataFrame)[source]

Replaces the content of the vessels table with the content of the all_vessels DataFrame.

Parameters:

all_vessels (pd.DataFrame) – vessels data to load

pipeline.src.flows.vessels.vessels_flow()[source]