From 6843adce4a12225239bfffbbf9add4650fede234 Mon Sep 17 00:00:00 2001 From: Tom Arne Pedersen Date: Thu, 25 Jan 2024 08:11:10 +0100 Subject: [PATCH] #17, Removing MMSI number from the input target ship. Declaring the MMSI field optional. --- data/target_ships/target_ship_1.json | 5 ++--- data/target_ships/target_ship_2.json | 3 +-- data/target_ships/target_ship_3.json | 3 +-- src/trafficgen/types.py | 6 +++--- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/data/target_ships/target_ship_1.json b/data/target_ships/target_ship_1.json index f1c730b..be1b53a 100644 --- a/data/target_ships/target_ship_1.json +++ b/data/target_ships/target_ship_1.json @@ -4,8 +4,7 @@ "width": 20, "height": 8, "speedMax": 17, - "mmsi": 257845600, - "name": "BASTO IV", + "name": "BASTO", "shipType": "Passenger/Ro-Ro Cargo Ship" } -} +} \ No newline at end of file diff --git a/data/target_ships/target_ship_2.json b/data/target_ships/target_ship_2.json index 96b4eda..456ca81 100644 --- a/data/target_ships/target_ship_2.json +++ b/data/target_ships/target_ship_2.json @@ -4,8 +4,7 @@ "width": 10, "height": 8, "speedMax": 15, - "mmsi": 257083180, "name": "CANOLE", "shipType": "Cargo" } -} +} \ No newline at end of file diff --git a/data/target_ships/target_ship_3.json b/data/target_ships/target_ship_3.json index dbf5408..e22d3bd 100644 --- a/data/target_ships/target_ship_3.json +++ b/data/target_ships/target_ship_3.json @@ -4,8 +4,7 @@ "width": 30, "height": 30, "speedMax": 21, - "mmsi": 219945000, "name": "BASTO VI", "shipType": "Passenger/Ro-Ro Cargo Ship" } -} +} \ No newline at end of file diff --git a/src/trafficgen/types.py b/src/trafficgen/types.py index a168c58..8a12874 100644 --- a/src/trafficgen/types.py +++ b/src/trafficgen/types.py @@ -1,10 +1,10 @@ """Domain specific data types used in trafficgen.""" from enum import Enum -from typing import List, Union +from typing import List, Optional, Union from uuid import UUID -from pydantic import BaseModel +from pydantic import BaseModel, Field def to_camel(string: str) -> str: @@ -99,7 +99,7 @@ class ShipStatic(BaseModel): width: float height: float speed_max: float - mmsi: int + mmsi: Optional[int] = Field(None, ge=100000000, le=999999999, description="Maritime Mobile Service Identity (MMSI)", examples=[123456789]) name: str ship_type: GeneralShipType