Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from dataclasses import dataclass
from typing import List
from vortexasdk.api.serdes import FromDictMixin
from vortexasdk.api.shared_types import IDName, EntityWithProbability
@dataclass(frozen=True)
class Corporation(IDName, FromDictMixin):
"""Represent a Corporation reference record returned by the API."""
corporate_entity_type: List[str]
ref_type: str
leaf: bool
parent: List[str]
@dataclass(frozen=True)
class CorporateEntity(EntityWithProbability):
"""
Represents a relationship between a corporation and another entity like a vessel.
[Cargo Event Entities Further Documentation](https://docs.vortexa.com/reference/intro-cargo-events)
"""
event_type: str
location: List[GeographyEntity]
probability: Optional[float] = None
pos: Optional[List[float]] = None
vessel_id: Optional[str] = None
start_timestamp: Optional[ISODate] = None
end_timestamp: Optional[ISODate] = None
@dataclass(frozen=True)
class CargoMovement(FromDictMixin):
"""
Cargo movements are the base data set the Vortexa API is centred around.
Each movement represents a journey of a certain quantity of a product between places.
[Cargo Movement Further Documentation](https://docs.vortexa.com/reference/intro-cargo-movement)
"""
cargo_movement_id: ID
quantity: int
status: str
vessels: List[VesselEntity]
product: List[ProductEntity]
events: List[CargoEvent]
Node,
)
Position = Tuple[float, float]
@dataclass(frozen=True)
class BoundingBox:
"""Polygon with list of bounding lon lat coords."""
type: str
coordinates: List[Position]
@dataclass(frozen=True)
class Geography(Node, IDNameLayer, FromDictMixin):
"""Represent a Geography reference record returned by the API."""
bounding_box: Optional[BoundingBox]
centre_point: Optional[Position]
exclusion_rule: List[IDNameLayer]
hierarchy: List[IDLayer]
location: Optional[Position]
@dataclass(frozen=True)
class GeographyEntity(EntityWithProbability):
"""
Represents a hierarchy tree of locational data.
from vortexasdk.api.corporation import CorporateEntity
from vortexasdk.api.id import ID
from vortexasdk.api.serdes import FromDictMixin
from vortexasdk.api.shared_types import (
IDName,
ISODate,
Node,
Tag,
Scrubber,
Flag,
)
@dataclass(frozen=True,)
class Vessel(Node, FromDictMixin):
"""
Represent a Vessel reference record returned by the API.
[Vessels Further Documentation](https://docs.vortexa.com/reference/GET/reference/vessels/%7Bid%7D)
"""
related_names: List[str]
mmsi: int
tags: List[Tag]
current_product_type: List
vessel_class: str
dead_weight: Optional[int] = None
cubic_capacity: Optional[int] = None
from dataclasses import dataclass
from vortexasdk.api import ISODate
from vortexasdk.api.serdes import FromDictMixin
@dataclass(frozen=True)
class TimeSeriesItem(FromDictMixin):
"""
Generic container class holding a _key_, _value_ pair, and a _count_ of records contributing to the given value.
For example, this class could hold the total tonnage exported (value) on 2019-01-01 (key), and the count of cargo
movements contributing to this tonnage aggregate, ie the number of cargo movements on this day (count).
"""
key: ISODate
value: float
count: int
from dataclasses import dataclass
from typing import List
from vortexasdk.api.serdes import FromDictMixin
from vortexasdk.api.shared_types import Entity, EntityWithProbability, Node
@dataclass(frozen=True)
class Product(Node, FromDictMixin):
"""
Represent a Product reference record returned by the API.
[Product Further Documentation](https://docs.vortexa.com/reference/GET/reference/products/%7Bid%7D)
"""
layer: List[str]
meta: dict
hierarchy: List[Entity]
@dataclass(frozen=True)
class ProductEntity(EntityWithProbability):
"""