Skip to content

Commit

Permalink
Merge pull request #36 from dnv-opensource/35-allow-ship-class-to-be-…
Browse files Browse the repository at this point in the history
…used-in-own_ship-and-target_ships

add Ship class as an option for own_ship and target_ships in TrafficSituation
  • Loading branch information
grunde73 authored Apr 5, 2024
2 parents d0aa2b8 + 0e82a8e commit ab53424
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 71 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e

## [Unreleased]

- src/maritime_schema/types/caga.py: Allow own_ship and target_ships to take a Ship object as input

## [0.0.6] - 2024-04-04

### Changed
Expand Down
8 changes: 4 additions & 4 deletions docs/schema/caga/input_schema.html

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions docs/schema/caga/output_schema.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions schema/caga/input_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@
"id": {
"description": "Unique Identifier",
"examples": [
"c8067411-76fe-421d-a60e-07b30948fdd3"
"412934b7-38fb-43d5-af4f-13fdccae87e1"
],
"format": "uuid",
"title": "Id",
Expand Down Expand Up @@ -795,7 +795,7 @@
"default": null,
"description": "Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`",
"examples": [
"2024-04-04T15:28:16.125239"
"2024-04-05T15:23:03.825251"
],
"title": "Starttime"
},
Expand Down
60 changes: 30 additions & 30 deletions schema/caga/output_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,21 @@
"predictions": {
"position": [
{
"time": "2024-04-04T15:28:16.141020",
"time": "2024-04-05T15:23:03.838874",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
}
},
{
"time": "2024-04-04T15:28:16.141044",
"time": "2024-04-05T15:23:03.838882",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
}
},
{
"time": "2024-04-04T15:28:16.141064",
"time": "2024-04-05T15:23:03.838888",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
Expand All @@ -137,7 +137,7 @@
"tcpa": 1200.0
}
],
"time": "2024-04-04T15:28:16.140981"
"time": "2024-04-05T15:23:03.838845"
}
]
],
Expand Down Expand Up @@ -219,7 +219,7 @@
"turnRadius": 500.0
}
],
"time": "2024-04-04T15:28:16.141188"
"time": "2024-04-05T15:23:03.838942"
}
]
],
Expand Down Expand Up @@ -252,7 +252,7 @@
],
"description": "Date and Time of the event",
"examples": [
"2024-04-04T15:28:16.136594"
"2024-04-05T15:23:03.836796"
],
"title": "Time"
},
Expand Down Expand Up @@ -366,7 +366,7 @@
],
"description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`",
"examples": [
"2024-04-04T15:28:16.135180"
"2024-04-05T15:23:03.835357"
],
"title": "Time"
},
Expand All @@ -392,21 +392,21 @@
"predictions": {
"position": [
{
"time": "2024-04-04T15:28:16.135228",
"time": "2024-04-05T15:23:03.835406",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
}
},
{
"time": "2024-04-04T15:28:16.135237",
"time": "2024-04-05T15:23:03.835414",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
}
},
{
"time": "2024-04-04T15:28:16.135243",
"time": "2024-04-05T15:23:03.835421",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
Expand Down Expand Up @@ -522,7 +522,7 @@
"id": {
"description": "Unique Identifier",
"examples": [
"44febc4b-3376-42d7-9573-1ddfcdea77a2"
"b2575786-7825-4545-90c8-6b6a2bb04bf3"
],
"format": "uuid",
"title": "Id",
Expand Down Expand Up @@ -679,21 +679,21 @@
"examples": [
[
{
"time": "2024-04-04T15:28:16.130246",
"time": "2024-04-05T15:23:03.830331",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
}
},
{
"time": "2024-04-04T15:28:16.130262",
"time": "2024-04-05T15:23:03.830348",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
}
},
{
"time": "2024-04-04T15:28:16.130269",
"time": "2024-04-05T15:23:03.830355",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
Expand Down Expand Up @@ -1093,7 +1093,7 @@
],
"description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`",
"examples": [
"2024-04-04T15:28:16.129205"
"2024-04-05T15:23:03.829289"
],
"title": "Time"
},
Expand Down Expand Up @@ -1129,7 +1129,7 @@
"id": {
"description": "Unique Identifier",
"examples": [
"c8067411-76fe-421d-a60e-07b30948fdd3"
"412934b7-38fb-43d5-af4f-13fdccae87e1"
],
"format": "uuid",
"title": "Id",
Expand Down Expand Up @@ -1266,7 +1266,7 @@
"id": {
"description": "Unique Identifier",
"examples": [
"8e8120b8-b87f-4fae-8632-e17f4c535c73"
"6845da60-42f0-4e7b-a5d6-838d9232e211"
],
"format": "uuid",
"title": "Id",
Expand Down Expand Up @@ -1423,7 +1423,7 @@
"sog": 10.0
}
],
"time": "2024-04-04T15:28:16.146312"
"time": "2024-04-05T15:23:03.841844"
},
{
"ownShip": {
Expand Down Expand Up @@ -1467,7 +1467,7 @@
"sog": 10.0
}
],
"time": "2024-04-04T15:28:16.146397"
"time": "2024-04-05T15:23:03.841894"
}
]
],
Expand Down Expand Up @@ -1508,7 +1508,7 @@
],
"description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`",
"examples": [
"2024-04-04T15:28:16.144585"
"2024-04-05T15:23:03.840597"
],
"title": "Time"
},
Expand Down Expand Up @@ -1546,7 +1546,7 @@
],
"description": "Date and Time of the event",
"examples": [
"2024-04-04T15:28:16.139551"
"2024-04-05T15:23:03.838186"
],
"title": "Time"
}
Expand Down Expand Up @@ -1725,7 +1725,7 @@
"default": null,
"description": "Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`",
"examples": [
"2024-04-04T15:28:16.125239"
"2024-04-05T15:23:03.825251"
],
"title": "Starttime"
},
Expand Down Expand Up @@ -1959,7 +1959,7 @@
"creationTime": {
"description": "Date and Time that this file was created, in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`. This should be the simulation end time.",
"examples": [
"2024-04-04T15:28:16.148176"
"2024-04-05T15:23:03.843119"
],
"format": "date-time",
"title": "Creationtime",
Expand Down Expand Up @@ -2063,7 +2063,7 @@
"turnRadius": 500.0
}
],
"time": "2024-04-04T15:28:16.148333"
"time": "2024-04-05T15:23:03.843249"
}
],
"timeSeriesData": [
Expand All @@ -2088,21 +2088,21 @@
"predictions": {
"position": [
{
"time": "2024-04-04T15:28:16.148295",
"time": "2024-04-05T15:23:03.843217",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
}
},
{
"time": "2024-04-04T15:28:16.148304",
"time": "2024-04-05T15:23:03.843225",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
}
},
{
"time": "2024-04-04T15:28:16.148310",
"time": "2024-04-05T15:23:03.843230",
"value": {
"latitude": 57.2343,
"longitude": 10.3432
Expand All @@ -2114,7 +2114,7 @@
"tcpa": 1200.0
}
],
"time": "2024-04-04T15:28:16.148277"
"time": "2024-04-05T15:23:03.843202"
}
]
}
Expand Down Expand Up @@ -2182,7 +2182,7 @@
"sog": 10.0
}
],
"time": "2024-04-04T15:28:16.148436"
"time": "2024-04-05T15:23:03.843339"
},
{
"ownShip": {
Expand Down Expand Up @@ -2226,7 +2226,7 @@
"sog": 10.0
}
],
"time": "2024-04-04T15:28:16.148473"
"time": "2024-04-05T15:23:03.843373"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions src/maritime_schema/types/caga.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ class TrafficSituation(BaseModelConfig):
description="Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`",
examples=[datetime.now()],
)
own_ship: OwnShip = Field(
own_ship: Union[OwnShip, Ship] = Field(
title="Own Ship data",
description="Own Ship data",
examples=[create_ship_example()],
)
target_ships: List[TargetShip] = Field(
target_ships: List[Union[TargetShip, Ship]] = Field(
None,
title="Target Ship data",
description="Target Ship data",
Expand Down

0 comments on commit ab53424

Please sign in to comment.