Skip to content

Commit

Permalink
Merge branch 'master' into chore-update-notes
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriiashmyhlo committed Sep 7, 2023
2 parents 311b264 + d5a4600 commit 629e785
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 3 deletions.
27 changes: 26 additions & 1 deletion tests/api/examples/cargo_movements.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@
"dwt": 5260,
"cubic_capacity": 6100,
"vessel_class": "tiny_tanker",
"classes": [
{
"id": "vlcc_plus",
"label": "VLCC+",
"layer": "legacy"
},
{
"id": "oil",
"label": "Oil Tankers",
"layer": "group"
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "coarse"
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "granular"
}
],
"corporate_entities": [
{
"id": "f9bd45e65e292909a7b751b0026dcf7795c6194b3c0712910a241caee32c99b8",
Expand Down Expand Up @@ -66,7 +88,10 @@
],
"vessel_id": "9cbf7c0fc6ccf1dfeacde02b87f3b6b1653030f560d4fc677bf1d7d0be8f8449",
"probability": 1,
"pos": [4.29914090037834, 51.87936163368058],
"pos": [
4.29914090037834,
51.87936163368058
],
"start_timestamp": "2019-10-18T21:38:34+0000",
"end_timestamp": "2019-10-20T16:41:49+0000"
}
Expand Down
22 changes: 22 additions & 0 deletions tests/api/examples/vessel_entity1.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@
"dwt": 298855,
"cubic_capacity": 327310,
"vessel_class": "vlcc_plus",
"classes": [
{
"id": "vlcc_plus",
"label": "VLCC+",
"layer": "legacy"
},
{
"id": "oil",
"label": "Oil Tankers",
"layer": "group"
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "coarse"
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "granular"
}
],
"corporate_entities": [
{
"id": "cbd7dfe8a9fb0fa0ce3252ce7643437db6a32d0947a0c23d68dc5dea2f2d65d7",
Expand Down
46 changes: 45 additions & 1 deletion tests/api/examples/vessels.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,28 @@
"corporate_entities": [],
"leaf": true,
"vessel_class": "tiny_tanker",
"classes": [
{
"id": "vlcc_plus",
"label": "VLCC+",
"layer": "legacy"
},
{
"id": "oil",
"label": "Oil Tankers",
"layer": "group"
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "coarse"
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "granular"
}
],
"cubic_capacity": 7060,
"tags": [
{
Expand All @@ -55,7 +77,7 @@
"vessel"
]
},
{
{
"call_sign": "839",
"dead_weight": 5000,
"id": "1761da4fb069cd6ce153b6ad1c48e15cdb994eb386e4aafbe8f1bbde993cbaef",
Expand Down Expand Up @@ -116,6 +138,28 @@
"corporate_entities": [],
"leaf": true,
"vessel_class": "tiny_tanker",
"classes": [
{
"id": "vlcc_plus",
"label": "VLCC+",
"layer": "legacy"
},
{
"id": "oil",
"label": "Oil Tankers",
"layer": "group"
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "coarse"
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "granular"
}
],
"cubic_capacity": 6318,
"tags": [
{
Expand Down
18 changes: 18 additions & 0 deletions tests/api/test_cargo_movement.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ class TestCargoMovement(TestCase):
"dwt": 5260,
"cubic_capacity": 6100,
"vessel_class": "tiny_tanker",
"classes": [
{"id": "vlcc_plus", "label": "VLCC+", "layer": "legacy"},
{"id": "oil", "label": "Oil Tankers", "layer": "group"},
{"id": "oil_vlcc", "label": "VLCC+", "layer": "coarse"},
{"id": "oil_vlcc", "label": "VLCC+", "layer": "granular"},
],
"corporate_entities": [
{
"id": "f9bd45e65e292909a7b751b0026dcf7795c6194b3c0712910a241caee32c99b8",
Expand Down Expand Up @@ -156,6 +162,18 @@ def test_convert_to_flat_dict(self):
"vessels.0.start_timestamp": "2019-10-18T21:38:34+0000",
"vessels.0.status": "vessel_status_laden_known",
"vessels.0.vessel_class": "tiny_tanker",
"vessels.0.classes.0.id": "vlcc_plus",
"vessels.0.classes.0.layer": "legacy",
"vessels.0.classes.0.label": "VLCC+",
"vessels.0.classes.1.id": "oil",
"vessels.0.classes.1.layer": "group",
"vessels.0.classes.1.label": "Oil Tankers",
"vessels.0.classes.2.id": "oil_vlcc",
"vessels.0.classes.2.layer": "coarse",
"vessels.0.classes.2.label": "VLCC+",
"vessels.0.classes.3.id": "oil_vlcc",
"vessels.0.classes.3.layer": "granular",
"vessels.0.classes.3.label": "VLCC+",
"vessels.0.scrubber": None,
"vessels.0.flag": None,
"vessels.0.voyage_id": "401f0e74fc42401248a484aca2e9955dea885378796f7f4d0bc8e92c35ea270a",
Expand Down
6 changes: 6 additions & 0 deletions tests/api/test_vessel_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"dwt": 298855,
"cubic_capacity": 327310,
"vessel_class": "vlcc_plus",
"classes": [
{"id": "vlcc_plus", "label": "VLCC+", "layer": "legacy"},
{"id": "oil", "label": "Oil Tankers", "layer": "group"},
{"id": "oil_vlcc", "label": "VLCC+", "layer": "coarse"},
{"id": "oil_vlcc", "label": "VLCC+", "layer": "granular"},
],
"corporate_entities": [
{
"id": "cbd7dfe8a9fb0fa0ce3252ce7643437db6a32d0947a0c23d68dc5dea2f2d65d7",
Expand Down
46 changes: 46 additions & 0 deletions tests/endpoints/test_vessels_search_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,52 @@ def test_to_df(self):
"corporate_entities": {0: [], 1: []},
"leaf": {0: True, 1: True},
"vessel_class": {0: "tiny_tanker", 1: "tiny_tanker"},
"classes": {
0: [
{
"id": "vlcc_plus",
"label": "VLCC+",
"layer": "legacy",
},
{
"id": "oil",
"label": "Oil Tankers",
"layer": "group",
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "coarse",
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "granular",
},
],
1: [
{
"id": "vlcc_plus",
"label": "VLCC+",
"layer": "legacy",
},
{
"id": "oil",
"label": "Oil Tankers",
"layer": "group",
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "coarse",
},
{
"id": "oil_vlcc",
"label": "VLCC+",
"layer": "granular",
},
],
},
"cubic_capacity": {0: 7060, 1: 6318},
"tags": {
0: [
Expand Down
16 changes: 16 additions & 0 deletions vortexasdk/api/shared_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,19 @@ class Scrubber(BaseModel):
tag: Optional[str] = None
scrubber: Optional[str] = None
planned: Optional[bool] = None


class VesselClassEntry(BaseModel):
"""
Represents a property that is associated with the classes of a vessel.
- `id` key will be a Vessel class Entity ID.
- `layer` key will be the layer, e.g. class, sub-class, type or legacy.
- `label` key will be the commercial name of the entity.
"""

id: Optional[str] = None
layer: Optional[str] = None
label: Optional[str] = None
3 changes: 3 additions & 0 deletions vortexasdk/api/vessel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Tag,
Scrubber,
Flag,
VesselClassEntry,
)


Expand Down Expand Up @@ -46,6 +47,7 @@ class Vessel(Node):
current_product_type: Optional[List] = None

vessel_class: Optional[str] = None
classes: Optional[List[VesselClassEntry]] = None
vessel_status: Optional[str] = None

corporate_entities: Optional[List[VesselEntityCorporateEntity]] = None
Expand Down Expand Up @@ -81,6 +83,7 @@ class VesselEntity(IDName):
dwt: Optional[int] = None

vessel_class: Optional[str] = None
classes: Optional[List[VesselClassEntry]] = None
corporate_entities: Optional[
List[VesselEntityCorporateEntityWithConfidence]
] = None
Expand Down
7 changes: 6 additions & 1 deletion vortexasdk/api/vessel_availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
from typing import List, Optional


from vortexasdk.api.shared_types import EntityWithListLayer, ISODate
from vortexasdk.api.shared_types import (
EntityWithListLayer,
ISODate,
VesselClassEntry,
)


class DeclaredDestination(BaseModel):
Expand Down Expand Up @@ -42,6 +46,7 @@ class VesselAvailability(BaseModel):
available_at: Optional[ISODate] = None
evaluated_at: Optional[ISODate] = None
vessel_class: Optional[str] = None
vessel_class_hierarchy: Optional[List[VesselClassEntry]] = None
vessel_declared_destination: Optional[List[DeclaredDestination]] = None
vessel_dwt: Optional[int] = None
vessel_cubic_capacity: Optional[int] = None
Expand Down
2 changes: 2 additions & 0 deletions vortexasdk/api/voyages.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ISODate,
Scrubber,
Tag,
VesselClassEntry,
)


Expand Down Expand Up @@ -49,6 +50,7 @@ class VoyagesVesselEntity(BaseModel):
name: Optional[str] = None
dead_weight: Optional[int] = None
vessel_class: Optional[str] = None
classes: Optional[List[VesselClassEntry]] = None
imo: Optional[int] = None
mmsi: Optional[int] = None
call_sign: Optional[str] = None
Expand Down

0 comments on commit 629e785

Please sign in to comment.