From d7ba7958b178890c5b177a84ff11d0bac5d2a82e Mon Sep 17 00:00:00 2001 From: Claas Date: Tue, 20 Feb 2024 21:18:51 +0100 Subject: [PATCH 01/36] README.md : corrected repo URL --- README.md | 248 +++++++++++++++++++++++++++--------------------------- 1 file changed, 124 insertions(+), 124 deletions(-) diff --git a/README.md b/README.md index e376875..1846c35 100644 --- a/README.md +++ b/README.md @@ -1,124 +1,124 @@ -# maritime-schema -Python package containing data classes and corresponding JSON schemata for common types used in generating traffic scenarios and testing of autonomy - -maritime-schema supports -* .. - - -## Installation - -```sh -pip install . -``` - -## Usage Example - -API: - -```py -from maritime_schema import ... -``` - -CLI: - -```sh -maritime-schema ... -``` - -_For more examples and usage, please refer to maritime-schema's [documentation][maritime_schema_docs]._ - -## Development Setup - -1. Install Python 3.9 or higher, i.e. [Python 3.10](https://www.python.org/downloads/release/python-3104/) or [Python 3.11](https://www.python.org/downloads/release/python-3114/) - -2. Update pip and setuptools: - - ```sh - python -m pip install --upgrade pip setuptools - ``` - -3. git clone the maritime-schema repository into your local development directory: - - ```sh - git clone https://github.com/dnv-opensource/maritime-schema path/to/your/dev/maritime-schema - ``` - -4. In the maritime-schema root folder: - - Create a Python virtual environment: - - ```sh - python -m venv .venv - ``` - - Activate the virtual environment: - - ..on Windows: - - ```sh - > .venv\Scripts\activate.bat - ``` - - ..on Linux: - - ```sh - source .venv/bin/activate - ``` - - Update pip and setuptools: - - ```sh - (.venv) $ python -m pip install --upgrade pip setuptools - ``` - - Install maritime-schema's dependencies: - ```sh - (.venv) $ pip install -r requirements-dev.txt - ``` - - This should return without errors. - -5. Setup your development environment to locate Python source codes: - - For example, Visual Studio Code on Windows assumes the Python environment is specified in a `.env` file.
- If you are developing and running the Python code from VSCode, make sure to create a `.env` file in the maritime-schema root folder with below content.
- Set the path for `PROJ_DIR` to where your maritime-schema folder is on your system.
- _Note_: `.env` is part of `.gitignore`, such that you do not commit your `.env` file to the repository. - - ```ini - PROJ_DIR= - PYTHONPATH=${PROJ_DIR}/src - ``` - -6. Test that the installation works (in the maritime-schema root folder): - - ```sh - (.venv) $ pytest . - ``` - -## Meta - -Copyright (c) 2024 [DNV](https://www.dnv.com) [open source](https://github.com/dnv-opensource) - -Author One - [@LinkedIn](https://www.linkedin.com/in/authorone) - author.one@dnv.com - -Author Two - [@LinkedIn](https://www.linkedin.com/in/authorthree) - author.two@dnv.com - -Claas Rostock - [@LinkedIn](https://www.linkedin.com/in/claasrostock/?locale=en_US) - claas.rostock@dnv.com - -Distributed under the MIT license. See [LICENSE](LICENSE.md) for more information. - -[https://github.com/dnv-opensource/maritime-schema](https://github.com/dnv-opensource/maritime-schema) - -## Contributing - -1. Fork it () -2. Create your branch (`git checkout -b my-branch-name`) -3. Commit your changes (`git commit -am 'place a descriptive commit message here'`) -4. Push to the branch (`git push origin my-branch-name`) -5. Create a new Pull Request in GitHub - -For your contribution, please make sure you follow the [STYLEGUIDE](STYLEGUIDE.md) before creating the Pull Request. - - -[maritime_schema_docs]: https://AuthorOne.github.io/maritime-schema/README.html +# maritime-schema +Python package containing data classes and corresponding JSON schemata for common types used in generating traffic scenarios and testing of autonomy + +maritime-schema supports +* .. + + +## Installation + +```sh +pip install . +``` + +## Usage Example + +API: + +```py +from maritime_schema import ... +``` + +CLI: + +```sh +maritime-schema ... +``` + +_For more examples and usage, please refer to maritime-schema's [documentation][maritime_schema_docs]._ + +## Development Setup + +1. Install Python 3.9 or higher, i.e. [Python 3.10](https://www.python.org/downloads/release/python-3104/) or [Python 3.11](https://www.python.org/downloads/release/python-3114/) + +2. Update pip and setuptools: + + ```sh + python -m pip install --upgrade pip setuptools + ``` + +3. git clone the maritime-schema repository into your local development directory: + + ```sh + git clone https://github.com/dnv-opensource/maritime-schema path/to/your/dev/maritime-schema + ``` + +4. In the maritime-schema root folder: + + Create a Python virtual environment: + + ```sh + python -m venv .venv + ``` + + Activate the virtual environment: + + ..on Windows: + + ```sh + > .venv\Scripts\activate.bat + ``` + + ..on Linux: + + ```sh + source .venv/bin/activate + ``` + + Update pip and setuptools: + + ```sh + (.venv) $ python -m pip install --upgrade pip setuptools + ``` + + Install maritime-schema's dependencies: + ```sh + (.venv) $ pip install -r requirements-dev.txt + ``` + + This should return without errors. + +5. Setup your development environment to locate Python source codes: + + For example, Visual Studio Code on Windows assumes the Python environment is specified in a `.env` file.
+ If you are developing and running the Python code from VSCode, make sure to create a `.env` file in the maritime-schema root folder with below content.
+ Set the path for `PROJ_DIR` to where your maritime-schema folder is on your system.
+ _Note_: `.env` is part of `.gitignore`, such that you do not commit your `.env` file to the repository. + + ```ini + PROJ_DIR= + PYTHONPATH=${PROJ_DIR}/src + ``` + +6. Test that the installation works (in the maritime-schema root folder): + + ```sh + (.venv) $ pytest . + ``` + +## Meta + +Copyright (c) 2024 [DNV](https://www.dnv.com) [open source](https://github.com/dnv-opensource) + +Author One - [@LinkedIn](https://www.linkedin.com/in/authorone) - author.one@dnv.com + +Author Two - [@LinkedIn](https://www.linkedin.com/in/authorthree) - author.two@dnv.com + +Claas Rostock - [@LinkedIn](https://www.linkedin.com/in/claasrostock/?locale=en_US) - claas.rostock@dnv.com + +Distributed under the MIT license. See [LICENSE](LICENSE.md) for more information. + +[https://github.com/dnv-opensource/maritime-schema](https://github.com/dnv-opensource/maritime-schema) + +## Contributing + +1. Fork it () +2. Create your branch (`git checkout -b my-branch-name`) +3. Commit your changes (`git commit -am 'place a descriptive commit message here'`) +4. Push to the branch (`git push origin my-branch-name`) +5. Create a new Pull Request in GitHub + +For your contribution, please make sure you follow the [STYLEGUIDE](STYLEGUIDE.md) before creating the Pull Request. + + +[maritime_schema_docs]: https://AuthorOne.github.io/maritime-schema/README.html From 77f36f0f149decebad5e1c2784d29d2b890dfab9 Mon Sep 17 00:00:00 2001 From: Claas Date: Tue, 20 Feb 2024 21:20:25 +0100 Subject: [PATCH 02/36] pyproject.toml : minor change (added a trailing comma) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 219d89a..07e418e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ authors = [ {name = "Author One", email = "author.one@dnv.com"}, ] maintainers = [ - {name = "Claas Rostock", email = "claas.rostock@dnv.com"} + {name = "Claas Rostock", email = "claas.rostock@dnv.com"}, ] keywords = [] classifiers = [ From 91081753df773eb5b0be727419a26c47deeab864 Mon Sep 17 00:00:00 2001 From: Claas Date: Tue, 20 Feb 2024 21:20:33 +0100 Subject: [PATCH 03/36] updated CHANGELOG.md --- CHANGELOG.md | 141 ++++++++++++++++++--------------------------------- 1 file changed, 50 insertions(+), 91 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c184c7..c5df250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,98 +1,57 @@ -# Changelog - -All notable changes to the [maritime-schema] project will be documented in this file.
-The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - +# Changelog + +All notable changes to the [maritime-schema] project will be documented in this file.
+The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + ## [Unreleased] +### Changed +* Moved all project configuration from setup.cfg to pyproject.toml +* Moved all tox configuration from setup.cfg to tox.ini. +* Moved pytest configuration from pyproject.toml to pytest.ini +* Deleted setup.cfg + ### Dependencies * updated to black[jupyter]==24.1 (from black[jupyter]==23.12) * updated to version: '==24.1' (from version: '==23.12') * updated to ruff==0.2.1 (from ruff==0.1.8) * updated to pyright==1.1.350 (from pyright==1.1.338) -* updated to sourcery==1.15 (from sourcery==1.14) - -* -/- - - -## [0.1.4] - 2023-11-08 - -### Changed - -* incorporated latest updates introduced in projects - -### Dependencies - -* Updated dependencies to latest versions - - -## [0.1.3] - 2023-08-24 - -### Changed - -* GitHub workflow publish_release.yml: corrected smaller errors -* Explicitly removed .env file from remote repository -* Updated README.md to include guidance on how to create a .env file locally -* dependencies: updated packages in requirements-dev.txt to latest versions - - -## [0.1.2] - 2023-06-22 - -### Changed - -* Modularized GitHub workflows -* requirements-dev.txt: Updated dependencies to latest versions -* setup.cfg: indicated supported Python versions as py310 and py311
- (from formerly py39 and py310) -* GitHub workflows: changed default Python version from 3.10 to 3.11 - - -## [0.1.0] - 2023-02-21 - -### Changed - -* pyproject.toml: Changed ruff configuration to by default allow Uppercase variable names in functions.
-(As this is a very common case in science calculus) -* README.md: Changed install infos for development setup to pip install requirements-dev.txt (not requirements.txt) - - -## [0.0.1] - 2023-02-21 - -* Initial release - -### Added - -* added this - -### Changed - -* changed that - -### Dependencies - -* updated to some_package_on_pypi>=0.1.0 - -### Fixed - -* fixed issue #12345 - -### Deprecated - -* following features will soon be removed and have been marked as deprecated: - * function x in module z - -### Removed - -* following features have been removed: - * function y in module z - - - - -[unreleased]: https://github.com/AuthorOne/maritime-schema/compare/v0.1.4...HEAD -[0.1.4]: https://github.com/AuthorOne/maritime-schema/releases/tag/v0.1.3...v0.1.4 -[0.1.3]: https://github.com/AuthorOne/maritime-schema/releases/tag/v0.1.2...v0.1.3 -[0.1.2]: https://github.com/AuthorOne/maritime-schema/releases/tag/v0.1.0...v0.1.2 -[0.1.0]: https://github.com/AuthorOne/maritime-schema/releases/tag/v0.0.1...v0.1.0 -[0.0.1]: https://github.com/AuthorOne/maritime-schema/releases/tag/v0.0.1 -[maritime-schema]: https://github.com/AuthorOne/maritime-schema +* updated to sourcery==1.15 (from sourcery==1.14) + + +## [0.0.1] - 2024-01-11 + +* Initial release + +### Added + +* added this + +### Changed + +* changed that + +### Dependencies + +* updated to some_package_on_pypi>=0.1.0 + +### Fixed + +* fixed issue #12345 + +### Deprecated + +* following features will soon be removed and have been marked as deprecated: + * function x in module z + +### Removed + +* following features have been removed: + * function y in module z + + + +[unreleased]: https://github.com/dnv-opensource/maritime-schema/compare/v0.0.2...HEAD +[0.0.2]: https://github.com/dnv-opensource/maritime-schema/releases/tag/v0.0.1...v0.0.2 +[0.0.1]: https://github.com/dnv-opensource/maritime-schema/releases/tag/v0.0.1 +[maritime-schema]: https://github.com/dnv-opensource/maritime-schema From 693394aefac1a00bdac9ec4089e6c4371ceb2b7a Mon Sep 17 00:00:00 2001 From: Claas Date: Wed, 21 Feb 2024 18:23:23 +0100 Subject: [PATCH 04/36] VS Code settings: Removed the setting which added the /src folder to PythonPath. This is no longer necessary. Installing the current package in "editable" mode, using the pip install -e option, solves the issue and removes the need to manually add /src to the PythonPath environment variable. --- .vscode/settings.json | 51 ++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 0709fc1..4565c2d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,28 +1,25 @@ -{ - "terminal.integrated.env.windows": { - "PYTHONPATH": "${workspaceFolder}/src" - }, - "python.terminal.activateEnvInCurrentTerminal": true, - "python.languageServer": "Pylance", - "ruff.importStrategy": "fromEnvironment", - "editor.formatOnSave": true, - "[python]": { - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.organizeImports": "explicit" - }, - }, - "autoDocstring.docstringFormat": "numpy", - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true, - "python.analysis.logLevel": "Warning", - "python.analysis.completeFunctionParens": false, - "python.analysis.diagnosticMode": "workspace", - "python.analysis.diagnosticSeverityOverrides": {}, - "python.analysis.indexing": true, - "python.analysis.autoImportCompletions": true, - "python.analysis.inlayHints.variableTypes": false, - "python.analysis.inlayHints.functionReturnTypes": false, - "python.analysis.inlayHints.pytestParameters": true, - "python.terminal.executeInFileDir": true, +{ + "python.terminal.activateEnvInCurrentTerminal": true, + "python.languageServer": "Pylance", + "ruff.importStrategy": "fromEnvironment", + "editor.formatOnSave": true, + "[python]": { + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, + }, + "autoDocstring.docstringFormat": "numpy", + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "python.analysis.logLevel": "Warning", + "python.analysis.completeFunctionParens": false, + "python.analysis.diagnosticMode": "workspace", + "python.analysis.diagnosticSeverityOverrides": {}, + "python.analysis.indexing": true, + "python.analysis.autoImportCompletions": true, + "python.analysis.inlayHints.variableTypes": false, + "python.analysis.inlayHints.functionReturnTypes": false, + "python.analysis.inlayHints.pytestParameters": true, + "python.terminal.executeInFileDir": true, } \ No newline at end of file From 6f087e2e89b468c07af9152b8ec85b5aca908e2a Mon Sep 17 00:00:00 2001 From: Claas Date: Wed, 21 Feb 2024 18:27:07 +0100 Subject: [PATCH 05/36] README.md : Under `Development Setup`, added a step to install current package in "editable" mode, using the pip install -e option. This removes the need to manually add /src to the PythonPath environment variable in order for debugging and tests to work. --- README.md | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 1846c35..5256cba 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ maritime-schema supports ## Installation ```sh -pip install . +pip install maritime-schema ``` ## Usage Example @@ -75,22 +75,14 @@ _For more examples and usage, please refer to maritime-schema's [documentation][ ```sh (.venv) $ pip install -r requirements-dev.txt ``` - This should return without errors. -5. Setup your development environment to locate Python source codes: - - For example, Visual Studio Code on Windows assumes the Python environment is specified in a `.env` file.
- If you are developing and running the Python code from VSCode, make sure to create a `.env` file in the maritime-schema root folder with below content.
- Set the path for `PROJ_DIR` to where your maritime-schema folder is on your system.
- _Note_: `.env` is part of `.gitignore`, such that you do not commit your `.env` file to the repository. - - ```ini - PROJ_DIR= - PYTHONPATH=${PROJ_DIR}/src + Finally, install maritime-schema itself, yet not as a regular package but as an _editable_ package instead, using the pip install option -e: + ```sh + (.venv) $ pip install -e . ``` -6. Test that the installation works (in the maritime-schema root folder): +5. Test that the installation works (in the maritime-schema root folder): ```sh (.venv) $ pytest . From fd3afd1cd14940b8e3d009005a17433a84c6febb Mon Sep 17 00:00:00 2001 From: Claas Date: Wed, 21 Feb 2024 18:55:26 +0100 Subject: [PATCH 06/36] Updated CHANGELOG.md --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5df250..97cc6e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e ## [Unreleased] +### Added +* README.md : Under `Development Setup`, added a step to install current package in "editable" mode, using the pip install -e option. +This removes the need to manually add /src to the PythonPath environment variable in order for debugging and tests to work. + +### Removed +* VS Code settings: Removed the setting which added the /src folder to PythonPath. This is no longer necessary. Installing the project itself as a package in "editable" mode, using the pip install -e option, solves the issue and removes the need to manually add /src to the PythonPath environment variable. + ### Changed * Moved all project configuration from setup.cfg to pyproject.toml * Moved all tox configuration from setup.cfg to tox.ini. From 3032021eac0a775b26b602ac0e9b8b746e3e0f2e Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 12:31:49 +0100 Subject: [PATCH 07/36] tox.ini : minor typo --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 4905da2..69d423a 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ envlist = py{39,310,311,312}-{linux,macos,windows} [coverage:paths] source = src/maritime_schema - */site-packages/maritime-schema + */site-packages/maritime_schema [coverage:run] source = maritime_schema From 19e8927edffd6d2862656f8351079c72ee1f9054 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 12:32:47 +0100 Subject: [PATCH 08/36] utils: added module strings.py as home for the to_camel() utility function --- src/maritime_schema/utils/strings.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/maritime_schema/utils/strings.py diff --git a/src/maritime_schema/utils/strings.py b/src/maritime_schema/utils/strings.py new file mode 100644 index 0000000..a3bf4f1 --- /dev/null +++ b/src/maritime_schema/utils/strings.py @@ -0,0 +1,13 @@ +import logging + +__all__ = ["to_camel"] + + +logger = logging.getLogger(__name__) + + +def to_camel(string: str) -> str: + """Change casing of string to CamelCase.""" + words = string.split("_") + camel_string: str = words[0] + "".join(word.capitalize() for word in words[1:]) + return camel_string From bd24ce5c904299ff6b2098ca840c6ef8989a2db3 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 17:49:33 +0100 Subject: [PATCH 09/36] pyproject.toml: adjusted ruff settings following the new [ruff.tool.lint] subsection introduced by ruff in v0.2 --- pyproject.toml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 07e418e..e93c910 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,11 +33,9 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", ] dependencies = [ - "pydantic>=2.5", - "dictIO>=0.3.1", - # "some_package_on_pypi>=0.1.0", - # "some_project_in_my_local_dev @ file:../some_project_in_my_local_dev", - # "some_project_on_github @ git+https://github.com/user/project.git@version_or_tag_or_branch_name#egg=project_name", + "pydantic>=2.6", + "json-schema-for-humans>=0.4.7", + "dictIO>=0.3.3", ] [project.urls] @@ -70,11 +68,17 @@ exclude = [ "./src/folder_to_be_ignored", ] src = ["src"] +line-length = 120 +target-version = "py39" + +[tool.ruff.lint] ignore = [ "E501", # Line length too long "D100", # Missing docstring in public module + "D101", # Missing docstring in public class "D104", # Missing docstring in public package "D105", # Missing docstring in magic method + "D106", # Missing docstring in public nested class "D107", # Missing docstring in __init__ "D202", # No blank lines allowed after function docstring "D203", # 1 blank line required before class docstring @@ -88,7 +92,6 @@ ignore = [ # "N816", # Variable in global scope should not be mixedCase (uncomment if you want to allow mixedCase variable names in global scope) "N999", # Invalid module name ] -line-length = 120 select = [ "E", "D", @@ -98,19 +101,18 @@ select = [ "I", "B", ] -target-version = "py39" -[tool.ruff.pep8-naming] +[tool.ruff.lint.pep8-naming] ignore-names = [ "test_*", "setUp", "tearDown", ] -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "numpy" -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "__init__.py" = ["I001"] "./tests/*" = ["D"] From 72adc0b1ec8b5cd6bfcd9169e8b88ead236b65cd Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 17:51:10 +0100 Subject: [PATCH 10/36] requirements.txt: added json-schema-for-humans --- requirements.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index c74a74a..cccc2cc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,3 @@ -pydantic>=2.5 -dictIO>=0.3.1 - -# some_package_on_pypi>=0.1.0 - -# ../some_project_in_my_local_dev +pydantic>=2.6 +json-schema-for-humans>=0.4.7 +dictIO>=0.3.3 From 937dc5358b5475cbb190c227649cbc4d4af1ae46 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 17:54:32 +0100 Subject: [PATCH 11/36] utils: added module publish.py as home for schema generation functions --- src/maritime_schema/utils/publish.py | 134 +++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 src/maritime_schema/utils/publish.py diff --git a/src/maritime_schema/utils/publish.py b/src/maritime_schema/utils/publish.py new file mode 100644 index 0000000..893ac00 --- /dev/null +++ b/src/maritime_schema/utils/publish.py @@ -0,0 +1,134 @@ +import json +import logging +import os +from glob import glob +from pathlib import Path +from typing import List, Union + +from dictIO.utils.path import relative_path +from json_schema_for_humans.generate import ( + SchemaToRender, + TemplateRenderer, + generate_schemas_doc, +) +from json_schema_for_humans.generation_configuration import GenerationConfiguration +from pydantic import BaseModel +from pydantic._internal._model_construction import ModelMetaclass + +__all__ = ["generate_schema", "generate_docs"] + + +logger = logging.getLogger(__name__) + + +def generate_schema( + model: Union[BaseModel, ModelMetaclass], + name: str, + schema_dir: Union[str, os.PathLike[str], None] = None, + by_alias: bool = False, +): + """Generate json schema in the given target folder. + + Parameters + ---------- + model : BaseModel + The pydantic model for which the schema shall be generated + name : str + The filename the schema shall be given (without extension) + schema_dir : Union[str, os.PathLike[str], None], optional + The target folder in which the schema and documentation files shall be generated in. + If None, files will be generated in src/maritime_schema/schema. + , by default None + by_alias : bool, optional + Whether to serialize using field aliases., by default False + """ + default_dir = Path(__file__).parent.parent / "schema" + schema_dir = schema_dir or default_dir + + # Assert model argument is a pydantic BaseModel + # Background: ModelMetaClass is added just to please static type checking, + # which would otherwise complain. + # Behind the scenes in pdyantic, models always inherit the attributes of BaseModel. + assert hasattr(model, "model_json_schema") + + # Make sure schema_dir argument is of type Path. If not, cast it to Path type. + schema_dir = schema_dir if isinstance(schema_dir, Path) else Path(schema_dir) + + # Create schema_dir if it does not exist + schema_dir.mkdir(parents=True, exist_ok=True) + + # Generate json schema + json_file: Path = schema_dir / f"{name}.json" + schema = json.dumps(model.model_json_schema(by_alias=by_alias)) # pyright: ignore + with open(json_file, "w", encoding="utf-8") as f: + _ = f.write(schema) + + return + + +def generate_docs( + schema_dir: Union[str, os.PathLike[str], None] = None, + docs_dir: Union[str, os.PathLike[str], None] = None, +): + """Generate schema documentation in the given docs folder. + + The documentation will be generated in html format. + + Parameters + ---------- + schema_dir : Union[str, os.PathLike[str], None], optional + The source folder containing the json schemata + for which the html documentation shall be generated. + If None, schemata will be read from in src/maritime_schema/schema. + , by default None + docs_dir : Union[str, os.PathLike[str]] + The folder in which the html documentation files shall be generated in. + If None, html files will be generated in docs/source/schema. + , by default None + """ + schema_dir_default = Path(__file__).parent.parent / "schema" + schema_dir = schema_dir or schema_dir_default + + docs_dir_default = Path(__file__).parent.parent.parent.parent / "docs" / "source" / "schema" + docs_dir = docs_dir or docs_dir_default + + # Make sure schema_dir argument is of type Path. If not, cast it to Path type. + schema_dir = schema_dir if isinstance(schema_dir, Path) else Path(schema_dir) + + # Make sure docs_dir argument is of type Path. If not, cast it to Path type. + docs_dir = docs_dir if isinstance(docs_dir, Path) else Path(docs_dir) + + # Create docs_dir if it does not exist + docs_dir.mkdir(parents=True, exist_ok=True) + + # Collect all schemata in schema dir + pattern: str = f"{str(schema_dir.absolute())}/**.json" + schemata: List[Path] = [Path(file) for file in glob(pattern)] + + # Generate html documentation for schemata + config: GenerationConfiguration = GenerationConfiguration( + template_name="js_offline", + expand_buttons=True, + link_to_reused_ref=False, + show_breadcrumbs=False, + ) + + schemas_to_render: List[SchemaToRender] = [] + + for schema in schemata: + rel_path: Path = relative_path(from_path=schema_dir, to_path=schema.parent) + name: str = schema.stem + html_file: Path = docs_dir / rel_path / f"{name}.html" + schema_to_render: SchemaToRender = SchemaToRender( + schema_file=schema, + result_file=html_file, + output_dir=None, + ) + schemas_to_render.append(schema_to_render) + + _ = generate_schemas_doc( + schemas_to_render=schemas_to_render, + template_renderer=TemplateRenderer(config), + ) + + return From 7c1bfce1f2ddc0f6dda864c9bf5e1f47809bafd6 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 17:56:01 +0100 Subject: [PATCH 12/36] turned 'subpackage1' into sub-package 'types' --- src/maritime_schema/subpackage1/module1.py | 24 - src/maritime_schema/subpackage2/__init__.py | 0 .../{subpackage1 => types}/__init__.py | 0 src/maritime_schema/types/caga.py | 771 ++++++++++++++++++ 4 files changed, 771 insertions(+), 24 deletions(-) delete mode 100644 src/maritime_schema/subpackage1/module1.py delete mode 100644 src/maritime_schema/subpackage2/__init__.py rename src/maritime_schema/{subpackage1 => types}/__init__.py (100%) create mode 100644 src/maritime_schema/types/caga.py diff --git a/src/maritime_schema/subpackage1/module1.py b/src/maritime_schema/subpackage1/module1.py deleted file mode 100644 index 3d7141f..0000000 --- a/src/maritime_schema/subpackage1/module1.py +++ /dev/null @@ -1,24 +0,0 @@ -import logging - -__ALL__ = ["int_to_str"] - -logger = logging.getLogger(__name__) - - -def int_to_str(input: int) -> str: - """Convert integer to string. - - This function converts an integer to its string representation. - - Parameters - ---------- - input : int - the integer to be converted to string - - Returns - ------- - str - the resulting string - """ - logger.debug(f"function int_to_str() in subpackage1 called with argument {input}") - return str(input) diff --git a/src/maritime_schema/subpackage2/__init__.py b/src/maritime_schema/subpackage2/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/maritime_schema/subpackage1/__init__.py b/src/maritime_schema/types/__init__.py similarity index 100% rename from src/maritime_schema/subpackage1/__init__.py rename to src/maritime_schema/types/__init__.py diff --git a/src/maritime_schema/types/caga.py b/src/maritime_schema/types/caga.py new file mode 100644 index 0000000..a5738cb --- /dev/null +++ b/src/maritime_schema/types/caga.py @@ -0,0 +1,771 @@ +# pyright: reportCallIssue=false +# pyright: reportIncompatibleVariableOverride=false +import logging +from datetime import datetime, timedelta +from enum import Enum +from pathlib import Path +from typing import Any, Dict, List, Optional, Union +from uuid import UUID, uuid4 + +from pydantic import BaseModel +from pydantic.fields import Field # , FieldInfo + +from maritime_schema.utils.strings import to_camel + +__ALL__ = ["TrafficSituation", "OutputSchema", "publish_schema"] + +logger = logging.getLogger(__name__) + + +class AISNavStatus(str, Enum): + UNDER_WAY_USING_ENGINE = "Under way using engine" + AT_ANCHOR = "At anchor" + NOT_UNDER_COMMAND = "Not under command" + RESTRICTED_MANOEUVERABILITY = "Restricted manoeuverability" + CONSTRAINED_BY_HER_DRAUGHT = "Constrained by her draught" + MOORED = "Moored" + AGROUND = "Aground" + ENGAGED_IN_FISHING = "Engaged in fishing" + UNDER_WAY_SAILING = "Under way sailing" + RESERVED_FOR_FUTURE_AMENDMENT_OF_NAVIGATIONAL_STATUS_FOR_HSC = ( + "Reserved for future amendment of navigational status for HSC" + ) + RESERVED_FOR_FUTURE_AMENDMENT_OF_NAVIGATIONAL_STATUS_FOR_WIG = ( + "Reserved for future amendment of navigational status for WIG" + ) + RESERVED_FOR_FUTURE_USE_1 = "Reserved for future use 1" + RESERVED_FOR_FUTURE_USE_2 = "Reserved for future use 2" + RESERVED_FOR_FUTURE_USE_3 = "Reserved for future use 3" + AIS_SART_IS_ACTIVE = "AIS SART is active" + NOT_DEFINED_DEFAULT = "Not defined (default)" + + +class GeneralShipType(str, Enum): + WING_IN_GROUND = "Wing in ground" + FISHING = "Fishing" + TOWING = "Towing" + DREDGING_OR_UNDERWATER_OPS = "Dredging or underwater ops" + DIVING_OPS = "Diving ops" + MILITARY_OPS = "Military ops" + SAILING = "Sailing" + PLEASURE_CRAFT = "Pleasure Craft" + HIGH_SPEED_CRAFT = "High speed craft" + PILOT_VESSEL = "Pilot Vessel" + SEARCH_AND_RESCUE_VESSEL = "Search and Rescue vessel" + TUG = "Tug" + PORT_TENDER = "Port Tender" + ANTI_POLLUTION = "Anti-pollution" + LAW_ENFORCEMENT = "Law Enforcement" + MEDICAL_TRANSPORT = "Medical Transport" + NONCOMBATANT_SHIP = "Noncombatant ship" + PASSENGER = "Passenger" + CARGO = "Cargo" + TANKER = "Tanker" + OTHER_TYPE = "Other Type" + + +class InterpolationMethod(str, Enum): + LINEAR = "linear" + COSINE = "cosine" + SMOOTHSTEP = "smoothstep" + ACCELERATE = "accelerate" + DECELERATE = "decelerate" + ORDINAL = "ordinal" + + +class WaveSpectra(Enum): + JONSWAP = "JONSWAP" + PiersonMoskowitz = "Pierson-Moskowitz" + Bretschneider = "Bretschneider" + + +class WeatherCondition(Enum): + Clear = "Clear" + Cloudy = "Cloudy" + Foggy = "Foggy" + Rainy = "Rainy" + Snowy = "Snowy" + + +class PrecipitationType(Enum): + None_ = "None" + Rain = "Rain" + Snow = "Snow" + Sleet = "Sleet" + Hail = "Hail" + + +class Environment(BaseModel): + air_temperature: float = Field(None, description="The air temperature in degrees Celsius", examples=[20.0]) + water_remperature: float = Field(None, description="The water temperature in degrees Celsius", examples=[15.0]) + precipitation: PrecipitationType = Field( + None, description="The type of precipitation", examples=[PrecipitationType.Rain] + ) + wind_speed: float = Field(None, description="The wind speed in m/s", examples=[10.0]) + wind_direction: float = Field(None, description="The wind direction in degrees", examples=[180.0]) + current_speed: float = Field(None, description="The current speed in m/s", examples=[1.0]) + current_direction: float = Field(None, description="The current direction in degrees", examples=[90.0]) + wave_spectrum: WaveSpectra = Field(None, description="The wave spectrum", examples=[WaveSpectra.JONSWAP]) + significant_wave_height: float = Field(None, description="The significant wave height in meters", examples=[3.0]) + wave_period: float = Field(None, description="The wave period in seconds", examples=[12.0]) + wave_direction: float = Field(None, description="The wave direction in degrees", examples=[270.0]) + visibility: float = Field(None, description="The visibility in nautical miles", examples=[5.0]) + conditions: WeatherCondition = Field( + None, description="The overall weather conditions", examples=[WeatherCondition.Clear] + ) + + class Config: + alias_generator = to_camel + populate_by_name = True + + +environment = Environment( + air_temperature=20.0, + water_remperature=15.0, + precipitation=PrecipitationType.Rain, + wind_speed=10.0, + wind_direction=180.0, + current_speed=1.0, + current_direction=90.0, + wave_spectrum=WaveSpectra.JONSWAP, + significant_wave_height=3.0, + wave_period=12.0, + wave_direction=270.0, + visibility=5.0, + conditions=WeatherCondition.Clear, +) + + +class Position(BaseModel): + latitude: float = Field(..., ge=-90, le=90, description="WGS-84 latitude", examples=[51.2131]) + longitude: float = Field(..., ge=-180, le=180, description="WGS-84 longitude", examples=[11.2131]) + + +position_example = Position(latitude=57.2343, longitude=10.3432) + + +class ShipStatic(BaseModel): + """Static ship data that will not change during the scenario.""" + + id: UUID = Field(..., description="Unique Identifier", examples=[uuid4()]) + length: float = Field(g=0, description="Length of the ship in meters", examples=[230.0]) + width: float = Field(g=0, description="Width of the ship in meters", examples=[30.0]) + height: Optional[float] = Field(10, g=0, description="Height of the ship in meters", examples=[15.0]) + mmsi: Optional[int] = Field( + None, ge=100000000, le=999999999, description="Maritime Mobile Service Identity (MMSI)", examples=[123456789] + ) + imo: Optional[int] = Field(None, ge=1000000, le=9999999, description="IMO Number", examples=[1234567]) + name: Optional[str] = Field(None, description="Ship title", examples=["RMS Titanic"]) + ship_type: GeneralShipType = Field(description="General ship type, based on AIS") + + class Config: + alias_generator = to_camel + populate_by_name = True + + +ship_static_example = ShipStatic( + id=uuid4(), + length=230.0, + width=30.0, + height=15.0, + mmsi=123456789, + name="RMS Titanic", + ship_type=GeneralShipType.FISHING, +) + + +class Initial(BaseModel): + position: Position = Field( + ..., + title="Longitude and Latitude Values", + description="A geographical coordinate", + examples=[Position(latitude=51.2123, longitude=11.2313)], + ) + sog: float = Field( + ..., + ge=0, + title="Initial ship speed over ground", + description="Initial ship speed over ground in knots", + examples=[10.0], + ) + cog: float = Field( + ..., + ge=0, + le=360, + title="Initial ship course over ground", + description="Initial ship course over ground in degrees", + examples=[45.0], + ) + heading: Optional[float] = Field( + None, ge=0, le=360, title="Initial ship heading", description="Initial ship heading in degrees", examples=[45.2] + ) + nav_status: AISNavStatus = Field(..., description="AIS Navigational Status") + + class Config: + alias_generator = to_camel + populate_by_name = True + + +initial_example = Initial( + position=Position(latitude=51.2123, longitude=11.2313), + sog=12.3, + cog=284.2, + heading=283.1, + nav_status=AISNavStatus.UNDER_WAY_USING_ENGINE, +) + + +class DataPoint(BaseModel): + value: float = Field(..., description="the value of the data at the current timestep", examples=[12.3]) + m_before_leg_change: float = Field( + ..., description="meters before the waypoint to start interpolating to the new value", examples=[10] + ) + m_after_leg_change: float = Field( + ..., description="meters after the waypoint to finish interpolating to the new value", examples=[10] + ) + interp_method: Union[InterpolationMethod, str] = Field("linear", description="Method used for interpolation") + + class Config: + alias_generator = to_camel + populate_by_name = True + + +data_point_example1 = DataPoint(value=12.3, m_before_leg_change=100, m_after_leg_change=100, interp_method="linear") +data_point_example2 = DataPoint(value=200, m_before_leg_change=500, m_after_leg_change=500, interp_method="cosine") + + +class Data(BaseModel): + sog: DataPoint = Field( + None, + description="Speed data point", + examples=[DataPoint(value=12.3, m_before_leg_change=100, m_after_leg_change=100, interp_method="linear")], + ) + heading: DataPoint = Field( + None, + description="Heading data point", + examples=[DataPoint(value=180, m_before_leg_change=100, m_after_leg_change=100, interp_method="linear")], + ) + + class Config: + alias_generator = to_camel + populate_by_name = True + extra = "allow" + json_schema_extra = { + "additionalProperties": { + "type": "object", + "properties": { + "value": {"type": "number"}, + "mBeforeLegChange": {"type": "number"}, + "mAfterLegChange": {"type": "number"}, + "interpMethod": {"type": "string"}, + }, + "required": ["value", "mBeforeLegChange", "mAfterLegChange", "interpMethod"], + "description": "The 'data' field can include additional properties. All additional properties should be DataPoint objects.", + } + } + + +class Waypoint(BaseModel): + position: Position = Field( + description="A geographical coordinate", examples=[Position(latitude=51.2123, longitude=11.2313)] + ) + turn_radius: float = Field(0, description="Orthodrome turn radius as defined in RTZ format", examples=[200]) + data: Data = Field(None, description="A `Data` object that includes `speed`, `course`, and `heading` data points") + + class Config: + alias_generator = to_camel + populate_by_name = True + + +waypoint_example = Waypoint( + position=position_example, turn_radius=500, data=Data(sog=data_point_example1, cog=data_point_example2) +) + + +class Ship(BaseModel): + static: Optional[ShipStatic] = Field( + description="Static ship information which does not change during a scenario.", examples=[ship_static_example] + ) + initial: Initial = Field(title="Initial own ship Initial", examples=[initial_example]) + waypoints: Optional[List[Waypoint]] = Field( + None, + description="An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", + examples=[waypoint_example], + ) + + +ship_example = Ship(static=ship_static_example, initial=initial_example, waypoints=[waypoint_example]) + + +class OwnShip(Ship): + pass + + +class TargetShip(Ship): + pass + + +class TrafficSituation(BaseModel): + title: str = Field(description="The title of the traffic situation", examples=["overtaking_18"], omit_default=True) + description: str = Field( + description="A description of the traffic situation", + examples=["Crossing situation with 3 target vessels in the Oslofjord"], + ) + start_time: Optional[datetime] = Field( + None, + title="Situation starting time", + description="Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", + examples=[datetime.now()], + ) + own_ship: OwnShip = Field(title="Own Ship data", description="Own Ship data", examples=[ship_example]) + target_ships: List[TargetShip] = Field( + None, title="Target Ship data", description="Target Ship data", examples=[[ship_example]] + ) + environment: Optional[Environment] = Field(None, description="environmental parameters", examples=[environment]) + + class Config: + alias_generator = to_camel + populate_by_name = True + title = "Test Input Schema" + extra = "allow" + + +# %% + +# Ownship +ownship_initial = Initial( + position=Position(latitude=57.7089, longitude=11.9746), # Gothenburg + sog=20.0, + cog=90.0, + nav_status=AISNavStatus.UNDER_WAY_USING_ENGINE, +) + +ownship = OwnShip( + static=ShipStatic(id=uuid4(), length=230.0, width=30.0, ship_type=GeneralShipType.PASSENGER), + initial=ownship_initial, +) + +# Target vessel 1 (Head-on) +target1_initial = Initial( + position=Position(latitude=57.7089, longitude=10.9746), # West of Gothenburg + sog=20.0, + cog=270.0, + nav_status=AISNavStatus.UNDER_WAY_USING_ENGINE, +) + +target1 = TargetShip( + static=ShipStatic(id=uuid4(), length=180.0, width=28.0, ship_type=GeneralShipType.CARGO), initial=target1_initial +) + + +# Traffic situation +traffic_situation = TrafficSituation( + title="head-on scenario", + description="One vessel is approaching head-on", + start_time=datetime.now(), + own_ship=ownship, + target_ships=[target1], +) + + +# %% + +name_example = "AutoNavigation-System 1" +name_example1 = "Simulator-System 1" +version_example = "1.2.3" +vendor_example = "CompanyABC" + + +class SoftwareConfig(BaseModel): + name: str = Field(..., description="The name of the system", examples=[name_example]) + version: str = Field(..., description="The software version", examples=["1.2.3"]) + vendor: str = Field(..., description="The name of the system vendor", examples=["CompanyABC"]) + + class Config: + extra = "allow" + + +software_config_example = SoftwareConfig(name=name_example, version=version_example, vendor=vendor_example) +software_config_example1 = SoftwareConfig(name=name_example1, version=version_example, vendor=vendor_example) + + +class CagaConfiguration(SoftwareConfig): + vendor_minimum_distance_to_targets: float = Field( + None, description="Minimum distance in meters that the system will keep to other Vessels", examples=[100] + ) + vendor_critical_TCPA: float = Field( # noqa: N815 + None, + description="If the projected CPA is less than minimumDistanceToTargets, and TCPA falls below criticalTCPA, a new manoeuver should be calculated", + examples=[1000], + ) + vendor_manoeuver_delay: float = Field( + None, + description="Time given in seconds to the navigator / system, before the proposed manoeuver is no longer able to be excecuted", + examples=[20], + ) + vendor_safety_depth: float = Field(None, description="Minimum safety depth", examples=[30]) + vendor_automatic_manoeuver_acceptance_time: float = Field( + None, + description="If automatic maneuver acceptance is enabled, the new route will be activated after a specified number of seconds", + examples=[20], + ) + + class Config: + alias_generator = to_camel + populate_by_name = True + extra = "allow" + + +caga_config_example = CagaConfiguration( + name=name_example, + version=version_example, + vendor=vendor_example, + minimum_distance_to_targets=100, + critical_TCPA=1000, + manoeuver_delay=20, + safety_depth=20, + automatic_manoeuver_acceptance_time=7, +) + +# %% + + +class EncounterType(str, Enum): + OVERTAKING_STAND_ON = "Overtaking stand-on" + OVERTAKING_GIVE_WAY = "Overtaking give-way" + HEAD_ON = "Head-on" + CROSSING_GIVE_WAY = "Crossing give-way" + CROSSING_STAND_ON = "Crossing stand-on" + NO_RISK = "No Risk" + + +class PredictedPoint(BaseModel): + time: Union[datetime, int] = Field( + ..., + description="Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", + examples=[datetime.now()], + ) + value: Union[float, Any] = Field(..., description="Value of the prediction", examples=[position_example, 100]) + + +position_example = Position(latitude=57.2343, longitude=10.3432) +position_example2 = Position(latitude=57.2345, longitude=10.3432) +position_example3 = Position(latitude=57.2349, longitude=10.3430) + +predicted_point_example = PredictedPoint(time=datetime.now(), value=position_example) +predicted_point_example2 = PredictedPoint(time=datetime.now() + timedelta(seconds=10), value=position_example2) +predicted_point_example3 = PredictedPoint(time=datetime.now() + timedelta(seconds=20), value=position_example3) + +waypoint_example2 = Waypoint(position=position_example2, turn_radius=500, data=Data(sog=data_point_example1)) +waypoint_example3 = Waypoint(position=position_example3, turn_radius=500, data=Data(sog=data_point_example1)) + + +class DetectedShip(BaseModel): + id: UUID = Field(..., description="Unique Identifier", examples=[uuid4()]) + + position: Position = Field( + ..., + title="Longitude and Latitude Values", + description="A geographical coordinate", + examples=[Position(latitude=51.2123, longitude=11.2313)], + ) + sog: float = Field( + ..., + ge=0, + title="ship speed over ground", + description="Initial ship speed over ground in knots", + examples=[10.0], + ) + cog: float = Field( + ..., + ge=0, + le=360, + title="ship course over ground", + description="Initial ship course over ground in degrees", + examples=[45.0], + ) + heading: Optional[float] = Field( + None, ge=0, le=360, title="ship heading", description="Initial ship heading in degrees", examples=[45.2] + ) + nav_status: AISNavStatus = Field(None, description="AIS Navigational Status") + + encounter_type: Optional[EncounterType] = Field( + None, description="COLREG encounter type", examples=["Overtaking stand-on"] + ) + colreg_rules_applied: List[int] = Field( + None, + description="COLREG rules the system is applying to the vessel. Each item in the list must be of type `int` corresponding to the COLREG rule number", + examples=[[16, 17]], + ) + distance_to_target: float = Field( + None, description="Calculated distance from the own ship to the target vessel", examples=[1900.2] + ) + dcpa: Optional[float] = Field(None, description="Calculated closest point of approach", examples=[100.3]) + tcpa: Optional[float] = Field( + None, description="calculated time to closest point of approach in seconds", examples=[2131] + ) + + predictions: Dict[str, List[PredictedPoint]] = Field( + None, + description="List of predicted future values. This can be used to store data like a predicted path for each target vessel. The `value` field supports both numbers and objects", + examples=[[predicted_point_example, predicted_point_example2, predicted_point_example3]], + ) + + class Config: + alias_generator = to_camel + populate_by_name = True + extra = "allow" + + +detected_ship_example = DetectedShip( + id=uuid4(), + position=position_example, + sog=10.2, + cog=181, + nav_status=AISNavStatus.UNDER_WAY_USING_ENGINE, + encounter_type=EncounterType.HEAD_ON, + colreg_rules_applied=[12], + distance_to_target=874.00, + dcpa=300, + tcpa=1200, + predictions={"position": [predicted_point_example, predicted_point_example2, predicted_point_example3]}, +) + +# %% + + +class SimulatedShip(BaseModel): + id: UUID = Field(..., description="Unique Identifier", examples=[uuid4()]) + + position: Position = Field( + ..., + title="Longitude and Latitude Values", + description="A geographical coordinate", + examples=[Position(latitude=51.2123, longitude=11.2313)], + ) + sog: float = Field( + ..., + ge=0, + title="ship speed over ground", + description="Initial ship speed over ground in knots", + examples=[10.0], + ) + cog: float = Field( + ..., + ge=0, + le=360, + title="ship course over ground", + description="Initial ship course over ground in degrees", + examples=[45.0], + ) + heading: Optional[float] = Field( + None, ge=0, le=360, title="ship heading", description="Initial ship heading in degrees", examples=[45.2] + ) + nav_status: AISNavStatus = Field(..., description="AIS Navigational Status") + + acceleration: float = Field(None, description="Ship acceleration in `ms^-2`", examples=[0.01]) + rate_of_turn: float = Field(None, description="Ship rate of turn in `deg/s`", examples=[1.8]) + + class Config: + alias_generator = to_camel + populate_by_name = True + extra = "allow" + + +simulated_ship_example1 = SimulatedShip( + id=uuid4(), + position=position_example, + sog=10.0, + cog=181, + nav_status=AISNavStatus.ENGAGED_IN_FISHING, + acceleration=0.01, + rate_of_turn=1, +) +simulated_ship_example2 = SimulatedShip( + id=uuid4(), + position=position_example3, + sog=14.0, + cog=7, + nav_status=AISNavStatus.UNDER_WAY_USING_ENGINE, + rate_of_turn=0, + mmsi=123456789, +) +simulated_ship_example3 = SimulatedShip( + id=uuid4(), + position=position_example2, + sog=20.0, + cog=97, + nav_status=AISNavStatus.UNDER_WAY_USING_ENGINE, + rate_of_turn=3, + mmsi=987654321, +) + +# %% + + +class CagaTimeFrame(BaseModel): + time: Union[datetime, int] = Field( + ..., + description="Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", + examples=[datetime.now()], + ) + target_ships: List[DetectedShip] = Field( + ..., description="list of target ships detected by the CAGA system", examples=[[detected_ship_example]] + ) + internal_status: Any = Field( + None, description="Dictionary containing additional internal information about the system (health, status..)" + ) + + class Config: + alias_generator = to_camel + populate_by_name = True + + +caga_time_frame_example = CagaTimeFrame(time=datetime.now(), target_ships=[detected_ship_example]) + + +waypoint_list_example = [waypoint_example, waypoint_example2, waypoint_example3] + + +class CagaEvent(BaseModel): + time: Union[datetime, int] = Field(..., description="Date and Time of the event", examples=[datetime.now()]) + route: List[Waypoint] = Field(None, description="Planned CAGA Route", examples=[waypoint_list_example]) + + class Config: + extra = "allow" + + +caga_event_example = CagaEvent(time=datetime.now(), route=waypoint_list_example) + + +class SimulatorEvent(BaseModel): + time: Union[datetime, int] = Field(..., description="Date and Time of the event", examples=[datetime.now()]) + + class Config: + extra = "allow" + + +class CagaData(BaseModel): + configuration: CagaConfiguration = Field(..., description="System Configuration", examples=[caga_config_example]) + time_series_data: List[CagaTimeFrame] = Field( + ..., description="Time series data from the system", examples=[[caga_time_frame_example]] + ) + event_data: List[CagaEvent] = Field(None, description="Event data from the system", examples=[[caga_event_example]]) + + class Config: + alias_generator = to_camel + populate_by_name = True + + +auto_navigation_data_example = CagaData( + configuration=caga_config_example, time_series_data=[caga_time_frame_example], event_data=[caga_event_example] +) + + +class SimulationTimeFrame(BaseModel): + time: Union[datetime, int] = Field( + ..., + description="Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", + examples=[datetime.now()], + ) + own_ship: SimulatedShip + target_ships: List[SimulatedShip] + + class Config: + alias_generator = to_camel + populate_by_name = True + + +simulation_time_frame_example = SimulationTimeFrame( + time=datetime.now(), + own_ship=simulated_ship_example3, + target_ships=[simulated_ship_example1, simulated_ship_example2], +) +simulation_time_frame_example1 = SimulationTimeFrame( + time=datetime.now() + timedelta(seconds=10), + own_ship=simulated_ship_example3, + target_ships=[simulated_ship_example1, simulated_ship_example2], +) + + +class SimulationData(BaseModel): + configuration: SoftwareConfig = Field( + ..., description="Simulator software configuration", examples=[software_config_example1] + ) + time_series_data: List[SimulationTimeFrame] = Field( + ..., + description="TimeSeries data originating from the Simulator", + examples=[[simulation_time_frame_example, simulation_time_frame_example1]], + ) + event_data: List[SimulatorEvent] = Field(None, description="Event data from the simulator") + + class Config: + alias_generator = to_camel + populate_by_name = True + + +simulation_data_example = SimulationData( + configuration=software_config_example1, + time_series_data=[simulation_time_frame_example, simulation_time_frame_example1], +) + + +class OutputSchema(BaseModel): + creation_time: datetime = Field( + ..., + 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=[datetime.now()], + ) + traffic_situation: Optional[TrafficSituation] = Field( + None, + description="The traffic situation that was simulated (input file). This should remain unmofidied.", + ) + caga_data: Optional[CagaData] = Field( + None, + description="Data generated by the system under test (auto-navigation / collision and grounding avoidance system) during the scenario.", + examples=[auto_navigation_data_example], + ) + simulation_data: Optional[SimulationData] = Field( + None, description="Data generated by the simulator duirng the scenario", examples=[simulation_data_example] + ) + + class Config: + alias_generator = to_camel + populate_by_name = True + title = "Test Output Schema" + extra = "allow" + json_schema_extra = { + "description": "#### This is a JSON schema for result data originating from Collision and Grounding Avoidance systems" + } + + +def publish_schema(): + """Generate input and output schema and the corresponding html documentation.""" + from maritime_schema.utils.publish import generate_docs, generate_schema + + schema_dir = Path(__file__).parent.parent / "schema" / "caga" + docs_dir = Path(__file__).parent.parent.parent.parent / "docs" / "source" / "schema" / "caga" + + # Generate input schema + generate_schema( + model=TrafficSituation, + name="input_schema", + schema_dir=schema_dir, + ) + + # Generate output schema + generate_schema( + model=OutputSchema, + name="output_schema", + schema_dir=schema_dir, + by_alias=True, + ) + + # Generate html documentation + generate_docs( + schema_dir=schema_dir, + docs_dir=docs_dir, + ) + + +# %% From 2ffd9e0d3c8d334278bd411f64d9c4a1af81cea9 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 17:56:57 +0100 Subject: [PATCH 13/36] created subfolder /schema to hold generated json schemata --- src/maritime_schema/schema/caga/input_schema.json | 1 + src/maritime_schema/schema/caga/output_schema.json | 1 + 2 files changed, 2 insertions(+) create mode 100644 src/maritime_schema/schema/caga/input_schema.json create mode 100644 src/maritime_schema/schema/caga/output_schema.json diff --git a/src/maritime_schema/schema/caga/input_schema.json b/src/maritime_schema/schema/caga/input_schema.json new file mode 100644 index 0000000..69f61c4 --- /dev/null +++ b/src/maritime_schema/schema/caga/input_schema.json @@ -0,0 +1 @@ +{"$defs": {"AISNavStatus": {"enum": ["Under way using engine", "At anchor", "Not under command", "Restricted manoeuverability", "Constrained by her draught", "Moored", "Aground", "Engaged in fishing", "Under way sailing", "Reserved for future amendment of navigational status for HSC", "Reserved for future amendment of navigational status for WIG", "Reserved for future use 1", "Reserved for future use 2", "Reserved for future use 3", "AIS SART is active", "Not defined (default)"], "title": "AISNavStatus", "type": "string"}, "Data": {"additionalProperties": {"description": "The 'data' field can include additional properties. All additional properties should be DataPoint objects.", "properties": {"value": {"type": "number"}, "mBeforeLegChange": {"type": "number"}, "mAfterLegChange": {"type": "number"}, "interpMethod": {"type": "string"}}, "required": ["value", "mBeforeLegChange", "mAfterLegChange", "interpMethod"], "type": "object"}, "properties": {"sog": {"allOf": [{"$ref": "#/$defs/DataPoint"}], "default": null, "description": "Speed data point", "examples": [{"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}]}, "heading": {"allOf": [{"$ref": "#/$defs/DataPoint"}], "default": null, "description": "Heading data point", "examples": [{"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 180.0}]}}, "title": "Data", "type": "object"}, "DataPoint": {"properties": {"value": {"description": "the value of the data at the current timestep", "examples": [12.3], "title": "Value", "type": "number"}, "m_before_leg_change": {"description": "meters before the waypoint to start interpolating to the new value", "examples": [10], "title": "M Before Leg Change", "type": "number"}, "m_after_leg_change": {"description": "meters after the waypoint to finish interpolating to the new value", "examples": [10], "title": "M After Leg Change", "type": "number"}, "interp_method": {"anyOf": [{"$ref": "#/$defs/InterpolationMethod"}, {"type": "string"}], "default": "linear", "description": "Method used for interpolation", "title": "Interp Method"}}, "required": ["value", "m_before_leg_change", "m_after_leg_change"], "title": "DataPoint", "type": "object"}, "Environment": {"properties": {"air_temperature": {"default": null, "description": "The air temperature in degrees Celsius", "examples": [20.0], "title": "Air Temperature", "type": "number"}, "water_remperature": {"default": null, "description": "The water temperature in degrees Celsius", "examples": [15.0], "title": "Water Remperature", "type": "number"}, "precipitation": {"allOf": [{"$ref": "#/$defs/PrecipitationType"}], "default": null, "description": "The type of precipitation", "examples": ["Rain"]}, "wind_speed": {"default": null, "description": "The wind speed in m/s", "examples": [10.0], "title": "Wind Speed", "type": "number"}, "wind_direction": {"default": null, "description": "The wind direction in degrees", "examples": [180.0], "title": "Wind Direction", "type": "number"}, "current_speed": {"default": null, "description": "The current speed in m/s", "examples": [1.0], "title": "Current Speed", "type": "number"}, "current_direction": {"default": null, "description": "The current direction in degrees", "examples": [90.0], "title": "Current Direction", "type": "number"}, "wave_spectrum": {"allOf": [{"$ref": "#/$defs/WaveSpectra"}], "default": null, "description": "The wave spectrum", "examples": ["JONSWAP"]}, "significant_wave_height": {"default": null, "description": "The significant wave height in meters", "examples": [3.0], "title": "Significant Wave Height", "type": "number"}, "wave_period": {"default": null, "description": "The wave period in seconds", "examples": [12.0], "title": "Wave Period", "type": "number"}, "wave_direction": {"default": null, "description": "The wave direction in degrees", "examples": [270.0], "title": "Wave Direction", "type": "number"}, "visibility": {"default": null, "description": "The visibility in nautical miles", "examples": [5.0], "title": "Visibility", "type": "number"}, "conditions": {"allOf": [{"$ref": "#/$defs/WeatherCondition"}], "default": null, "description": "The overall weather conditions", "examples": ["Clear"]}}, "title": "Environment", "type": "object"}, "GeneralShipType": {"enum": ["Wing in ground", "Fishing", "Towing", "Dredging or underwater ops", "Diving ops", "Military ops", "Sailing", "Pleasure Craft", "High speed craft", "Pilot Vessel", "Search and Rescue vessel", "Tug", "Port Tender", "Anti-pollution", "Law Enforcement", "Medical Transport", "Noncombatant ship", "Passenger", "Cargo", "Tanker", "Other Type"], "title": "GeneralShipType", "type": "string"}, "Initial": {"properties": {"position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}], "title": "Longitude and Latitude Values"}, "sog": {"description": "Initial ship speed over ground in knots", "examples": [10.0], "minimum": 0.0, "title": "Initial ship speed over ground", "type": "number"}, "cog": {"description": "Initial ship course over ground in degrees", "examples": [45.0], "maximum": 360.0, "minimum": 0.0, "title": "Initial ship course over ground", "type": "number"}, "heading": {"anyOf": [{"maximum": 360.0, "minimum": 0.0, "type": "number"}, {"type": "null"}], "default": null, "description": "Initial ship heading in degrees", "examples": [45.2], "title": "Initial ship heading"}, "nav_status": {"allOf": [{"$ref": "#/$defs/AISNavStatus"}], "description": "AIS Navigational Status"}}, "required": ["position", "sog", "cog", "nav_status"], "title": "Initial", "type": "object"}, "InterpolationMethod": {"enum": ["linear", "cosine", "smoothstep", "accelerate", "decelerate", "ordinal"], "title": "InterpolationMethod", "type": "string"}, "OwnShip": {"properties": {"static": {"anyOf": [{"$ref": "#/$defs/ShipStatic"}, {"type": "null"}], "description": "Static ship information which does not change during a scenario.", "examples": [{"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}]}, "initial": {"allOf": [{"$ref": "#/$defs/Initial"}], "examples": [{"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}], "title": "Initial own ship Initial"}, "waypoints": {"anyOf": [{"items": {"$ref": "#/$defs/Waypoint"}, "type": "array"}, {"type": "null"}], "default": null, "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", "examples": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}], "title": "Waypoints"}}, "required": ["static", "initial"], "title": "OwnShip", "type": "object"}, "Position": {"properties": {"latitude": {"description": "WGS-84 latitude", "examples": [51.2131], "maximum": 90.0, "minimum": -90.0, "title": "Latitude", "type": "number"}, "longitude": {"description": "WGS-84 longitude", "examples": [11.2131], "maximum": 180.0, "minimum": -180.0, "title": "Longitude", "type": "number"}}, "required": ["latitude", "longitude"], "title": "Position", "type": "object"}, "PrecipitationType": {"enum": ["None", "Rain", "Snow", "Sleet", "Hail"], "title": "PrecipitationType", "type": "string"}, "ShipStatic": {"description": "Static ship data that will not change during the scenario.", "properties": {"id": {"description": "Unique Identifier", "examples": ["e2b858d4-c83b-4cfc-95fd-c09051840c03"], "format": "uuid", "title": "Id", "type": "string"}, "length": {"description": "Length of the ship in meters", "examples": [230.0], "g": 0, "title": "Length", "type": "number"}, "width": {"description": "Width of the ship in meters", "examples": [30.0], "g": 0, "title": "Width", "type": "number"}, "height": {"anyOf": [{"type": "number"}, {"type": "null"}], "default": 10, "description": "Height of the ship in meters", "examples": [15.0], "g": 0, "title": "Height"}, "mmsi": {"anyOf": [{"maximum": 999999999, "minimum": 100000000, "type": "integer"}, {"type": "null"}], "default": null, "description": "Maritime Mobile Service Identity (MMSI)", "examples": [123456789], "title": "Mmsi"}, "imo": {"anyOf": [{"maximum": 9999999, "minimum": 1000000, "type": "integer"}, {"type": "null"}], "default": null, "description": "IMO Number", "examples": [1234567], "title": "Imo"}, "name": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null, "description": "Ship title", "examples": ["RMS Titanic"], "title": "Name"}, "ship_type": {"allOf": [{"$ref": "#/$defs/GeneralShipType"}], "description": "General ship type, based on AIS"}}, "required": ["id", "length", "width", "ship_type"], "title": "ShipStatic", "type": "object"}, "TargetShip": {"properties": {"static": {"anyOf": [{"$ref": "#/$defs/ShipStatic"}, {"type": "null"}], "description": "Static ship information which does not change during a scenario.", "examples": [{"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}]}, "initial": {"allOf": [{"$ref": "#/$defs/Initial"}], "examples": [{"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}], "title": "Initial own ship Initial"}, "waypoints": {"anyOf": [{"items": {"$ref": "#/$defs/Waypoint"}, "type": "array"}, {"type": "null"}], "default": null, "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", "examples": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}], "title": "Waypoints"}}, "required": ["static", "initial"], "title": "TargetShip", "type": "object"}, "WaveSpectra": {"enum": ["JONSWAP", "Pierson-Moskowitz", "Bretschneider"], "title": "WaveSpectra", "type": "string"}, "Waypoint": {"properties": {"position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}]}, "turn_radius": {"default": 0, "description": "Orthodrome turn radius as defined in RTZ format", "examples": [200], "title": "Turn Radius", "type": "number"}, "data": {"allOf": [{"$ref": "#/$defs/Data"}], "default": null, "description": "A `Data` object that includes `speed`, `course`, and `heading` data points"}}, "required": ["position"], "title": "Waypoint", "type": "object"}, "WeatherCondition": {"enum": ["Clear", "Cloudy", "Foggy", "Rainy", "Snowy"], "title": "WeatherCondition", "type": "string"}}, "additionalProperties": true, "properties": {"title": {"description": "The title of the traffic situation", "examples": ["overtaking_18"], "omit_default": true, "title": "Title", "type": "string"}, "description": {"description": "A description of the traffic situation", "examples": ["Crossing situation with 3 target vessels in the Oslofjord"], "title": "Description", "type": "string"}, "start_time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "default": null, "description": "Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": ["2024-02-22T17:45:49.335445"], "title": "Situation starting time"}, "own_ship": {"allOf": [{"$ref": "#/$defs/OwnShip"}], "description": "Own Ship data", "examples": [{"initial": {"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}, "static": {"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}, "waypoints": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}]}], "title": "Own Ship data"}, "target_ships": {"default": null, "description": "Target Ship data", "examples": [[{"initial": {"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}, "static": {"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}, "waypoints": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}]}]], "items": {"$ref": "#/$defs/TargetShip"}, "title": "Target Ship data", "type": "array"}, "environment": {"anyOf": [{"$ref": "#/$defs/Environment"}, {"type": "null"}], "default": null, "description": "environmental parameters", "examples": [{"airTemperature": 20.0, "conditions": "Clear", "currentDirection": 90.0, "currentSpeed": 1.0, "precipitation": "Rain", "significantWaveHeight": 3.0, "visibility": 5.0, "waterRemperature": 15.0, "waveDirection": 270.0, "wavePeriod": 12.0, "waveSpectrum": "JONSWAP", "windDirection": 180.0, "windSpeed": 10.0}]}}, "required": ["title", "description", "own_ship"], "title": "Test Input Schema", "type": "object"} \ No newline at end of file diff --git a/src/maritime_schema/schema/caga/output_schema.json b/src/maritime_schema/schema/caga/output_schema.json new file mode 100644 index 0000000..99792a9 --- /dev/null +++ b/src/maritime_schema/schema/caga/output_schema.json @@ -0,0 +1 @@ +{"$defs": {"AISNavStatus": {"enum": ["Under way using engine", "At anchor", "Not under command", "Restricted manoeuverability", "Constrained by her draught", "Moored", "Aground", "Engaged in fishing", "Under way sailing", "Reserved for future amendment of navigational status for HSC", "Reserved for future amendment of navigational status for WIG", "Reserved for future use 1", "Reserved for future use 2", "Reserved for future use 3", "AIS SART is active", "Not defined (default)"], "title": "AISNavStatus", "type": "string"}, "CagaConfiguration": {"additionalProperties": true, "properties": {"name": {"description": "The name of the system", "examples": ["AutoNavigation-System 1"], "title": "Name", "type": "string"}, "version": {"description": "The software version", "examples": ["1.2.3"], "title": "Version", "type": "string"}, "vendor": {"description": "The name of the system vendor", "examples": ["CompanyABC"], "title": "Vendor", "type": "string"}, "vendorMinimumDistanceToTargets": {"default": null, "description": "Minimum distance in meters that the system will keep to other Vessels", "examples": [100], "title": "Vendorminimumdistancetotargets", "type": "number"}, "vendorCriticalTcpa": {"default": null, "description": "If the projected CPA is less than minimumDistanceToTargets, and TCPA falls below criticalTCPA, a new manoeuver should be calculated", "examples": [1000], "title": "Vendorcriticaltcpa", "type": "number"}, "vendorManoeuverDelay": {"default": null, "description": "Time given in seconds to the navigator / system, before the proposed manoeuver is no longer able to be excecuted", "examples": [20], "title": "Vendormanoeuverdelay", "type": "number"}, "vendorSafetyDepth": {"default": null, "description": "Minimum safety depth", "examples": [30], "title": "Vendorsafetydepth", "type": "number"}, "vendorAutomaticManoeuverAcceptanceTime": {"default": null, "description": "If automatic maneuver acceptance is enabled, the new route will be activated after a specified number of seconds", "examples": [20], "title": "Vendorautomaticmanoeuveracceptancetime", "type": "number"}}, "required": ["name", "version", "vendor"], "title": "CagaConfiguration", "type": "object"}, "CagaData": {"properties": {"configuration": {"allOf": [{"$ref": "#/$defs/CagaConfiguration"}], "description": "System Configuration", "examples": [{"automatic_manoeuver_acceptance_time": 7, "critical_TCPA": 1000, "manoeuver_delay": 20, "minimum_distance_to_targets": 100, "name": "AutoNavigation-System 1", "safety_depth": 20, "vendor": "CompanyABC", "vendorAutomaticManoeuverAcceptanceTime": null, "vendorCriticalTcpa": null, "vendorManoeuverDelay": null, "vendorMinimumDistanceToTargets": null, "vendorSafetyDepth": null, "version": "1.2.3"}]}, "timeSeriesData": {"description": "Time series data from the system", "examples": [[{"internalStatus": null, "targetShips": [{"cog": 181.0, "colregRulesApplied": [12], "dcpa": 300.0, "distanceToTarget": 874.0, "encounterType": "Head-on", "heading": null, "id": "c85e6953-adc2-4321-88f9-1b545abf6336", "navStatus": "Under way using engine", "position": {"latitude": 57.2343, "longitude": 10.3432}, "predictions": {"position": [{"time": "2024-02-22T17:45:49.335445", "value": {"latitude": 57.2343, "longitude": 10.3432}}, {"time": "2024-02-22T17:45:59.335445", "value": {"latitude": 57.2345, "longitude": 10.3432}}, {"time": "2024-02-22T17:46:09.335445", "value": {"latitude": 57.2349, "longitude": 10.343}}]}, "sog": 10.2, "tcpa": 1200.0}], "time": "2024-02-22T17:45:49.335445"}]], "items": {"$ref": "#/$defs/CagaTimeFrame"}, "title": "Timeseriesdata", "type": "array"}, "eventData": {"default": null, "description": "Event data from the system", "examples": [[{"route": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2345, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2349, "longitude": 10.343}, "turnRadius": 500.0}], "time": "2024-02-22T17:45:49.335445"}]], "items": {"$ref": "#/$defs/CagaEvent"}, "title": "Eventdata", "type": "array"}}, "required": ["configuration", "timeSeriesData"], "title": "CagaData", "type": "object"}, "CagaEvent": {"additionalProperties": true, "properties": {"time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "integer"}], "description": "Date and Time of the event", "examples": ["2024-02-22T17:45:49.335445"], "title": "Time"}, "route": {"default": null, "description": "Planned CAGA Route", "examples": [[{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2345, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2349, "longitude": 10.343}, "turnRadius": 500.0}]], "items": {"$ref": "#/$defs/Waypoint"}, "title": "Route", "type": "array"}}, "required": ["time"], "title": "CagaEvent", "type": "object"}, "CagaTimeFrame": {"properties": {"time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "integer"}], "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": ["2024-02-22T17:45:49.335445"], "title": "Time"}, "targetShips": {"description": "list of target ships detected by the CAGA system", "examples": [[{"cog": 181.0, "colregRulesApplied": [12], "dcpa": 300.0, "distanceToTarget": 874.0, "encounterType": "Head-on", "heading": null, "id": "c85e6953-adc2-4321-88f9-1b545abf6336", "navStatus": "Under way using engine", "position": {"latitude": 57.2343, "longitude": 10.3432}, "predictions": {"position": [{"time": "2024-02-22T17:45:49.335445", "value": {"latitude": 57.2343, "longitude": 10.3432}}, {"time": "2024-02-22T17:45:59.335445", "value": {"latitude": 57.2345, "longitude": 10.3432}}, {"time": "2024-02-22T17:46:09.335445", "value": {"latitude": 57.2349, "longitude": 10.343}}]}, "sog": 10.2, "tcpa": 1200.0}]], "items": {"$ref": "#/$defs/DetectedShip"}, "title": "Targetships", "type": "array"}, "internalStatus": {"default": null, "description": "Dictionary containing additional internal information about the system (health, status..)", "title": "Internalstatus"}}, "required": ["time", "targetShips"], "title": "CagaTimeFrame", "type": "object"}, "Data": {"additionalProperties": {"description": "The 'data' field can include additional properties. All additional properties should be DataPoint objects.", "properties": {"value": {"type": "number"}, "mBeforeLegChange": {"type": "number"}, "mAfterLegChange": {"type": "number"}, "interpMethod": {"type": "string"}}, "required": ["value", "mBeforeLegChange", "mAfterLegChange", "interpMethod"], "type": "object"}, "properties": {"sog": {"allOf": [{"$ref": "#/$defs/DataPoint"}], "default": null, "description": "Speed data point", "examples": [{"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}]}, "heading": {"allOf": [{"$ref": "#/$defs/DataPoint"}], "default": null, "description": "Heading data point", "examples": [{"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 180.0}]}}, "title": "Data", "type": "object"}, "DataPoint": {"properties": {"value": {"description": "the value of the data at the current timestep", "examples": [12.3], "title": "Value", "type": "number"}, "mBeforeLegChange": {"description": "meters before the waypoint to start interpolating to the new value", "examples": [10], "title": "Mbeforelegchange", "type": "number"}, "mAfterLegChange": {"description": "meters after the waypoint to finish interpolating to the new value", "examples": [10], "title": "Mafterlegchange", "type": "number"}, "interpMethod": {"anyOf": [{"$ref": "#/$defs/InterpolationMethod"}, {"type": "string"}], "default": "linear", "description": "Method used for interpolation", "title": "Interpmethod"}}, "required": ["value", "mBeforeLegChange", "mAfterLegChange"], "title": "DataPoint", "type": "object"}, "DetectedShip": {"additionalProperties": true, "properties": {"id": {"description": "Unique Identifier", "examples": ["f3b9173e-3b5b-4176-862b-aa16be45d97c"], "format": "uuid", "title": "Id", "type": "string"}, "position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}], "title": "Longitude and Latitude Values"}, "sog": {"description": "Initial ship speed over ground in knots", "examples": [10.0], "minimum": 0.0, "title": "ship speed over ground", "type": "number"}, "cog": {"description": "Initial ship course over ground in degrees", "examples": [45.0], "maximum": 360.0, "minimum": 0.0, "title": "ship course over ground", "type": "number"}, "heading": {"anyOf": [{"maximum": 360.0, "minimum": 0.0, "type": "number"}, {"type": "null"}], "default": null, "description": "Initial ship heading in degrees", "examples": [45.2], "title": "ship heading"}, "navStatus": {"allOf": [{"$ref": "#/$defs/AISNavStatus"}], "default": null, "description": "AIS Navigational Status"}, "encounterType": {"anyOf": [{"$ref": "#/$defs/EncounterType"}, {"type": "null"}], "default": null, "description": "COLREG encounter type", "examples": ["Overtaking stand-on"]}, "colregRulesApplied": {"default": null, "description": "COLREG rules the system is applying to the vessel. Each item in the list must be of type `int` corresponding to the COLREG rule number", "examples": [[16, 17]], "items": {"type": "integer"}, "title": "Colregrulesapplied", "type": "array"}, "distanceToTarget": {"default": null, "description": "Calculated distance from the own ship to the target vessel", "examples": [1900.2], "title": "Distancetotarget", "type": "number"}, "dcpa": {"anyOf": [{"type": "number"}, {"type": "null"}], "default": null, "description": "Calculated closest point of approach", "examples": [100.3], "title": "Dcpa"}, "tcpa": {"anyOf": [{"type": "number"}, {"type": "null"}], "default": null, "description": "calculated time to closest point of approach in seconds", "examples": [2131], "title": "Tcpa"}, "predictions": {"additionalProperties": {"items": {"$ref": "#/$defs/PredictedPoint"}, "type": "array"}, "default": null, "description": "List of predicted future values. This can be used to store data like a predicted path for each target vessel. The `value` field supports both numbers and objects", "examples": [[{"time": "2024-02-22T17:45:49.335445", "value": {"latitude": 57.2343, "longitude": 10.3432}}, {"time": "2024-02-22T17:45:59.335445", "value": {"latitude": 57.2345, "longitude": 10.3432}}, {"time": "2024-02-22T17:46:09.335445", "value": {"latitude": 57.2349, "longitude": 10.343}}]], "title": "Predictions", "type": "object"}}, "required": ["id", "position", "sog", "cog"], "title": "DetectedShip", "type": "object"}, "EncounterType": {"enum": ["Overtaking stand-on", "Overtaking give-way", "Head-on", "Crossing give-way", "Crossing stand-on", "No Risk"], "title": "EncounterType", "type": "string"}, "Environment": {"properties": {"airTemperature": {"default": null, "description": "The air temperature in degrees Celsius", "examples": [20.0], "title": "Airtemperature", "type": "number"}, "waterRemperature": {"default": null, "description": "The water temperature in degrees Celsius", "examples": [15.0], "title": "Waterremperature", "type": "number"}, "precipitation": {"allOf": [{"$ref": "#/$defs/PrecipitationType"}], "default": null, "description": "The type of precipitation", "examples": ["Rain"]}, "windSpeed": {"default": null, "description": "The wind speed in m/s", "examples": [10.0], "title": "Windspeed", "type": "number"}, "windDirection": {"default": null, "description": "The wind direction in degrees", "examples": [180.0], "title": "Winddirection", "type": "number"}, "currentSpeed": {"default": null, "description": "The current speed in m/s", "examples": [1.0], "title": "Currentspeed", "type": "number"}, "currentDirection": {"default": null, "description": "The current direction in degrees", "examples": [90.0], "title": "Currentdirection", "type": "number"}, "waveSpectrum": {"allOf": [{"$ref": "#/$defs/WaveSpectra"}], "default": null, "description": "The wave spectrum", "examples": ["JONSWAP"]}, "significantWaveHeight": {"default": null, "description": "The significant wave height in meters", "examples": [3.0], "title": "Significantwaveheight", "type": "number"}, "wavePeriod": {"default": null, "description": "The wave period in seconds", "examples": [12.0], "title": "Waveperiod", "type": "number"}, "waveDirection": {"default": null, "description": "The wave direction in degrees", "examples": [270.0], "title": "Wavedirection", "type": "number"}, "visibility": {"default": null, "description": "The visibility in nautical miles", "examples": [5.0], "title": "Visibility", "type": "number"}, "conditions": {"allOf": [{"$ref": "#/$defs/WeatherCondition"}], "default": null, "description": "The overall weather conditions", "examples": ["Clear"]}}, "title": "Environment", "type": "object"}, "GeneralShipType": {"enum": ["Wing in ground", "Fishing", "Towing", "Dredging or underwater ops", "Diving ops", "Military ops", "Sailing", "Pleasure Craft", "High speed craft", "Pilot Vessel", "Search and Rescue vessel", "Tug", "Port Tender", "Anti-pollution", "Law Enforcement", "Medical Transport", "Noncombatant ship", "Passenger", "Cargo", "Tanker", "Other Type"], "title": "GeneralShipType", "type": "string"}, "Initial": {"properties": {"position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}], "title": "Longitude and Latitude Values"}, "sog": {"description": "Initial ship speed over ground in knots", "examples": [10.0], "minimum": 0.0, "title": "Initial ship speed over ground", "type": "number"}, "cog": {"description": "Initial ship course over ground in degrees", "examples": [45.0], "maximum": 360.0, "minimum": 0.0, "title": "Initial ship course over ground", "type": "number"}, "heading": {"anyOf": [{"maximum": 360.0, "minimum": 0.0, "type": "number"}, {"type": "null"}], "default": null, "description": "Initial ship heading in degrees", "examples": [45.2], "title": "Initial ship heading"}, "navStatus": {"allOf": [{"$ref": "#/$defs/AISNavStatus"}], "description": "AIS Navigational Status"}}, "required": ["position", "sog", "cog", "navStatus"], "title": "Initial", "type": "object"}, "InterpolationMethod": {"enum": ["linear", "cosine", "smoothstep", "accelerate", "decelerate", "ordinal"], "title": "InterpolationMethod", "type": "string"}, "OwnShip": {"properties": {"static": {"anyOf": [{"$ref": "#/$defs/ShipStatic"}, {"type": "null"}], "description": "Static ship information which does not change during a scenario.", "examples": [{"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}]}, "initial": {"allOf": [{"$ref": "#/$defs/Initial"}], "examples": [{"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}], "title": "Initial own ship Initial"}, "waypoints": {"anyOf": [{"items": {"$ref": "#/$defs/Waypoint"}, "type": "array"}, {"type": "null"}], "default": null, "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", "examples": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}], "title": "Waypoints"}}, "required": ["static", "initial"], "title": "OwnShip", "type": "object"}, "Position": {"properties": {"latitude": {"description": "WGS-84 latitude", "examples": [51.2131], "maximum": 90.0, "minimum": -90.0, "title": "Latitude", "type": "number"}, "longitude": {"description": "WGS-84 longitude", "examples": [11.2131], "maximum": 180.0, "minimum": -180.0, "title": "Longitude", "type": "number"}}, "required": ["latitude", "longitude"], "title": "Position", "type": "object"}, "PrecipitationType": {"enum": ["None", "Rain", "Snow", "Sleet", "Hail"], "title": "PrecipitationType", "type": "string"}, "PredictedPoint": {"properties": {"time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "integer"}], "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": ["2024-02-22T17:45:49.335445"], "title": "Time"}, "value": {"anyOf": [{"type": "number"}, {}], "description": "Value of the prediction", "examples": [{"latitude": 57.2343, "longitude": 10.3432}, 100], "title": "Value"}}, "required": ["time", "value"], "title": "PredictedPoint", "type": "object"}, "ShipStatic": {"description": "Static ship data that will not change during the scenario.", "properties": {"id": {"description": "Unique Identifier", "examples": ["e2b858d4-c83b-4cfc-95fd-c09051840c03"], "format": "uuid", "title": "Id", "type": "string"}, "length": {"description": "Length of the ship in meters", "examples": [230.0], "g": 0, "title": "Length", "type": "number"}, "width": {"description": "Width of the ship in meters", "examples": [30.0], "g": 0, "title": "Width", "type": "number"}, "height": {"anyOf": [{"type": "number"}, {"type": "null"}], "default": 10, "description": "Height of the ship in meters", "examples": [15.0], "g": 0, "title": "Height"}, "mmsi": {"anyOf": [{"maximum": 999999999, "minimum": 100000000, "type": "integer"}, {"type": "null"}], "default": null, "description": "Maritime Mobile Service Identity (MMSI)", "examples": [123456789], "title": "Mmsi"}, "imo": {"anyOf": [{"maximum": 9999999, "minimum": 1000000, "type": "integer"}, {"type": "null"}], "default": null, "description": "IMO Number", "examples": [1234567], "title": "Imo"}, "name": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null, "description": "Ship title", "examples": ["RMS Titanic"], "title": "Name"}, "shipType": {"allOf": [{"$ref": "#/$defs/GeneralShipType"}], "description": "General ship type, based on AIS"}}, "required": ["id", "length", "width", "shipType"], "title": "ShipStatic", "type": "object"}, "SimulatedShip": {"additionalProperties": true, "properties": {"id": {"description": "Unique Identifier", "examples": ["f923a710-d915-46dd-929c-30cfb36f0407"], "format": "uuid", "title": "Id", "type": "string"}, "position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}], "title": "Longitude and Latitude Values"}, "sog": {"description": "Initial ship speed over ground in knots", "examples": [10.0], "minimum": 0.0, "title": "ship speed over ground", "type": "number"}, "cog": {"description": "Initial ship course over ground in degrees", "examples": [45.0], "maximum": 360.0, "minimum": 0.0, "title": "ship course over ground", "type": "number"}, "heading": {"anyOf": [{"maximum": 360.0, "minimum": 0.0, "type": "number"}, {"type": "null"}], "default": null, "description": "Initial ship heading in degrees", "examples": [45.2], "title": "ship heading"}, "navStatus": {"allOf": [{"$ref": "#/$defs/AISNavStatus"}], "description": "AIS Navigational Status"}, "acceleration": {"default": null, "description": "Ship acceleration in `ms^-2`", "examples": [0.01], "title": "Acceleration", "type": "number"}, "rateOfTurn": {"default": null, "description": "Ship rate of turn in `deg/s`", "examples": [1.8], "title": "Rateofturn", "type": "number"}}, "required": ["id", "position", "sog", "cog", "navStatus"], "title": "SimulatedShip", "type": "object"}, "SimulationData": {"properties": {"configuration": {"allOf": [{"$ref": "#/$defs/SoftwareConfig"}], "description": "Simulator software configuration", "examples": [{"name": "Simulator-System 1", "vendor": "CompanyABC", "version": "1.2.3"}]}, "timeSeriesData": {"description": "TimeSeries data originating from the Simulator", "examples": [[{"ownShip": {"acceleration": null, "cog": 97.0, "heading": null, "id": "1d1bd483-1f48-4329-a1ce-bddcece590dc", "mmsi": 987654321, "navStatus": "Under way using engine", "position": {"latitude": 57.2345, "longitude": 10.3432}, "rateOfTurn": 3.0, "sog": 20.0}, "targetShips": [{"acceleration": 0.01, "cog": 181.0, "heading": null, "id": "90023c6f-f9b0-4569-8327-0164d2fd858a", "navStatus": "Engaged in fishing", "position": {"latitude": 57.2343, "longitude": 10.3432}, "rateOfTurn": 1.0, "sog": 10.0}, {"acceleration": null, "cog": 7.0, "heading": null, "id": "b97a6de7-8097-4f42-8107-e86e44163ab2", "mmsi": 123456789, "navStatus": "Under way using engine", "position": {"latitude": 57.2349, "longitude": 10.343}, "rateOfTurn": 0.0, "sog": 14.0}], "time": "2024-02-22T17:45:49.351070"}, {"ownShip": {"acceleration": null, "cog": 97.0, "heading": null, "id": "1d1bd483-1f48-4329-a1ce-bddcece590dc", "mmsi": 987654321, "navStatus": "Under way using engine", "position": {"latitude": 57.2345, "longitude": 10.3432}, "rateOfTurn": 3.0, "sog": 20.0}, "targetShips": [{"acceleration": 0.01, "cog": 181.0, "heading": null, "id": "90023c6f-f9b0-4569-8327-0164d2fd858a", "navStatus": "Engaged in fishing", "position": {"latitude": 57.2343, "longitude": 10.3432}, "rateOfTurn": 1.0, "sog": 10.0}, {"acceleration": null, "cog": 7.0, "heading": null, "id": "b97a6de7-8097-4f42-8107-e86e44163ab2", "mmsi": 123456789, "navStatus": "Under way using engine", "position": {"latitude": 57.2349, "longitude": 10.343}, "rateOfTurn": 0.0, "sog": 14.0}], "time": "2024-02-22T17:45:59.351070"}]], "items": {"$ref": "#/$defs/SimulationTimeFrame"}, "title": "Timeseriesdata", "type": "array"}, "eventData": {"default": null, "description": "Event data from the simulator", "items": {"$ref": "#/$defs/SimulatorEvent"}, "title": "Eventdata", "type": "array"}}, "required": ["configuration", "timeSeriesData"], "title": "SimulationData", "type": "object"}, "SimulationTimeFrame": {"properties": {"time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "integer"}], "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": ["2024-02-22T17:45:49.351070"], "title": "Time"}, "ownShip": {"$ref": "#/$defs/SimulatedShip"}, "targetShips": {"items": {"$ref": "#/$defs/SimulatedShip"}, "title": "Targetships", "type": "array"}}, "required": ["time", "ownShip", "targetShips"], "title": "SimulationTimeFrame", "type": "object"}, "SimulatorEvent": {"additionalProperties": true, "properties": {"time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "integer"}], "description": "Date and Time of the event", "examples": ["2024-02-22T17:45:49.335445"], "title": "Time"}}, "required": ["time"], "title": "SimulatorEvent", "type": "object"}, "SoftwareConfig": {"additionalProperties": true, "properties": {"name": {"description": "The name of the system", "examples": ["AutoNavigation-System 1"], "title": "Name", "type": "string"}, "version": {"description": "The software version", "examples": ["1.2.3"], "title": "Version", "type": "string"}, "vendor": {"description": "The name of the system vendor", "examples": ["CompanyABC"], "title": "Vendor", "type": "string"}}, "required": ["name", "version", "vendor"], "title": "SoftwareConfig", "type": "object"}, "TargetShip": {"properties": {"static": {"anyOf": [{"$ref": "#/$defs/ShipStatic"}, {"type": "null"}], "description": "Static ship information which does not change during a scenario.", "examples": [{"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}]}, "initial": {"allOf": [{"$ref": "#/$defs/Initial"}], "examples": [{"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}], "title": "Initial own ship Initial"}, "waypoints": {"anyOf": [{"items": {"$ref": "#/$defs/Waypoint"}, "type": "array"}, {"type": "null"}], "default": null, "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", "examples": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}], "title": "Waypoints"}}, "required": ["static", "initial"], "title": "TargetShip", "type": "object"}, "TrafficSituation": {"additionalProperties": true, "properties": {"title": {"description": "The title of the traffic situation", "examples": ["overtaking_18"], "omit_default": true, "title": "Title", "type": "string"}, "description": {"description": "A description of the traffic situation", "examples": ["Crossing situation with 3 target vessels in the Oslofjord"], "title": "Description", "type": "string"}, "startTime": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "default": null, "description": "Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": ["2024-02-22T17:45:49.335445"], "title": "Situation starting time"}, "ownShip": {"allOf": [{"$ref": "#/$defs/OwnShip"}], "description": "Own Ship data", "examples": [{"initial": {"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}, "static": {"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}, "waypoints": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}]}], "title": "Own Ship data"}, "targetShips": {"default": null, "description": "Target Ship data", "examples": [[{"initial": {"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}, "static": {"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}, "waypoints": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}]}]], "items": {"$ref": "#/$defs/TargetShip"}, "title": "Target Ship data", "type": "array"}, "environment": {"anyOf": [{"$ref": "#/$defs/Environment"}, {"type": "null"}], "default": null, "description": "environmental parameters", "examples": [{"airTemperature": 20.0, "conditions": "Clear", "currentDirection": 90.0, "currentSpeed": 1.0, "precipitation": "Rain", "significantWaveHeight": 3.0, "visibility": 5.0, "waterRemperature": 15.0, "waveDirection": 270.0, "wavePeriod": 12.0, "waveSpectrum": "JONSWAP", "windDirection": 180.0, "windSpeed": 10.0}]}}, "required": ["title", "description", "ownShip"], "title": "Test Input Schema", "type": "object"}, "WaveSpectra": {"enum": ["JONSWAP", "Pierson-Moskowitz", "Bretschneider"], "title": "WaveSpectra", "type": "string"}, "Waypoint": {"properties": {"position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}]}, "turnRadius": {"default": 0, "description": "Orthodrome turn radius as defined in RTZ format", "examples": [200], "title": "Turnradius", "type": "number"}, "data": {"allOf": [{"$ref": "#/$defs/Data"}], "default": null, "description": "A `Data` object that includes `speed`, `course`, and `heading` data points"}}, "required": ["position"], "title": "Waypoint", "type": "object"}, "WeatherCondition": {"enum": ["Clear", "Cloudy", "Foggy", "Rainy", "Snowy"], "title": "WeatherCondition", "type": "string"}}, "additionalProperties": true, "description": "#### This is a JSON schema for result data originating from Collision and Grounding Avoidance systems", "properties": {"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-02-22T17:45:49.351070"], "format": "date-time", "title": "Creationtime", "type": "string"}, "trafficSituation": {"anyOf": [{"$ref": "#/$defs/TrafficSituation"}, {"type": "null"}], "default": null, "description": "The traffic situation that was simulated (input file). This should remain unmofidied."}, "cagaData": {"anyOf": [{"$ref": "#/$defs/CagaData"}, {"type": "null"}], "default": null, "description": "Data generated by the system under test (auto-navigation / collision and grounding avoidance system) during the scenario.", "examples": [{"configuration": {"automatic_manoeuver_acceptance_time": 7, "critical_TCPA": 1000, "manoeuver_delay": 20, "minimum_distance_to_targets": 100, "name": "AutoNavigation-System 1", "safety_depth": 20, "vendor": "CompanyABC", "vendorAutomaticManoeuverAcceptanceTime": null, "vendorCriticalTcpa": null, "vendorManoeuverDelay": null, "vendorMinimumDistanceToTargets": null, "vendorSafetyDepth": null, "version": "1.2.3"}, "eventData": [{"route": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2345, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2349, "longitude": 10.343}, "turnRadius": 500.0}], "time": "2024-02-22T17:45:49.335445"}], "timeSeriesData": [{"internalStatus": null, "targetShips": [{"cog": 181.0, "colregRulesApplied": [12], "dcpa": 300.0, "distanceToTarget": 874.0, "encounterType": "Head-on", "heading": null, "id": "c85e6953-adc2-4321-88f9-1b545abf6336", "navStatus": "Under way using engine", "position": {"latitude": 57.2343, "longitude": 10.3432}, "predictions": {"position": [{"time": "2024-02-22T17:45:49.335445", "value": {"latitude": 57.2343, "longitude": 10.3432}}, {"time": "2024-02-22T17:45:59.335445", "value": {"latitude": 57.2345, "longitude": 10.3432}}, {"time": "2024-02-22T17:46:09.335445", "value": {"latitude": 57.2349, "longitude": 10.343}}]}, "sog": 10.2, "tcpa": 1200.0}], "time": "2024-02-22T17:45:49.335445"}]}]}, "simulationData": {"anyOf": [{"$ref": "#/$defs/SimulationData"}, {"type": "null"}], "default": null, "description": "Data generated by the simulator duirng the scenario", "examples": [{"configuration": {"name": "Simulator-System 1", "vendor": "CompanyABC", "version": "1.2.3"}, "eventData": null, "timeSeriesData": [{"ownShip": {"acceleration": null, "cog": 97.0, "heading": null, "id": "1d1bd483-1f48-4329-a1ce-bddcece590dc", "mmsi": 987654321, "navStatus": "Under way using engine", "position": {"latitude": 57.2345, "longitude": 10.3432}, "rateOfTurn": 3.0, "sog": 20.0}, "targetShips": [{"acceleration": 0.01, "cog": 181.0, "heading": null, "id": "90023c6f-f9b0-4569-8327-0164d2fd858a", "navStatus": "Engaged in fishing", "position": {"latitude": 57.2343, "longitude": 10.3432}, "rateOfTurn": 1.0, "sog": 10.0}, {"acceleration": null, "cog": 7.0, "heading": null, "id": "b97a6de7-8097-4f42-8107-e86e44163ab2", "mmsi": 123456789, "navStatus": "Under way using engine", "position": {"latitude": 57.2349, "longitude": 10.343}, "rateOfTurn": 0.0, "sog": 14.0}], "time": "2024-02-22T17:45:49.351070"}, {"ownShip": {"acceleration": null, "cog": 97.0, "heading": null, "id": "1d1bd483-1f48-4329-a1ce-bddcece590dc", "mmsi": 987654321, "navStatus": "Under way using engine", "position": {"latitude": 57.2345, "longitude": 10.3432}, "rateOfTurn": 3.0, "sog": 20.0}, "targetShips": [{"acceleration": 0.01, "cog": 181.0, "heading": null, "id": "90023c6f-f9b0-4569-8327-0164d2fd858a", "navStatus": "Engaged in fishing", "position": {"latitude": 57.2343, "longitude": 10.3432}, "rateOfTurn": 1.0, "sog": 10.0}, {"acceleration": null, "cog": 7.0, "heading": null, "id": "b97a6de7-8097-4f42-8107-e86e44163ab2", "mmsi": 123456789, "navStatus": "Under way using engine", "position": {"latitude": 57.2349, "longitude": 10.343}, "rateOfTurn": 0.0, "sog": 14.0}], "time": "2024-02-22T17:45:59.351070"}]}]}}, "required": ["creationTime"], "title": "Test Output Schema", "type": "object"} \ No newline at end of file From faa5385defd790dcb3aa68a76e1272de49d01ca5 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 17:57:20 +0100 Subject: [PATCH 14/36] deleted subpackage2 --- src/maritime_schema/subpackage2/module2.py | 36 ---------------------- 1 file changed, 36 deletions(-) delete mode 100644 src/maritime_schema/subpackage2/module2.py diff --git a/src/maritime_schema/subpackage2/module2.py b/src/maritime_schema/subpackage2/module2.py deleted file mode 100644 index 61498f3..0000000 --- a/src/maritime_schema/subpackage2/module2.py +++ /dev/null @@ -1,36 +0,0 @@ -import logging - -__ALL__ = ["str_to_int"] - -logger = logging.getLogger(__name__) - - -def str_to_int(input: str) -> int: - """Convert string to integer. - - This function converts a string to an integer. - The passed in string must represent a valid integer value. - - Parameters - ---------- - input : str - the string literal to be converted to integer - - Returns - ------- - int - the resulting integer - - Raises - ------ - ValueError - if conversion to integer is not possible, i.e. the string literal does not represent a valid integer number. - """ - logger.debug(f"function str_to_int() in subpackage2 called with argument {input}") - result: int - try: - result = int(input) - except ValueError as e: - logger.exception(f"ValueError raised in function str_to_int() in subpackage2. input was: {input}") - raise ValueError from e - return result From b463d71841c7ba10f78d64bdfdeb40b2e519eecc Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 17:59:16 +0100 Subject: [PATCH 15/36] adjusted api.py to the package currently contains --- src/maritime_schema/api.py | 242 +++++++++++-------------------------- 1 file changed, 72 insertions(+), 170 deletions(-) diff --git a/src/maritime_schema/api.py b/src/maritime_schema/api.py index 04770b4..d4fa8d5 100644 --- a/src/maritime_schema/api.py +++ b/src/maritime_schema/api.py @@ -1,170 +1,72 @@ -import logging -import os -from pathlib import Path -from typing import Union - -from dictIO import DictReader - -from maritime_schema.subpackage1.module1 import int_to_str -from maritime_schema.subpackage2.module2 import str_to_int - -__ALL__ = ["run", "MaritimeSchemaProcess"] - -logger = logging.getLogger(__name__) - - -def run( - config_file: Union[str, os.PathLike[str]], - option: bool = False, -): - """Run the maritime-schema process. - - Run the maritime-schema process and .. (long description). - - Parameters - ---------- - config_file : Union[str, os.PathLike[str]] - file containing the maritime-schema configuration - option : bool, optional - if True, does something differently, by default False - - Raises - ------ - FileNotFoundError - if config_file does not exist - """ - - # Make sure config_file argument is of type Path. If not, cast it to Path type. - config_file = config_file if isinstance(config_file, Path) else Path(config_file) - - # Check whether config file exists - if not config_file.exists(): - logger.error(f"run: File {config_file} not found.") - raise FileNotFoundError(config_file) - - if option: - logger.info("option is True. maritime-schema process will do something differently.") - - process = MaritimeSchemaProcess(config_file) - process.run() - - return - - -class MaritimeSchemaProcess: - """Top level class encapsulating the maritime-schema process.""" - - def __init__( - self, - config_file: Path, - ): - self.config_file: Path = config_file - self._run_number: int = 0 - self._max_number_of_runs: int = 1 - self.terminate: bool = False - self._read_config_file() - return - - def run(self): - """Run the maritime-schema process. - - Runs the maritime-schema process in a self-terminated loop. - """ - - # Run maritime-schema process until termination is flagged - while not self.terminate: - self._run_process() - self.terminate = self._run_number >= self._max_number_of_runs - return - - @property - def run_number(self) -> int: - """Example for a read only property.""" - return self._run_number - - @property - def max_number_of_runs(self) -> int: - """Example for a read/write property implemented through a pair of explicit - getter and setter methods (see below for the related setter method). - """ - return self._max_number_of_runs - - @max_number_of_runs.setter - def max_number_of_runs(self, value: int): - """Setter method that belongs to above getter method. - - Note that implementing specific getter- and setter methods is in most cases not necessary. - The same can be achieved by simply making the instance variable a public attribute. - I.e., declaring the instance variable in __init__() not as - self._max_number_of_runs: int = .. # (-> private instance variable) - but as - self.max_number_of_runs: int = .. # (-> public attribute) - - However, in some cases the additional effort of implementing explicit getter- and setter- methods - as in this example can be reasoned, for instance if you have a need for increased control - and want be able to cancel or alter code execution, or write log messages whenever a property - gets reads or written from outside. - """ - - self._max_number_of_runs = value - return - - def _run_process(self): - """Execute a single run of the maritime-schema process.""" - self._run_number += 1 - - logger.info(f"Start run {self._run_number}") - - # Do stuff - _string: str = _do_cool_stuff(self._run_number) - _number: int = _do_even_cooler_stuff(_string) - logger.debug(f"\t _string: {_string} _number: {_number}") - - logger.info(f"Successfully finished run {self._run_number}") - - return - - def _read_config_file(self): - """Read config file.""" - config = DictReader.read(self.config_file) - if "max_number_of_runs" in config: - self._max_number_of_runs = config["max_number_of_runs"] - return - - -def _do_cool_stuff(run_number: int) -> str: - """Do cool stuff. - - Converts the passed in run number to a string. - - Parameters - ---------- - run_number : int - the run number - - Returns - ------- - str - the run number converted to string - """ - result: str = int_to_str(run_number) - return result - - -def _do_even_cooler_stuff(string: str) -> int: - """Do even cooler stuff. - - Converts the passed in string-formatted integer back to an integer. - - Parameters - ---------- - string : str - the string-formatted integer to be converted back to an integer - - Returns - ------- - int - the resulting integer - """ - result: int = str_to_int(string) - return result +import logging +import os +from pathlib import Path +from typing import Union + +from maritime_schema.types import caga + +__ALL__ = ["run", "MaritimeSchemaProcess"] + +logger = logging.getLogger(__name__) + + +def run( + config_file: Union[str, os.PathLike[str]], +): + """Run the maritime-schema process. + + Run the maritime-schema process and .. (long description). + + Parameters + ---------- + config_file : Union[str, os.PathLike[str]] + file containing the maritime-schema configuration + + Raises + ------ + FileNotFoundError + if config_file does not exist + """ + + # Make sure config_file argument is of type Path. If not, cast it to Path type. + config_file = config_file if isinstance(config_file, Path) else Path(config_file) + + # Check whether config file exists + if not config_file.exists(): + logger.error(f"run: File {config_file} not found.") + raise FileNotFoundError(config_file) + + process = MaritimeSchemaProcess(config_file) + process.run() + + return + + +class MaritimeSchemaProcess: + """Top level class encapsulating the maritime-schema process.""" + + def __init__( + self, + config_file: Path, + ): + self.config_file: Path = config_file + self._read_config_file() + return + + def run(self): + """Publish the maritime schema.""" + + logger.info("Start publishing schema") + + caga.publish_schema() + + logger.info("Successfully published schema") + + return + + def _read_config_file(self): + """Read config file.""" + # from dictIO import DictReader + # config = DictReader.read(self.config_file) + # do something with the config + return From d5c16e99c8a6809bacb3893637c11851bbbc8505 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 17:59:41 +0100 Subject: [PATCH 16/36] adjusted cli to what the package currently contains --- src/maritime_schema/cli/maritime_schema.py | 230 ++++++++++----------- 1 file changed, 108 insertions(+), 122 deletions(-) diff --git a/src/maritime_schema/cli/maritime_schema.py b/src/maritime_schema/cli/maritime_schema.py index bd926a8..38afeb9 100644 --- a/src/maritime_schema/cli/maritime_schema.py +++ b/src/maritime_schema/cli/maritime_schema.py @@ -1,122 +1,108 @@ -#!/usr/bin/env python -# coding: utf-8 - -import argparse -import logging -from pathlib import Path -from typing import Union - -from maritime_schema.api import run -from maritime_schema.utils.logging import configure_logging - -logger = logging.getLogger(__name__) - - -def _argparser() -> argparse.ArgumentParser: - parser = argparse.ArgumentParser( - prog="maritime-schema", - usage="%(prog)s config_file [options [args]]", - epilog="_________________maritime-schema___________________", - prefix_chars="-", - add_help=True, - description=("maritime-schema config_file --option"), - ) - - _ = parser.add_argument( - "config_file", - metavar="config_file", - type=str, - help="name of the file containing the maritime-schema configuration.", - ) - - _ = parser.add_argument( - "--option", - action="store_true", - help="example option.", - default=False, - required=False, - ) - - console_verbosity = parser.add_mutually_exclusive_group(required=False) - - _ = console_verbosity.add_argument( - "-q", - "--quiet", - action="store_true", - help=("console output will be quiet."), - default=False, - ) - - _ = console_verbosity.add_argument( - "-v", - "--verbose", - action="store_true", - help=("console output will be verbose."), - default=False, - ) - - _ = parser.add_argument( - "--log", - action="store", - type=str, - help="name of log file. If specified, this will activate logging to file.", - default=None, - required=False, - ) - - _ = parser.add_argument( - "--log-level", - action="store", - type=str, - help="log level applied to logging to file.", - choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], - default="WARNING", - required=False, - ) - - return parser - - -def main(): - """Entry point for console script as configured in setup.cfg. - - Runs the command line interface and parses arguments and options entered on the console. - """ - - parser = _argparser() - args = parser.parse_args() - - # Configure Logging - # ..to console - log_level_console: str = "WARNING" - if any([args.quiet, args.verbose]): - log_level_console = "ERROR" if args.quiet else log_level_console - log_level_console = "INFO" if args.verbose else log_level_console - # ..to file - log_file: Union[Path, None] = Path(args.log) if args.log else None - log_level_file: str = args.log_level - configure_logging(log_level_console, log_file, log_level_file) - - config_file: Path = Path(args.config_file) - option: bool = args.option - - # Check whether maritime-schema config file exists - if not config_file.is_file(): - logger.error(f"maritime-schema.py: File {config_file} not found.") - return - - logger.info( - f"Start maritime-schema.py with following arguments:\n" - f"\t config_file: \t{config_file}\n" - f"\t option: \t\t\t{option}\n" - ) - - # Invoke API - run( - config_file=config_file, - option=option, - ) - - -if __name__ == "__main__": - main() +#!/usr/bin/env python +# coding: utf-8 + +import argparse +import logging +from pathlib import Path +from typing import Union + +from maritime_schema.api import run +from maritime_schema.utils.logging import configure_logging + +logger = logging.getLogger(__name__) + + +def _argparser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser( + prog="maritime-schema", + usage="%(prog)s config_file [options [args]]", + epilog="_________________maritime-schema___________________", + prefix_chars="-", + add_help=True, + description=("maritime-schema config_file --option"), + ) + + _ = parser.add_argument( + "config_file", + metavar="config_file", + type=str, + help="name of the file containing the maritime-schema configuration.", + ) + + console_verbosity = parser.add_mutually_exclusive_group(required=False) + + _ = console_verbosity.add_argument( + "-q", + "--quiet", + action="store_true", + help=("console output will be quiet."), + default=False, + ) + + _ = console_verbosity.add_argument( + "-v", + "--verbose", + action="store_true", + help=("console output will be verbose."), + default=False, + ) + + _ = parser.add_argument( + "--log", + action="store", + type=str, + help="name of log file. If specified, this will activate logging to file.", + default=None, + required=False, + ) + + _ = parser.add_argument( + "--log-level", + action="store", + type=str, + help="log level applied to logging to file.", + choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], + default="WARNING", + required=False, + ) + + return parser + + +def main(): + """Entry point for console script as configured in setup.cfg. + + Runs the command line interface and parses arguments and options entered on the console. + """ + + parser = _argparser() + args = parser.parse_args() + + # Configure Logging + # ..to console + log_level_console: str = "WARNING" + if any([args.quiet, args.verbose]): + log_level_console = "ERROR" if args.quiet else log_level_console + log_level_console = "INFO" if args.verbose else log_level_console + # ..to file + log_file: Union[Path, None] = Path(args.log) if args.log else None + log_level_file: str = args.log_level + configure_logging(log_level_console, log_file, log_level_file) + + config_file: Path = Path(args.config_file) + + # Check whether maritime-schema config file exists + if not config_file.is_file(): + logger.error(f"maritime-schema.py: File {config_file} not found.") + return + + logger.info(f"Start maritime-schema.py with following arguments:\n" f"\t config_file: \t{config_file}\n") + + # Invoke API + run( + config_file=config_file, + ) + + +if __name__ == "__main__": + main() From c866cf628dcd0303a06a6fcc0bbb753b9a951a1c Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:01:54 +0100 Subject: [PATCH 17/36] added test for types.caga.publish_schema() --- tests/types/test_caga.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/types/test_caga.py diff --git a/tests/types/test_caga.py b/tests/types/test_caga.py new file mode 100644 index 0000000..510b4db --- /dev/null +++ b/tests/types/test_caga.py @@ -0,0 +1,27 @@ +# pyright: reportPrivateUsage=false + +from pathlib import Path + +from maritime_schema.types.caga import publish_schema + + +def test_publish_schema(): + # Prepare + target_dir: Path = Path("../../src/maritime_schema/schema/caga") + docs_dir: Path = Path("../../docs/source/schema/caga") + input_schema_json_file: Path = target_dir / "input_schema.json" + input_schema_html_file: Path = docs_dir / "input_schema.html" + output_schema_json_file: Path = target_dir / "output_schema.json" + output_schema_html_file: Path = docs_dir / "output_schema.html" + input_schema_json_file.unlink(missing_ok=True) + input_schema_html_file.unlink(missing_ok=True) + output_schema_json_file.unlink(missing_ok=True) + output_schema_html_file.unlink(missing_ok=True) + # Execute + publish_schema() + # Assert + assert target_dir.exists() + assert input_schema_json_file.exists() + assert input_schema_html_file.exists() + assert output_schema_json_file.exists() + assert output_schema_html_file.exists() From dbc6d235de3ce2e7d6049167e29a26edcb873568 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:02:30 +0100 Subject: [PATCH 18/36] tests: adjusted cli tests to what is currently implemented --- tests/cli/test_maritime_schema_cli.py | 399 +++++++++++++------------- 1 file changed, 196 insertions(+), 203 deletions(-) diff --git a/tests/cli/test_maritime_schema_cli.py b/tests/cli/test_maritime_schema_cli.py index 60b7a69..f3f6419 100644 --- a/tests/cli/test_maritime_schema_cli.py +++ b/tests/cli/test_maritime_schema_cli.py @@ -1,203 +1,196 @@ -# pyright: reportPrivateUsage=false -import sys -from argparse import ArgumentError -from dataclasses import dataclass, field -from pathlib import Path -from typing import List, Union - -import pytest -from pytest import MonkeyPatch - -from maritime_schema.cli import maritime_schema -from maritime_schema.cli.maritime_schema import _argparser, main - -# *****Test commandline interface (CLI)************************************************************ - - -@dataclass() -class CliArgs: - # Expected default values for the CLI arguments when maritime-schema gets called via the commandline - quiet: bool = False - verbose: bool = False - log: Union[str, None] = None - log_level: str = field(default_factory=lambda: "WARNING") - config_file: Union[str, None] = field(default_factory=lambda: "test_config_file") # noqa: N815 - option: bool = False - - -@pytest.mark.parametrize( - "inputs, expected", - [ - ([], ArgumentError), - (["test_config_file"], CliArgs()), - (["test_config_file", "-q"], CliArgs(quiet=True)), - (["test_config_file", "--quiet"], CliArgs(quiet=True)), - (["test_config_file", "-v"], CliArgs(verbose=True)), - (["test_config_file", "--verbose"], CliArgs(verbose=True)), - (["test_config_file", "-qv"], ArgumentError), - (["test_config_file", "--log", "logFile"], CliArgs(log="logFile")), - (["test_config_file", "--log"], ArgumentError), - (["test_config_file", "--log-level", "INFO"], CliArgs(log_level="INFO")), - (["test_config_file", "--log-level"], ArgumentError), - (["test_config_file", "--option"], CliArgs(option=True)), - (["test_config_file", "-o"], ArgumentError), - ], -) -def test_cli( - inputs: List[str], - expected: Union[CliArgs, type], - monkeypatch: MonkeyPatch, -): - # sourcery skip: no-conditionals-in-tests - # sourcery skip: no-loop-in-tests - # Prepare - monkeypatch.setattr(sys, "argv", ["maritime-schema"] + inputs) - parser = _argparser() - # Execute - if isinstance(expected, CliArgs): - args_expected: CliArgs = expected - args = parser.parse_args() - # Assert args - for key in args_expected.__dataclass_fields__: - assert args.__getattribute__(key) == args_expected.__getattribute__(key) - elif issubclass(expected, Exception): - exception: type = expected - # Assert that expected exception is raised - with pytest.raises((exception, SystemExit)): - args = parser.parse_args() - else: - raise AssertionError() - - -# *****Ensure the CLI correctly configures logging************************************************* - - -@dataclass() -class ConfigureLoggingArgs: - # Values that main() is expected to pass to ConfigureLogging() by default when configuring the logging - log_level_console: str = field(default_factory=lambda: "WARNING") - log_file: Union[Path, None] = None - log_level_file: str = field(default_factory=lambda: "WARNING") - - -@pytest.mark.parametrize( - "inputs, expected", - [ - ([], ArgumentError), - (["test_config_file"], ConfigureLoggingArgs()), - (["test_config_file", "-q"], ConfigureLoggingArgs(log_level_console="ERROR")), - (["test_config_file", "--quiet"], ConfigureLoggingArgs(log_level_console="ERROR")), - (["test_config_file", "-v"], ConfigureLoggingArgs(log_level_console="INFO")), - ( - ["test_config_file", "--verbose"], - ConfigureLoggingArgs(log_level_console="INFO"), - ), - (["test_config_file", "-qv"], ArgumentError), - ( - ["test_config_file", "--log", "logFile"], - ConfigureLoggingArgs(log_file=Path("logFile")), - ), - (["test_config_file", "--log"], ArgumentError), - ( - ["test_config_file", "--log-level", "INFO"], - ConfigureLoggingArgs(log_level_file="INFO"), - ), - (["test_config_file", "--log-level"], ArgumentError), - ], -) -def test_logging_configuration( - inputs: List[str], - expected: Union[ConfigureLoggingArgs, type], - monkeypatch: MonkeyPatch, -): - # sourcery skip: no-conditionals-in-tests - # sourcery skip: no-loop-in-tests - # Prepare - monkeypatch.setattr(sys, "argv", ["maritime-schema"] + inputs) - args: ConfigureLoggingArgs = ConfigureLoggingArgs() - - def fake_configure_logging( - log_level_console: str, - log_file: Union[Path, None], - log_level_file: str, - ): - args.log_level_console = log_level_console - args.log_file = log_file - args.log_level_file = log_level_file - - def fake_run( - config_file: Path, - option: bool, - ): - pass - - monkeypatch.setattr(maritime_schema, "configure_logging", fake_configure_logging) - monkeypatch.setattr(maritime_schema, "run", fake_run) - # Execute - if isinstance(expected, ConfigureLoggingArgs): - args_expected: ConfigureLoggingArgs = expected - main() - # Assert args - for key in args_expected.__dataclass_fields__: - assert args.__getattribute__(key) == args_expected.__getattribute__(key) - elif issubclass(expected, Exception): - exception: type = expected - # Assert that expected exception is raised - with pytest.raises((exception, SystemExit)): - main() - else: - raise AssertionError() - - -# *****Ensure the CLI correctly invokes the API**************************************************** - - -@dataclass() -class ApiArgs: - # Values that main() is expected to pass to run() by default when invoking the API - config_file: Path = field(default_factory=lambda: Path("test_config_file")) - option: bool = False - - -@pytest.mark.parametrize( - "inputs, expected", - [ - ([], ArgumentError), - (["test_config_file"], ApiArgs()), - (["test_config_file", "--option"], ApiArgs(option=True)), - (["test_config_file", "-o"], ArgumentError), - ], -) -def test_api_invokation( - inputs: List[str], - expected: Union[ApiArgs, type], - monkeypatch: MonkeyPatch, -): - # sourcery skip: no-conditionals-in-tests - # sourcery skip: no-loop-in-tests - # Prepare - monkeypatch.setattr(sys, "argv", ["maritime-schema"] + inputs) - args: ApiArgs = ApiArgs() - - def fake_run( - config_file: Path, - option: bool = False, - ): - args.config_file = config_file - args.option = option - - monkeypatch.setattr(maritime_schema, "run", fake_run) - # Execute - if isinstance(expected, ApiArgs): - args_expected: ApiArgs = expected - main() - # Assert args - for key in args_expected.__dataclass_fields__: - assert args.__getattribute__(key) == args_expected.__getattribute__(key) - elif issubclass(expected, Exception): - exception: type = expected - # Assert that expected exception is raised - with pytest.raises((exception, SystemExit)): - main() - else: - raise AssertionError() +# pyright: reportPrivateUsage=false +import sys +from argparse import ArgumentError +from dataclasses import dataclass, field +from pathlib import Path +from typing import List, Union + +import pytest +from pytest import MonkeyPatch + +from maritime_schema.cli import maritime_schema +from maritime_schema.cli.maritime_schema import _argparser, main + +# *****Test commandline interface (CLI)************************************************************ + + +@dataclass() +class CliArgs: + # Expected default values for the CLI arguments when maritime-schema gets called via the commandline + quiet: bool = False + verbose: bool = False + log: Union[str, None] = None + log_level: str = field(default_factory=lambda: "WARNING") + config_file: Union[str, None] = field(default_factory=lambda: "test_config_file") # noqa: N815 + + +@pytest.mark.parametrize( + "inputs, expected", + [ + ([], ArgumentError), + (["test_config_file"], CliArgs()), + (["test_config_file", "-q"], CliArgs(quiet=True)), + (["test_config_file", "--quiet"], CliArgs(quiet=True)), + (["test_config_file", "-v"], CliArgs(verbose=True)), + (["test_config_file", "--verbose"], CliArgs(verbose=True)), + (["test_config_file", "-qv"], ArgumentError), + (["test_config_file", "--log", "logFile"], CliArgs(log="logFile")), + (["test_config_file", "--log"], ArgumentError), + (["test_config_file", "--log-level", "INFO"], CliArgs(log_level="INFO")), + (["test_config_file", "--log-level"], ArgumentError), + (["test_config_file", "-o"], ArgumentError), + ], +) +def test_cli( + inputs: List[str], + expected: Union[CliArgs, type], + monkeypatch: MonkeyPatch, +): + # sourcery skip: no-conditionals-in-tests + # sourcery skip: no-loop-in-tests + # Prepare + monkeypatch.setattr(sys, "argv", ["maritime-schema"] + inputs) + parser = _argparser() + # Execute + if isinstance(expected, CliArgs): + args_expected: CliArgs = expected + args = parser.parse_args() + # Assert args + for key in args_expected.__dataclass_fields__: + assert args.__getattribute__(key) == args_expected.__getattribute__(key) + elif issubclass(expected, Exception): + exception: type = expected + # Assert that expected exception is raised + with pytest.raises((exception, SystemExit)): + args = parser.parse_args() + else: + raise AssertionError() + + +# *****Ensure the CLI correctly configures logging************************************************* + + +@dataclass() +class ConfigureLoggingArgs: + # Values that main() is expected to pass to ConfigureLogging() by default when configuring the logging + log_level_console: str = field(default_factory=lambda: "WARNING") + log_file: Union[Path, None] = None + log_level_file: str = field(default_factory=lambda: "WARNING") + + +@pytest.mark.parametrize( + "inputs, expected", + [ + ([], ArgumentError), + (["test_config_file"], ConfigureLoggingArgs()), + (["test_config_file", "-q"], ConfigureLoggingArgs(log_level_console="ERROR")), + (["test_config_file", "--quiet"], ConfigureLoggingArgs(log_level_console="ERROR")), + (["test_config_file", "-v"], ConfigureLoggingArgs(log_level_console="INFO")), + ( + ["test_config_file", "--verbose"], + ConfigureLoggingArgs(log_level_console="INFO"), + ), + (["test_config_file", "-qv"], ArgumentError), + ( + ["test_config_file", "--log", "logFile"], + ConfigureLoggingArgs(log_file=Path("logFile")), + ), + (["test_config_file", "--log"], ArgumentError), + ( + ["test_config_file", "--log-level", "INFO"], + ConfigureLoggingArgs(log_level_file="INFO"), + ), + (["test_config_file", "--log-level"], ArgumentError), + ], +) +def test_logging_configuration( + inputs: List[str], + expected: Union[ConfigureLoggingArgs, type], + monkeypatch: MonkeyPatch, +): + # sourcery skip: no-conditionals-in-tests + # sourcery skip: no-loop-in-tests + # Prepare + monkeypatch.setattr(sys, "argv", ["maritime-schema"] + inputs) + args: ConfigureLoggingArgs = ConfigureLoggingArgs() + + def fake_configure_logging( + log_level_console: str, + log_file: Union[Path, None], + log_level_file: str, + ): + args.log_level_console = log_level_console + args.log_file = log_file + args.log_level_file = log_level_file + + def fake_run( + config_file: Path, + ): + pass + + monkeypatch.setattr(maritime_schema, "configure_logging", fake_configure_logging) + monkeypatch.setattr(maritime_schema, "run", fake_run) + # Execute + if isinstance(expected, ConfigureLoggingArgs): + args_expected: ConfigureLoggingArgs = expected + main() + # Assert args + for key in args_expected.__dataclass_fields__: + assert args.__getattribute__(key) == args_expected.__getattribute__(key) + elif issubclass(expected, Exception): + exception: type = expected + # Assert that expected exception is raised + with pytest.raises((exception, SystemExit)): + main() + else: + raise AssertionError() + + +# *****Ensure the CLI correctly invokes the API**************************************************** + + +@dataclass() +class ApiArgs: + # Values that main() is expected to pass to run() by default when invoking the API + config_file: Path = field(default_factory=lambda: Path("test_config_file")) + + +@pytest.mark.parametrize( + "inputs, expected", + [ + ([], ArgumentError), + (["test_config_file"], ApiArgs()), + (["test_config_file", "-o"], ArgumentError), + ], +) +def test_api_invokation( + inputs: List[str], + expected: Union[ApiArgs, type], + monkeypatch: MonkeyPatch, +): + # sourcery skip: no-conditionals-in-tests + # sourcery skip: no-loop-in-tests + # Prepare + monkeypatch.setattr(sys, "argv", ["maritime-schema"] + inputs) + args: ApiArgs = ApiArgs() + + def fake_run( + config_file: Path, + ): + args.config_file = config_file + + monkeypatch.setattr(maritime_schema, "run", fake_run) + # Execute + if isinstance(expected, ApiArgs): + args_expected: ApiArgs = expected + main() + # Assert args + for key in args_expected.__dataclass_fields__: + assert args.__getattribute__(key) == args_expected.__getattribute__(key) + elif issubclass(expected, Exception): + exception: type = expected + # Assert that expected exception is raised + with pytest.raises((exception, SystemExit)): + main() + else: + raise AssertionError() From 6b640c0cd600e1252eadcf24d281b43e12536503 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:03:11 +0100 Subject: [PATCH 19/36] tests: removed orphaned tests for 'subpackage1' and 'subpackage2' --- tests/subpackage1/test_module1.py | 15 -------- tests/subpackage2/test_module2.py | 58 ------------------------------- 2 files changed, 73 deletions(-) delete mode 100644 tests/subpackage1/test_module1.py delete mode 100644 tests/subpackage2/test_module2.py diff --git a/tests/subpackage1/test_module1.py b/tests/subpackage1/test_module1.py deleted file mode 100644 index 59acc6a..0000000 --- a/tests/subpackage1/test_module1.py +++ /dev/null @@ -1,15 +0,0 @@ -# pyright: reportPrivateUsage=false - -from maritime_schema.subpackage1.module1 import int_to_str - - -def test_int_to_str(): - """Example for a simple unit test.""" - # Prepare - int_in: int = 1 - str_out_expected: str = "1" - # Execute - str_out = int_to_str(int_in) - # Assert - assert isinstance(str_out, str) - assert str_out == str_out_expected diff --git a/tests/subpackage2/test_module2.py b/tests/subpackage2/test_module2.py deleted file mode 100644 index ef79878..0000000 --- a/tests/subpackage2/test_module2.py +++ /dev/null @@ -1,58 +0,0 @@ -# pyright: reportPrivateUsage=false -import contextlib - -import pytest -from pytest import LogCaptureFixture - -from maritime_schema.subpackage2.module2 import str_to_int - - -@pytest.mark.parametrize( - "str_in, int_expected", - [ - ("1", 1), - ("2", 2), - ("-1", -1), - ], -) -def test_str_to_int(str_in: str, int_expected: int): - """Example of a test that uses the pytest.mark.parametrize decorator. - - Parameters - ---------- - str_in : str - the string passed in to str_to_int() - int_expected : int - the integer expected as return value from the call to str_to_int() - """ - # Prepare - # (nothing to prepare, as we use the pytest.mark.parametrize decorator - # to set the input and expected output.) - # Execute - int_out = str_to_int(str_in) - # Assert - assert isinstance(int_out, int) - assert int_out == int_expected - - -def test_str_to_int_exception(): - # Prepare - str_in: str = "3.0" - # Execute - with pytest.raises(ValueError): - _ = str_to_int(str_in) - - -def test_str_to_int_exception_log_message(caplog: LogCaptureFixture): - # Prepare - str_in: str = "3.0" - log_level_expected = "ERROR" - log_message_expected = f"ValueError raised in function str_to_int() in subpackage2. input was: {str_in}" - caplog.clear() - # Execute - with contextlib.suppress(Exception): - _ = str_to_int(str_in) - # Assert - assert len(caplog.records) > 0 - assert caplog.records[0].levelname == log_level_expected - assert caplog.records[0].message == log_message_expected From 3489d7c6d8f81c76f7aaa021137b88443b257b9f Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:03:52 +0100 Subject: [PATCH 20/36] tests: adjusted api tests to what is currently implemented --- tests/test_api.py | 119 +++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 70 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index f24717f..121b356 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,70 +1,49 @@ -# pyright: reportPrivateUsage=false -from pathlib import Path - -import pytest -from pytest import LogCaptureFixture - -from maritime_schema.api import MaritimeSchemaProcess, run - - -def test_file_not_found_exception(): - # Prepare - config_file = Path("this_file_does_not_exist") - # Execute and Assert - with pytest.raises(FileNotFoundError): - _ = run(config_file) - - -def test_run(): - # Prepare - config_file = Path("test_config_file") - # Execute - run(config_file=config_file) - # Assert - # (nothin to assert. Assertion is that no exception is thrown.) - - -def test_run_with_option(caplog: LogCaptureFixture): - # Prepare - config_file = Path("test_config_file") - log_level_expected = "INFO" - log_message_expected = "option is True. maritime-schema process will do something differently." - caplog.clear() - # Execute - run(config_file=config_file, option=True) - # Assert - assert len(caplog.records) > 0 - assert caplog.records[0].levelname == log_level_expected - assert caplog.records[0].message == log_message_expected - - -class TestMaritimeSchemaProcess: - def test_init(self): - # Prepare - config_file = Path("test_config_file.json") - # Execute - process = MaritimeSchemaProcess(config_file=config_file) - # Assert - assert process.config_file is config_file - assert process.max_number_of_runs == 3 - assert process.run_number == 0 - assert process.terminate is False - - def test_init_with_empty_config_file(self): - # sourcery skip: class-extract-method - # Prepare - config_file = Path("test_config_file_empty.json") - # Execute - process = MaritimeSchemaProcess(config_file=config_file) - # Assert - assert process.config_file is config_file - assert process.max_number_of_runs == 1 - assert process.run_number == 0 - assert process.terminate is False - - -# @TODO: To be implemented -@pytest.mark.skip(reason="To be implemented") -def test_example_skip(): - """Example of a test skipped because it is not yet implemented.""" - pass +# pyright: reportPrivateUsage=false +from pathlib import Path + +import pytest + +from maritime_schema.api import MaritimeSchemaProcess, run + + +def test_file_not_found_exception(): + # Prepare + config_file = Path("this_file_does_not_exist") + # Execute and Assert + with pytest.raises(FileNotFoundError): + _ = run(config_file) + + +def test_run(): + # Prepare + config_file = Path("test_config_file") + # Execute + run(config_file=config_file) + # Assert + # (nothing to assert. Assertion is that no exception is thrown.) + + +class TestMaritimeSchemaProcess: + def test_init(self): + # Prepare + config_file = Path("test_config_file.json") + # Execute + process = MaritimeSchemaProcess(config_file=config_file) + # Assert + assert process.config_file is config_file + + def test_init_with_empty_config_file(self): + # sourcery skip: class-extract-method + # Prepare + config_file = Path("test_config_file_empty.json") + # Execute + process = MaritimeSchemaProcess(config_file=config_file) + # Assert + assert process.config_file is config_file + + +# @TODO: To be implemented +@pytest.mark.skip(reason="To be implemented") +def test_example_skip(): + """Example of a test skipped because it is not yet implemented.""" + pass From 68be485c0c24facf07fcd7d74b99864eceac585b Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:04:19 +0100 Subject: [PATCH 21/36] tests: adjusted test.fixtures in conftest.py --- tests/conftest.py | 106 +++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index ec37c2e..129f993 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,53 +1,53 @@ -import logging -import os -from glob import glob -from pathlib import Path -from shutil import rmtree - -import pytest -from pytest import LogCaptureFixture - - -@pytest.fixture(scope="package", autouse=True) -def chdir(): - os.chdir(Path(__file__).parent.absolute() / "test_working_directory") - - -@pytest.fixture(scope="package", autouse=True) -def test_dir(): - return Path(__file__).parent.absolute() - - -output_dirs = [ - "results", -] -output_files = [ - "*test*.pdf", -] - - -@pytest.fixture(autouse=True) -def default_setup_and_teardown(caplog: LogCaptureFixture): - _remove_output_dirs_and_files() - yield - _remove_output_dirs_and_files() - - -def _remove_output_dirs_and_files(): - for folder in output_dirs: - rmtree(folder, ignore_errors=True) - for pattern in output_files: - for file in glob(pattern): - file = Path(file) - file.unlink(missing_ok=True) - - -@pytest.fixture(autouse=True) -def setup_logging(caplog: LogCaptureFixture): - caplog.set_level("INFO") - caplog.clear() - - -@pytest.fixture(autouse=True) -def logger(): - return logging.getLogger() +import logging +import os +from glob import glob +from pathlib import Path +from shutil import rmtree + +import pytest +from pytest import LogCaptureFixture + + +@pytest.fixture(scope="package", autouse=True) +def chdir(): + os.chdir(Path(__file__).parent.absolute() / "test_working_directory") + + +@pytest.fixture(scope="package", autouse=True) +def test_dir(): + return Path(__file__).parent.absolute() + + +output_dirs = [ + "results", +] +output_files = [ + "*test*.pdf", +] + + +@pytest.fixture(autouse=True) +def default_setup_and_teardown(caplog: LogCaptureFixture): + _remove_output_dirs_and_files() + yield + _remove_output_dirs_and_files() + + +def _remove_output_dirs_and_files(): + for folder in output_dirs: + rmtree(folder, ignore_errors=True) + for pattern in output_files: + for file in glob(pattern): + file = Path(file) + file.unlink(missing_ok=True) + + +@pytest.fixture(autouse=True) +def setup_logging(caplog: LogCaptureFixture): + caplog.set_level("INFO") + caplog.clear() + + +@pytest.fixture(autouse=True) +def logger(): + return logging.getLogger() From 9447a34ed97624f7b655cf1765d77b9e1586abda Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:06:14 +0100 Subject: [PATCH 22/36] .gitignore: added .ruff_cache --- .gitignore | 284 +++++++++++++++++++++++++++-------------------------- 1 file changed, 143 insertions(+), 141 deletions(-) diff --git a/.gitignore b/.gitignore index 9185239..52ff691 100644 --- a/.gitignore +++ b/.gitignore @@ -1,141 +1,143 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# PyCharm -.idea - -# VS Code Settings -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -!.vscode/*.code-snippets - +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# PyCharm +.idea + +# VS Code Settings +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# ruff +.ruff_cache From b1308398fe7f6487be97920ba2ddd6ff925722d4 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:07:03 +0100 Subject: [PATCH 23/36] Sphinx documentation: Tied schema html documentation into the docs --- docs/source/index.rst | 51 +- docs/source/maritime_schema.rst | 47 +- .../maritime_schema.subpackage2.module2.rst | 7 - docs/source/maritime_schema.subpackage2.rst | 15 - ...le1.rst => maritime_schema.types.caga.rst} | 14 +- ...package1.rst => maritime_schema.types.rst} | 30 +- docs/source/schema.caga.input_schema.rst | 5 + docs/source/schema.caga.output_schema.rst | 5 + docs/source/schema.caga.rst | 8 + docs/source/schema.rst | 7 + docs/source/schema/caga/input_schema.html | 292 ++++++ docs/source/schema/caga/output_schema.html | 962 ++++++++++++++++++ 12 files changed, 1350 insertions(+), 93 deletions(-) delete mode 100644 docs/source/maritime_schema.subpackage2.module2.rst delete mode 100644 docs/source/maritime_schema.subpackage2.rst rename docs/source/{maritime_schema.subpackage1.module1.rst => maritime_schema.types.caga.rst} (50%) rename docs/source/{maritime_schema.subpackage1.rst => maritime_schema.types.rst} (54%) create mode 100644 docs/source/schema.caga.input_schema.rst create mode 100644 docs/source/schema.caga.output_schema.rst create mode 100644 docs/source/schema.caga.rst create mode 100644 docs/source/schema.rst create mode 100644 docs/source/schema/caga/input_schema.html create mode 100644 docs/source/schema/caga/output_schema.html diff --git a/docs/source/index.rst b/docs/source/index.rst index 130efa2..faba269 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,25 +1,26 @@ -.. maritime-schema documentation master file, created by - sphinx-quickstart on Wed Jul 6 21:16:21 2022. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -maritime-schema: Example Python Package -========================================= - -.. toctree:: - :maxdepth: 4 - :caption: Contents: - - README - CHANGELOG - LICENSE - api - cli - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` +.. maritime-schema documentation master file, created by + sphinx-quickstart on Wed Jul 6 21:16:21 2022. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +maritime-schema: Example Python Package +========================================= + +.. toctree:: + :maxdepth: 4 + :caption: Contents: + + README + CHANGELOG + LICENSE + api + cli + schema + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/source/maritime_schema.rst b/docs/source/maritime_schema.rst index 0171ab7..2dc7ff4 100644 --- a/docs/source/maritime_schema.rst +++ b/docs/source/maritime_schema.rst @@ -1,24 +1,23 @@ -maritime\_schema package -======================== - -.. automodule:: maritime_schema - :members: - :undoc-members: - :show-inheritance: - -Subpackages ------------ - -.. toctree:: - :maxdepth: 4 - - maritime_schema.subpackage1 - maritime_schema.subpackage2 - -Submodules ----------- - -.. toctree:: - :maxdepth: 4 - - maritime_schema.api +maritime\_schema package +======================== + +.. automodule:: maritime_schema + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + maritime_schema.types + +Submodules +---------- + +.. toctree:: + :maxdepth: 4 + + maritime_schema.api diff --git a/docs/source/maritime_schema.subpackage2.module2.rst b/docs/source/maritime_schema.subpackage2.module2.rst deleted file mode 100644 index 2685e99..0000000 --- a/docs/source/maritime_schema.subpackage2.module2.rst +++ /dev/null @@ -1,7 +0,0 @@ -maritime\_schema.subpackage2.module2 module -=========================================== - -.. automodule:: maritime_schema.subpackage2.module2 - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/maritime_schema.subpackage2.rst b/docs/source/maritime_schema.subpackage2.rst deleted file mode 100644 index f0736f9..0000000 --- a/docs/source/maritime_schema.subpackage2.rst +++ /dev/null @@ -1,15 +0,0 @@ -maritime\_schema.subpackage2 package -==================================== - -.. automodule:: maritime_schema.subpackage2 - :members: - :undoc-members: - :show-inheritance: - -Submodules ----------- - -.. toctree:: - :maxdepth: 4 - - maritime_schema.subpackage2.module2 diff --git a/docs/source/maritime_schema.subpackage1.module1.rst b/docs/source/maritime_schema.types.caga.rst similarity index 50% rename from docs/source/maritime_schema.subpackage1.module1.rst rename to docs/source/maritime_schema.types.caga.rst index 190d0d4..bb4701e 100644 --- a/docs/source/maritime_schema.subpackage1.module1.rst +++ b/docs/source/maritime_schema.types.caga.rst @@ -1,7 +1,7 @@ -maritime\_schema.subpackage1.module1 module -=========================================== - -.. automodule:: maritime_schema.subpackage1.module1 - :members: - :undoc-members: - :show-inheritance: +maritime\_schema.types.caga module +=========================================== + +.. automodule:: maritime_schema.types.caga + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/maritime_schema.subpackage1.rst b/docs/source/maritime_schema.types.rst similarity index 54% rename from docs/source/maritime_schema.subpackage1.rst rename to docs/source/maritime_schema.types.rst index 305f860..e96bb8c 100644 --- a/docs/source/maritime_schema.subpackage1.rst +++ b/docs/source/maritime_schema.types.rst @@ -1,15 +1,15 @@ -maritime\_schema.subpackage1 package -==================================== - -.. automodule:: maritime_schema.subpackage1 - :members: - :undoc-members: - :show-inheritance: - -Submodules ----------- - -.. toctree:: - :maxdepth: 4 - - maritime_schema.subpackage1.module1 +maritime\_schema.types package +==================================== + +.. automodule:: maritime_schema.types + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +.. toctree:: + :maxdepth: 4 + + maritime_schema.types.caga diff --git a/docs/source/schema.caga.input_schema.rst b/docs/source/schema.caga.input_schema.rst new file mode 100644 index 0000000..d5d328a --- /dev/null +++ b/docs/source/schema.caga.input_schema.rst @@ -0,0 +1,5 @@ +CAGA Input Schema +================= + +.. raw:: html + :file: ./schema/caga/input_schema.html diff --git a/docs/source/schema.caga.output_schema.rst b/docs/source/schema.caga.output_schema.rst new file mode 100644 index 0000000..2d19b78 --- /dev/null +++ b/docs/source/schema.caga.output_schema.rst @@ -0,0 +1,5 @@ +CAGA Output Schema +================== + +.. raw:: html + :file: ./schema/caga/output_schema.html diff --git a/docs/source/schema.caga.rst b/docs/source/schema.caga.rst new file mode 100644 index 0000000..3dfb42d --- /dev/null +++ b/docs/source/schema.caga.rst @@ -0,0 +1,8 @@ +CAGA Schema +=========== + +.. toctree:: + :maxdepth: 2 + + schema.caga.input_schema + schema.caga.output_schema diff --git a/docs/source/schema.rst b/docs/source/schema.rst new file mode 100644 index 0000000..7b8fcf2 --- /dev/null +++ b/docs/source/schema.rst @@ -0,0 +1,7 @@ +Schema Documentation +==================== + +.. toctree:: + :maxdepth: 2 + + schema.caga diff --git a/docs/source/schema/caga/input_schema.html b/docs/source/schema/caga/input_schema.html new file mode 100644 index 0000000..4c43e0b --- /dev/null +++ b/docs/source/schema/caga/input_schema.html @@ -0,0 +1,292 @@ + Test Input Schema

Test Input Schema

Type: object

Title

Type: string

The title of the traffic situation


Example:

"overtaking_18"
+

Description

Type: string

A description of the traffic situation


Example:

"Crossing situation with 3 target vessels in the Oslofjord"
+

Situation starting time

Default: null

Starting time of the situation in ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: null

Example:

"2024-02-22T18:00:50.685826"
+

Own Ship data

Type: object

Own Ship data


Example:

{
+    "initial": {
+        "cog": 284.2,
+        "heading": 283.1,
+        "navStatus": "Under way using engine",
+        "position": {
+            "latitude": 51.2123,
+            "longitude": 11.2313
+        },
+        "sog": 12.3
+    },
+    "static": {
+        "height": 15.0,
+        "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+        "imo": null,
+        "length": 230.0,
+        "mmsi": 123456789,
+        "name": "RMS Titanic",
+        "shipType": "Fishing",
+        "width": 30.0
+    },
+    "waypoints": [
+        {
+            "data": {
+                "cog": {
+                    "interpMethod": "cosine",
+                    "mAfterLegChange": 500.0,
+                    "mBeforeLegChange": 500.0,
+                    "value": 200.0
+                },
+                "heading": null,
+                "sog": {
+                    "interpMethod": "linear",
+                    "mAfterLegChange": 100.0,
+                    "mBeforeLegChange": 100.0,
+                    "value": 12.3
+                }
+            },
+            "position": {
+                "latitude": 57.2343,
+                "longitude": 10.3432
+            },
+            "turnRadius": 500.0
+        }
+    ]
+}
+


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"59c9a773-8b81-4a7b-882f-052836d031e7"
+

Length

Type: number

Length of the ship in meters


Example:

230.0
+

Width

Type: number

Width of the ship in meters


Example:

30.0
+

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
+

Mmsi

Default: null

Maritime Mobile Service Identity (MMSI)

Type: integer

Value must be greater or equal to 100000000 and lesser or equal to 999999999

Type: null

Example:

123456789
+

Imo

Default: null

IMO Number

Type: integer

Value must be greater or equal to 1000000 and lesser or equal to 9999999

Type: null

Example:

1234567
+

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
+

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
+    "height": 15.0,
+    "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+    "imo": null,
+    "length": 230.0,
+    "mmsi": 123456789,
+    "name": "RMS Titanic",
+    "shipType": "Fishing",
+    "width": 30.0
+}
+

Initial own ship Initial

Type: object

Example:

{
+    "cog": 284.2,
+    "heading": 283.1,
+    "navStatus": "Under way using engine",
+    "position": {
+        "latitude": 51.2123,
+        "longitude": 11.2313
+    },
+    "sog": 12.3
+}
+

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

Initial ship speed over ground

Type: number

Initial ship speed over ground in knots

Value must be greater or equal to 0.0


Example:

10.0
+

Initial ship course over ground

Type: number

Initial ship course over ground in degrees

Value must be greater or equal to 0.0 and lesser or equal to 360.0


Example:

45.0
+

Initial ship heading

Default: null

Initial ship heading in degrees

Type: number

Value must be greater or equal to 0.0 and lesser or equal to 360.0

Type: null

Example:

45.2
+

Type: enum (of string)

AIS Navigational Status

Must be one of:

  • "Under way using engine"
  • "At anchor"
  • "Not under command"
  • "Restricted manoeuverability"
  • "Constrained by her draught"
  • "Moored"
  • "Aground"
  • "Engaged in fishing"
  • "Under way sailing"
  • "Reserved for future amendment of navigational status for HSC"
  • "Reserved for future amendment of navigational status for WIG"
  • "Reserved for future use 1"
  • "Reserved for future use 2"
  • "Reserved for future use 3"
  • "AIS SART is active"
  • "Not defined (default)"

Waypoints

Default: null

An array of Waypoint objects. Each waypoint object must have a position property.
If no turn radius is provided, it will be assumed to be 0.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status

Type: array
No Additional Items

Each item of this array must be:

Type: object

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

Turn Radius

Type: number Default: 0

Orthodrome turn radius as defined in RTZ format


Example:

200
+

Type: object Default: null

A Data object that includes speed, course, and heading data points

Type: object Default: null

Speed data point


Example:

{
+    "interpMethod": "linear",
+    "mAfterLegChange": 100.0,
+    "mBeforeLegChange": 100.0,
+    "value": 12.3
+}
+

Value

Type: number

the value of the data at the current timestep


Example:

12.3
+

M Before Leg Change

Type: number

meters before the waypoint to start interpolating to the new value


Example:

10
+

M After Leg Change

Type: number

meters after the waypoint to finish interpolating to the new value


Example:

10
+

Interp Method

Default: "linear"

Method used for interpolation

Type: enum (of string)

Must be one of:

  • "linear"
  • "cosine"
  • "smoothstep"
  • "accelerate"
  • "decelerate"
  • "ordinal"
Type: string

Type: object Default: null

Heading data point


Example:

{
+    "interpMethod": "linear",
+    "mAfterLegChange": 100.0,
+    "mBeforeLegChange": 100.0,
+    "value": 180.0
+}
+

Value

Type: number

the value of the data at the current timestep


Example:

12.3
+

M Before Leg Change

Type: number

meters before the waypoint to start interpolating to the new value


Example:

10
+

M After Leg Change

Type: number

meters after the waypoint to finish interpolating to the new value


Example:

10
+

Interp Method

Default: "linear"

Method used for interpolation

Type: enum (of string)

Must be one of:

  • "linear"
  • "cosine"
  • "smoothstep"
  • "accelerate"
  • "decelerate"
  • "ordinal"
Type: string

Each additional property must conform to the following schema

Type: object

The 'data' field can include additional properties. All additional properties should be DataPoint objects.

Type: number

Type: number

Type: number

Type: string
Type: null

Example:

{
+    "data": {
+        "cog": {
+            "interpMethod": "cosine",
+            "mAfterLegChange": 500.0,
+            "mBeforeLegChange": 500.0,
+            "value": 200.0
+        },
+        "heading": null,
+        "sog": {
+            "interpMethod": "linear",
+            "mAfterLegChange": 100.0,
+            "mBeforeLegChange": 100.0,
+            "value": 12.3
+        }
+    },
+    "position": {
+        "latitude": 57.2343,
+        "longitude": 10.3432
+    },
+    "turnRadius": 500.0
+}
+

Target Ship data

Type: array Default: null

Target Ship data

No Additional Items

Each item of this array must be:

Type: object


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"59c9a773-8b81-4a7b-882f-052836d031e7"
+

Length

Type: number

Length of the ship in meters


Example:

230.0
+

Width

Type: number

Width of the ship in meters


Example:

30.0
+

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
+

Mmsi

Default: null

Maritime Mobile Service Identity (MMSI)

Type: integer

Value must be greater or equal to 100000000 and lesser or equal to 999999999

Type: null

Example:

123456789
+

Imo

Default: null

IMO Number

Type: integer

Value must be greater or equal to 1000000 and lesser or equal to 9999999

Type: null

Example:

1234567
+

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
+

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
+    "height": 15.0,
+    "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+    "imo": null,
+    "length": 230.0,
+    "mmsi": 123456789,
+    "name": "RMS Titanic",
+    "shipType": "Fishing",
+    "width": 30.0
+}
+

Initial own ship Initial

Type: object

Example:

{
+    "cog": 284.2,
+    "heading": 283.1,
+    "navStatus": "Under way using engine",
+    "position": {
+        "latitude": 51.2123,
+        "longitude": 11.2313
+    },
+    "sog": 12.3
+}
+

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

Initial ship speed over ground

Type: number

Initial ship speed over ground in knots

Value must be greater or equal to 0.0


Example:

10.0
+

Initial ship course over ground

Type: number

Initial ship course over ground in degrees

Value must be greater or equal to 0.0 and lesser or equal to 360.0


Example:

45.0
+

Initial ship heading

Default: null

Initial ship heading in degrees

Type: number

Value must be greater or equal to 0.0 and lesser or equal to 360.0

Type: null

Example:

45.2
+

Type: enum (of string)

AIS Navigational Status

Must be one of:

  • "Under way using engine"
  • "At anchor"
  • "Not under command"
  • "Restricted manoeuverability"
  • "Constrained by her draught"
  • "Moored"
  • "Aground"
  • "Engaged in fishing"
  • "Under way sailing"
  • "Reserved for future amendment of navigational status for HSC"
  • "Reserved for future amendment of navigational status for WIG"
  • "Reserved for future use 1"
  • "Reserved for future use 2"
  • "Reserved for future use 3"
  • "AIS SART is active"
  • "Not defined (default)"

Waypoints

Default: null

An array of Waypoint objects. Each waypoint object must have a position property.
If no turn radius is provided, it will be assumed to be 0.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status

Type: array
No Additional Items

Each item of this array must be:

Type: object

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

Turn Radius

Type: number Default: 0

Orthodrome turn radius as defined in RTZ format


Example:

200
+

Type: object Default: null

A Data object that includes speed, course, and heading data points

Type: object Default: null

Speed data point


Example:

{
+    "interpMethod": "linear",
+    "mAfterLegChange": 100.0,
+    "mBeforeLegChange": 100.0,
+    "value": 12.3
+}
+

Value

Type: number

the value of the data at the current timestep


Example:

12.3
+

M Before Leg Change

Type: number

meters before the waypoint to start interpolating to the new value


Example:

10
+

M After Leg Change

Type: number

meters after the waypoint to finish interpolating to the new value


Example:

10
+

Interp Method

Default: "linear"

Method used for interpolation

Type: enum (of string)

Must be one of:

  • "linear"
  • "cosine"
  • "smoothstep"
  • "accelerate"
  • "decelerate"
  • "ordinal"
Type: string

Type: object Default: null

Heading data point


Example:

{
+    "interpMethod": "linear",
+    "mAfterLegChange": 100.0,
+    "mBeforeLegChange": 100.0,
+    "value": 180.0
+}
+

Value

Type: number

the value of the data at the current timestep


Example:

12.3
+

M Before Leg Change

Type: number

meters before the waypoint to start interpolating to the new value


Example:

10
+

M After Leg Change

Type: number

meters after the waypoint to finish interpolating to the new value


Example:

10
+

Interp Method

Default: "linear"

Method used for interpolation

Type: enum (of string)

Must be one of:

  • "linear"
  • "cosine"
  • "smoothstep"
  • "accelerate"
  • "decelerate"
  • "ordinal"
Type: string

Each additional property must conform to the following schema

Type: object

The 'data' field can include additional properties. All additional properties should be DataPoint objects.

Type: number

Type: number

Type: number

Type: string
Type: null

Example:

{
+    "data": {
+        "cog": {
+            "interpMethod": "cosine",
+            "mAfterLegChange": 500.0,
+            "mBeforeLegChange": 500.0,
+            "value": 200.0
+        },
+        "heading": null,
+        "sog": {
+            "interpMethod": "linear",
+            "mAfterLegChange": 100.0,
+            "mBeforeLegChange": 100.0,
+            "value": 12.3
+        }
+    },
+    "position": {
+        "latitude": 57.2343,
+        "longitude": 10.3432
+    },
+    "turnRadius": 500.0
+}
+

Example:

[
+    {
+        "initial": {
+            "cog": 284.2,
+            "heading": 283.1,
+            "navStatus": "Under way using engine",
+            "position": {
+                "latitude": 51.2123,
+                "longitude": 11.2313
+            },
+            "sog": 12.3
+        },
+        "static": {
+            "height": 15.0,
+            "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+            "imo": null,
+            "length": 230.0,
+            "mmsi": 123456789,
+            "name": "RMS Titanic",
+            "shipType": "Fishing",
+            "width": 30.0
+        },
+        "waypoints": [
+            {
+                "data": {
+                    "cog": {
+                        "interpMethod": "cosine",
+                        "mAfterLegChange": 500.0,
+                        "mBeforeLegChange": 500.0,
+                        "value": 200.0
+                    },
+                    "heading": null,
+                    "sog": {
+                        "interpMethod": "linear",
+                        "mAfterLegChange": 100.0,
+                        "mBeforeLegChange": 100.0,
+                        "value": 12.3
+                    }
+                },
+                "position": {
+                    "latitude": 57.2343,
+                    "longitude": 10.3432
+                },
+                "turnRadius": 500.0
+            }
+        ]
+    }
+]
+

Default: null

environmental parameters

Type: object

Air Temperature

Type: number Default: null

The air temperature in degrees Celsius


Example:

20.0
+

Water Remperature

Type: number Default: null

The water temperature in degrees Celsius


Example:

15.0
+

Type: enum (of string) Default: null

The type of precipitation

Must be one of:

  • "None"
  • "Rain"
  • "Snow"
  • "Sleet"
  • "Hail"

Example:

"Rain"
+

Wind Speed

Type: number Default: null

The wind speed in m/s


Example:

10.0
+

Wind Direction

Type: number Default: null

The wind direction in degrees


Example:

180.0
+

Current Speed

Type: number Default: null

The current speed in m/s


Example:

1.0
+

Current Direction

Type: number Default: null

The current direction in degrees


Example:

90.0
+

Type: enum (of string) Default: null

The wave spectrum

Must be one of:

  • "JONSWAP"
  • "Pierson-Moskowitz"
  • "Bretschneider"

Example:

"JONSWAP"
+

Significant Wave Height

Type: number Default: null

The significant wave height in meters


Example:

3.0
+

Wave Period

Type: number Default: null

The wave period in seconds


Example:

12.0
+

Wave Direction

Type: number Default: null

The wave direction in degrees


Example:

270.0
+

Visibility

Type: number Default: null

The visibility in nautical miles


Example:

5.0
+

Type: enum (of string) Default: null

The overall weather conditions

Must be one of:

  • "Clear"
  • "Cloudy"
  • "Foggy"
  • "Rainy"
  • "Snowy"

Example:

"Clear"
+
Type: null

Example:

{
+    "airTemperature": 20.0,
+    "conditions": "Clear",
+    "currentDirection": 90.0,
+    "currentSpeed": 1.0,
+    "precipitation": "Rain",
+    "significantWaveHeight": 3.0,
+    "visibility": 5.0,
+    "waterRemperature": 15.0,
+    "waveDirection": 270.0,
+    "wavePeriod": 12.0,
+    "waveSpectrum": "JONSWAP",
+    "windDirection": 180.0,
+    "windSpeed": 10.0
+}
+

Additional Properties of any type are allowed.

Type: object
\ No newline at end of file diff --git a/docs/source/schema/caga/output_schema.html b/docs/source/schema/caga/output_schema.html new file mode 100644 index 0000000..086653c --- /dev/null +++ b/docs/source/schema/caga/output_schema.html @@ -0,0 +1,962 @@ + Test Output Schema

Test Output Schema

Type: object

This is a JSON schema for result data originating from Collision and Grounding Avoidance systems

Creationtime

Type: stringFormat: date-time

Date and Time that this file was created, in ISO 8601 format YYYY-MM-DDThh:mm:ssZ. This should be the simulation end time.


Example:

"2024-02-22T18:00:50.710068"
+

Default: null

The traffic situation that was simulated (input file). This should remain unmofidied.

Type: object

Title

Type: string

The title of the traffic situation


Example:

"overtaking_18"
+

Description

Type: string

A description of the traffic situation


Example:

"Crossing situation with 3 target vessels in the Oslofjord"
+

Situation starting time

Default: null

Starting time of the situation in ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: null

Example:

"2024-02-22T18:00:50.685826"
+

Own Ship data

Type: object

Own Ship data


Example:

{
+    "initial": {
+        "cog": 284.2,
+        "heading": 283.1,
+        "navStatus": "Under way using engine",
+        "position": {
+            "latitude": 51.2123,
+            "longitude": 11.2313
+        },
+        "sog": 12.3
+    },
+    "static": {
+        "height": 15.0,
+        "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+        "imo": null,
+        "length": 230.0,
+        "mmsi": 123456789,
+        "name": "RMS Titanic",
+        "shipType": "Fishing",
+        "width": 30.0
+    },
+    "waypoints": [
+        {
+            "data": {
+                "cog": {
+                    "interpMethod": "cosine",
+                    "mAfterLegChange": 500.0,
+                    "mBeforeLegChange": 500.0,
+                    "value": 200.0
+                },
+                "heading": null,
+                "sog": {
+                    "interpMethod": "linear",
+                    "mAfterLegChange": 100.0,
+                    "mBeforeLegChange": 100.0,
+                    "value": 12.3
+                }
+            },
+            "position": {
+                "latitude": 57.2343,
+                "longitude": 10.3432
+            },
+            "turnRadius": 500.0
+        }
+    ]
+}
+


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"59c9a773-8b81-4a7b-882f-052836d031e7"
+

Length

Type: number

Length of the ship in meters


Example:

230.0
+

Width

Type: number

Width of the ship in meters


Example:

30.0
+

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
+

Mmsi

Default: null

Maritime Mobile Service Identity (MMSI)

Type: integer

Value must be greater or equal to 100000000 and lesser or equal to 999999999

Type: null

Example:

123456789
+

Imo

Default: null

IMO Number

Type: integer

Value must be greater or equal to 1000000 and lesser or equal to 9999999

Type: null

Example:

1234567
+

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
+

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
+    "height": 15.0,
+    "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+    "imo": null,
+    "length": 230.0,
+    "mmsi": 123456789,
+    "name": "RMS Titanic",
+    "shipType": "Fishing",
+    "width": 30.0
+}
+

Initial own ship Initial

Type: object

Example:

{
+    "cog": 284.2,
+    "heading": 283.1,
+    "navStatus": "Under way using engine",
+    "position": {
+        "latitude": 51.2123,
+        "longitude": 11.2313
+    },
+    "sog": 12.3
+}
+

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

Initial ship speed over ground

Type: number

Initial ship speed over ground in knots

Value must be greater or equal to 0.0


Example:

10.0
+

Initial ship course over ground

Type: number

Initial ship course over ground in degrees

Value must be greater or equal to 0.0 and lesser or equal to 360.0


Example:

45.0
+

Initial ship heading

Default: null

Initial ship heading in degrees

Type: number

Value must be greater or equal to 0.0 and lesser or equal to 360.0

Type: null

Example:

45.2
+

Type: enum (of string)

AIS Navigational Status

Must be one of:

  • "Under way using engine"
  • "At anchor"
  • "Not under command"
  • "Restricted manoeuverability"
  • "Constrained by her draught"
  • "Moored"
  • "Aground"
  • "Engaged in fishing"
  • "Under way sailing"
  • "Reserved for future amendment of navigational status for HSC"
  • "Reserved for future amendment of navigational status for WIG"
  • "Reserved for future use 1"
  • "Reserved for future use 2"
  • "Reserved for future use 3"
  • "AIS SART is active"
  • "Not defined (default)"

Waypoints

Default: null

An array of Waypoint objects. Each waypoint object must have a position property.
If no turn radius is provided, it will be assumed to be 0.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status

Type: array
No Additional Items

Each item of this array must be:

Type: object

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

Turnradius

Type: number Default: 0

Orthodrome turn radius as defined in RTZ format


Example:

200
+

Type: object Default: null

A Data object that includes speed, course, and heading data points

Type: object Default: null

Speed data point


Example:

{
+    "interpMethod": "linear",
+    "mAfterLegChange": 100.0,
+    "mBeforeLegChange": 100.0,
+    "value": 12.3
+}
+

Value

Type: number

the value of the data at the current timestep


Example:

12.3
+

Mbeforelegchange

Type: number

meters before the waypoint to start interpolating to the new value


Example:

10
+

Mafterlegchange

Type: number

meters after the waypoint to finish interpolating to the new value


Example:

10
+

Interpmethod

Default: "linear"

Method used for interpolation

Type: enum (of string)

Must be one of:

  • "linear"
  • "cosine"
  • "smoothstep"
  • "accelerate"
  • "decelerate"
  • "ordinal"
Type: string

Type: object Default: null

Heading data point


Example:

{
+    "interpMethod": "linear",
+    "mAfterLegChange": 100.0,
+    "mBeforeLegChange": 100.0,
+    "value": 180.0
+}
+

Value

Type: number

the value of the data at the current timestep


Example:

12.3
+

Mbeforelegchange

Type: number

meters before the waypoint to start interpolating to the new value


Example:

10
+

Mafterlegchange

Type: number

meters after the waypoint to finish interpolating to the new value


Example:

10
+

Interpmethod

Default: "linear"

Method used for interpolation

Type: enum (of string)

Must be one of:

  • "linear"
  • "cosine"
  • "smoothstep"
  • "accelerate"
  • "decelerate"
  • "ordinal"
Type: string

Each additional property must conform to the following schema

Type: object

The 'data' field can include additional properties. All additional properties should be DataPoint objects.

Type: number

Type: number

Type: number

Type: string
Type: null

Example:

{
+    "data": {
+        "cog": {
+            "interpMethod": "cosine",
+            "mAfterLegChange": 500.0,
+            "mBeforeLegChange": 500.0,
+            "value": 200.0
+        },
+        "heading": null,
+        "sog": {
+            "interpMethod": "linear",
+            "mAfterLegChange": 100.0,
+            "mBeforeLegChange": 100.0,
+            "value": 12.3
+        }
+    },
+    "position": {
+        "latitude": 57.2343,
+        "longitude": 10.3432
+    },
+    "turnRadius": 500.0
+}
+

Target Ship data

Type: array Default: null

Target Ship data

No Additional Items

Each item of this array must be:

Type: object


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"59c9a773-8b81-4a7b-882f-052836d031e7"
+

Length

Type: number

Length of the ship in meters


Example:

230.0
+

Width

Type: number

Width of the ship in meters


Example:

30.0
+

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
+

Mmsi

Default: null

Maritime Mobile Service Identity (MMSI)

Type: integer

Value must be greater or equal to 100000000 and lesser or equal to 999999999

Type: null

Example:

123456789
+

Imo

Default: null

IMO Number

Type: integer

Value must be greater or equal to 1000000 and lesser or equal to 9999999

Type: null

Example:

1234567
+

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
+

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
+    "height": 15.0,
+    "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+    "imo": null,
+    "length": 230.0,
+    "mmsi": 123456789,
+    "name": "RMS Titanic",
+    "shipType": "Fishing",
+    "width": 30.0
+}
+

Initial own ship Initial

Type: object

Example:

{
+    "cog": 284.2,
+    "heading": 283.1,
+    "navStatus": "Under way using engine",
+    "position": {
+        "latitude": 51.2123,
+        "longitude": 11.2313
+    },
+    "sog": 12.3
+}
+

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

Initial ship speed over ground

Type: number

Initial ship speed over ground in knots

Value must be greater or equal to 0.0


Example:

10.0
+

Initial ship course over ground

Type: number

Initial ship course over ground in degrees

Value must be greater or equal to 0.0 and lesser or equal to 360.0


Example:

45.0
+

Initial ship heading

Default: null

Initial ship heading in degrees

Type: number

Value must be greater or equal to 0.0 and lesser or equal to 360.0

Type: null

Example:

45.2
+

Type: enum (of string)

AIS Navigational Status

Must be one of:

  • "Under way using engine"
  • "At anchor"
  • "Not under command"
  • "Restricted manoeuverability"
  • "Constrained by her draught"
  • "Moored"
  • "Aground"
  • "Engaged in fishing"
  • "Under way sailing"
  • "Reserved for future amendment of navigational status for HSC"
  • "Reserved for future amendment of navigational status for WIG"
  • "Reserved for future use 1"
  • "Reserved for future use 2"
  • "Reserved for future use 3"
  • "AIS SART is active"
  • "Not defined (default)"

Waypoints

Default: null

An array of Waypoint objects. Each waypoint object must have a position property.
If no turn radius is provided, it will be assumed to be 0.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status

Type: array
No Additional Items

Each item of this array must be:

Type: object

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

Turnradius

Type: number Default: 0

Orthodrome turn radius as defined in RTZ format


Example:

200
+

Type: object Default: null

A Data object that includes speed, course, and heading data points

Type: object Default: null

Speed data point


Example:

{
+    "interpMethod": "linear",
+    "mAfterLegChange": 100.0,
+    "mBeforeLegChange": 100.0,
+    "value": 12.3
+}
+

Value

Type: number

the value of the data at the current timestep


Example:

12.3
+

Mbeforelegchange

Type: number

meters before the waypoint to start interpolating to the new value


Example:

10
+

Mafterlegchange

Type: number

meters after the waypoint to finish interpolating to the new value


Example:

10
+

Interpmethod

Default: "linear"

Method used for interpolation

Type: enum (of string)

Must be one of:

  • "linear"
  • "cosine"
  • "smoothstep"
  • "accelerate"
  • "decelerate"
  • "ordinal"
Type: string

Type: object Default: null

Heading data point


Example:

{
+    "interpMethod": "linear",
+    "mAfterLegChange": 100.0,
+    "mBeforeLegChange": 100.0,
+    "value": 180.0
+}
+

Value

Type: number

the value of the data at the current timestep


Example:

12.3
+

Mbeforelegchange

Type: number

meters before the waypoint to start interpolating to the new value


Example:

10
+

Mafterlegchange

Type: number

meters after the waypoint to finish interpolating to the new value


Example:

10
+

Interpmethod

Default: "linear"

Method used for interpolation

Type: enum (of string)

Must be one of:

  • "linear"
  • "cosine"
  • "smoothstep"
  • "accelerate"
  • "decelerate"
  • "ordinal"
Type: string

Each additional property must conform to the following schema

Type: object

The 'data' field can include additional properties. All additional properties should be DataPoint objects.

Type: number

Type: number

Type: number

Type: string
Type: null

Example:

{
+    "data": {
+        "cog": {
+            "interpMethod": "cosine",
+            "mAfterLegChange": 500.0,
+            "mBeforeLegChange": 500.0,
+            "value": 200.0
+        },
+        "heading": null,
+        "sog": {
+            "interpMethod": "linear",
+            "mAfterLegChange": 100.0,
+            "mBeforeLegChange": 100.0,
+            "value": 12.3
+        }
+    },
+    "position": {
+        "latitude": 57.2343,
+        "longitude": 10.3432
+    },
+    "turnRadius": 500.0
+}
+

Example:

[
+    {
+        "initial": {
+            "cog": 284.2,
+            "heading": 283.1,
+            "navStatus": "Under way using engine",
+            "position": {
+                "latitude": 51.2123,
+                "longitude": 11.2313
+            },
+            "sog": 12.3
+        },
+        "static": {
+            "height": 15.0,
+            "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+            "imo": null,
+            "length": 230.0,
+            "mmsi": 123456789,
+            "name": "RMS Titanic",
+            "shipType": "Fishing",
+            "width": 30.0
+        },
+        "waypoints": [
+            {
+                "data": {
+                    "cog": {
+                        "interpMethod": "cosine",
+                        "mAfterLegChange": 500.0,
+                        "mBeforeLegChange": 500.0,
+                        "value": 200.0
+                    },
+                    "heading": null,
+                    "sog": {
+                        "interpMethod": "linear",
+                        "mAfterLegChange": 100.0,
+                        "mBeforeLegChange": 100.0,
+                        "value": 12.3
+                    }
+                },
+                "position": {
+                    "latitude": 57.2343,
+                    "longitude": 10.3432
+                },
+                "turnRadius": 500.0
+            }
+        ]
+    }
+]
+

Default: null

environmental parameters

Type: object

Airtemperature

Type: number Default: null

The air temperature in degrees Celsius


Example:

20.0
+

Waterremperature

Type: number Default: null

The water temperature in degrees Celsius


Example:

15.0
+

Type: enum (of string) Default: null

The type of precipitation

Must be one of:

  • "None"
  • "Rain"
  • "Snow"
  • "Sleet"
  • "Hail"

Example:

"Rain"
+

Windspeed

Type: number Default: null

The wind speed in m/s


Example:

10.0
+

Winddirection

Type: number Default: null

The wind direction in degrees


Example:

180.0
+

Currentspeed

Type: number Default: null

The current speed in m/s


Example:

1.0
+

Currentdirection

Type: number Default: null

The current direction in degrees


Example:

90.0
+

Type: enum (of string) Default: null

The wave spectrum

Must be one of:

  • "JONSWAP"
  • "Pierson-Moskowitz"
  • "Bretschneider"

Example:

"JONSWAP"
+

Significantwaveheight

Type: number Default: null

The significant wave height in meters


Example:

3.0
+

Waveperiod

Type: number Default: null

The wave period in seconds


Example:

12.0
+

Wavedirection

Type: number Default: null

The wave direction in degrees


Example:

270.0
+

Visibility

Type: number Default: null

The visibility in nautical miles


Example:

5.0
+

Type: enum (of string) Default: null

The overall weather conditions

Must be one of:

  • "Clear"
  • "Cloudy"
  • "Foggy"
  • "Rainy"
  • "Snowy"

Example:

"Clear"
+
Type: null

Example:

{
+    "airTemperature": 20.0,
+    "conditions": "Clear",
+    "currentDirection": 90.0,
+    "currentSpeed": 1.0,
+    "precipitation": "Rain",
+    "significantWaveHeight": 3.0,
+    "visibility": 5.0,
+    "waterRemperature": 15.0,
+    "waveDirection": 270.0,
+    "wavePeriod": 12.0,
+    "waveSpectrum": "JONSWAP",
+    "windDirection": 180.0,
+    "windSpeed": 10.0
+}
+

Additional Properties of any type are allowed.

Type: object
Type: null

Default: null

Data generated by the system under test (auto-navigation / collision and grounding avoidance system) during the scenario.

Type: object

Type: object

System Configuration


Example:

{
+    "automatic_manoeuver_acceptance_time": 7,
+    "critical_TCPA": 1000,
+    "manoeuver_delay": 20,
+    "minimum_distance_to_targets": 100,
+    "name": "AutoNavigation-System 1",
+    "safety_depth": 20,
+    "vendor": "CompanyABC",
+    "vendorAutomaticManoeuverAcceptanceTime": null,
+    "vendorCriticalTcpa": null,
+    "vendorManoeuverDelay": null,
+    "vendorMinimumDistanceToTargets": null,
+    "vendorSafetyDepth": null,
+    "version": "1.2.3"
+}
+

Name

Type: string

The name of the system


Example:

"AutoNavigation-System 1"
+

Version

Type: string

The software version


Example:

"1.2.3"
+

Vendor

Type: string

The name of the system vendor


Example:

"CompanyABC"
+

Vendorminimumdistancetotargets

Type: number Default: null

Minimum distance in meters that the system will keep to other Vessels


Example:

100
+

Vendorcriticaltcpa

Type: number Default: null

If the projected CPA is less than minimumDistanceToTargets, and TCPA falls below criticalTCPA, a new manoeuver should be calculated


Example:

1000
+

Vendormanoeuverdelay

Type: number Default: null

Time given in seconds to the navigator / system, before the proposed manoeuver is no longer able to be excecuted


Example:

20
+

Vendorsafetydepth

Type: number Default: null

Minimum safety depth


Example:

30
+

Vendorautomaticmanoeuveracceptancetime

Type: number Default: null

If automatic maneuver acceptance is enabled, the new route will be activated after a specified number of seconds


Example:

20
+

Additional Properties of any type are allowed.

Type: object

Timeseriesdata

Type: array

Time series data from the system

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:00:50.701810"
+

Targetships

Type: array

list of target ships detected by the CAGA system

No Additional Items

Each item of this array must be:

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"e576d68d-20df-4c72-bda5-2d5577051cc3"
+

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

ship speed over ground

Type: number

Initial ship speed over ground in knots

Value must be greater or equal to 0.0


Example:

10.0
+

ship course over ground

Type: number

Initial ship course over ground in degrees

Value must be greater or equal to 0.0 and lesser or equal to 360.0


Example:

45.0
+

ship heading

Default: null

Initial ship heading in degrees

Type: number

Value must be greater or equal to 0.0 and lesser or equal to 360.0

Type: null

Example:

45.2
+

Type: enum (of string) Default: null

AIS Navigational Status

Must be one of:

  • "Under way using engine"
  • "At anchor"
  • "Not under command"
  • "Restricted manoeuverability"
  • "Constrained by her draught"
  • "Moored"
  • "Aground"
  • "Engaged in fishing"
  • "Under way sailing"
  • "Reserved for future amendment of navigational status for HSC"
  • "Reserved for future amendment of navigational status for WIG"
  • "Reserved for future use 1"
  • "Reserved for future use 2"
  • "Reserved for future use 3"
  • "AIS SART is active"
  • "Not defined (default)"

Default: null

COLREG encounter type

Type: enum (of string)

Must be one of:

  • "Overtaking stand-on"
  • "Overtaking give-way"
  • "Head-on"
  • "Crossing give-way"
  • "Crossing stand-on"
  • "No Risk"
Type: null

Example:

"Overtaking stand-on"
+

Colregrulesapplied

Type: array of integer Default: null

COLREG rules the system is applying to the vessel. Each item in the list must be of type int corresponding to the COLREG rule number

No Additional Items

Each item of this array must be:

Type: integer

Example:

[
+    16,
+    17
+]
+

Distancetotarget

Type: number Default: null

Calculated distance from the own ship to the target vessel


Example:

1900.2
+

Dcpa

Default: null

Calculated closest point of approach

Type: number
Type: null

Example:

100.3
+

Tcpa

Default: null

calculated time to closest point of approach in seconds

Type: number
Type: null

Example:

2131
+

Predictions

Type: object Default: null

List of predicted future values. This can be used to store data like a predicted path for each target vessel. The value field supports both numbers and objects


Example:

[
+    {
+        "time": "2024-02-22T18:00:50.693574",
+        "value": {
+            "latitude": 57.2343,
+            "longitude": 10.3432
+        }
+    },
+    {
+        "time": "2024-02-22T18:01:00.693574",
+        "value": {
+            "latitude": 57.2345,
+            "longitude": 10.3432
+        }
+    },
+    {
+        "time": "2024-02-22T18:01:10.693574",
+        "value": {
+            "latitude": 57.2349,
+            "longitude": 10.343
+        }
+    }
+]
+

Each additional property must conform to the following schema

Type: array
No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:00:50.693574"
+

Value


Value of the prediction

Type: number
Type: object

Examples:

{
+    "latitude": 57.2343,
+    "longitude": 10.3432
+}
+
100
+

Additional Properties of any type are allowed.

Type: object

Example:

[
+    {
+        "cog": 181.0,
+        "colregRulesApplied": [
+            12
+        ],
+        "dcpa": 300.0,
+        "distanceToTarget": 874.0,
+        "encounterType": "Head-on",
+        "heading": null,
+        "id": "d49ffb39-5f08-4edf-82ad-9b2dd642e1c7",
+        "navStatus": "Under way using engine",
+        "position": {
+            "latitude": 57.2343,
+            "longitude": 10.3432
+        },
+        "predictions": {
+            "position": [
+                {
+                    "time": "2024-02-22T18:00:50.693574",
+                    "value": {
+                        "latitude": 57.2343,
+                        "longitude": 10.3432
+                    }
+                },
+                {
+                    "time": "2024-02-22T18:01:00.693574",
+                    "value": {
+                        "latitude": 57.2345,
+                        "longitude": 10.3432
+                    }
+                },
+                {
+                    "time": "2024-02-22T18:01:10.693574",
+                    "value": {
+                        "latitude": 57.2349,
+                        "longitude": 10.343
+                    }
+                }
+            ]
+        },
+        "sog": 10.2,
+        "tcpa": 1200.0
+    }
+]
+

Internalstatus

Type: object Default: null

Dictionary containing additional internal information about the system (health, status..)


Example:

[
+    {
+        "internalStatus": null,
+        "targetShips": [
+            {
+                "cog": 181.0,
+                "colregRulesApplied": [
+                    12
+                ],
+                "dcpa": 300.0,
+                "distanceToTarget": 874.0,
+                "encounterType": "Head-on",
+                "heading": null,
+                "id": "d49ffb39-5f08-4edf-82ad-9b2dd642e1c7",
+                "navStatus": "Under way using engine",
+                "position": {
+                    "latitude": 57.2343,
+                    "longitude": 10.3432
+                },
+                "predictions": {
+                    "position": [
+                        {
+                            "time": "2024-02-22T18:00:50.693574",
+                            "value": {
+                                "latitude": 57.2343,
+                                "longitude": 10.3432
+                            }
+                        },
+                        {
+                            "time": "2024-02-22T18:01:00.693574",
+                            "value": {
+                                "latitude": 57.2345,
+                                "longitude": 10.3432
+                            }
+                        },
+                        {
+                            "time": "2024-02-22T18:01:10.693574",
+                            "value": {
+                                "latitude": 57.2349,
+                                "longitude": 10.343
+                            }
+                        }
+                    ]
+                },
+                "sog": 10.2,
+                "tcpa": 1200.0
+            }
+        ],
+        "time": "2024-02-22T18:00:50.701810"
+    }
+]
+

Eventdata

Type: array Default: null

Event data from the system

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the event

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:00:50.701810"
+

Route

Type: array Default: null

Planned CAGA Route

No Additional Items

Each item of this array must be:

Type: object

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

Turnradius

Type: number Default: 0

Orthodrome turn radius as defined in RTZ format


Example:

200
+

Type: object Default: null

A Data object that includes speed, course, and heading data points

Type: object Default: null

Speed data point


Example:

{
+    "interpMethod": "linear",
+    "mAfterLegChange": 100.0,
+    "mBeforeLegChange": 100.0,
+    "value": 12.3
+}
+

Value

Type: number

the value of the data at the current timestep


Example:

12.3
+

Mbeforelegchange

Type: number

meters before the waypoint to start interpolating to the new value


Example:

10
+

Mafterlegchange

Type: number

meters after the waypoint to finish interpolating to the new value


Example:

10
+

Interpmethod

Default: "linear"

Method used for interpolation

Type: enum (of string)

Must be one of:

  • "linear"
  • "cosine"
  • "smoothstep"
  • "accelerate"
  • "decelerate"
  • "ordinal"
Type: string

Type: object Default: null

Heading data point


Example:

{
+    "interpMethod": "linear",
+    "mAfterLegChange": 100.0,
+    "mBeforeLegChange": 100.0,
+    "value": 180.0
+}
+

Value

Type: number

the value of the data at the current timestep


Example:

12.3
+

Mbeforelegchange

Type: number

meters before the waypoint to start interpolating to the new value


Example:

10
+

Mafterlegchange

Type: number

meters after the waypoint to finish interpolating to the new value


Example:

10
+

Interpmethod

Default: "linear"

Method used for interpolation

Type: enum (of string)

Must be one of:

  • "linear"
  • "cosine"
  • "smoothstep"
  • "accelerate"
  • "decelerate"
  • "ordinal"
Type: string

Each additional property must conform to the following schema

Type: object

The 'data' field can include additional properties. All additional properties should be DataPoint objects.

Type: number

Type: number

Type: number

Type: string

Example:

[
+    {
+        "data": {
+            "cog": {
+                "interpMethod": "cosine",
+                "mAfterLegChange": 500.0,
+                "mBeforeLegChange": 500.0,
+                "value": 200.0
+            },
+            "heading": null,
+            "sog": {
+                "interpMethod": "linear",
+                "mAfterLegChange": 100.0,
+                "mBeforeLegChange": 100.0,
+                "value": 12.3
+            }
+        },
+        "position": {
+            "latitude": 57.2343,
+            "longitude": 10.3432
+        },
+        "turnRadius": 500.0
+    },
+    {
+        "data": {
+            "heading": null,
+            "sog": {
+                "interpMethod": "linear",
+                "mAfterLegChange": 100.0,
+                "mBeforeLegChange": 100.0,
+                "value": 12.3
+            }
+        },
+        "position": {
+            "latitude": 57.2345,
+            "longitude": 10.3432
+        },
+        "turnRadius": 500.0
+    },
+    {
+        "data": {
+            "heading": null,
+            "sog": {
+                "interpMethod": "linear",
+                "mAfterLegChange": 100.0,
+                "mBeforeLegChange": 100.0,
+                "value": 12.3
+            }
+        },
+        "position": {
+            "latitude": 57.2349,
+            "longitude": 10.343
+        },
+        "turnRadius": 500.0
+    }
+]
+

Additional Properties of any type are allowed.

Type: object

Example:

[
+    {
+        "route": [
+            {
+                "data": {
+                    "cog": {
+                        "interpMethod": "cosine",
+                        "mAfterLegChange": 500.0,
+                        "mBeforeLegChange": 500.0,
+                        "value": 200.0
+                    },
+                    "heading": null,
+                    "sog": {
+                        "interpMethod": "linear",
+                        "mAfterLegChange": 100.0,
+                        "mBeforeLegChange": 100.0,
+                        "value": 12.3
+                    }
+                },
+                "position": {
+                    "latitude": 57.2343,
+                    "longitude": 10.3432
+                },
+                "turnRadius": 500.0
+            },
+            {
+                "data": {
+                    "heading": null,
+                    "sog": {
+                        "interpMethod": "linear",
+                        "mAfterLegChange": 100.0,
+                        "mBeforeLegChange": 100.0,
+                        "value": 12.3
+                    }
+                },
+                "position": {
+                    "latitude": 57.2345,
+                    "longitude": 10.3432
+                },
+                "turnRadius": 500.0
+            },
+            {
+                "data": {
+                    "heading": null,
+                    "sog": {
+                        "interpMethod": "linear",
+                        "mAfterLegChange": 100.0,
+                        "mBeforeLegChange": 100.0,
+                        "value": 12.3
+                    }
+                },
+                "position": {
+                    "latitude": 57.2349,
+                    "longitude": 10.343
+                },
+                "turnRadius": 500.0
+            }
+        ],
+        "time": "2024-02-22T18:00:50.701810"
+    }
+]
+
Type: null

Example:

{
+    "configuration": {
+        "automatic_manoeuver_acceptance_time": 7,
+        "critical_TCPA": 1000,
+        "manoeuver_delay": 20,
+        "minimum_distance_to_targets": 100,
+        "name": "AutoNavigation-System 1",
+        "safety_depth": 20,
+        "vendor": "CompanyABC",
+        "vendorAutomaticManoeuverAcceptanceTime": null,
+        "vendorCriticalTcpa": null,
+        "vendorManoeuverDelay": null,
+        "vendorMinimumDistanceToTargets": null,
+        "vendorSafetyDepth": null,
+        "version": "1.2.3"
+    },
+    "eventData": [
+        {
+            "route": [
+                {
+                    "data": {
+                        "cog": {
+                            "interpMethod": "cosine",
+                            "mAfterLegChange": 500.0,
+                            "mBeforeLegChange": 500.0,
+                            "value": 200.0
+                        },
+                        "heading": null,
+                        "sog": {
+                            "interpMethod": "linear",
+                            "mAfterLegChange": 100.0,
+                            "mBeforeLegChange": 100.0,
+                            "value": 12.3
+                        }
+                    },
+                    "position": {
+                        "latitude": 57.2343,
+                        "longitude": 10.3432
+                    },
+                    "turnRadius": 500.0
+                },
+                {
+                    "data": {
+                        "heading": null,
+                        "sog": {
+                            "interpMethod": "linear",
+                            "mAfterLegChange": 100.0,
+                            "mBeforeLegChange": 100.0,
+                            "value": 12.3
+                        }
+                    },
+                    "position": {
+                        "latitude": 57.2345,
+                        "longitude": 10.3432
+                    },
+                    "turnRadius": 500.0
+                },
+                {
+                    "data": {
+                        "heading": null,
+                        "sog": {
+                            "interpMethod": "linear",
+                            "mAfterLegChange": 100.0,
+                            "mBeforeLegChange": 100.0,
+                            "value": 12.3
+                        }
+                    },
+                    "position": {
+                        "latitude": 57.2349,
+                        "longitude": 10.343
+                    },
+                    "turnRadius": 500.0
+                }
+            ],
+            "time": "2024-02-22T18:00:50.701810"
+        }
+    ],
+    "timeSeriesData": [
+        {
+            "internalStatus": null,
+            "targetShips": [
+                {
+                    "cog": 181.0,
+                    "colregRulesApplied": [
+                        12
+                    ],
+                    "dcpa": 300.0,
+                    "distanceToTarget": 874.0,
+                    "encounterType": "Head-on",
+                    "heading": null,
+                    "id": "d49ffb39-5f08-4edf-82ad-9b2dd642e1c7",
+                    "navStatus": "Under way using engine",
+                    "position": {
+                        "latitude": 57.2343,
+                        "longitude": 10.3432
+                    },
+                    "predictions": {
+                        "position": [
+                            {
+                                "time": "2024-02-22T18:00:50.693574",
+                                "value": {
+                                    "latitude": 57.2343,
+                                    "longitude": 10.3432
+                                }
+                            },
+                            {
+                                "time": "2024-02-22T18:01:00.693574",
+                                "value": {
+                                    "latitude": 57.2345,
+                                    "longitude": 10.3432
+                                }
+                            },
+                            {
+                                "time": "2024-02-22T18:01:10.693574",
+                                "value": {
+                                    "latitude": 57.2349,
+                                    "longitude": 10.343
+                                }
+                            }
+                        ]
+                    },
+                    "sog": 10.2,
+                    "tcpa": 1200.0
+                }
+            ],
+            "time": "2024-02-22T18:00:50.701810"
+        }
+    ]
+}
+

Default: null

Data generated by the simulator duirng the scenario

Type: object

Type: object

Simulator software configuration


Example:

{
+    "name": "Simulator-System 1",
+    "vendor": "CompanyABC",
+    "version": "1.2.3"
+}
+

Name

Type: string

The name of the system


Example:

"AutoNavigation-System 1"
+

Version

Type: string

The software version


Example:

"1.2.3"
+

Vendor

Type: string

The name of the system vendor


Example:

"CompanyABC"
+

Additional Properties of any type are allowed.

Type: object

Timeseriesdata

Type: array

TimeSeries data originating from the Simulator

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:00:50.701810"
+

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"a1ce93f7-e3ed-4969-afe1-86730c80ae47"
+

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

ship speed over ground

Type: number

Initial ship speed over ground in knots

Value must be greater or equal to 0.0


Example:

10.0
+

ship course over ground

Type: number

Initial ship course over ground in degrees

Value must be greater or equal to 0.0 and lesser or equal to 360.0


Example:

45.0
+

ship heading

Default: null

Initial ship heading in degrees

Type: number

Value must be greater or equal to 0.0 and lesser or equal to 360.0

Type: null

Example:

45.2
+

Type: enum (of string)

AIS Navigational Status

Must be one of:

  • "Under way using engine"
  • "At anchor"
  • "Not under command"
  • "Restricted manoeuverability"
  • "Constrained by her draught"
  • "Moored"
  • "Aground"
  • "Engaged in fishing"
  • "Under way sailing"
  • "Reserved for future amendment of navigational status for HSC"
  • "Reserved for future amendment of navigational status for WIG"
  • "Reserved for future use 1"
  • "Reserved for future use 2"
  • "Reserved for future use 3"
  • "AIS SART is active"
  • "Not defined (default)"

Acceleration

Type: number Default: null

Ship acceleration in ms^-2


Example:

0.01
+

Rateofturn

Type: number Default: null

Ship rate of turn in deg/s


Example:

1.8
+

Additional Properties of any type are allowed.

Type: object

Targetships

Type: array
No Additional Items

Each item of this array must be:

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"a1ce93f7-e3ed-4969-afe1-86730c80ae47"
+

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
+    "latitude": 51.2123,
+    "longitude": 11.2313
+}
+

Latitude

Type: number

WGS-84 latitude

Value must be greater or equal to -90.0 and lesser or equal to 90.0


Example:

51.2131
+

Longitude

Type: number

WGS-84 longitude

Value must be greater or equal to -180.0 and lesser or equal to 180.0


Example:

11.2131
+

ship speed over ground

Type: number

Initial ship speed over ground in knots

Value must be greater or equal to 0.0


Example:

10.0
+

ship course over ground

Type: number

Initial ship course over ground in degrees

Value must be greater or equal to 0.0 and lesser or equal to 360.0


Example:

45.0
+

ship heading

Default: null

Initial ship heading in degrees

Type: number

Value must be greater or equal to 0.0 and lesser or equal to 360.0

Type: null

Example:

45.2
+

Type: enum (of string)

AIS Navigational Status

Must be one of:

  • "Under way using engine"
  • "At anchor"
  • "Not under command"
  • "Restricted manoeuverability"
  • "Constrained by her draught"
  • "Moored"
  • "Aground"
  • "Engaged in fishing"
  • "Under way sailing"
  • "Reserved for future amendment of navigational status for HSC"
  • "Reserved for future amendment of navigational status for WIG"
  • "Reserved for future use 1"
  • "Reserved for future use 2"
  • "Reserved for future use 3"
  • "AIS SART is active"
  • "Not defined (default)"

Acceleration

Type: number Default: null

Ship acceleration in ms^-2


Example:

0.01
+

Rateofturn

Type: number Default: null

Ship rate of turn in deg/s


Example:

1.8
+

Additional Properties of any type are allowed.

Type: object

Example:

[
+    {
+        "ownShip": {
+            "acceleration": null,
+            "cog": 97.0,
+            "heading": null,
+            "id": "37750be4-1653-4be2-a918-c1cac7abbeee",
+            "mmsi": 987654321,
+            "navStatus": "Under way using engine",
+            "position": {
+                "latitude": 57.2345,
+                "longitude": 10.3432
+            },
+            "rateOfTurn": 3.0,
+            "sog": 20.0
+        },
+        "targetShips": [
+            {
+                "acceleration": 0.01,
+                "cog": 181.0,
+                "heading": null,
+                "id": "e9d221bc-8379-4ee8-aaa7-dbca25602850",
+                "navStatus": "Engaged in fishing",
+                "position": {
+                    "latitude": 57.2343,
+                    "longitude": 10.3432
+                },
+                "rateOfTurn": 1.0,
+                "sog": 10.0
+            },
+            {
+                "acceleration": null,
+                "cog": 7.0,
+                "heading": null,
+                "id": "44ac0396-d5a8-4f71-8f2e-e5d9376cb60f",
+                "mmsi": 123456789,
+                "navStatus": "Under way using engine",
+                "position": {
+                    "latitude": 57.2349,
+                    "longitude": 10.343
+                },
+                "rateOfTurn": 0.0,
+                "sog": 14.0
+            }
+        ],
+        "time": "2024-02-22T18:00:50.701810"
+    },
+    {
+        "ownShip": {
+            "acceleration": null,
+            "cog": 97.0,
+            "heading": null,
+            "id": "37750be4-1653-4be2-a918-c1cac7abbeee",
+            "mmsi": 987654321,
+            "navStatus": "Under way using engine",
+            "position": {
+                "latitude": 57.2345,
+                "longitude": 10.3432
+            },
+            "rateOfTurn": 3.0,
+            "sog": 20.0
+        },
+        "targetShips": [
+            {
+                "acceleration": 0.01,
+                "cog": 181.0,
+                "heading": null,
+                "id": "e9d221bc-8379-4ee8-aaa7-dbca25602850",
+                "navStatus": "Engaged in fishing",
+                "position": {
+                    "latitude": 57.2343,
+                    "longitude": 10.3432
+                },
+                "rateOfTurn": 1.0,
+                "sog": 10.0
+            },
+            {
+                "acceleration": null,
+                "cog": 7.0,
+                "heading": null,
+                "id": "44ac0396-d5a8-4f71-8f2e-e5d9376cb60f",
+                "mmsi": 123456789,
+                "navStatus": "Under way using engine",
+                "position": {
+                    "latitude": 57.2349,
+                    "longitude": 10.343
+                },
+                "rateOfTurn": 0.0,
+                "sog": 14.0
+            }
+        ],
+        "time": "2024-02-22T18:01:00.701810"
+    }
+]
+

Eventdata

Type: array Default: null

Event data from the simulator

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the event

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:00:50.701810"
+

Additional Properties of any type are allowed.

Type: object
Type: null

Example:

{
+    "configuration": {
+        "name": "Simulator-System 1",
+        "vendor": "CompanyABC",
+        "version": "1.2.3"
+    },
+    "eventData": null,
+    "timeSeriesData": [
+        {
+            "ownShip": {
+                "acceleration": null,
+                "cog": 97.0,
+                "heading": null,
+                "id": "37750be4-1653-4be2-a918-c1cac7abbeee",
+                "mmsi": 987654321,
+                "navStatus": "Under way using engine",
+                "position": {
+                    "latitude": 57.2345,
+                    "longitude": 10.3432
+                },
+                "rateOfTurn": 3.0,
+                "sog": 20.0
+            },
+            "targetShips": [
+                {
+                    "acceleration": 0.01,
+                    "cog": 181.0,
+                    "heading": null,
+                    "id": "e9d221bc-8379-4ee8-aaa7-dbca25602850",
+                    "navStatus": "Engaged in fishing",
+                    "position": {
+                        "latitude": 57.2343,
+                        "longitude": 10.3432
+                    },
+                    "rateOfTurn": 1.0,
+                    "sog": 10.0
+                },
+                {
+                    "acceleration": null,
+                    "cog": 7.0,
+                    "heading": null,
+                    "id": "44ac0396-d5a8-4f71-8f2e-e5d9376cb60f",
+                    "mmsi": 123456789,
+                    "navStatus": "Under way using engine",
+                    "position": {
+                        "latitude": 57.2349,
+                        "longitude": 10.343
+                    },
+                    "rateOfTurn": 0.0,
+                    "sog": 14.0
+                }
+            ],
+            "time": "2024-02-22T18:00:50.701810"
+        },
+        {
+            "ownShip": {
+                "acceleration": null,
+                "cog": 97.0,
+                "heading": null,
+                "id": "37750be4-1653-4be2-a918-c1cac7abbeee",
+                "mmsi": 987654321,
+                "navStatus": "Under way using engine",
+                "position": {
+                    "latitude": 57.2345,
+                    "longitude": 10.3432
+                },
+                "rateOfTurn": 3.0,
+                "sog": 20.0
+            },
+            "targetShips": [
+                {
+                    "acceleration": 0.01,
+                    "cog": 181.0,
+                    "heading": null,
+                    "id": "e9d221bc-8379-4ee8-aaa7-dbca25602850",
+                    "navStatus": "Engaged in fishing",
+                    "position": {
+                        "latitude": 57.2343,
+                        "longitude": 10.3432
+                    },
+                    "rateOfTurn": 1.0,
+                    "sog": 10.0
+                },
+                {
+                    "acceleration": null,
+                    "cog": 7.0,
+                    "heading": null,
+                    "id": "44ac0396-d5a8-4f71-8f2e-e5d9376cb60f",
+                    "mmsi": 123456789,
+                    "navStatus": "Under way using engine",
+                    "position": {
+                        "latitude": 57.2349,
+                        "longitude": 10.343
+                    },
+                    "rateOfTurn": 0.0,
+                    "sog": 14.0
+                }
+            ],
+            "time": "2024-02-22T18:01:00.701810"
+        }
+    ]
+}
+

Additional Properties of any type are allowed.

Type: object
\ No newline at end of file From c2fff41f4128deeae0d3e177d96242acd3b7c0a1 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:11:43 +0100 Subject: [PATCH 24/36] utils.publish.generate_schema(): improved formatting of exported json schemata. The json files are now indented, hence easier to read by humans. --- src/maritime_schema/utils/publish.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/maritime_schema/utils/publish.py b/src/maritime_schema/utils/publish.py index 893ac00..5cb9e2a 100644 --- a/src/maritime_schema/utils/publish.py +++ b/src/maritime_schema/utils/publish.py @@ -59,7 +59,10 @@ def generate_schema( # Generate json schema json_file: Path = schema_dir / f"{name}.json" - schema = json.dumps(model.model_json_schema(by_alias=by_alias)) # pyright: ignore + schema = json.dumps( + model.model_json_schema(by_alias=by_alias), # pyright: ignore + indent=4, + ) with open(json_file, "w", encoding="utf-8") as f: _ = f.write(schema) From 0429a5069874402f9fa2586a84cbc8edd53c4552 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:11:58 +0100 Subject: [PATCH 25/36] schema re-generated --- docs/source/schema/caga/input_schema.html | 16 +- docs/source/schema/caga/output_schema.html | 104 +- .../schema/caga/input_schema.json | 976 ++++++- .../schema/caga/output_schema.json | 2279 ++++++++++++++++- 4 files changed, 3313 insertions(+), 62 deletions(-) diff --git a/docs/source/schema/caga/input_schema.html b/docs/source/schema/caga/input_schema.html index 4c43e0b..139e9cd 100644 --- a/docs/source/schema/caga/input_schema.html +++ b/docs/source/schema/caga/input_schema.html @@ -1,6 +1,6 @@ Test Input Schema

Test Input Schema

Type: object

Title

Type: string

The title of the traffic situation


Example:

"overtaking_18"
 

Description

Type: string

A description of the traffic situation


Example:

"Crossing situation with 3 target vessels in the Oslofjord"
-

Situation starting time

Default: null

Starting time of the situation in ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: null

Example:

"2024-02-22T18:00:50.685826"
+

Situation starting time

Default: null

Starting time of the situation in ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: null

Example:

"2024-02-22T18:09:43.984842"
 

Own Ship data

Type: object

Own Ship data


Example:

{
     "initial": {
         "cog": 284.2,
@@ -14,7 +14,7 @@
     },
     "static": {
         "height": 15.0,
-        "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+        "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
         "imo": null,
         "length": 230.0,
         "mmsi": 123456789,
@@ -47,7 +47,7 @@
         }
     ]
 }
-


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"59c9a773-8b81-4a7b-882f-052836d031e7"
+


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"0a9d3443-d305-4c28-a41b-09ed3f167254"
 

Length

Type: number

Length of the ship in meters


Example:

230.0
 

Width

Type: number

Width of the ship in meters


Example:

30.0
 

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
@@ -56,7 +56,7 @@
 

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
 

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
     "height": 15.0,
-    "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+    "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
     "imo": null,
     "length": 230.0,
     "mmsi": 123456789,
@@ -130,7 +130,7 @@
     },
     "turnRadius": 500.0
 }
-

Target Ship data

Type: array Default: null

Target Ship data

No Additional Items

Each item of this array must be:

Type: object


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"59c9a773-8b81-4a7b-882f-052836d031e7"
+

Target Ship data

Type: array Default: null

Target Ship data

No Additional Items

Each item of this array must be:

Type: object


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"0a9d3443-d305-4c28-a41b-09ed3f167254"
 

Length

Type: number

Length of the ship in meters


Example:

230.0
 

Width

Type: number

Width of the ship in meters


Example:

30.0
 

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
@@ -139,7 +139,7 @@
 

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
 

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
     "height": 15.0,
-    "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+    "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
     "imo": null,
     "length": 230.0,
     "mmsi": 123456789,
@@ -227,7 +227,7 @@
         },
         "static": {
             "height": 15.0,
-            "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+            "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
             "imo": null,
             "length": 230.0,
             "mmsi": 123456789,
@@ -289,4 +289,4 @@
     "windDirection": 180.0,
     "windSpeed": 10.0
 }
-

Additional Properties of any type are allowed.

Type: object
\ No newline at end of file +

Additional Properties of any type are allowed.

Type: object
\ No newline at end of file diff --git a/docs/source/schema/caga/output_schema.html b/docs/source/schema/caga/output_schema.html index 086653c..01b99f8 100644 --- a/docs/source/schema/caga/output_schema.html +++ b/docs/source/schema/caga/output_schema.html @@ -1,7 +1,7 @@ - Test Output Schema

Test Output Schema

Type: object

This is a JSON schema for result data originating from Collision and Grounding Avoidance systems

Creationtime

Type: stringFormat: date-time

Date and Time that this file was created, in ISO 8601 format YYYY-MM-DDThh:mm:ssZ. This should be the simulation end time.


Example:

"2024-02-22T18:00:50.710068"
+ Test Output Schema 

Test Output Schema

Type: object

This is a JSON schema for result data originating from Collision and Grounding Avoidance systems

Creationtime

Type: stringFormat: date-time

Date and Time that this file was created, in ISO 8601 format YYYY-MM-DDThh:mm:ssZ. This should be the simulation end time.


Example:

"2024-02-22T18:09:44.004768"
 

Default: null

The traffic situation that was simulated (input file). This should remain unmofidied.

Type: object

Title

Type: string

The title of the traffic situation


Example:

"overtaking_18"
 

Description

Type: string

A description of the traffic situation


Example:

"Crossing situation with 3 target vessels in the Oslofjord"
-

Situation starting time

Default: null

Starting time of the situation in ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: null

Example:

"2024-02-22T18:00:50.685826"
+

Situation starting time

Default: null

Starting time of the situation in ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: null

Example:

"2024-02-22T18:09:43.984842"
 

Own Ship data

Type: object

Own Ship data


Example:

{
     "initial": {
         "cog": 284.2,
@@ -15,7 +15,7 @@
     },
     "static": {
         "height": 15.0,
-        "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+        "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
         "imo": null,
         "length": 230.0,
         "mmsi": 123456789,
@@ -48,7 +48,7 @@
         }
     ]
 }
-


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"59c9a773-8b81-4a7b-882f-052836d031e7"
+


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"0a9d3443-d305-4c28-a41b-09ed3f167254"
 

Length

Type: number

Length of the ship in meters


Example:

230.0
 

Width

Type: number

Width of the ship in meters


Example:

30.0
 

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
@@ -57,7 +57,7 @@
 

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
 

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
     "height": 15.0,
-    "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+    "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
     "imo": null,
     "length": 230.0,
     "mmsi": 123456789,
@@ -131,7 +131,7 @@
     },
     "turnRadius": 500.0
 }
-

Target Ship data

Type: array Default: null

Target Ship data

No Additional Items

Each item of this array must be:

Type: object


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"59c9a773-8b81-4a7b-882f-052836d031e7"
+

Target Ship data

Type: array Default: null

Target Ship data

No Additional Items

Each item of this array must be:

Type: object


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"0a9d3443-d305-4c28-a41b-09ed3f167254"
 

Length

Type: number

Length of the ship in meters


Example:

230.0
 

Width

Type: number

Width of the ship in meters


Example:

30.0
 

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
@@ -140,7 +140,7 @@
 

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
 

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
     "height": 15.0,
-    "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+    "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
     "imo": null,
     "length": 230.0,
     "mmsi": 123456789,
@@ -228,7 +228,7 @@
         },
         "static": {
             "height": 15.0,
-            "id": "ec890dd9-52cc-40c4-bcd0-828cf0c65a95",
+            "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
             "imo": null,
             "length": 230.0,
             "mmsi": 123456789,
@@ -313,8 +313,8 @@
 

Vendormanoeuverdelay

Type: number Default: null

Time given in seconds to the navigator / system, before the proposed manoeuver is no longer able to be excecuted


Example:

20
 

Vendorsafetydepth

Type: number Default: null

Minimum safety depth


Example:

30
 

Vendorautomaticmanoeuveracceptancetime

Type: number Default: null

If automatic maneuver acceptance is enabled, the new route will be activated after a specified number of seconds


Example:

20
-

Additional Properties of any type are allowed.

Type: object

Timeseriesdata

Type: array

Time series data from the system

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:00:50.701810"
-

Targetships

Type: array

list of target ships detected by the CAGA system

No Additional Items

Each item of this array must be:

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"e576d68d-20df-4c72-bda5-2d5577051cc3"
+

Additional Properties of any type are allowed.

Type: object

Timeseriesdata

Type: array

Time series data from the system

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:09:43.995843"
+

Targetships

Type: array

list of target ships detected by the CAGA system

No Additional Items

Each item of this array must be:

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"a8c08c4a-12c3-4f75-94e9-05f43df79e3b"
 

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
     "latitude": 51.2123,
     "longitude": 11.2313
@@ -334,28 +334,28 @@
 

Tcpa

Default: null

calculated time to closest point of approach in seconds

Type: number
Type: null

Example:

2131
 

Predictions

Type: object Default: null

List of predicted future values. This can be used to store data like a predicted path for each target vessel. The value field supports both numbers and objects


Example:

[
     {
-        "time": "2024-02-22T18:00:50.693574",
+        "time": "2024-02-22T18:09:43.990808",
         "value": {
             "latitude": 57.2343,
             "longitude": 10.3432
         }
     },
     {
-        "time": "2024-02-22T18:01:00.693574",
+        "time": "2024-02-22T18:09:53.990808",
         "value": {
             "latitude": 57.2345,
             "longitude": 10.3432
         }
     },
     {
-        "time": "2024-02-22T18:01:10.693574",
+        "time": "2024-02-22T18:10:03.990808",
         "value": {
             "latitude": 57.2349,
             "longitude": 10.343
         }
     }
 ]
-

Each additional property must conform to the following schema

Type: array
No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:00:50.693574"
+

Each additional property must conform to the following schema

Type: array
No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:09:43.989767"
 

Value


Value of the prediction

Type: number
Type: object

Examples:

{
     "latitude": 57.2343,
     "longitude": 10.3432
@@ -371,7 +371,7 @@
         "distanceToTarget": 874.0,
         "encounterType": "Head-on",
         "heading": null,
-        "id": "d49ffb39-5f08-4edf-82ad-9b2dd642e1c7",
+        "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f",
         "navStatus": "Under way using engine",
         "position": {
             "latitude": 57.2343,
@@ -380,21 +380,21 @@
         "predictions": {
             "position": [
                 {
-                    "time": "2024-02-22T18:00:50.693574",
+                    "time": "2024-02-22T18:09:43.990808",
                     "value": {
                         "latitude": 57.2343,
                         "longitude": 10.3432
                     }
                 },
                 {
-                    "time": "2024-02-22T18:01:00.693574",
+                    "time": "2024-02-22T18:09:53.990808",
                     "value": {
                         "latitude": 57.2345,
                         "longitude": 10.3432
                     }
                 },
                 {
-                    "time": "2024-02-22T18:01:10.693574",
+                    "time": "2024-02-22T18:10:03.990808",
                     "value": {
                         "latitude": 57.2349,
                         "longitude": 10.343
@@ -419,7 +419,7 @@
                 "distanceToTarget": 874.0,
                 "encounterType": "Head-on",
                 "heading": null,
-                "id": "d49ffb39-5f08-4edf-82ad-9b2dd642e1c7",
+                "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f",
                 "navStatus": "Under way using engine",
                 "position": {
                     "latitude": 57.2343,
@@ -428,21 +428,21 @@
                 "predictions": {
                     "position": [
                         {
-                            "time": "2024-02-22T18:00:50.693574",
+                            "time": "2024-02-22T18:09:43.990808",
                             "value": {
                                 "latitude": 57.2343,
                                 "longitude": 10.3432
                             }
                         },
                         {
-                            "time": "2024-02-22T18:01:00.693574",
+                            "time": "2024-02-22T18:09:53.990808",
                             "value": {
                                 "latitude": 57.2345,
                                 "longitude": 10.3432
                             }
                         },
                         {
-                            "time": "2024-02-22T18:01:10.693574",
+                            "time": "2024-02-22T18:10:03.990808",
                             "value": {
                                 "latitude": 57.2349,
                                 "longitude": 10.343
@@ -454,10 +454,10 @@
                 "tcpa": 1200.0
             }
         ],
-        "time": "2024-02-22T18:00:50.701810"
+        "time": "2024-02-22T18:09:43.997843"
     }
 ]
-

Eventdata

Type: array Default: null

Event data from the system

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the event

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:00:50.701810"
+

Eventdata

Type: array Default: null

Event data from the system

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the event

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:09:43.997843"
 

Route

Type: array Default: null

Planned CAGA Route

No Additional Items

Each item of this array must be:

Type: object

Type: object

A geographical coordinate


Example:

{
     "latitude": 51.2123,
     "longitude": 11.2313
@@ -597,7 +597,7 @@
                 "turnRadius": 500.0
             }
         ],
-        "time": "2024-02-22T18:00:50.701810"
+        "time": "2024-02-22T18:09:43.998842"
     }
 ]
 
Type: null

Example:

{
@@ -674,7 +674,7 @@
                     "turnRadius": 500.0
                 }
             ],
-            "time": "2024-02-22T18:00:50.701810"
+            "time": "2024-02-22T18:09:43.998842"
         }
     ],
     "timeSeriesData": [
@@ -690,7 +690,7 @@
                     "distanceToTarget": 874.0,
                     "encounterType": "Head-on",
                     "heading": null,
-                    "id": "d49ffb39-5f08-4edf-82ad-9b2dd642e1c7",
+                    "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f",
                     "navStatus": "Under way using engine",
                     "position": {
                         "latitude": 57.2343,
@@ -699,21 +699,21 @@
                     "predictions": {
                         "position": [
                             {
-                                "time": "2024-02-22T18:00:50.693574",
+                                "time": "2024-02-22T18:09:43.990808",
                                 "value": {
                                     "latitude": 57.2343,
                                     "longitude": 10.3432
                                 }
                             },
                             {
-                                "time": "2024-02-22T18:01:00.693574",
+                                "time": "2024-02-22T18:09:53.990808",
                                 "value": {
                                     "latitude": 57.2345,
                                     "longitude": 10.3432
                                 }
                             },
                             {
-                                "time": "2024-02-22T18:01:10.693574",
+                                "time": "2024-02-22T18:10:03.990808",
                                 "value": {
                                     "latitude": 57.2349,
                                     "longitude": 10.343
@@ -725,7 +725,7 @@
                     "tcpa": 1200.0
                 }
             ],
-            "time": "2024-02-22T18:00:50.701810"
+            "time": "2024-02-22T18:09:43.997843"
         }
     ]
 }
@@ -737,8 +737,8 @@
 

Name

Type: string

The name of the system


Example:

"AutoNavigation-System 1"
 

Version

Type: string

The software version


Example:

"1.2.3"
 

Vendor

Type: string

The name of the system vendor


Example:

"CompanyABC"
-

Additional Properties of any type are allowed.

Type: object

Timeseriesdata

Type: array

TimeSeries data originating from the Simulator

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:00:50.701810"
-

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"a1ce93f7-e3ed-4969-afe1-86730c80ae47"
+

Additional Properties of any type are allowed.

Type: object

Timeseriesdata

Type: array

TimeSeries data originating from the Simulator

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:09:44.001842"
+

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"a61becc8-2e93-4acf-9629-2b22131716ac"
 

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
     "latitude": 51.2123,
     "longitude": 11.2313
@@ -750,7 +750,7 @@
 

ship heading

Default: null

Initial ship heading in degrees

Type: number

Value must be greater or equal to 0.0 and lesser or equal to 360.0

Type: null

Example:

45.2
 

Type: enum (of string)

AIS Navigational Status

Must be one of:

  • "Under way using engine"
  • "At anchor"
  • "Not under command"
  • "Restricted manoeuverability"
  • "Constrained by her draught"
  • "Moored"
  • "Aground"
  • "Engaged in fishing"
  • "Under way sailing"
  • "Reserved for future amendment of navigational status for HSC"
  • "Reserved for future amendment of navigational status for WIG"
  • "Reserved for future use 1"
  • "Reserved for future use 2"
  • "Reserved for future use 3"
  • "AIS SART is active"
  • "Not defined (default)"

Acceleration

Type: number Default: null

Ship acceleration in ms^-2


Example:

0.01
 

Rateofturn

Type: number Default: null

Ship rate of turn in deg/s


Example:

1.8
-

Additional Properties of any type are allowed.

Type: object

Targetships

Type: array
No Additional Items

Each item of this array must be:

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"a1ce93f7-e3ed-4969-afe1-86730c80ae47"
+

Additional Properties of any type are allowed.

Type: object

Targetships

Type: array
No Additional Items

Each item of this array must be:

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"a61becc8-2e93-4acf-9629-2b22131716ac"
 

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
     "latitude": 51.2123,
     "longitude": 11.2313
@@ -768,7 +768,7 @@
             "acceleration": null,
             "cog": 97.0,
             "heading": null,
-            "id": "37750be4-1653-4be2-a918-c1cac7abbeee",
+            "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab",
             "mmsi": 987654321,
             "navStatus": "Under way using engine",
             "position": {
@@ -783,7 +783,7 @@
                 "acceleration": 0.01,
                 "cog": 181.0,
                 "heading": null,
-                "id": "e9d221bc-8379-4ee8-aaa7-dbca25602850",
+                "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7",
                 "navStatus": "Engaged in fishing",
                 "position": {
                     "latitude": 57.2343,
@@ -796,7 +796,7 @@
                 "acceleration": null,
                 "cog": 7.0,
                 "heading": null,
-                "id": "44ac0396-d5a8-4f71-8f2e-e5d9376cb60f",
+                "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b",
                 "mmsi": 123456789,
                 "navStatus": "Under way using engine",
                 "position": {
@@ -807,14 +807,14 @@
                 "sog": 14.0
             }
         ],
-        "time": "2024-02-22T18:00:50.701810"
+        "time": "2024-02-22T18:09:44.002844"
     },
     {
         "ownShip": {
             "acceleration": null,
             "cog": 97.0,
             "heading": null,
-            "id": "37750be4-1653-4be2-a918-c1cac7abbeee",
+            "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab",
             "mmsi": 987654321,
             "navStatus": "Under way using engine",
             "position": {
@@ -829,7 +829,7 @@
                 "acceleration": 0.01,
                 "cog": 181.0,
                 "heading": null,
-                "id": "e9d221bc-8379-4ee8-aaa7-dbca25602850",
+                "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7",
                 "navStatus": "Engaged in fishing",
                 "position": {
                     "latitude": 57.2343,
@@ -842,7 +842,7 @@
                 "acceleration": null,
                 "cog": 7.0,
                 "heading": null,
-                "id": "44ac0396-d5a8-4f71-8f2e-e5d9376cb60f",
+                "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b",
                 "mmsi": 123456789,
                 "navStatus": "Under way using engine",
                 "position": {
@@ -853,10 +853,10 @@
                 "sog": 14.0
             }
         ],
-        "time": "2024-02-22T18:01:00.701810"
+        "time": "2024-02-22T18:09:54.002844"
     }
 ]
-

Eventdata

Type: array Default: null

Event data from the simulator

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the event

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:00:50.701810"
+

Eventdata

Type: array Default: null

Event data from the simulator

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the event

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:09:43.998842"
 

Additional Properties of any type are allowed.

Type: object
Type: null

Example:

{
     "configuration": {
         "name": "Simulator-System 1",
@@ -870,7 +870,7 @@
                 "acceleration": null,
                 "cog": 97.0,
                 "heading": null,
-                "id": "37750be4-1653-4be2-a918-c1cac7abbeee",
+                "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab",
                 "mmsi": 987654321,
                 "navStatus": "Under way using engine",
                 "position": {
@@ -885,7 +885,7 @@
                     "acceleration": 0.01,
                     "cog": 181.0,
                     "heading": null,
-                    "id": "e9d221bc-8379-4ee8-aaa7-dbca25602850",
+                    "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7",
                     "navStatus": "Engaged in fishing",
                     "position": {
                         "latitude": 57.2343,
@@ -898,7 +898,7 @@
                     "acceleration": null,
                     "cog": 7.0,
                     "heading": null,
-                    "id": "44ac0396-d5a8-4f71-8f2e-e5d9376cb60f",
+                    "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b",
                     "mmsi": 123456789,
                     "navStatus": "Under way using engine",
                     "position": {
@@ -909,14 +909,14 @@
                     "sog": 14.0
                 }
             ],
-            "time": "2024-02-22T18:00:50.701810"
+            "time": "2024-02-22T18:09:44.002844"
         },
         {
             "ownShip": {
                 "acceleration": null,
                 "cog": 97.0,
                 "heading": null,
-                "id": "37750be4-1653-4be2-a918-c1cac7abbeee",
+                "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab",
                 "mmsi": 987654321,
                 "navStatus": "Under way using engine",
                 "position": {
@@ -931,7 +931,7 @@
                     "acceleration": 0.01,
                     "cog": 181.0,
                     "heading": null,
-                    "id": "e9d221bc-8379-4ee8-aaa7-dbca25602850",
+                    "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7",
                     "navStatus": "Engaged in fishing",
                     "position": {
                         "latitude": 57.2343,
@@ -944,7 +944,7 @@
                     "acceleration": null,
                     "cog": 7.0,
                     "heading": null,
-                    "id": "44ac0396-d5a8-4f71-8f2e-e5d9376cb60f",
+                    "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b",
                     "mmsi": 123456789,
                     "navStatus": "Under way using engine",
                     "position": {
@@ -955,8 +955,8 @@
                     "sog": 14.0
                 }
             ],
-            "time": "2024-02-22T18:01:00.701810"
+            "time": "2024-02-22T18:09:54.002844"
         }
     ]
 }
-

Additional Properties of any type are allowed.

Type: object
\ No newline at end of file +

Additional Properties of any type are allowed.

Type: object
\ No newline at end of file diff --git a/src/maritime_schema/schema/caga/input_schema.json b/src/maritime_schema/schema/caga/input_schema.json index 69f61c4..855f890 100644 --- a/src/maritime_schema/schema/caga/input_schema.json +++ b/src/maritime_schema/schema/caga/input_schema.json @@ -1 +1,975 @@ -{"$defs": {"AISNavStatus": {"enum": ["Under way using engine", "At anchor", "Not under command", "Restricted manoeuverability", "Constrained by her draught", "Moored", "Aground", "Engaged in fishing", "Under way sailing", "Reserved for future amendment of navigational status for HSC", "Reserved for future amendment of navigational status for WIG", "Reserved for future use 1", "Reserved for future use 2", "Reserved for future use 3", "AIS SART is active", "Not defined (default)"], "title": "AISNavStatus", "type": "string"}, "Data": {"additionalProperties": {"description": "The 'data' field can include additional properties. All additional properties should be DataPoint objects.", "properties": {"value": {"type": "number"}, "mBeforeLegChange": {"type": "number"}, "mAfterLegChange": {"type": "number"}, "interpMethod": {"type": "string"}}, "required": ["value", "mBeforeLegChange", "mAfterLegChange", "interpMethod"], "type": "object"}, "properties": {"sog": {"allOf": [{"$ref": "#/$defs/DataPoint"}], "default": null, "description": "Speed data point", "examples": [{"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}]}, "heading": {"allOf": [{"$ref": "#/$defs/DataPoint"}], "default": null, "description": "Heading data point", "examples": [{"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 180.0}]}}, "title": "Data", "type": "object"}, "DataPoint": {"properties": {"value": {"description": "the value of the data at the current timestep", "examples": [12.3], "title": "Value", "type": "number"}, "m_before_leg_change": {"description": "meters before the waypoint to start interpolating to the new value", "examples": [10], "title": "M Before Leg Change", "type": "number"}, "m_after_leg_change": {"description": "meters after the waypoint to finish interpolating to the new value", "examples": [10], "title": "M After Leg Change", "type": "number"}, "interp_method": {"anyOf": [{"$ref": "#/$defs/InterpolationMethod"}, {"type": "string"}], "default": "linear", "description": "Method used for interpolation", "title": "Interp Method"}}, "required": ["value", "m_before_leg_change", "m_after_leg_change"], "title": "DataPoint", "type": "object"}, "Environment": {"properties": {"air_temperature": {"default": null, "description": "The air temperature in degrees Celsius", "examples": [20.0], "title": "Air Temperature", "type": "number"}, "water_remperature": {"default": null, "description": "The water temperature in degrees Celsius", "examples": [15.0], "title": "Water Remperature", "type": "number"}, "precipitation": {"allOf": [{"$ref": "#/$defs/PrecipitationType"}], "default": null, "description": "The type of precipitation", "examples": ["Rain"]}, "wind_speed": {"default": null, "description": "The wind speed in m/s", "examples": [10.0], "title": "Wind Speed", "type": "number"}, "wind_direction": {"default": null, "description": "The wind direction in degrees", "examples": [180.0], "title": "Wind Direction", "type": "number"}, "current_speed": {"default": null, "description": "The current speed in m/s", "examples": [1.0], "title": "Current Speed", "type": "number"}, "current_direction": {"default": null, "description": "The current direction in degrees", "examples": [90.0], "title": "Current Direction", "type": "number"}, "wave_spectrum": {"allOf": [{"$ref": "#/$defs/WaveSpectra"}], "default": null, "description": "The wave spectrum", "examples": ["JONSWAP"]}, "significant_wave_height": {"default": null, "description": "The significant wave height in meters", "examples": [3.0], "title": "Significant Wave Height", "type": "number"}, "wave_period": {"default": null, "description": "The wave period in seconds", "examples": [12.0], "title": "Wave Period", "type": "number"}, "wave_direction": {"default": null, "description": "The wave direction in degrees", "examples": [270.0], "title": "Wave Direction", "type": "number"}, "visibility": {"default": null, "description": "The visibility in nautical miles", "examples": [5.0], "title": "Visibility", "type": "number"}, "conditions": {"allOf": [{"$ref": "#/$defs/WeatherCondition"}], "default": null, "description": "The overall weather conditions", "examples": ["Clear"]}}, "title": "Environment", "type": "object"}, "GeneralShipType": {"enum": ["Wing in ground", "Fishing", "Towing", "Dredging or underwater ops", "Diving ops", "Military ops", "Sailing", "Pleasure Craft", "High speed craft", "Pilot Vessel", "Search and Rescue vessel", "Tug", "Port Tender", "Anti-pollution", "Law Enforcement", "Medical Transport", "Noncombatant ship", "Passenger", "Cargo", "Tanker", "Other Type"], "title": "GeneralShipType", "type": "string"}, "Initial": {"properties": {"position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}], "title": "Longitude and Latitude Values"}, "sog": {"description": "Initial ship speed over ground in knots", "examples": [10.0], "minimum": 0.0, "title": "Initial ship speed over ground", "type": "number"}, "cog": {"description": "Initial ship course over ground in degrees", "examples": [45.0], "maximum": 360.0, "minimum": 0.0, "title": "Initial ship course over ground", "type": "number"}, "heading": {"anyOf": [{"maximum": 360.0, "minimum": 0.0, "type": "number"}, {"type": "null"}], "default": null, "description": "Initial ship heading in degrees", "examples": [45.2], "title": "Initial ship heading"}, "nav_status": {"allOf": [{"$ref": "#/$defs/AISNavStatus"}], "description": "AIS Navigational Status"}}, "required": ["position", "sog", "cog", "nav_status"], "title": "Initial", "type": "object"}, "InterpolationMethod": {"enum": ["linear", "cosine", "smoothstep", "accelerate", "decelerate", "ordinal"], "title": "InterpolationMethod", "type": "string"}, "OwnShip": {"properties": {"static": {"anyOf": [{"$ref": "#/$defs/ShipStatic"}, {"type": "null"}], "description": "Static ship information which does not change during a scenario.", "examples": [{"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}]}, "initial": {"allOf": [{"$ref": "#/$defs/Initial"}], "examples": [{"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}], "title": "Initial own ship Initial"}, "waypoints": {"anyOf": [{"items": {"$ref": "#/$defs/Waypoint"}, "type": "array"}, {"type": "null"}], "default": null, "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", "examples": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}], "title": "Waypoints"}}, "required": ["static", "initial"], "title": "OwnShip", "type": "object"}, "Position": {"properties": {"latitude": {"description": "WGS-84 latitude", "examples": [51.2131], "maximum": 90.0, "minimum": -90.0, "title": "Latitude", "type": "number"}, "longitude": {"description": "WGS-84 longitude", "examples": [11.2131], "maximum": 180.0, "minimum": -180.0, "title": "Longitude", "type": "number"}}, "required": ["latitude", "longitude"], "title": "Position", "type": "object"}, "PrecipitationType": {"enum": ["None", "Rain", "Snow", "Sleet", "Hail"], "title": "PrecipitationType", "type": "string"}, "ShipStatic": {"description": "Static ship data that will not change during the scenario.", "properties": {"id": {"description": "Unique Identifier", "examples": ["e2b858d4-c83b-4cfc-95fd-c09051840c03"], "format": "uuid", "title": "Id", "type": "string"}, "length": {"description": "Length of the ship in meters", "examples": [230.0], "g": 0, "title": "Length", "type": "number"}, "width": {"description": "Width of the ship in meters", "examples": [30.0], "g": 0, "title": "Width", "type": "number"}, "height": {"anyOf": [{"type": "number"}, {"type": "null"}], "default": 10, "description": "Height of the ship in meters", "examples": [15.0], "g": 0, "title": "Height"}, "mmsi": {"anyOf": [{"maximum": 999999999, "minimum": 100000000, "type": "integer"}, {"type": "null"}], "default": null, "description": "Maritime Mobile Service Identity (MMSI)", "examples": [123456789], "title": "Mmsi"}, "imo": {"anyOf": [{"maximum": 9999999, "minimum": 1000000, "type": "integer"}, {"type": "null"}], "default": null, "description": "IMO Number", "examples": [1234567], "title": "Imo"}, "name": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null, "description": "Ship title", "examples": ["RMS Titanic"], "title": "Name"}, "ship_type": {"allOf": [{"$ref": "#/$defs/GeneralShipType"}], "description": "General ship type, based on AIS"}}, "required": ["id", "length", "width", "ship_type"], "title": "ShipStatic", "type": "object"}, "TargetShip": {"properties": {"static": {"anyOf": [{"$ref": "#/$defs/ShipStatic"}, {"type": "null"}], "description": "Static ship information which does not change during a scenario.", "examples": [{"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}]}, "initial": {"allOf": [{"$ref": "#/$defs/Initial"}], "examples": [{"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}], "title": "Initial own ship Initial"}, "waypoints": {"anyOf": [{"items": {"$ref": "#/$defs/Waypoint"}, "type": "array"}, {"type": "null"}], "default": null, "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", "examples": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}], "title": "Waypoints"}}, "required": ["static", "initial"], "title": "TargetShip", "type": "object"}, "WaveSpectra": {"enum": ["JONSWAP", "Pierson-Moskowitz", "Bretschneider"], "title": "WaveSpectra", "type": "string"}, "Waypoint": {"properties": {"position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}]}, "turn_radius": {"default": 0, "description": "Orthodrome turn radius as defined in RTZ format", "examples": [200], "title": "Turn Radius", "type": "number"}, "data": {"allOf": [{"$ref": "#/$defs/Data"}], "default": null, "description": "A `Data` object that includes `speed`, `course`, and `heading` data points"}}, "required": ["position"], "title": "Waypoint", "type": "object"}, "WeatherCondition": {"enum": ["Clear", "Cloudy", "Foggy", "Rainy", "Snowy"], "title": "WeatherCondition", "type": "string"}}, "additionalProperties": true, "properties": {"title": {"description": "The title of the traffic situation", "examples": ["overtaking_18"], "omit_default": true, "title": "Title", "type": "string"}, "description": {"description": "A description of the traffic situation", "examples": ["Crossing situation with 3 target vessels in the Oslofjord"], "title": "Description", "type": "string"}, "start_time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "default": null, "description": "Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": ["2024-02-22T17:45:49.335445"], "title": "Situation starting time"}, "own_ship": {"allOf": [{"$ref": "#/$defs/OwnShip"}], "description": "Own Ship data", "examples": [{"initial": {"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}, "static": {"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}, "waypoints": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}]}], "title": "Own Ship data"}, "target_ships": {"default": null, "description": "Target Ship data", "examples": [[{"initial": {"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}, "static": {"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}, "waypoints": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}]}]], "items": {"$ref": "#/$defs/TargetShip"}, "title": "Target Ship data", "type": "array"}, "environment": {"anyOf": [{"$ref": "#/$defs/Environment"}, {"type": "null"}], "default": null, "description": "environmental parameters", "examples": [{"airTemperature": 20.0, "conditions": "Clear", "currentDirection": 90.0, "currentSpeed": 1.0, "precipitation": "Rain", "significantWaveHeight": 3.0, "visibility": 5.0, "waterRemperature": 15.0, "waveDirection": 270.0, "wavePeriod": 12.0, "waveSpectrum": "JONSWAP", "windDirection": 180.0, "windSpeed": 10.0}]}}, "required": ["title", "description", "own_ship"], "title": "Test Input Schema", "type": "object"} \ No newline at end of file +{ + "$defs": { + "AISNavStatus": { + "enum": [ + "Under way using engine", + "At anchor", + "Not under command", + "Restricted manoeuverability", + "Constrained by her draught", + "Moored", + "Aground", + "Engaged in fishing", + "Under way sailing", + "Reserved for future amendment of navigational status for HSC", + "Reserved for future amendment of navigational status for WIG", + "Reserved for future use 1", + "Reserved for future use 2", + "Reserved for future use 3", + "AIS SART is active", + "Not defined (default)" + ], + "title": "AISNavStatus", + "type": "string" + }, + "Data": { + "additionalProperties": { + "description": "The 'data' field can include additional properties. All additional properties should be DataPoint objects.", + "properties": { + "value": { + "type": "number" + }, + "mBeforeLegChange": { + "type": "number" + }, + "mAfterLegChange": { + "type": "number" + }, + "interpMethod": { + "type": "string" + } + }, + "required": [ + "value", + "mBeforeLegChange", + "mAfterLegChange", + "interpMethod" + ], + "type": "object" + }, + "properties": { + "sog": { + "allOf": [ + { + "$ref": "#/$defs/DataPoint" + } + ], + "default": null, + "description": "Speed data point", + "examples": [ + { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + ] + }, + "heading": { + "allOf": [ + { + "$ref": "#/$defs/DataPoint" + } + ], + "default": null, + "description": "Heading data point", + "examples": [ + { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 180.0 + } + ] + } + }, + "title": "Data", + "type": "object" + }, + "DataPoint": { + "properties": { + "value": { + "description": "the value of the data at the current timestep", + "examples": [ + 12.3 + ], + "title": "Value", + "type": "number" + }, + "m_before_leg_change": { + "description": "meters before the waypoint to start interpolating to the new value", + "examples": [ + 10 + ], + "title": "M Before Leg Change", + "type": "number" + }, + "m_after_leg_change": { + "description": "meters after the waypoint to finish interpolating to the new value", + "examples": [ + 10 + ], + "title": "M After Leg Change", + "type": "number" + }, + "interp_method": { + "anyOf": [ + { + "$ref": "#/$defs/InterpolationMethod" + }, + { + "type": "string" + } + ], + "default": "linear", + "description": "Method used for interpolation", + "title": "Interp Method" + } + }, + "required": [ + "value", + "m_before_leg_change", + "m_after_leg_change" + ], + "title": "DataPoint", + "type": "object" + }, + "Environment": { + "properties": { + "air_temperature": { + "default": null, + "description": "The air temperature in degrees Celsius", + "examples": [ + 20.0 + ], + "title": "Air Temperature", + "type": "number" + }, + "water_remperature": { + "default": null, + "description": "The water temperature in degrees Celsius", + "examples": [ + 15.0 + ], + "title": "Water Remperature", + "type": "number" + }, + "precipitation": { + "allOf": [ + { + "$ref": "#/$defs/PrecipitationType" + } + ], + "default": null, + "description": "The type of precipitation", + "examples": [ + "Rain" + ] + }, + "wind_speed": { + "default": null, + "description": "The wind speed in m/s", + "examples": [ + 10.0 + ], + "title": "Wind Speed", + "type": "number" + }, + "wind_direction": { + "default": null, + "description": "The wind direction in degrees", + "examples": [ + 180.0 + ], + "title": "Wind Direction", + "type": "number" + }, + "current_speed": { + "default": null, + "description": "The current speed in m/s", + "examples": [ + 1.0 + ], + "title": "Current Speed", + "type": "number" + }, + "current_direction": { + "default": null, + "description": "The current direction in degrees", + "examples": [ + 90.0 + ], + "title": "Current Direction", + "type": "number" + }, + "wave_spectrum": { + "allOf": [ + { + "$ref": "#/$defs/WaveSpectra" + } + ], + "default": null, + "description": "The wave spectrum", + "examples": [ + "JONSWAP" + ] + }, + "significant_wave_height": { + "default": null, + "description": "The significant wave height in meters", + "examples": [ + 3.0 + ], + "title": "Significant Wave Height", + "type": "number" + }, + "wave_period": { + "default": null, + "description": "The wave period in seconds", + "examples": [ + 12.0 + ], + "title": "Wave Period", + "type": "number" + }, + "wave_direction": { + "default": null, + "description": "The wave direction in degrees", + "examples": [ + 270.0 + ], + "title": "Wave Direction", + "type": "number" + }, + "visibility": { + "default": null, + "description": "The visibility in nautical miles", + "examples": [ + 5.0 + ], + "title": "Visibility", + "type": "number" + }, + "conditions": { + "allOf": [ + { + "$ref": "#/$defs/WeatherCondition" + } + ], + "default": null, + "description": "The overall weather conditions", + "examples": [ + "Clear" + ] + } + }, + "title": "Environment", + "type": "object" + }, + "GeneralShipType": { + "enum": [ + "Wing in ground", + "Fishing", + "Towing", + "Dredging or underwater ops", + "Diving ops", + "Military ops", + "Sailing", + "Pleasure Craft", + "High speed craft", + "Pilot Vessel", + "Search and Rescue vessel", + "Tug", + "Port Tender", + "Anti-pollution", + "Law Enforcement", + "Medical Transport", + "Noncombatant ship", + "Passenger", + "Cargo", + "Tanker", + "Other Type" + ], + "title": "GeneralShipType", + "type": "string" + }, + "Initial": { + "properties": { + "position": { + "allOf": [ + { + "$ref": "#/$defs/Position" + } + ], + "description": "A geographical coordinate", + "examples": [ + { + "latitude": 51.2123, + "longitude": 11.2313 + } + ], + "title": "Longitude and Latitude Values" + }, + "sog": { + "description": "Initial ship speed over ground in knots", + "examples": [ + 10.0 + ], + "minimum": 0.0, + "title": "Initial ship speed over ground", + "type": "number" + }, + "cog": { + "description": "Initial ship course over ground in degrees", + "examples": [ + 45.0 + ], + "maximum": 360.0, + "minimum": 0.0, + "title": "Initial ship course over ground", + "type": "number" + }, + "heading": { + "anyOf": [ + { + "maximum": 360.0, + "minimum": 0.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Initial ship heading in degrees", + "examples": [ + 45.2 + ], + "title": "Initial ship heading" + }, + "nav_status": { + "allOf": [ + { + "$ref": "#/$defs/AISNavStatus" + } + ], + "description": "AIS Navigational Status" + } + }, + "required": [ + "position", + "sog", + "cog", + "nav_status" + ], + "title": "Initial", + "type": "object" + }, + "InterpolationMethod": { + "enum": [ + "linear", + "cosine", + "smoothstep", + "accelerate", + "decelerate", + "ordinal" + ], + "title": "InterpolationMethod", + "type": "string" + }, + "OwnShip": { + "properties": { + "static": { + "anyOf": [ + { + "$ref": "#/$defs/ShipStatic" + }, + { + "type": "null" + } + ], + "description": "Static ship information which does not change during a scenario.", + "examples": [ + { + "height": 15.0, + "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "imo": null, + "length": 230.0, + "mmsi": 123456789, + "name": "RMS Titanic", + "shipType": "Fishing", + "width": 30.0 + } + ] + }, + "initial": { + "allOf": [ + { + "$ref": "#/$defs/Initial" + } + ], + "examples": [ + { + "cog": 284.2, + "heading": 283.1, + "navStatus": "Under way using engine", + "position": { + "latitude": 51.2123, + "longitude": 11.2313 + }, + "sog": 12.3 + } + ], + "title": "Initial own ship Initial" + }, + "waypoints": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Waypoint" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", + "examples": [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + } + ], + "title": "Waypoints" + } + }, + "required": [ + "static", + "initial" + ], + "title": "OwnShip", + "type": "object" + }, + "Position": { + "properties": { + "latitude": { + "description": "WGS-84 latitude", + "examples": [ + 51.2131 + ], + "maximum": 90.0, + "minimum": -90.0, + "title": "Latitude", + "type": "number" + }, + "longitude": { + "description": "WGS-84 longitude", + "examples": [ + 11.2131 + ], + "maximum": 180.0, + "minimum": -180.0, + "title": "Longitude", + "type": "number" + } + }, + "required": [ + "latitude", + "longitude" + ], + "title": "Position", + "type": "object" + }, + "PrecipitationType": { + "enum": [ + "None", + "Rain", + "Snow", + "Sleet", + "Hail" + ], + "title": "PrecipitationType", + "type": "string" + }, + "ShipStatic": { + "description": "Static ship data that will not change during the scenario.", + "properties": { + "id": { + "description": "Unique Identifier", + "examples": [ + "0a9d3443-d305-4c28-a41b-09ed3f167254" + ], + "format": "uuid", + "title": "Id", + "type": "string" + }, + "length": { + "description": "Length of the ship in meters", + "examples": [ + 230.0 + ], + "g": 0, + "title": "Length", + "type": "number" + }, + "width": { + "description": "Width of the ship in meters", + "examples": [ + 30.0 + ], + "g": 0, + "title": "Width", + "type": "number" + }, + "height": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": 10, + "description": "Height of the ship in meters", + "examples": [ + 15.0 + ], + "g": 0, + "title": "Height" + }, + "mmsi": { + "anyOf": [ + { + "maximum": 999999999, + "minimum": 100000000, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Maritime Mobile Service Identity (MMSI)", + "examples": [ + 123456789 + ], + "title": "Mmsi" + }, + "imo": { + "anyOf": [ + { + "maximum": 9999999, + "minimum": 1000000, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "IMO Number", + "examples": [ + 1234567 + ], + "title": "Imo" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Ship title", + "examples": [ + "RMS Titanic" + ], + "title": "Name" + }, + "ship_type": { + "allOf": [ + { + "$ref": "#/$defs/GeneralShipType" + } + ], + "description": "General ship type, based on AIS" + } + }, + "required": [ + "id", + "length", + "width", + "ship_type" + ], + "title": "ShipStatic", + "type": "object" + }, + "TargetShip": { + "properties": { + "static": { + "anyOf": [ + { + "$ref": "#/$defs/ShipStatic" + }, + { + "type": "null" + } + ], + "description": "Static ship information which does not change during a scenario.", + "examples": [ + { + "height": 15.0, + "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "imo": null, + "length": 230.0, + "mmsi": 123456789, + "name": "RMS Titanic", + "shipType": "Fishing", + "width": 30.0 + } + ] + }, + "initial": { + "allOf": [ + { + "$ref": "#/$defs/Initial" + } + ], + "examples": [ + { + "cog": 284.2, + "heading": 283.1, + "navStatus": "Under way using engine", + "position": { + "latitude": 51.2123, + "longitude": 11.2313 + }, + "sog": 12.3 + } + ], + "title": "Initial own ship Initial" + }, + "waypoints": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Waypoint" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", + "examples": [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + } + ], + "title": "Waypoints" + } + }, + "required": [ + "static", + "initial" + ], + "title": "TargetShip", + "type": "object" + }, + "WaveSpectra": { + "enum": [ + "JONSWAP", + "Pierson-Moskowitz", + "Bretschneider" + ], + "title": "WaveSpectra", + "type": "string" + }, + "Waypoint": { + "properties": { + "position": { + "allOf": [ + { + "$ref": "#/$defs/Position" + } + ], + "description": "A geographical coordinate", + "examples": [ + { + "latitude": 51.2123, + "longitude": 11.2313 + } + ] + }, + "turn_radius": { + "default": 0, + "description": "Orthodrome turn radius as defined in RTZ format", + "examples": [ + 200 + ], + "title": "Turn Radius", + "type": "number" + }, + "data": { + "allOf": [ + { + "$ref": "#/$defs/Data" + } + ], + "default": null, + "description": "A `Data` object that includes `speed`, `course`, and `heading` data points" + } + }, + "required": [ + "position" + ], + "title": "Waypoint", + "type": "object" + }, + "WeatherCondition": { + "enum": [ + "Clear", + "Cloudy", + "Foggy", + "Rainy", + "Snowy" + ], + "title": "WeatherCondition", + "type": "string" + } + }, + "additionalProperties": true, + "properties": { + "title": { + "description": "The title of the traffic situation", + "examples": [ + "overtaking_18" + ], + "omit_default": true, + "title": "Title", + "type": "string" + }, + "description": { + "description": "A description of the traffic situation", + "examples": [ + "Crossing situation with 3 target vessels in the Oslofjord" + ], + "title": "Description", + "type": "string" + }, + "start_time": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", + "examples": [ + "2024-02-22T18:09:43.984842" + ], + "title": "Situation starting time" + }, + "own_ship": { + "allOf": [ + { + "$ref": "#/$defs/OwnShip" + } + ], + "description": "Own Ship data", + "examples": [ + { + "initial": { + "cog": 284.2, + "heading": 283.1, + "navStatus": "Under way using engine", + "position": { + "latitude": 51.2123, + "longitude": 11.2313 + }, + "sog": 12.3 + }, + "static": { + "height": 15.0, + "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "imo": null, + "length": 230.0, + "mmsi": 123456789, + "name": "RMS Titanic", + "shipType": "Fishing", + "width": 30.0 + }, + "waypoints": [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + } + ] + } + ], + "title": "Own Ship data" + }, + "target_ships": { + "default": null, + "description": "Target Ship data", + "examples": [ + [ + { + "initial": { + "cog": 284.2, + "heading": 283.1, + "navStatus": "Under way using engine", + "position": { + "latitude": 51.2123, + "longitude": 11.2313 + }, + "sog": 12.3 + }, + "static": { + "height": 15.0, + "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "imo": null, + "length": 230.0, + "mmsi": 123456789, + "name": "RMS Titanic", + "shipType": "Fishing", + "width": 30.0 + }, + "waypoints": [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + } + ] + } + ] + ], + "items": { + "$ref": "#/$defs/TargetShip" + }, + "title": "Target Ship data", + "type": "array" + }, + "environment": { + "anyOf": [ + { + "$ref": "#/$defs/Environment" + }, + { + "type": "null" + } + ], + "default": null, + "description": "environmental parameters", + "examples": [ + { + "airTemperature": 20.0, + "conditions": "Clear", + "currentDirection": 90.0, + "currentSpeed": 1.0, + "precipitation": "Rain", + "significantWaveHeight": 3.0, + "visibility": 5.0, + "waterRemperature": 15.0, + "waveDirection": 270.0, + "wavePeriod": 12.0, + "waveSpectrum": "JONSWAP", + "windDirection": 180.0, + "windSpeed": 10.0 + } + ] + } + }, + "required": [ + "title", + "description", + "own_ship" + ], + "title": "Test Input Schema", + "type": "object" +} \ No newline at end of file diff --git a/src/maritime_schema/schema/caga/output_schema.json b/src/maritime_schema/schema/caga/output_schema.json index 99792a9..eb71d92 100644 --- a/src/maritime_schema/schema/caga/output_schema.json +++ b/src/maritime_schema/schema/caga/output_schema.json @@ -1 +1,2278 @@ -{"$defs": {"AISNavStatus": {"enum": ["Under way using engine", "At anchor", "Not under command", "Restricted manoeuverability", "Constrained by her draught", "Moored", "Aground", "Engaged in fishing", "Under way sailing", "Reserved for future amendment of navigational status for HSC", "Reserved for future amendment of navigational status for WIG", "Reserved for future use 1", "Reserved for future use 2", "Reserved for future use 3", "AIS SART is active", "Not defined (default)"], "title": "AISNavStatus", "type": "string"}, "CagaConfiguration": {"additionalProperties": true, "properties": {"name": {"description": "The name of the system", "examples": ["AutoNavigation-System 1"], "title": "Name", "type": "string"}, "version": {"description": "The software version", "examples": ["1.2.3"], "title": "Version", "type": "string"}, "vendor": {"description": "The name of the system vendor", "examples": ["CompanyABC"], "title": "Vendor", "type": "string"}, "vendorMinimumDistanceToTargets": {"default": null, "description": "Minimum distance in meters that the system will keep to other Vessels", "examples": [100], "title": "Vendorminimumdistancetotargets", "type": "number"}, "vendorCriticalTcpa": {"default": null, "description": "If the projected CPA is less than minimumDistanceToTargets, and TCPA falls below criticalTCPA, a new manoeuver should be calculated", "examples": [1000], "title": "Vendorcriticaltcpa", "type": "number"}, "vendorManoeuverDelay": {"default": null, "description": "Time given in seconds to the navigator / system, before the proposed manoeuver is no longer able to be excecuted", "examples": [20], "title": "Vendormanoeuverdelay", "type": "number"}, "vendorSafetyDepth": {"default": null, "description": "Minimum safety depth", "examples": [30], "title": "Vendorsafetydepth", "type": "number"}, "vendorAutomaticManoeuverAcceptanceTime": {"default": null, "description": "If automatic maneuver acceptance is enabled, the new route will be activated after a specified number of seconds", "examples": [20], "title": "Vendorautomaticmanoeuveracceptancetime", "type": "number"}}, "required": ["name", "version", "vendor"], "title": "CagaConfiguration", "type": "object"}, "CagaData": {"properties": {"configuration": {"allOf": [{"$ref": "#/$defs/CagaConfiguration"}], "description": "System Configuration", "examples": [{"automatic_manoeuver_acceptance_time": 7, "critical_TCPA": 1000, "manoeuver_delay": 20, "minimum_distance_to_targets": 100, "name": "AutoNavigation-System 1", "safety_depth": 20, "vendor": "CompanyABC", "vendorAutomaticManoeuverAcceptanceTime": null, "vendorCriticalTcpa": null, "vendorManoeuverDelay": null, "vendorMinimumDistanceToTargets": null, "vendorSafetyDepth": null, "version": "1.2.3"}]}, "timeSeriesData": {"description": "Time series data from the system", "examples": [[{"internalStatus": null, "targetShips": [{"cog": 181.0, "colregRulesApplied": [12], "dcpa": 300.0, "distanceToTarget": 874.0, "encounterType": "Head-on", "heading": null, "id": "c85e6953-adc2-4321-88f9-1b545abf6336", "navStatus": "Under way using engine", "position": {"latitude": 57.2343, "longitude": 10.3432}, "predictions": {"position": [{"time": "2024-02-22T17:45:49.335445", "value": {"latitude": 57.2343, "longitude": 10.3432}}, {"time": "2024-02-22T17:45:59.335445", "value": {"latitude": 57.2345, "longitude": 10.3432}}, {"time": "2024-02-22T17:46:09.335445", "value": {"latitude": 57.2349, "longitude": 10.343}}]}, "sog": 10.2, "tcpa": 1200.0}], "time": "2024-02-22T17:45:49.335445"}]], "items": {"$ref": "#/$defs/CagaTimeFrame"}, "title": "Timeseriesdata", "type": "array"}, "eventData": {"default": null, "description": "Event data from the system", "examples": [[{"route": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2345, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2349, "longitude": 10.343}, "turnRadius": 500.0}], "time": "2024-02-22T17:45:49.335445"}]], "items": {"$ref": "#/$defs/CagaEvent"}, "title": "Eventdata", "type": "array"}}, "required": ["configuration", "timeSeriesData"], "title": "CagaData", "type": "object"}, "CagaEvent": {"additionalProperties": true, "properties": {"time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "integer"}], "description": "Date and Time of the event", "examples": ["2024-02-22T17:45:49.335445"], "title": "Time"}, "route": {"default": null, "description": "Planned CAGA Route", "examples": [[{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2345, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2349, "longitude": 10.343}, "turnRadius": 500.0}]], "items": {"$ref": "#/$defs/Waypoint"}, "title": "Route", "type": "array"}}, "required": ["time"], "title": "CagaEvent", "type": "object"}, "CagaTimeFrame": {"properties": {"time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "integer"}], "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": ["2024-02-22T17:45:49.335445"], "title": "Time"}, "targetShips": {"description": "list of target ships detected by the CAGA system", "examples": [[{"cog": 181.0, "colregRulesApplied": [12], "dcpa": 300.0, "distanceToTarget": 874.0, "encounterType": "Head-on", "heading": null, "id": "c85e6953-adc2-4321-88f9-1b545abf6336", "navStatus": "Under way using engine", "position": {"latitude": 57.2343, "longitude": 10.3432}, "predictions": {"position": [{"time": "2024-02-22T17:45:49.335445", "value": {"latitude": 57.2343, "longitude": 10.3432}}, {"time": "2024-02-22T17:45:59.335445", "value": {"latitude": 57.2345, "longitude": 10.3432}}, {"time": "2024-02-22T17:46:09.335445", "value": {"latitude": 57.2349, "longitude": 10.343}}]}, "sog": 10.2, "tcpa": 1200.0}]], "items": {"$ref": "#/$defs/DetectedShip"}, "title": "Targetships", "type": "array"}, "internalStatus": {"default": null, "description": "Dictionary containing additional internal information about the system (health, status..)", "title": "Internalstatus"}}, "required": ["time", "targetShips"], "title": "CagaTimeFrame", "type": "object"}, "Data": {"additionalProperties": {"description": "The 'data' field can include additional properties. All additional properties should be DataPoint objects.", "properties": {"value": {"type": "number"}, "mBeforeLegChange": {"type": "number"}, "mAfterLegChange": {"type": "number"}, "interpMethod": {"type": "string"}}, "required": ["value", "mBeforeLegChange", "mAfterLegChange", "interpMethod"], "type": "object"}, "properties": {"sog": {"allOf": [{"$ref": "#/$defs/DataPoint"}], "default": null, "description": "Speed data point", "examples": [{"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}]}, "heading": {"allOf": [{"$ref": "#/$defs/DataPoint"}], "default": null, "description": "Heading data point", "examples": [{"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 180.0}]}}, "title": "Data", "type": "object"}, "DataPoint": {"properties": {"value": {"description": "the value of the data at the current timestep", "examples": [12.3], "title": "Value", "type": "number"}, "mBeforeLegChange": {"description": "meters before the waypoint to start interpolating to the new value", "examples": [10], "title": "Mbeforelegchange", "type": "number"}, "mAfterLegChange": {"description": "meters after the waypoint to finish interpolating to the new value", "examples": [10], "title": "Mafterlegchange", "type": "number"}, "interpMethod": {"anyOf": [{"$ref": "#/$defs/InterpolationMethod"}, {"type": "string"}], "default": "linear", "description": "Method used for interpolation", "title": "Interpmethod"}}, "required": ["value", "mBeforeLegChange", "mAfterLegChange"], "title": "DataPoint", "type": "object"}, "DetectedShip": {"additionalProperties": true, "properties": {"id": {"description": "Unique Identifier", "examples": ["f3b9173e-3b5b-4176-862b-aa16be45d97c"], "format": "uuid", "title": "Id", "type": "string"}, "position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}], "title": "Longitude and Latitude Values"}, "sog": {"description": "Initial ship speed over ground in knots", "examples": [10.0], "minimum": 0.0, "title": "ship speed over ground", "type": "number"}, "cog": {"description": "Initial ship course over ground in degrees", "examples": [45.0], "maximum": 360.0, "minimum": 0.0, "title": "ship course over ground", "type": "number"}, "heading": {"anyOf": [{"maximum": 360.0, "minimum": 0.0, "type": "number"}, {"type": "null"}], "default": null, "description": "Initial ship heading in degrees", "examples": [45.2], "title": "ship heading"}, "navStatus": {"allOf": [{"$ref": "#/$defs/AISNavStatus"}], "default": null, "description": "AIS Navigational Status"}, "encounterType": {"anyOf": [{"$ref": "#/$defs/EncounterType"}, {"type": "null"}], "default": null, "description": "COLREG encounter type", "examples": ["Overtaking stand-on"]}, "colregRulesApplied": {"default": null, "description": "COLREG rules the system is applying to the vessel. Each item in the list must be of type `int` corresponding to the COLREG rule number", "examples": [[16, 17]], "items": {"type": "integer"}, "title": "Colregrulesapplied", "type": "array"}, "distanceToTarget": {"default": null, "description": "Calculated distance from the own ship to the target vessel", "examples": [1900.2], "title": "Distancetotarget", "type": "number"}, "dcpa": {"anyOf": [{"type": "number"}, {"type": "null"}], "default": null, "description": "Calculated closest point of approach", "examples": [100.3], "title": "Dcpa"}, "tcpa": {"anyOf": [{"type": "number"}, {"type": "null"}], "default": null, "description": "calculated time to closest point of approach in seconds", "examples": [2131], "title": "Tcpa"}, "predictions": {"additionalProperties": {"items": {"$ref": "#/$defs/PredictedPoint"}, "type": "array"}, "default": null, "description": "List of predicted future values. This can be used to store data like a predicted path for each target vessel. The `value` field supports both numbers and objects", "examples": [[{"time": "2024-02-22T17:45:49.335445", "value": {"latitude": 57.2343, "longitude": 10.3432}}, {"time": "2024-02-22T17:45:59.335445", "value": {"latitude": 57.2345, "longitude": 10.3432}}, {"time": "2024-02-22T17:46:09.335445", "value": {"latitude": 57.2349, "longitude": 10.343}}]], "title": "Predictions", "type": "object"}}, "required": ["id", "position", "sog", "cog"], "title": "DetectedShip", "type": "object"}, "EncounterType": {"enum": ["Overtaking stand-on", "Overtaking give-way", "Head-on", "Crossing give-way", "Crossing stand-on", "No Risk"], "title": "EncounterType", "type": "string"}, "Environment": {"properties": {"airTemperature": {"default": null, "description": "The air temperature in degrees Celsius", "examples": [20.0], "title": "Airtemperature", "type": "number"}, "waterRemperature": {"default": null, "description": "The water temperature in degrees Celsius", "examples": [15.0], "title": "Waterremperature", "type": "number"}, "precipitation": {"allOf": [{"$ref": "#/$defs/PrecipitationType"}], "default": null, "description": "The type of precipitation", "examples": ["Rain"]}, "windSpeed": {"default": null, "description": "The wind speed in m/s", "examples": [10.0], "title": "Windspeed", "type": "number"}, "windDirection": {"default": null, "description": "The wind direction in degrees", "examples": [180.0], "title": "Winddirection", "type": "number"}, "currentSpeed": {"default": null, "description": "The current speed in m/s", "examples": [1.0], "title": "Currentspeed", "type": "number"}, "currentDirection": {"default": null, "description": "The current direction in degrees", "examples": [90.0], "title": "Currentdirection", "type": "number"}, "waveSpectrum": {"allOf": [{"$ref": "#/$defs/WaveSpectra"}], "default": null, "description": "The wave spectrum", "examples": ["JONSWAP"]}, "significantWaveHeight": {"default": null, "description": "The significant wave height in meters", "examples": [3.0], "title": "Significantwaveheight", "type": "number"}, "wavePeriod": {"default": null, "description": "The wave period in seconds", "examples": [12.0], "title": "Waveperiod", "type": "number"}, "waveDirection": {"default": null, "description": "The wave direction in degrees", "examples": [270.0], "title": "Wavedirection", "type": "number"}, "visibility": {"default": null, "description": "The visibility in nautical miles", "examples": [5.0], "title": "Visibility", "type": "number"}, "conditions": {"allOf": [{"$ref": "#/$defs/WeatherCondition"}], "default": null, "description": "The overall weather conditions", "examples": ["Clear"]}}, "title": "Environment", "type": "object"}, "GeneralShipType": {"enum": ["Wing in ground", "Fishing", "Towing", "Dredging or underwater ops", "Diving ops", "Military ops", "Sailing", "Pleasure Craft", "High speed craft", "Pilot Vessel", "Search and Rescue vessel", "Tug", "Port Tender", "Anti-pollution", "Law Enforcement", "Medical Transport", "Noncombatant ship", "Passenger", "Cargo", "Tanker", "Other Type"], "title": "GeneralShipType", "type": "string"}, "Initial": {"properties": {"position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}], "title": "Longitude and Latitude Values"}, "sog": {"description": "Initial ship speed over ground in knots", "examples": [10.0], "minimum": 0.0, "title": "Initial ship speed over ground", "type": "number"}, "cog": {"description": "Initial ship course over ground in degrees", "examples": [45.0], "maximum": 360.0, "minimum": 0.0, "title": "Initial ship course over ground", "type": "number"}, "heading": {"anyOf": [{"maximum": 360.0, "minimum": 0.0, "type": "number"}, {"type": "null"}], "default": null, "description": "Initial ship heading in degrees", "examples": [45.2], "title": "Initial ship heading"}, "navStatus": {"allOf": [{"$ref": "#/$defs/AISNavStatus"}], "description": "AIS Navigational Status"}}, "required": ["position", "sog", "cog", "navStatus"], "title": "Initial", "type": "object"}, "InterpolationMethod": {"enum": ["linear", "cosine", "smoothstep", "accelerate", "decelerate", "ordinal"], "title": "InterpolationMethod", "type": "string"}, "OwnShip": {"properties": {"static": {"anyOf": [{"$ref": "#/$defs/ShipStatic"}, {"type": "null"}], "description": "Static ship information which does not change during a scenario.", "examples": [{"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}]}, "initial": {"allOf": [{"$ref": "#/$defs/Initial"}], "examples": [{"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}], "title": "Initial own ship Initial"}, "waypoints": {"anyOf": [{"items": {"$ref": "#/$defs/Waypoint"}, "type": "array"}, {"type": "null"}], "default": null, "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", "examples": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}], "title": "Waypoints"}}, "required": ["static", "initial"], "title": "OwnShip", "type": "object"}, "Position": {"properties": {"latitude": {"description": "WGS-84 latitude", "examples": [51.2131], "maximum": 90.0, "minimum": -90.0, "title": "Latitude", "type": "number"}, "longitude": {"description": "WGS-84 longitude", "examples": [11.2131], "maximum": 180.0, "minimum": -180.0, "title": "Longitude", "type": "number"}}, "required": ["latitude", "longitude"], "title": "Position", "type": "object"}, "PrecipitationType": {"enum": ["None", "Rain", "Snow", "Sleet", "Hail"], "title": "PrecipitationType", "type": "string"}, "PredictedPoint": {"properties": {"time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "integer"}], "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": ["2024-02-22T17:45:49.335445"], "title": "Time"}, "value": {"anyOf": [{"type": "number"}, {}], "description": "Value of the prediction", "examples": [{"latitude": 57.2343, "longitude": 10.3432}, 100], "title": "Value"}}, "required": ["time", "value"], "title": "PredictedPoint", "type": "object"}, "ShipStatic": {"description": "Static ship data that will not change during the scenario.", "properties": {"id": {"description": "Unique Identifier", "examples": ["e2b858d4-c83b-4cfc-95fd-c09051840c03"], "format": "uuid", "title": "Id", "type": "string"}, "length": {"description": "Length of the ship in meters", "examples": [230.0], "g": 0, "title": "Length", "type": "number"}, "width": {"description": "Width of the ship in meters", "examples": [30.0], "g": 0, "title": "Width", "type": "number"}, "height": {"anyOf": [{"type": "number"}, {"type": "null"}], "default": 10, "description": "Height of the ship in meters", "examples": [15.0], "g": 0, "title": "Height"}, "mmsi": {"anyOf": [{"maximum": 999999999, "minimum": 100000000, "type": "integer"}, {"type": "null"}], "default": null, "description": "Maritime Mobile Service Identity (MMSI)", "examples": [123456789], "title": "Mmsi"}, "imo": {"anyOf": [{"maximum": 9999999, "minimum": 1000000, "type": "integer"}, {"type": "null"}], "default": null, "description": "IMO Number", "examples": [1234567], "title": "Imo"}, "name": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": null, "description": "Ship title", "examples": ["RMS Titanic"], "title": "Name"}, "shipType": {"allOf": [{"$ref": "#/$defs/GeneralShipType"}], "description": "General ship type, based on AIS"}}, "required": ["id", "length", "width", "shipType"], "title": "ShipStatic", "type": "object"}, "SimulatedShip": {"additionalProperties": true, "properties": {"id": {"description": "Unique Identifier", "examples": ["f923a710-d915-46dd-929c-30cfb36f0407"], "format": "uuid", "title": "Id", "type": "string"}, "position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}], "title": "Longitude and Latitude Values"}, "sog": {"description": "Initial ship speed over ground in knots", "examples": [10.0], "minimum": 0.0, "title": "ship speed over ground", "type": "number"}, "cog": {"description": "Initial ship course over ground in degrees", "examples": [45.0], "maximum": 360.0, "minimum": 0.0, "title": "ship course over ground", "type": "number"}, "heading": {"anyOf": [{"maximum": 360.0, "minimum": 0.0, "type": "number"}, {"type": "null"}], "default": null, "description": "Initial ship heading in degrees", "examples": [45.2], "title": "ship heading"}, "navStatus": {"allOf": [{"$ref": "#/$defs/AISNavStatus"}], "description": "AIS Navigational Status"}, "acceleration": {"default": null, "description": "Ship acceleration in `ms^-2`", "examples": [0.01], "title": "Acceleration", "type": "number"}, "rateOfTurn": {"default": null, "description": "Ship rate of turn in `deg/s`", "examples": [1.8], "title": "Rateofturn", "type": "number"}}, "required": ["id", "position", "sog", "cog", "navStatus"], "title": "SimulatedShip", "type": "object"}, "SimulationData": {"properties": {"configuration": {"allOf": [{"$ref": "#/$defs/SoftwareConfig"}], "description": "Simulator software configuration", "examples": [{"name": "Simulator-System 1", "vendor": "CompanyABC", "version": "1.2.3"}]}, "timeSeriesData": {"description": "TimeSeries data originating from the Simulator", "examples": [[{"ownShip": {"acceleration": null, "cog": 97.0, "heading": null, "id": "1d1bd483-1f48-4329-a1ce-bddcece590dc", "mmsi": 987654321, "navStatus": "Under way using engine", "position": {"latitude": 57.2345, "longitude": 10.3432}, "rateOfTurn": 3.0, "sog": 20.0}, "targetShips": [{"acceleration": 0.01, "cog": 181.0, "heading": null, "id": "90023c6f-f9b0-4569-8327-0164d2fd858a", "navStatus": "Engaged in fishing", "position": {"latitude": 57.2343, "longitude": 10.3432}, "rateOfTurn": 1.0, "sog": 10.0}, {"acceleration": null, "cog": 7.0, "heading": null, "id": "b97a6de7-8097-4f42-8107-e86e44163ab2", "mmsi": 123456789, "navStatus": "Under way using engine", "position": {"latitude": 57.2349, "longitude": 10.343}, "rateOfTurn": 0.0, "sog": 14.0}], "time": "2024-02-22T17:45:49.351070"}, {"ownShip": {"acceleration": null, "cog": 97.0, "heading": null, "id": "1d1bd483-1f48-4329-a1ce-bddcece590dc", "mmsi": 987654321, "navStatus": "Under way using engine", "position": {"latitude": 57.2345, "longitude": 10.3432}, "rateOfTurn": 3.0, "sog": 20.0}, "targetShips": [{"acceleration": 0.01, "cog": 181.0, "heading": null, "id": "90023c6f-f9b0-4569-8327-0164d2fd858a", "navStatus": "Engaged in fishing", "position": {"latitude": 57.2343, "longitude": 10.3432}, "rateOfTurn": 1.0, "sog": 10.0}, {"acceleration": null, "cog": 7.0, "heading": null, "id": "b97a6de7-8097-4f42-8107-e86e44163ab2", "mmsi": 123456789, "navStatus": "Under way using engine", "position": {"latitude": 57.2349, "longitude": 10.343}, "rateOfTurn": 0.0, "sog": 14.0}], "time": "2024-02-22T17:45:59.351070"}]], "items": {"$ref": "#/$defs/SimulationTimeFrame"}, "title": "Timeseriesdata", "type": "array"}, "eventData": {"default": null, "description": "Event data from the simulator", "items": {"$ref": "#/$defs/SimulatorEvent"}, "title": "Eventdata", "type": "array"}}, "required": ["configuration", "timeSeriesData"], "title": "SimulationData", "type": "object"}, "SimulationTimeFrame": {"properties": {"time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "integer"}], "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": ["2024-02-22T17:45:49.351070"], "title": "Time"}, "ownShip": {"$ref": "#/$defs/SimulatedShip"}, "targetShips": {"items": {"$ref": "#/$defs/SimulatedShip"}, "title": "Targetships", "type": "array"}}, "required": ["time", "ownShip", "targetShips"], "title": "SimulationTimeFrame", "type": "object"}, "SimulatorEvent": {"additionalProperties": true, "properties": {"time": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "integer"}], "description": "Date and Time of the event", "examples": ["2024-02-22T17:45:49.335445"], "title": "Time"}}, "required": ["time"], "title": "SimulatorEvent", "type": "object"}, "SoftwareConfig": {"additionalProperties": true, "properties": {"name": {"description": "The name of the system", "examples": ["AutoNavigation-System 1"], "title": "Name", "type": "string"}, "version": {"description": "The software version", "examples": ["1.2.3"], "title": "Version", "type": "string"}, "vendor": {"description": "The name of the system vendor", "examples": ["CompanyABC"], "title": "Vendor", "type": "string"}}, "required": ["name", "version", "vendor"], "title": "SoftwareConfig", "type": "object"}, "TargetShip": {"properties": {"static": {"anyOf": [{"$ref": "#/$defs/ShipStatic"}, {"type": "null"}], "description": "Static ship information which does not change during a scenario.", "examples": [{"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}]}, "initial": {"allOf": [{"$ref": "#/$defs/Initial"}], "examples": [{"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}], "title": "Initial own ship Initial"}, "waypoints": {"anyOf": [{"items": {"$ref": "#/$defs/Waypoint"}, "type": "array"}, {"type": "null"}], "default": null, "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", "examples": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}], "title": "Waypoints"}}, "required": ["static", "initial"], "title": "TargetShip", "type": "object"}, "TrafficSituation": {"additionalProperties": true, "properties": {"title": {"description": "The title of the traffic situation", "examples": ["overtaking_18"], "omit_default": true, "title": "Title", "type": "string"}, "description": {"description": "A description of the traffic situation", "examples": ["Crossing situation with 3 target vessels in the Oslofjord"], "title": "Description", "type": "string"}, "startTime": {"anyOf": [{"format": "date-time", "type": "string"}, {"type": "null"}], "default": null, "description": "Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": ["2024-02-22T17:45:49.335445"], "title": "Situation starting time"}, "ownShip": {"allOf": [{"$ref": "#/$defs/OwnShip"}], "description": "Own Ship data", "examples": [{"initial": {"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}, "static": {"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}, "waypoints": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}]}], "title": "Own Ship data"}, "targetShips": {"default": null, "description": "Target Ship data", "examples": [[{"initial": {"cog": 284.2, "heading": 283.1, "navStatus": "Under way using engine", "position": {"latitude": 51.2123, "longitude": 11.2313}, "sog": 12.3}, "static": {"height": 15.0, "id": "cf5eeb84-7120-484a-a15e-fa2bbf25bd7a", "imo": null, "length": 230.0, "mmsi": 123456789, "name": "RMS Titanic", "shipType": "Fishing", "width": 30.0}, "waypoints": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}]}]], "items": {"$ref": "#/$defs/TargetShip"}, "title": "Target Ship data", "type": "array"}, "environment": {"anyOf": [{"$ref": "#/$defs/Environment"}, {"type": "null"}], "default": null, "description": "environmental parameters", "examples": [{"airTemperature": 20.0, "conditions": "Clear", "currentDirection": 90.0, "currentSpeed": 1.0, "precipitation": "Rain", "significantWaveHeight": 3.0, "visibility": 5.0, "waterRemperature": 15.0, "waveDirection": 270.0, "wavePeriod": 12.0, "waveSpectrum": "JONSWAP", "windDirection": 180.0, "windSpeed": 10.0}]}}, "required": ["title", "description", "ownShip"], "title": "Test Input Schema", "type": "object"}, "WaveSpectra": {"enum": ["JONSWAP", "Pierson-Moskowitz", "Bretschneider"], "title": "WaveSpectra", "type": "string"}, "Waypoint": {"properties": {"position": {"allOf": [{"$ref": "#/$defs/Position"}], "description": "A geographical coordinate", "examples": [{"latitude": 51.2123, "longitude": 11.2313}]}, "turnRadius": {"default": 0, "description": "Orthodrome turn radius as defined in RTZ format", "examples": [200], "title": "Turnradius", "type": "number"}, "data": {"allOf": [{"$ref": "#/$defs/Data"}], "default": null, "description": "A `Data` object that includes `speed`, `course`, and `heading` data points"}}, "required": ["position"], "title": "Waypoint", "type": "object"}, "WeatherCondition": {"enum": ["Clear", "Cloudy", "Foggy", "Rainy", "Snowy"], "title": "WeatherCondition", "type": "string"}}, "additionalProperties": true, "description": "#### This is a JSON schema for result data originating from Collision and Grounding Avoidance systems", "properties": {"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-02-22T17:45:49.351070"], "format": "date-time", "title": "Creationtime", "type": "string"}, "trafficSituation": {"anyOf": [{"$ref": "#/$defs/TrafficSituation"}, {"type": "null"}], "default": null, "description": "The traffic situation that was simulated (input file). This should remain unmofidied."}, "cagaData": {"anyOf": [{"$ref": "#/$defs/CagaData"}, {"type": "null"}], "default": null, "description": "Data generated by the system under test (auto-navigation / collision and grounding avoidance system) during the scenario.", "examples": [{"configuration": {"automatic_manoeuver_acceptance_time": 7, "critical_TCPA": 1000, "manoeuver_delay": 20, "minimum_distance_to_targets": 100, "name": "AutoNavigation-System 1", "safety_depth": 20, "vendor": "CompanyABC", "vendorAutomaticManoeuverAcceptanceTime": null, "vendorCriticalTcpa": null, "vendorManoeuverDelay": null, "vendorMinimumDistanceToTargets": null, "vendorSafetyDepth": null, "version": "1.2.3"}, "eventData": [{"route": [{"data": {"cog": {"interpMethod": "cosine", "mAfterLegChange": 500.0, "mBeforeLegChange": 500.0, "value": 200.0}, "heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2343, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2345, "longitude": 10.3432}, "turnRadius": 500.0}, {"data": {"heading": null, "sog": {"interpMethod": "linear", "mAfterLegChange": 100.0, "mBeforeLegChange": 100.0, "value": 12.3}}, "position": {"latitude": 57.2349, "longitude": 10.343}, "turnRadius": 500.0}], "time": "2024-02-22T17:45:49.335445"}], "timeSeriesData": [{"internalStatus": null, "targetShips": [{"cog": 181.0, "colregRulesApplied": [12], "dcpa": 300.0, "distanceToTarget": 874.0, "encounterType": "Head-on", "heading": null, "id": "c85e6953-adc2-4321-88f9-1b545abf6336", "navStatus": "Under way using engine", "position": {"latitude": 57.2343, "longitude": 10.3432}, "predictions": {"position": [{"time": "2024-02-22T17:45:49.335445", "value": {"latitude": 57.2343, "longitude": 10.3432}}, {"time": "2024-02-22T17:45:59.335445", "value": {"latitude": 57.2345, "longitude": 10.3432}}, {"time": "2024-02-22T17:46:09.335445", "value": {"latitude": 57.2349, "longitude": 10.343}}]}, "sog": 10.2, "tcpa": 1200.0}], "time": "2024-02-22T17:45:49.335445"}]}]}, "simulationData": {"anyOf": [{"$ref": "#/$defs/SimulationData"}, {"type": "null"}], "default": null, "description": "Data generated by the simulator duirng the scenario", "examples": [{"configuration": {"name": "Simulator-System 1", "vendor": "CompanyABC", "version": "1.2.3"}, "eventData": null, "timeSeriesData": [{"ownShip": {"acceleration": null, "cog": 97.0, "heading": null, "id": "1d1bd483-1f48-4329-a1ce-bddcece590dc", "mmsi": 987654321, "navStatus": "Under way using engine", "position": {"latitude": 57.2345, "longitude": 10.3432}, "rateOfTurn": 3.0, "sog": 20.0}, "targetShips": [{"acceleration": 0.01, "cog": 181.0, "heading": null, "id": "90023c6f-f9b0-4569-8327-0164d2fd858a", "navStatus": "Engaged in fishing", "position": {"latitude": 57.2343, "longitude": 10.3432}, "rateOfTurn": 1.0, "sog": 10.0}, {"acceleration": null, "cog": 7.0, "heading": null, "id": "b97a6de7-8097-4f42-8107-e86e44163ab2", "mmsi": 123456789, "navStatus": "Under way using engine", "position": {"latitude": 57.2349, "longitude": 10.343}, "rateOfTurn": 0.0, "sog": 14.0}], "time": "2024-02-22T17:45:49.351070"}, {"ownShip": {"acceleration": null, "cog": 97.0, "heading": null, "id": "1d1bd483-1f48-4329-a1ce-bddcece590dc", "mmsi": 987654321, "navStatus": "Under way using engine", "position": {"latitude": 57.2345, "longitude": 10.3432}, "rateOfTurn": 3.0, "sog": 20.0}, "targetShips": [{"acceleration": 0.01, "cog": 181.0, "heading": null, "id": "90023c6f-f9b0-4569-8327-0164d2fd858a", "navStatus": "Engaged in fishing", "position": {"latitude": 57.2343, "longitude": 10.3432}, "rateOfTurn": 1.0, "sog": 10.0}, {"acceleration": null, "cog": 7.0, "heading": null, "id": "b97a6de7-8097-4f42-8107-e86e44163ab2", "mmsi": 123456789, "navStatus": "Under way using engine", "position": {"latitude": 57.2349, "longitude": 10.343}, "rateOfTurn": 0.0, "sog": 14.0}], "time": "2024-02-22T17:45:59.351070"}]}]}}, "required": ["creationTime"], "title": "Test Output Schema", "type": "object"} \ No newline at end of file +{ + "$defs": { + "AISNavStatus": { + "enum": [ + "Under way using engine", + "At anchor", + "Not under command", + "Restricted manoeuverability", + "Constrained by her draught", + "Moored", + "Aground", + "Engaged in fishing", + "Under way sailing", + "Reserved for future amendment of navigational status for HSC", + "Reserved for future amendment of navigational status for WIG", + "Reserved for future use 1", + "Reserved for future use 2", + "Reserved for future use 3", + "AIS SART is active", + "Not defined (default)" + ], + "title": "AISNavStatus", + "type": "string" + }, + "CagaConfiguration": { + "additionalProperties": true, + "properties": { + "name": { + "description": "The name of the system", + "examples": [ + "AutoNavigation-System 1" + ], + "title": "Name", + "type": "string" + }, + "version": { + "description": "The software version", + "examples": [ + "1.2.3" + ], + "title": "Version", + "type": "string" + }, + "vendor": { + "description": "The name of the system vendor", + "examples": [ + "CompanyABC" + ], + "title": "Vendor", + "type": "string" + }, + "vendorMinimumDistanceToTargets": { + "default": null, + "description": "Minimum distance in meters that the system will keep to other Vessels", + "examples": [ + 100 + ], + "title": "Vendorminimumdistancetotargets", + "type": "number" + }, + "vendorCriticalTcpa": { + "default": null, + "description": "If the projected CPA is less than minimumDistanceToTargets, and TCPA falls below criticalTCPA, a new manoeuver should be calculated", + "examples": [ + 1000 + ], + "title": "Vendorcriticaltcpa", + "type": "number" + }, + "vendorManoeuverDelay": { + "default": null, + "description": "Time given in seconds to the navigator / system, before the proposed manoeuver is no longer able to be excecuted", + "examples": [ + 20 + ], + "title": "Vendormanoeuverdelay", + "type": "number" + }, + "vendorSafetyDepth": { + "default": null, + "description": "Minimum safety depth", + "examples": [ + 30 + ], + "title": "Vendorsafetydepth", + "type": "number" + }, + "vendorAutomaticManoeuverAcceptanceTime": { + "default": null, + "description": "If automatic maneuver acceptance is enabled, the new route will be activated after a specified number of seconds", + "examples": [ + 20 + ], + "title": "Vendorautomaticmanoeuveracceptancetime", + "type": "number" + } + }, + "required": [ + "name", + "version", + "vendor" + ], + "title": "CagaConfiguration", + "type": "object" + }, + "CagaData": { + "properties": { + "configuration": { + "allOf": [ + { + "$ref": "#/$defs/CagaConfiguration" + } + ], + "description": "System Configuration", + "examples": [ + { + "automatic_manoeuver_acceptance_time": 7, + "critical_TCPA": 1000, + "manoeuver_delay": 20, + "minimum_distance_to_targets": 100, + "name": "AutoNavigation-System 1", + "safety_depth": 20, + "vendor": "CompanyABC", + "vendorAutomaticManoeuverAcceptanceTime": null, + "vendorCriticalTcpa": null, + "vendorManoeuverDelay": null, + "vendorMinimumDistanceToTargets": null, + "vendorSafetyDepth": null, + "version": "1.2.3" + } + ] + }, + "timeSeriesData": { + "description": "Time series data from the system", + "examples": [ + [ + { + "internalStatus": null, + "targetShips": [ + { + "cog": 181.0, + "colregRulesApplied": [ + 12 + ], + "dcpa": 300.0, + "distanceToTarget": 874.0, + "encounterType": "Head-on", + "heading": null, + "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f", + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "predictions": { + "position": [ + { + "time": "2024-02-22T18:09:43.990808", + "value": { + "latitude": 57.2343, + "longitude": 10.3432 + } + }, + { + "time": "2024-02-22T18:09:53.990808", + "value": { + "latitude": 57.2345, + "longitude": 10.3432 + } + }, + { + "time": "2024-02-22T18:10:03.990808", + "value": { + "latitude": 57.2349, + "longitude": 10.343 + } + } + ] + }, + "sog": 10.2, + "tcpa": 1200.0 + } + ], + "time": "2024-02-22T18:09:43.997843" + } + ] + ], + "items": { + "$ref": "#/$defs/CagaTimeFrame" + }, + "title": "Timeseriesdata", + "type": "array" + }, + "eventData": { + "default": null, + "description": "Event data from the system", + "examples": [ + [ + { + "route": [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + }, + { + "data": { + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2345, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + }, + { + "data": { + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2349, + "longitude": 10.343 + }, + "turnRadius": 500.0 + } + ], + "time": "2024-02-22T18:09:43.998842" + } + ] + ], + "items": { + "$ref": "#/$defs/CagaEvent" + }, + "title": "Eventdata", + "type": "array" + } + }, + "required": [ + "configuration", + "timeSeriesData" + ], + "title": "CagaData", + "type": "object" + }, + "CagaEvent": { + "additionalProperties": true, + "properties": { + "time": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "integer" + } + ], + "description": "Date and Time of the event", + "examples": [ + "2024-02-22T18:09:43.997843" + ], + "title": "Time" + }, + "route": { + "default": null, + "description": "Planned CAGA Route", + "examples": [ + [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + }, + { + "data": { + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2345, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + }, + { + "data": { + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2349, + "longitude": 10.343 + }, + "turnRadius": 500.0 + } + ] + ], + "items": { + "$ref": "#/$defs/Waypoint" + }, + "title": "Route", + "type": "array" + } + }, + "required": [ + "time" + ], + "title": "CagaEvent", + "type": "object" + }, + "CagaTimeFrame": { + "properties": { + "time": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "integer" + } + ], + "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", + "examples": [ + "2024-02-22T18:09:43.995843" + ], + "title": "Time" + }, + "targetShips": { + "description": "list of target ships detected by the CAGA system", + "examples": [ + [ + { + "cog": 181.0, + "colregRulesApplied": [ + 12 + ], + "dcpa": 300.0, + "distanceToTarget": 874.0, + "encounterType": "Head-on", + "heading": null, + "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f", + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "predictions": { + "position": [ + { + "time": "2024-02-22T18:09:43.990808", + "value": { + "latitude": 57.2343, + "longitude": 10.3432 + } + }, + { + "time": "2024-02-22T18:09:53.990808", + "value": { + "latitude": 57.2345, + "longitude": 10.3432 + } + }, + { + "time": "2024-02-22T18:10:03.990808", + "value": { + "latitude": 57.2349, + "longitude": 10.343 + } + } + ] + }, + "sog": 10.2, + "tcpa": 1200.0 + } + ] + ], + "items": { + "$ref": "#/$defs/DetectedShip" + }, + "title": "Targetships", + "type": "array" + }, + "internalStatus": { + "default": null, + "description": "Dictionary containing additional internal information about the system (health, status..)", + "title": "Internalstatus" + } + }, + "required": [ + "time", + "targetShips" + ], + "title": "CagaTimeFrame", + "type": "object" + }, + "Data": { + "additionalProperties": { + "description": "The 'data' field can include additional properties. All additional properties should be DataPoint objects.", + "properties": { + "value": { + "type": "number" + }, + "mBeforeLegChange": { + "type": "number" + }, + "mAfterLegChange": { + "type": "number" + }, + "interpMethod": { + "type": "string" + } + }, + "required": [ + "value", + "mBeforeLegChange", + "mAfterLegChange", + "interpMethod" + ], + "type": "object" + }, + "properties": { + "sog": { + "allOf": [ + { + "$ref": "#/$defs/DataPoint" + } + ], + "default": null, + "description": "Speed data point", + "examples": [ + { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + ] + }, + "heading": { + "allOf": [ + { + "$ref": "#/$defs/DataPoint" + } + ], + "default": null, + "description": "Heading data point", + "examples": [ + { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 180.0 + } + ] + } + }, + "title": "Data", + "type": "object" + }, + "DataPoint": { + "properties": { + "value": { + "description": "the value of the data at the current timestep", + "examples": [ + 12.3 + ], + "title": "Value", + "type": "number" + }, + "mBeforeLegChange": { + "description": "meters before the waypoint to start interpolating to the new value", + "examples": [ + 10 + ], + "title": "Mbeforelegchange", + "type": "number" + }, + "mAfterLegChange": { + "description": "meters after the waypoint to finish interpolating to the new value", + "examples": [ + 10 + ], + "title": "Mafterlegchange", + "type": "number" + }, + "interpMethod": { + "anyOf": [ + { + "$ref": "#/$defs/InterpolationMethod" + }, + { + "type": "string" + } + ], + "default": "linear", + "description": "Method used for interpolation", + "title": "Interpmethod" + } + }, + "required": [ + "value", + "mBeforeLegChange", + "mAfterLegChange" + ], + "title": "DataPoint", + "type": "object" + }, + "DetectedShip": { + "additionalProperties": true, + "properties": { + "id": { + "description": "Unique Identifier", + "examples": [ + "a8c08c4a-12c3-4f75-94e9-05f43df79e3b" + ], + "format": "uuid", + "title": "Id", + "type": "string" + }, + "position": { + "allOf": [ + { + "$ref": "#/$defs/Position" + } + ], + "description": "A geographical coordinate", + "examples": [ + { + "latitude": 51.2123, + "longitude": 11.2313 + } + ], + "title": "Longitude and Latitude Values" + }, + "sog": { + "description": "Initial ship speed over ground in knots", + "examples": [ + 10.0 + ], + "minimum": 0.0, + "title": "ship speed over ground", + "type": "number" + }, + "cog": { + "description": "Initial ship course over ground in degrees", + "examples": [ + 45.0 + ], + "maximum": 360.0, + "minimum": 0.0, + "title": "ship course over ground", + "type": "number" + }, + "heading": { + "anyOf": [ + { + "maximum": 360.0, + "minimum": 0.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Initial ship heading in degrees", + "examples": [ + 45.2 + ], + "title": "ship heading" + }, + "navStatus": { + "allOf": [ + { + "$ref": "#/$defs/AISNavStatus" + } + ], + "default": null, + "description": "AIS Navigational Status" + }, + "encounterType": { + "anyOf": [ + { + "$ref": "#/$defs/EncounterType" + }, + { + "type": "null" + } + ], + "default": null, + "description": "COLREG encounter type", + "examples": [ + "Overtaking stand-on" + ] + }, + "colregRulesApplied": { + "default": null, + "description": "COLREG rules the system is applying to the vessel. Each item in the list must be of type `int` corresponding to the COLREG rule number", + "examples": [ + [ + 16, + 17 + ] + ], + "items": { + "type": "integer" + }, + "title": "Colregrulesapplied", + "type": "array" + }, + "distanceToTarget": { + "default": null, + "description": "Calculated distance from the own ship to the target vessel", + "examples": [ + 1900.2 + ], + "title": "Distancetotarget", + "type": "number" + }, + "dcpa": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Calculated closest point of approach", + "examples": [ + 100.3 + ], + "title": "Dcpa" + }, + "tcpa": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "calculated time to closest point of approach in seconds", + "examples": [ + 2131 + ], + "title": "Tcpa" + }, + "predictions": { + "additionalProperties": { + "items": { + "$ref": "#/$defs/PredictedPoint" + }, + "type": "array" + }, + "default": null, + "description": "List of predicted future values. This can be used to store data like a predicted path for each target vessel. The `value` field supports both numbers and objects", + "examples": [ + [ + { + "time": "2024-02-22T18:09:43.990808", + "value": { + "latitude": 57.2343, + "longitude": 10.3432 + } + }, + { + "time": "2024-02-22T18:09:53.990808", + "value": { + "latitude": 57.2345, + "longitude": 10.3432 + } + }, + { + "time": "2024-02-22T18:10:03.990808", + "value": { + "latitude": 57.2349, + "longitude": 10.343 + } + } + ] + ], + "title": "Predictions", + "type": "object" + } + }, + "required": [ + "id", + "position", + "sog", + "cog" + ], + "title": "DetectedShip", + "type": "object" + }, + "EncounterType": { + "enum": [ + "Overtaking stand-on", + "Overtaking give-way", + "Head-on", + "Crossing give-way", + "Crossing stand-on", + "No Risk" + ], + "title": "EncounterType", + "type": "string" + }, + "Environment": { + "properties": { + "airTemperature": { + "default": null, + "description": "The air temperature in degrees Celsius", + "examples": [ + 20.0 + ], + "title": "Airtemperature", + "type": "number" + }, + "waterRemperature": { + "default": null, + "description": "The water temperature in degrees Celsius", + "examples": [ + 15.0 + ], + "title": "Waterremperature", + "type": "number" + }, + "precipitation": { + "allOf": [ + { + "$ref": "#/$defs/PrecipitationType" + } + ], + "default": null, + "description": "The type of precipitation", + "examples": [ + "Rain" + ] + }, + "windSpeed": { + "default": null, + "description": "The wind speed in m/s", + "examples": [ + 10.0 + ], + "title": "Windspeed", + "type": "number" + }, + "windDirection": { + "default": null, + "description": "The wind direction in degrees", + "examples": [ + 180.0 + ], + "title": "Winddirection", + "type": "number" + }, + "currentSpeed": { + "default": null, + "description": "The current speed in m/s", + "examples": [ + 1.0 + ], + "title": "Currentspeed", + "type": "number" + }, + "currentDirection": { + "default": null, + "description": "The current direction in degrees", + "examples": [ + 90.0 + ], + "title": "Currentdirection", + "type": "number" + }, + "waveSpectrum": { + "allOf": [ + { + "$ref": "#/$defs/WaveSpectra" + } + ], + "default": null, + "description": "The wave spectrum", + "examples": [ + "JONSWAP" + ] + }, + "significantWaveHeight": { + "default": null, + "description": "The significant wave height in meters", + "examples": [ + 3.0 + ], + "title": "Significantwaveheight", + "type": "number" + }, + "wavePeriod": { + "default": null, + "description": "The wave period in seconds", + "examples": [ + 12.0 + ], + "title": "Waveperiod", + "type": "number" + }, + "waveDirection": { + "default": null, + "description": "The wave direction in degrees", + "examples": [ + 270.0 + ], + "title": "Wavedirection", + "type": "number" + }, + "visibility": { + "default": null, + "description": "The visibility in nautical miles", + "examples": [ + 5.0 + ], + "title": "Visibility", + "type": "number" + }, + "conditions": { + "allOf": [ + { + "$ref": "#/$defs/WeatherCondition" + } + ], + "default": null, + "description": "The overall weather conditions", + "examples": [ + "Clear" + ] + } + }, + "title": "Environment", + "type": "object" + }, + "GeneralShipType": { + "enum": [ + "Wing in ground", + "Fishing", + "Towing", + "Dredging or underwater ops", + "Diving ops", + "Military ops", + "Sailing", + "Pleasure Craft", + "High speed craft", + "Pilot Vessel", + "Search and Rescue vessel", + "Tug", + "Port Tender", + "Anti-pollution", + "Law Enforcement", + "Medical Transport", + "Noncombatant ship", + "Passenger", + "Cargo", + "Tanker", + "Other Type" + ], + "title": "GeneralShipType", + "type": "string" + }, + "Initial": { + "properties": { + "position": { + "allOf": [ + { + "$ref": "#/$defs/Position" + } + ], + "description": "A geographical coordinate", + "examples": [ + { + "latitude": 51.2123, + "longitude": 11.2313 + } + ], + "title": "Longitude and Latitude Values" + }, + "sog": { + "description": "Initial ship speed over ground in knots", + "examples": [ + 10.0 + ], + "minimum": 0.0, + "title": "Initial ship speed over ground", + "type": "number" + }, + "cog": { + "description": "Initial ship course over ground in degrees", + "examples": [ + 45.0 + ], + "maximum": 360.0, + "minimum": 0.0, + "title": "Initial ship course over ground", + "type": "number" + }, + "heading": { + "anyOf": [ + { + "maximum": 360.0, + "minimum": 0.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Initial ship heading in degrees", + "examples": [ + 45.2 + ], + "title": "Initial ship heading" + }, + "navStatus": { + "allOf": [ + { + "$ref": "#/$defs/AISNavStatus" + } + ], + "description": "AIS Navigational Status" + } + }, + "required": [ + "position", + "sog", + "cog", + "navStatus" + ], + "title": "Initial", + "type": "object" + }, + "InterpolationMethod": { + "enum": [ + "linear", + "cosine", + "smoothstep", + "accelerate", + "decelerate", + "ordinal" + ], + "title": "InterpolationMethod", + "type": "string" + }, + "OwnShip": { + "properties": { + "static": { + "anyOf": [ + { + "$ref": "#/$defs/ShipStatic" + }, + { + "type": "null" + } + ], + "description": "Static ship information which does not change during a scenario.", + "examples": [ + { + "height": 15.0, + "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "imo": null, + "length": 230.0, + "mmsi": 123456789, + "name": "RMS Titanic", + "shipType": "Fishing", + "width": 30.0 + } + ] + }, + "initial": { + "allOf": [ + { + "$ref": "#/$defs/Initial" + } + ], + "examples": [ + { + "cog": 284.2, + "heading": 283.1, + "navStatus": "Under way using engine", + "position": { + "latitude": 51.2123, + "longitude": 11.2313 + }, + "sog": 12.3 + } + ], + "title": "Initial own ship Initial" + }, + "waypoints": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Waypoint" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", + "examples": [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + } + ], + "title": "Waypoints" + } + }, + "required": [ + "static", + "initial" + ], + "title": "OwnShip", + "type": "object" + }, + "Position": { + "properties": { + "latitude": { + "description": "WGS-84 latitude", + "examples": [ + 51.2131 + ], + "maximum": 90.0, + "minimum": -90.0, + "title": "Latitude", + "type": "number" + }, + "longitude": { + "description": "WGS-84 longitude", + "examples": [ + 11.2131 + ], + "maximum": 180.0, + "minimum": -180.0, + "title": "Longitude", + "type": "number" + } + }, + "required": [ + "latitude", + "longitude" + ], + "title": "Position", + "type": "object" + }, + "PrecipitationType": { + "enum": [ + "None", + "Rain", + "Snow", + "Sleet", + "Hail" + ], + "title": "PrecipitationType", + "type": "string" + }, + "PredictedPoint": { + "properties": { + "time": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "integer" + } + ], + "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", + "examples": [ + "2024-02-22T18:09:43.989767" + ], + "title": "Time" + }, + "value": { + "anyOf": [ + { + "type": "number" + }, + {} + ], + "description": "Value of the prediction", + "examples": [ + { + "latitude": 57.2343, + "longitude": 10.3432 + }, + 100 + ], + "title": "Value" + } + }, + "required": [ + "time", + "value" + ], + "title": "PredictedPoint", + "type": "object" + }, + "ShipStatic": { + "description": "Static ship data that will not change during the scenario.", + "properties": { + "id": { + "description": "Unique Identifier", + "examples": [ + "0a9d3443-d305-4c28-a41b-09ed3f167254" + ], + "format": "uuid", + "title": "Id", + "type": "string" + }, + "length": { + "description": "Length of the ship in meters", + "examples": [ + 230.0 + ], + "g": 0, + "title": "Length", + "type": "number" + }, + "width": { + "description": "Width of the ship in meters", + "examples": [ + 30.0 + ], + "g": 0, + "title": "Width", + "type": "number" + }, + "height": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": 10, + "description": "Height of the ship in meters", + "examples": [ + 15.0 + ], + "g": 0, + "title": "Height" + }, + "mmsi": { + "anyOf": [ + { + "maximum": 999999999, + "minimum": 100000000, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Maritime Mobile Service Identity (MMSI)", + "examples": [ + 123456789 + ], + "title": "Mmsi" + }, + "imo": { + "anyOf": [ + { + "maximum": 9999999, + "minimum": 1000000, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "description": "IMO Number", + "examples": [ + 1234567 + ], + "title": "Imo" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Ship title", + "examples": [ + "RMS Titanic" + ], + "title": "Name" + }, + "shipType": { + "allOf": [ + { + "$ref": "#/$defs/GeneralShipType" + } + ], + "description": "General ship type, based on AIS" + } + }, + "required": [ + "id", + "length", + "width", + "shipType" + ], + "title": "ShipStatic", + "type": "object" + }, + "SimulatedShip": { + "additionalProperties": true, + "properties": { + "id": { + "description": "Unique Identifier", + "examples": [ + "a61becc8-2e93-4acf-9629-2b22131716ac" + ], + "format": "uuid", + "title": "Id", + "type": "string" + }, + "position": { + "allOf": [ + { + "$ref": "#/$defs/Position" + } + ], + "description": "A geographical coordinate", + "examples": [ + { + "latitude": 51.2123, + "longitude": 11.2313 + } + ], + "title": "Longitude and Latitude Values" + }, + "sog": { + "description": "Initial ship speed over ground in knots", + "examples": [ + 10.0 + ], + "minimum": 0.0, + "title": "ship speed over ground", + "type": "number" + }, + "cog": { + "description": "Initial ship course over ground in degrees", + "examples": [ + 45.0 + ], + "maximum": 360.0, + "minimum": 0.0, + "title": "ship course over ground", + "type": "number" + }, + "heading": { + "anyOf": [ + { + "maximum": 360.0, + "minimum": 0.0, + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Initial ship heading in degrees", + "examples": [ + 45.2 + ], + "title": "ship heading" + }, + "navStatus": { + "allOf": [ + { + "$ref": "#/$defs/AISNavStatus" + } + ], + "description": "AIS Navigational Status" + }, + "acceleration": { + "default": null, + "description": "Ship acceleration in `ms^-2`", + "examples": [ + 0.01 + ], + "title": "Acceleration", + "type": "number" + }, + "rateOfTurn": { + "default": null, + "description": "Ship rate of turn in `deg/s`", + "examples": [ + 1.8 + ], + "title": "Rateofturn", + "type": "number" + } + }, + "required": [ + "id", + "position", + "sog", + "cog", + "navStatus" + ], + "title": "SimulatedShip", + "type": "object" + }, + "SimulationData": { + "properties": { + "configuration": { + "allOf": [ + { + "$ref": "#/$defs/SoftwareConfig" + } + ], + "description": "Simulator software configuration", + "examples": [ + { + "name": "Simulator-System 1", + "vendor": "CompanyABC", + "version": "1.2.3" + } + ] + }, + "timeSeriesData": { + "description": "TimeSeries data originating from the Simulator", + "examples": [ + [ + { + "ownShip": { + "acceleration": null, + "cog": 97.0, + "heading": null, + "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab", + "mmsi": 987654321, + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2345, + "longitude": 10.3432 + }, + "rateOfTurn": 3.0, + "sog": 20.0 + }, + "targetShips": [ + { + "acceleration": 0.01, + "cog": 181.0, + "heading": null, + "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7", + "navStatus": "Engaged in fishing", + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "rateOfTurn": 1.0, + "sog": 10.0 + }, + { + "acceleration": null, + "cog": 7.0, + "heading": null, + "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b", + "mmsi": 123456789, + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2349, + "longitude": 10.343 + }, + "rateOfTurn": 0.0, + "sog": 14.0 + } + ], + "time": "2024-02-22T18:09:44.002844" + }, + { + "ownShip": { + "acceleration": null, + "cog": 97.0, + "heading": null, + "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab", + "mmsi": 987654321, + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2345, + "longitude": 10.3432 + }, + "rateOfTurn": 3.0, + "sog": 20.0 + }, + "targetShips": [ + { + "acceleration": 0.01, + "cog": 181.0, + "heading": null, + "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7", + "navStatus": "Engaged in fishing", + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "rateOfTurn": 1.0, + "sog": 10.0 + }, + { + "acceleration": null, + "cog": 7.0, + "heading": null, + "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b", + "mmsi": 123456789, + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2349, + "longitude": 10.343 + }, + "rateOfTurn": 0.0, + "sog": 14.0 + } + ], + "time": "2024-02-22T18:09:54.002844" + } + ] + ], + "items": { + "$ref": "#/$defs/SimulationTimeFrame" + }, + "title": "Timeseriesdata", + "type": "array" + }, + "eventData": { + "default": null, + "description": "Event data from the simulator", + "items": { + "$ref": "#/$defs/SimulatorEvent" + }, + "title": "Eventdata", + "type": "array" + } + }, + "required": [ + "configuration", + "timeSeriesData" + ], + "title": "SimulationData", + "type": "object" + }, + "SimulationTimeFrame": { + "properties": { + "time": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "integer" + } + ], + "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", + "examples": [ + "2024-02-22T18:09:44.001842" + ], + "title": "Time" + }, + "ownShip": { + "$ref": "#/$defs/SimulatedShip" + }, + "targetShips": { + "items": { + "$ref": "#/$defs/SimulatedShip" + }, + "title": "Targetships", + "type": "array" + } + }, + "required": [ + "time", + "ownShip", + "targetShips" + ], + "title": "SimulationTimeFrame", + "type": "object" + }, + "SimulatorEvent": { + "additionalProperties": true, + "properties": { + "time": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "integer" + } + ], + "description": "Date and Time of the event", + "examples": [ + "2024-02-22T18:09:43.998842" + ], + "title": "Time" + } + }, + "required": [ + "time" + ], + "title": "SimulatorEvent", + "type": "object" + }, + "SoftwareConfig": { + "additionalProperties": true, + "properties": { + "name": { + "description": "The name of the system", + "examples": [ + "AutoNavigation-System 1" + ], + "title": "Name", + "type": "string" + }, + "version": { + "description": "The software version", + "examples": [ + "1.2.3" + ], + "title": "Version", + "type": "string" + }, + "vendor": { + "description": "The name of the system vendor", + "examples": [ + "CompanyABC" + ], + "title": "Vendor", + "type": "string" + } + }, + "required": [ + "name", + "version", + "vendor" + ], + "title": "SoftwareConfig", + "type": "object" + }, + "TargetShip": { + "properties": { + "static": { + "anyOf": [ + { + "$ref": "#/$defs/ShipStatic" + }, + { + "type": "null" + } + ], + "description": "Static ship information which does not change during a scenario.", + "examples": [ + { + "height": 15.0, + "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "imo": null, + "length": 230.0, + "mmsi": 123456789, + "name": "RMS Titanic", + "shipType": "Fishing", + "width": 30.0 + } + ] + }, + "initial": { + "allOf": [ + { + "$ref": "#/$defs/Initial" + } + ], + "examples": [ + { + "cog": 284.2, + "heading": 283.1, + "navStatus": "Under way using engine", + "position": { + "latitude": 51.2123, + "longitude": 11.2313 + }, + "sog": 12.3 + } + ], + "title": "Initial own ship Initial" + }, + "waypoints": { + "anyOf": [ + { + "items": { + "$ref": "#/$defs/Waypoint" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "default": null, + "description": "An array of `Waypoint` objects. Each waypoint object must have a `position` property.
If no turn radius is provided, it will be assumed to be `0`.
Additional data can be added to each waypoint leg. This allows varying parameters on a per-leg basis, such as speed and heading, or navigational status ", + "examples": [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + } + ], + "title": "Waypoints" + } + }, + "required": [ + "static", + "initial" + ], + "title": "TargetShip", + "type": "object" + }, + "TrafficSituation": { + "additionalProperties": true, + "properties": { + "title": { + "description": "The title of the traffic situation", + "examples": [ + "overtaking_18" + ], + "omit_default": true, + "title": "Title", + "type": "string" + }, + "description": { + "description": "A description of the traffic situation", + "examples": [ + "Crossing situation with 3 target vessels in the Oslofjord" + ], + "title": "Description", + "type": "string" + }, + "startTime": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", + "examples": [ + "2024-02-22T18:09:43.984842" + ], + "title": "Situation starting time" + }, + "ownShip": { + "allOf": [ + { + "$ref": "#/$defs/OwnShip" + } + ], + "description": "Own Ship data", + "examples": [ + { + "initial": { + "cog": 284.2, + "heading": 283.1, + "navStatus": "Under way using engine", + "position": { + "latitude": 51.2123, + "longitude": 11.2313 + }, + "sog": 12.3 + }, + "static": { + "height": 15.0, + "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "imo": null, + "length": 230.0, + "mmsi": 123456789, + "name": "RMS Titanic", + "shipType": "Fishing", + "width": 30.0 + }, + "waypoints": [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + } + ] + } + ], + "title": "Own Ship data" + }, + "targetShips": { + "default": null, + "description": "Target Ship data", + "examples": [ + [ + { + "initial": { + "cog": 284.2, + "heading": 283.1, + "navStatus": "Under way using engine", + "position": { + "latitude": 51.2123, + "longitude": 11.2313 + }, + "sog": 12.3 + }, + "static": { + "height": 15.0, + "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "imo": null, + "length": 230.0, + "mmsi": 123456789, + "name": "RMS Titanic", + "shipType": "Fishing", + "width": 30.0 + }, + "waypoints": [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + } + ] + } + ] + ], + "items": { + "$ref": "#/$defs/TargetShip" + }, + "title": "Target Ship data", + "type": "array" + }, + "environment": { + "anyOf": [ + { + "$ref": "#/$defs/Environment" + }, + { + "type": "null" + } + ], + "default": null, + "description": "environmental parameters", + "examples": [ + { + "airTemperature": 20.0, + "conditions": "Clear", + "currentDirection": 90.0, + "currentSpeed": 1.0, + "precipitation": "Rain", + "significantWaveHeight": 3.0, + "visibility": 5.0, + "waterRemperature": 15.0, + "waveDirection": 270.0, + "wavePeriod": 12.0, + "waveSpectrum": "JONSWAP", + "windDirection": 180.0, + "windSpeed": 10.0 + } + ] + } + }, + "required": [ + "title", + "description", + "ownShip" + ], + "title": "Test Input Schema", + "type": "object" + }, + "WaveSpectra": { + "enum": [ + "JONSWAP", + "Pierson-Moskowitz", + "Bretschneider" + ], + "title": "WaveSpectra", + "type": "string" + }, + "Waypoint": { + "properties": { + "position": { + "allOf": [ + { + "$ref": "#/$defs/Position" + } + ], + "description": "A geographical coordinate", + "examples": [ + { + "latitude": 51.2123, + "longitude": 11.2313 + } + ] + }, + "turnRadius": { + "default": 0, + "description": "Orthodrome turn radius as defined in RTZ format", + "examples": [ + 200 + ], + "title": "Turnradius", + "type": "number" + }, + "data": { + "allOf": [ + { + "$ref": "#/$defs/Data" + } + ], + "default": null, + "description": "A `Data` object that includes `speed`, `course`, and `heading` data points" + } + }, + "required": [ + "position" + ], + "title": "Waypoint", + "type": "object" + }, + "WeatherCondition": { + "enum": [ + "Clear", + "Cloudy", + "Foggy", + "Rainy", + "Snowy" + ], + "title": "WeatherCondition", + "type": "string" + } + }, + "additionalProperties": true, + "description": "#### This is a JSON schema for result data originating from Collision and Grounding Avoidance systems", + "properties": { + "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-02-22T18:09:44.004768" + ], + "format": "date-time", + "title": "Creationtime", + "type": "string" + }, + "trafficSituation": { + "anyOf": [ + { + "$ref": "#/$defs/TrafficSituation" + }, + { + "type": "null" + } + ], + "default": null, + "description": "The traffic situation that was simulated (input file). This should remain unmofidied." + }, + "cagaData": { + "anyOf": [ + { + "$ref": "#/$defs/CagaData" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Data generated by the system under test (auto-navigation / collision and grounding avoidance system) during the scenario.", + "examples": [ + { + "configuration": { + "automatic_manoeuver_acceptance_time": 7, + "critical_TCPA": 1000, + "manoeuver_delay": 20, + "minimum_distance_to_targets": 100, + "name": "AutoNavigation-System 1", + "safety_depth": 20, + "vendor": "CompanyABC", + "vendorAutomaticManoeuverAcceptanceTime": null, + "vendorCriticalTcpa": null, + "vendorManoeuverDelay": null, + "vendorMinimumDistanceToTargets": null, + "vendorSafetyDepth": null, + "version": "1.2.3" + }, + "eventData": [ + { + "route": [ + { + "data": { + "cog": { + "interpMethod": "cosine", + "mAfterLegChange": 500.0, + "mBeforeLegChange": 500.0, + "value": 200.0 + }, + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + }, + { + "data": { + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2345, + "longitude": 10.3432 + }, + "turnRadius": 500.0 + }, + { + "data": { + "heading": null, + "sog": { + "interpMethod": "linear", + "mAfterLegChange": 100.0, + "mBeforeLegChange": 100.0, + "value": 12.3 + } + }, + "position": { + "latitude": 57.2349, + "longitude": 10.343 + }, + "turnRadius": 500.0 + } + ], + "time": "2024-02-22T18:09:43.998842" + } + ], + "timeSeriesData": [ + { + "internalStatus": null, + "targetShips": [ + { + "cog": 181.0, + "colregRulesApplied": [ + 12 + ], + "dcpa": 300.0, + "distanceToTarget": 874.0, + "encounterType": "Head-on", + "heading": null, + "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f", + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "predictions": { + "position": [ + { + "time": "2024-02-22T18:09:43.990808", + "value": { + "latitude": 57.2343, + "longitude": 10.3432 + } + }, + { + "time": "2024-02-22T18:09:53.990808", + "value": { + "latitude": 57.2345, + "longitude": 10.3432 + } + }, + { + "time": "2024-02-22T18:10:03.990808", + "value": { + "latitude": 57.2349, + "longitude": 10.343 + } + } + ] + }, + "sog": 10.2, + "tcpa": 1200.0 + } + ], + "time": "2024-02-22T18:09:43.997843" + } + ] + } + ] + }, + "simulationData": { + "anyOf": [ + { + "$ref": "#/$defs/SimulationData" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Data generated by the simulator duirng the scenario", + "examples": [ + { + "configuration": { + "name": "Simulator-System 1", + "vendor": "CompanyABC", + "version": "1.2.3" + }, + "eventData": null, + "timeSeriesData": [ + { + "ownShip": { + "acceleration": null, + "cog": 97.0, + "heading": null, + "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab", + "mmsi": 987654321, + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2345, + "longitude": 10.3432 + }, + "rateOfTurn": 3.0, + "sog": 20.0 + }, + "targetShips": [ + { + "acceleration": 0.01, + "cog": 181.0, + "heading": null, + "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7", + "navStatus": "Engaged in fishing", + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "rateOfTurn": 1.0, + "sog": 10.0 + }, + { + "acceleration": null, + "cog": 7.0, + "heading": null, + "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b", + "mmsi": 123456789, + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2349, + "longitude": 10.343 + }, + "rateOfTurn": 0.0, + "sog": 14.0 + } + ], + "time": "2024-02-22T18:09:44.002844" + }, + { + "ownShip": { + "acceleration": null, + "cog": 97.0, + "heading": null, + "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab", + "mmsi": 987654321, + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2345, + "longitude": 10.3432 + }, + "rateOfTurn": 3.0, + "sog": 20.0 + }, + "targetShips": [ + { + "acceleration": 0.01, + "cog": 181.0, + "heading": null, + "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7", + "navStatus": "Engaged in fishing", + "position": { + "latitude": 57.2343, + "longitude": 10.3432 + }, + "rateOfTurn": 1.0, + "sog": 10.0 + }, + { + "acceleration": null, + "cog": 7.0, + "heading": null, + "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b", + "mmsi": 123456789, + "navStatus": "Under way using engine", + "position": { + "latitude": 57.2349, + "longitude": 10.343 + }, + "rateOfTurn": 0.0, + "sog": 14.0 + } + ], + "time": "2024-02-22T18:09:54.002844" + } + ] + } + ] + } + }, + "required": [ + "creationTime" + ], + "title": "Test Output Schema", + "type": "object" +} \ No newline at end of file From 6b526d73f17ed8d0ad531c68f56664b55fa5367f Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:14:26 +0100 Subject: [PATCH 26/36] bumped version number to 0.0.3b3 --- docs/source/conf.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 27cd582..516d545 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ author = "Author One, Author Two, Claas Rostock" # The full version, including alpha/beta/rc tags -release = "0.0.3b2" +release = "0.0.3b3" # -- General configuration --------------------------------------------------- diff --git a/pyproject.toml b/pyproject.toml index e93c910..ddf25b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "maritime-schema" -version = "0.0.3b2" +version = "0.0.3b3" description = "Python data classes and JSON schemata for maritime traffic scenarios." readme = "README.md" requires-python = ">= 3.9" From 6c93a023fac24c8922e13cdf4fde9dc4fa20aa3a Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:22:33 +0100 Subject: [PATCH 27/36] test_caga: changed the way the folders are resolved --- tests/types/test_caga.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/types/test_caga.py b/tests/types/test_caga.py index 510b4db..c801715 100644 --- a/tests/types/test_caga.py +++ b/tests/types/test_caga.py @@ -7,8 +7,8 @@ def test_publish_schema(): # Prepare - target_dir: Path = Path("../../src/maritime_schema/schema/caga") - docs_dir: Path = Path("../../docs/source/schema/caga") + target_dir: Path = Path(__file__).parent.parent.parent / "src/maritime_schema/schema/caga" + docs_dir: Path = Path(__file__).parent.parent.parent / "docs/source/schema/caga" input_schema_json_file: Path = target_dir / "input_schema.json" input_schema_html_file: Path = docs_dir / "input_schema.html" output_schema_json_file: Path = target_dir / "output_schema.json" From a41dfedd92bee3177827064045d07849c1618d35 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:35:27 +0100 Subject: [PATCH 28/36] utils/publish.py: minor change --- src/maritime_schema/utils/publish.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/maritime_schema/utils/publish.py b/src/maritime_schema/utils/publish.py index 5cb9e2a..65d3863 100644 --- a/src/maritime_schema/utils/publish.py +++ b/src/maritime_schema/utils/publish.py @@ -42,8 +42,8 @@ def generate_schema( by_alias : bool, optional Whether to serialize using field aliases., by default False """ - default_dir = Path(__file__).parent.parent / "schema" - schema_dir = schema_dir or default_dir + schema_dir_default = Path(__file__).parent.parent / "schema" + schema_dir = schema_dir or schema_dir_default # Assert model argument is a pydantic BaseModel # Background: ModelMetaClass is added just to please static type checking, From 83eb72e2b62673af7e4e4cc739e1a5c04c87f297 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 18:35:56 +0100 Subject: [PATCH 29/36] test_caga: added a print() statement to debug failing test in GitHub --- tests/types/test_caga.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/types/test_caga.py b/tests/types/test_caga.py index c801715..0ff4159 100644 --- a/tests/types/test_caga.py +++ b/tests/types/test_caga.py @@ -21,6 +21,7 @@ def test_publish_schema(): publish_schema() # Assert assert target_dir.exists() + print(f"location of input_schema_json_file: {input_schema_json_file.absolute()}") assert input_schema_json_file.exists() assert input_schema_html_file.exists() assert output_schema_json_file.exists() From 944e2195ce7627ead0c6a7c58a2c3811e0e1803b Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 20:50:02 +0100 Subject: [PATCH 30/36] deleted src/maritime_schema/schema directory --- .../schema => schema}/caga/input_schema.json | 12 +-- .../schema => schema}/caga/output_schema.json | 98 +++++++++---------- 2 files changed, 55 insertions(+), 55 deletions(-) rename {src/maritime_schema/schema => schema}/caga/input_schema.json (96%) rename {src/maritime_schema/schema => schema}/caga/output_schema.json (94%) diff --git a/src/maritime_schema/schema/caga/input_schema.json b/schema/caga/input_schema.json similarity index 96% rename from src/maritime_schema/schema/caga/input_schema.json rename to schema/caga/input_schema.json index 855f890..8e021db 100644 --- a/src/maritime_schema/schema/caga/input_schema.json +++ b/schema/caga/input_schema.json @@ -392,7 +392,7 @@ "examples": [ { "height": 15.0, - "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324", "imo": null, "length": 230.0, "mmsi": 123456789, @@ -517,7 +517,7 @@ "id": { "description": "Unique Identifier", "examples": [ - "0a9d3443-d305-4c28-a41b-09ed3f167254" + "88331243-a2c6-4d5e-9f46-77bd0268c725" ], "format": "uuid", "title": "Id", @@ -643,7 +643,7 @@ "examples": [ { "height": 15.0, - "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324", "imo": null, "length": 230.0, "mmsi": 123456789, @@ -815,7 +815,7 @@ "default": null, "description": "Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": [ - "2024-02-22T18:09:43.984842" + "2024-02-22T20:45:32.777083" ], "title": "Situation starting time" }, @@ -840,7 +840,7 @@ }, "static": { "height": 15.0, - "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324", "imo": null, "length": 230.0, "mmsi": 123456789, @@ -894,7 +894,7 @@ }, "static": { "height": 15.0, - "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324", "imo": null, "length": 230.0, "mmsi": 123456789, diff --git a/src/maritime_schema/schema/caga/output_schema.json b/schema/caga/output_schema.json similarity index 94% rename from src/maritime_schema/schema/caga/output_schema.json rename to schema/caga/output_schema.json index eb71d92..fc98db5 100644 --- a/src/maritime_schema/schema/caga/output_schema.json +++ b/schema/caga/output_schema.json @@ -146,7 +146,7 @@ "distanceToTarget": 874.0, "encounterType": "Head-on", "heading": null, - "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f", + "id": "01c81ba8-5f7f-4c51-a56a-06a0664fa541", "navStatus": "Under way using engine", "position": { "latitude": 57.2343, @@ -155,21 +155,21 @@ "predictions": { "position": [ { - "time": "2024-02-22T18:09:43.990808", + "time": "2024-02-22T20:45:32.794525", "value": { "latitude": 57.2343, "longitude": 10.3432 } }, { - "time": "2024-02-22T18:09:53.990808", + "time": "2024-02-22T20:45:42.794525", "value": { "latitude": 57.2345, "longitude": 10.3432 } }, { - "time": "2024-02-22T18:10:03.990808", + "time": "2024-02-22T20:45:52.794525", "value": { "latitude": 57.2349, "longitude": 10.343 @@ -181,7 +181,7 @@ "tcpa": 1200.0 } ], - "time": "2024-02-22T18:09:43.997843" + "time": "2024-02-22T20:45:32.794525" } ] ], @@ -253,7 +253,7 @@ "turnRadius": 500.0 } ], - "time": "2024-02-22T18:09:43.998842" + "time": "2024-02-22T20:45:32.794525" } ] ], @@ -286,7 +286,7 @@ ], "description": "Date and Time of the event", "examples": [ - "2024-02-22T18:09:43.997843" + "2024-02-22T20:45:32.794525" ], "title": "Time" }, @@ -378,7 +378,7 @@ ], "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": [ - "2024-02-22T18:09:43.995843" + "2024-02-22T20:45:32.794525" ], "title": "Time" }, @@ -395,7 +395,7 @@ "distanceToTarget": 874.0, "encounterType": "Head-on", "heading": null, - "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f", + "id": "01c81ba8-5f7f-4c51-a56a-06a0664fa541", "navStatus": "Under way using engine", "position": { "latitude": 57.2343, @@ -404,21 +404,21 @@ "predictions": { "position": [ { - "time": "2024-02-22T18:09:43.990808", + "time": "2024-02-22T20:45:32.794525", "value": { "latitude": 57.2343, "longitude": 10.3432 } }, { - "time": "2024-02-22T18:09:53.990808", + "time": "2024-02-22T20:45:42.794525", "value": { "latitude": 57.2345, "longitude": 10.3432 } }, { - "time": "2024-02-22T18:10:03.990808", + "time": "2024-02-22T20:45:52.794525", "value": { "latitude": 57.2349, "longitude": 10.343 @@ -568,7 +568,7 @@ "id": { "description": "Unique Identifier", "examples": [ - "a8c08c4a-12c3-4f75-94e9-05f43df79e3b" + "8c5c24ae-39b5-40d4-87b6-d5821d644980" ], "format": "uuid", "title": "Id", @@ -718,21 +718,21 @@ "examples": [ [ { - "time": "2024-02-22T18:09:43.990808", + "time": "2024-02-22T20:45:32.794525", "value": { "latitude": 57.2343, "longitude": 10.3432 } }, { - "time": "2024-02-22T18:09:53.990808", + "time": "2024-02-22T20:45:42.794525", "value": { "latitude": 57.2345, "longitude": 10.3432 } }, { - "time": "2024-02-22T18:10:03.990808", + "time": "2024-02-22T20:45:52.794525", "value": { "latitude": 57.2349, "longitude": 10.343 @@ -1023,7 +1023,7 @@ "examples": [ { "height": 15.0, - "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324", "imo": null, "length": 230.0, "mmsi": 123456789, @@ -1156,7 +1156,7 @@ ], "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": [ - "2024-02-22T18:09:43.989767" + "2024-02-22T20:45:32.794525" ], "title": "Time" }, @@ -1191,7 +1191,7 @@ "id": { "description": "Unique Identifier", "examples": [ - "0a9d3443-d305-4c28-a41b-09ed3f167254" + "88331243-a2c6-4d5e-9f46-77bd0268c725" ], "format": "uuid", "title": "Id", @@ -1308,7 +1308,7 @@ "id": { "description": "Unique Identifier", "examples": [ - "a61becc8-2e93-4acf-9629-2b22131716ac" + "88aae6cb-f758-4994-b2ad-60bae5a55cb6" ], "format": "uuid", "title": "Id", @@ -1429,7 +1429,7 @@ "acceleration": null, "cog": 97.0, "heading": null, - "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab", + "id": "a4217ba8-2577-43d3-94e4-77bbed948a5d", "mmsi": 987654321, "navStatus": "Under way using engine", "position": { @@ -1444,7 +1444,7 @@ "acceleration": 0.01, "cog": 181.0, "heading": null, - "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7", + "id": "aa6152cc-86b5-45c5-bb1e-667c11083af4", "navStatus": "Engaged in fishing", "position": { "latitude": 57.2343, @@ -1457,7 +1457,7 @@ "acceleration": null, "cog": 7.0, "heading": null, - "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b", + "id": "74cedb4f-8cd1-4b65-9b1e-543118cfa0da", "mmsi": 123456789, "navStatus": "Under way using engine", "position": { @@ -1468,14 +1468,14 @@ "sog": 14.0 } ], - "time": "2024-02-22T18:09:44.002844" + "time": "2024-02-22T20:45:32.794525" }, { "ownShip": { "acceleration": null, "cog": 97.0, "heading": null, - "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab", + "id": "a4217ba8-2577-43d3-94e4-77bbed948a5d", "mmsi": 987654321, "navStatus": "Under way using engine", "position": { @@ -1490,7 +1490,7 @@ "acceleration": 0.01, "cog": 181.0, "heading": null, - "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7", + "id": "aa6152cc-86b5-45c5-bb1e-667c11083af4", "navStatus": "Engaged in fishing", "position": { "latitude": 57.2343, @@ -1503,7 +1503,7 @@ "acceleration": null, "cog": 7.0, "heading": null, - "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b", + "id": "74cedb4f-8cd1-4b65-9b1e-543118cfa0da", "mmsi": 123456789, "navStatus": "Under way using engine", "position": { @@ -1514,7 +1514,7 @@ "sog": 14.0 } ], - "time": "2024-02-22T18:09:54.002844" + "time": "2024-02-22T20:45:42.794525" } ] ], @@ -1555,7 +1555,7 @@ ], "description": "Date and Time of the predicted value `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": [ - "2024-02-22T18:09:44.001842" + "2024-02-22T20:45:32.794525" ], "title": "Time" }, @@ -1593,7 +1593,7 @@ ], "description": "Date and Time of the event", "examples": [ - "2024-02-22T18:09:43.998842" + "2024-02-22T20:45:32.794525" ], "title": "Time" } @@ -1655,7 +1655,7 @@ "examples": [ { "height": 15.0, - "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324", "imo": null, "length": 230.0, "mmsi": 123456789, @@ -1766,7 +1766,7 @@ "default": null, "description": "Starting time of the situation in `ISO 8601` format `YYYY-MM-DDThh:mm:ssZ`", "examples": [ - "2024-02-22T18:09:43.984842" + "2024-02-22T20:45:32.777083" ], "title": "Situation starting time" }, @@ -1791,7 +1791,7 @@ }, "static": { "height": 15.0, - "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324", "imo": null, "length": 230.0, "mmsi": 123456789, @@ -1845,7 +1845,7 @@ }, "static": { "height": 15.0, - "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25", + "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324", "imo": null, "length": 230.0, "mmsi": 123456789, @@ -1992,7 +1992,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-02-22T18:09:44.004768" + "2024-02-22T20:45:32.794525" ], "format": "date-time", "title": "Creationtime", @@ -2096,7 +2096,7 @@ "turnRadius": 500.0 } ], - "time": "2024-02-22T18:09:43.998842" + "time": "2024-02-22T20:45:32.794525" } ], "timeSeriesData": [ @@ -2112,7 +2112,7 @@ "distanceToTarget": 874.0, "encounterType": "Head-on", "heading": null, - "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f", + "id": "01c81ba8-5f7f-4c51-a56a-06a0664fa541", "navStatus": "Under way using engine", "position": { "latitude": 57.2343, @@ -2121,21 +2121,21 @@ "predictions": { "position": [ { - "time": "2024-02-22T18:09:43.990808", + "time": "2024-02-22T20:45:32.794525", "value": { "latitude": 57.2343, "longitude": 10.3432 } }, { - "time": "2024-02-22T18:09:53.990808", + "time": "2024-02-22T20:45:42.794525", "value": { "latitude": 57.2345, "longitude": 10.3432 } }, { - "time": "2024-02-22T18:10:03.990808", + "time": "2024-02-22T20:45:52.794525", "value": { "latitude": 57.2349, "longitude": 10.343 @@ -2147,7 +2147,7 @@ "tcpa": 1200.0 } ], - "time": "2024-02-22T18:09:43.997843" + "time": "2024-02-22T20:45:32.794525" } ] } @@ -2178,7 +2178,7 @@ "acceleration": null, "cog": 97.0, "heading": null, - "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab", + "id": "a4217ba8-2577-43d3-94e4-77bbed948a5d", "mmsi": 987654321, "navStatus": "Under way using engine", "position": { @@ -2193,7 +2193,7 @@ "acceleration": 0.01, "cog": 181.0, "heading": null, - "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7", + "id": "aa6152cc-86b5-45c5-bb1e-667c11083af4", "navStatus": "Engaged in fishing", "position": { "latitude": 57.2343, @@ -2206,7 +2206,7 @@ "acceleration": null, "cog": 7.0, "heading": null, - "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b", + "id": "74cedb4f-8cd1-4b65-9b1e-543118cfa0da", "mmsi": 123456789, "navStatus": "Under way using engine", "position": { @@ -2217,14 +2217,14 @@ "sog": 14.0 } ], - "time": "2024-02-22T18:09:44.002844" + "time": "2024-02-22T20:45:32.794525" }, { "ownShip": { "acceleration": null, "cog": 97.0, "heading": null, - "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab", + "id": "a4217ba8-2577-43d3-94e4-77bbed948a5d", "mmsi": 987654321, "navStatus": "Under way using engine", "position": { @@ -2239,7 +2239,7 @@ "acceleration": 0.01, "cog": 181.0, "heading": null, - "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7", + "id": "aa6152cc-86b5-45c5-bb1e-667c11083af4", "navStatus": "Engaged in fishing", "position": { "latitude": 57.2343, @@ -2252,7 +2252,7 @@ "acceleration": null, "cog": 7.0, "heading": null, - "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b", + "id": "74cedb4f-8cd1-4b65-9b1e-543118cfa0da", "mmsi": 123456789, "navStatus": "Under way using engine", "position": { @@ -2263,7 +2263,7 @@ "sog": 14.0 } ], - "time": "2024-02-22T18:09:54.002844" + "time": "2024-02-22T20:45:42.794525" } ] } From 46748c9ea989a6fbc03666119ba39ebbcb77bac9 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 20:50:26 +0100 Subject: [PATCH 31/36] simplified api.py --- src/maritime_schema/api.py | 65 ++++---------------------------------- 1 file changed, 6 insertions(+), 59 deletions(-) diff --git a/src/maritime_schema/api.py b/src/maritime_schema/api.py index d4fa8d5..7a0f526 100644 --- a/src/maritime_schema/api.py +++ b/src/maritime_schema/api.py @@ -1,72 +1,19 @@ import logging -import os -from pathlib import Path -from typing import Union from maritime_schema.types import caga -__ALL__ = ["run", "MaritimeSchemaProcess"] +__ALL__ = ["publish_schema"] logger = logging.getLogger(__name__) -def run( - config_file: Union[str, os.PathLike[str]], -): - """Run the maritime-schema process. +def publish_schema(): + """Publish the maritime schema.""" - Run the maritime-schema process and .. (long description). + logger.info("Start publishing schema") - Parameters - ---------- - config_file : Union[str, os.PathLike[str]] - file containing the maritime-schema configuration + caga.publish_schema() - Raises - ------ - FileNotFoundError - if config_file does not exist - """ - - # Make sure config_file argument is of type Path. If not, cast it to Path type. - config_file = config_file if isinstance(config_file, Path) else Path(config_file) - - # Check whether config file exists - if not config_file.exists(): - logger.error(f"run: File {config_file} not found.") - raise FileNotFoundError(config_file) - - process = MaritimeSchemaProcess(config_file) - process.run() + logger.info("Successfully published schema") return - - -class MaritimeSchemaProcess: - """Top level class encapsulating the maritime-schema process.""" - - def __init__( - self, - config_file: Path, - ): - self.config_file: Path = config_file - self._read_config_file() - return - - def run(self): - """Publish the maritime schema.""" - - logger.info("Start publishing schema") - - caga.publish_schema() - - logger.info("Successfully published schema") - - return - - def _read_config_file(self): - """Read config file.""" - # from dictIO import DictReader - # config = DictReader.read(self.config_file) - # do something with the config - return From dc6b20221db19ba486f1e2a70ada1e72b50f72db Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 20:52:42 +0100 Subject: [PATCH 32/36] changed schema directory to cwd() / schema and docs directory to cwd() / docs / schema --- .../{maritime_schema.py => publish_schema.py} | 30 ++++------------- src/maritime_schema/types/caga.py | 33 ++++++++++++++++--- src/maritime_schema/utils/publish.py | 17 ++++++---- 3 files changed, 46 insertions(+), 34 deletions(-) rename src/maritime_schema/cli/{maritime_schema.py => publish_schema.py} (68%) diff --git a/src/maritime_schema/cli/maritime_schema.py b/src/maritime_schema/cli/publish_schema.py similarity index 68% rename from src/maritime_schema/cli/maritime_schema.py rename to src/maritime_schema/cli/publish_schema.py index 38afeb9..c5a1fd6 100644 --- a/src/maritime_schema/cli/maritime_schema.py +++ b/src/maritime_schema/cli/publish_schema.py @@ -6,7 +6,7 @@ from pathlib import Path from typing import Union -from maritime_schema.api import run +from maritime_schema.api import publish_schema from maritime_schema.utils.logging import configure_logging logger = logging.getLogger(__name__) @@ -14,19 +14,12 @@ def _argparser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser( - prog="maritime-schema", - usage="%(prog)s config_file [options [args]]", - epilog="_________________maritime-schema___________________", + prog="publish-schema", + usage="%(prog)s [options [args]]", + epilog="_________________publish-schema___________________", prefix_chars="-", add_help=True, - description=("maritime-schema config_file --option"), - ) - - _ = parser.add_argument( - "config_file", - metavar="config_file", - type=str, - help="name of the file containing the maritime-schema configuration.", + description=("publish-schema"), ) console_verbosity = parser.add_mutually_exclusive_group(required=False) @@ -89,19 +82,10 @@ def main(): log_level_file: str = args.log_level configure_logging(log_level_console, log_file, log_level_file) - config_file: Path = Path(args.config_file) - - # Check whether maritime-schema config file exists - if not config_file.is_file(): - logger.error(f"maritime-schema.py: File {config_file} not found.") - return - - logger.info(f"Start maritime-schema.py with following arguments:\n" f"\t config_file: \t{config_file}\n") + logger.info("Start publish-schema.py") # Invoke API - run( - config_file=config_file, - ) + publish_schema() if __name__ == "__main__": diff --git a/src/maritime_schema/types/caga.py b/src/maritime_schema/types/caga.py index a5738cb..e2b3714 100644 --- a/src/maritime_schema/types/caga.py +++ b/src/maritime_schema/types/caga.py @@ -1,6 +1,7 @@ # pyright: reportCallIssue=false # pyright: reportIncompatibleVariableOverride=false import logging +import os from datetime import datetime, timedelta from enum import Enum from pathlib import Path @@ -739,12 +740,36 @@ class Config: } -def publish_schema(): - """Generate input and output schema and the corresponding html documentation.""" +def publish_schema( + schema_dir: Union[str, os.PathLike[str], None] = None, + docs_dir: Union[str, os.PathLike[str], None] = None, +): + """Generate input and output schema and the corresponding html documentation. + + Parameters + ---------- + schema_dir : Union[str, os.PathLike[str], None], optional + The folder in which the schema files shall be generated in. + If None, schema files will be generated in ./schema/caga. + , by default None + docs_dir : Union[str, os.PathLike[str]] + The folder in which the html documentation files shall be generated in. + If None, html files will be generated in ./docs/schema/caga. + , by default None + """ from maritime_schema.utils.publish import generate_docs, generate_schema - schema_dir = Path(__file__).parent.parent / "schema" / "caga" - docs_dir = Path(__file__).parent.parent.parent.parent / "docs" / "source" / "schema" / "caga" + schema_dir_default = Path.cwd() / "schema/caga" + schema_dir = schema_dir or schema_dir_default + + docs_dir_default = Path.cwd() / "docs/schema/caga" + docs_dir = docs_dir or docs_dir_default + + # Make sure schema_dir argument is of type Path. If not, cast it to Path type. + schema_dir = schema_dir if isinstance(schema_dir, Path) else Path(schema_dir) + + # Make sure docs_dir argument is of type Path. If not, cast it to Path type. + docs_dir = docs_dir if isinstance(docs_dir, Path) else Path(docs_dir) # Generate input schema generate_schema( diff --git a/src/maritime_schema/utils/publish.py b/src/maritime_schema/utils/publish.py index 65d3863..a02b270 100644 --- a/src/maritime_schema/utils/publish.py +++ b/src/maritime_schema/utils/publish.py @@ -36,13 +36,13 @@ def generate_schema( name : str The filename the schema shall be given (without extension) schema_dir : Union[str, os.PathLike[str], None], optional - The target folder in which the schema and documentation files shall be generated in. - If None, files will be generated in src/maritime_schema/schema. + The folder in which the schema file shall be generated in. + If None, schema file will be generated in ./schema. , by default None by_alias : bool, optional Whether to serialize using field aliases., by default False """ - schema_dir_default = Path(__file__).parent.parent / "schema" + schema_dir_default = Path.cwd() / "schema" schema_dir = schema_dir or schema_dir_default # Assert model argument is a pydantic BaseModel @@ -82,17 +82,17 @@ def generate_docs( schema_dir : Union[str, os.PathLike[str], None], optional The source folder containing the json schemata for which the html documentation shall be generated. - If None, schemata will be read from in src/maritime_schema/schema. + If None, schemata will be read from in ./schema. , by default None docs_dir : Union[str, os.PathLike[str]] The folder in which the html documentation files shall be generated in. - If None, html files will be generated in docs/source/schema. + If None, html files will be generated in ./docs/schema. , by default None """ - schema_dir_default = Path(__file__).parent.parent / "schema" + schema_dir_default = Path.cwd() / "schema" schema_dir = schema_dir or schema_dir_default - docs_dir_default = Path(__file__).parent.parent.parent.parent / "docs" / "source" / "schema" + docs_dir_default = Path.cwd() / "docs/schema" docs_dir = docs_dir or docs_dir_default # Make sure schema_dir argument is of type Path. If not, cast it to Path type. @@ -101,6 +101,9 @@ def generate_docs( # Make sure docs_dir argument is of type Path. If not, cast it to Path type. docs_dir = docs_dir if isinstance(docs_dir, Path) else Path(docs_dir) + # Create schema_dir if it does not exist + schema_dir.mkdir(parents=True, exist_ok=True) + # Create docs_dir if it does not exist docs_dir.mkdir(parents=True, exist_ok=True) From f32db215f8d0564eedc9b81a0c418c1e0c338ef4 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 20:53:15 +0100 Subject: [PATCH 33/36] adapted tests to simplified api and cli --- tests/cli/test_maritime_schema_cli.py | 121 ++++++-------------------- tests/conftest.py | 2 + tests/test_api.py | 47 +--------- tests/types/test_caga.py | 16 ++-- 4 files changed, 44 insertions(+), 142 deletions(-) diff --git a/tests/cli/test_maritime_schema_cli.py b/tests/cli/test_maritime_schema_cli.py index f3f6419..ac5753e 100644 --- a/tests/cli/test_maritime_schema_cli.py +++ b/tests/cli/test_maritime_schema_cli.py @@ -8,37 +8,34 @@ import pytest from pytest import MonkeyPatch -from maritime_schema.cli import maritime_schema -from maritime_schema.cli.maritime_schema import _argparser, main +from maritime_schema.cli import publish_schema +from maritime_schema.cli.publish_schema import _argparser, main # *****Test commandline interface (CLI)************************************************************ @dataclass() class CliArgs: - # Expected default values for the CLI arguments when maritime-schema gets called via the commandline + # Expected default values for the CLI arguments when publish-schema gets called via the commandline quiet: bool = False verbose: bool = False log: Union[str, None] = None log_level: str = field(default_factory=lambda: "WARNING") - config_file: Union[str, None] = field(default_factory=lambda: "test_config_file") # noqa: N815 @pytest.mark.parametrize( "inputs, expected", [ - ([], ArgumentError), - (["test_config_file"], CliArgs()), - (["test_config_file", "-q"], CliArgs(quiet=True)), - (["test_config_file", "--quiet"], CliArgs(quiet=True)), - (["test_config_file", "-v"], CliArgs(verbose=True)), - (["test_config_file", "--verbose"], CliArgs(verbose=True)), - (["test_config_file", "-qv"], ArgumentError), - (["test_config_file", "--log", "logFile"], CliArgs(log="logFile")), - (["test_config_file", "--log"], ArgumentError), - (["test_config_file", "--log-level", "INFO"], CliArgs(log_level="INFO")), - (["test_config_file", "--log-level"], ArgumentError), - (["test_config_file", "-o"], ArgumentError), + ([], CliArgs()), + (["-q"], CliArgs(quiet=True)), + (["--quiet"], CliArgs(quiet=True)), + (["-v"], CliArgs(verbose=True)), + (["--verbose"], CliArgs(verbose=True)), + (["-qv"], ArgumentError), + (["--log", "logFile"], CliArgs(log="logFile")), + (["--log"], ArgumentError), + (["--log-level", "INFO"], CliArgs(log_level="INFO")), + (["--log-level"], ArgumentError), ], ) def test_cli( @@ -49,7 +46,7 @@ def test_cli( # sourcery skip: no-conditionals-in-tests # sourcery skip: no-loop-in-tests # Prepare - monkeypatch.setattr(sys, "argv", ["maritime-schema"] + inputs) + monkeypatch.setattr(sys, "argv", ["publish-schema"] + inputs) parser = _argparser() # Execute if isinstance(expected, CliArgs): @@ -81,26 +78,16 @@ class ConfigureLoggingArgs: @pytest.mark.parametrize( "inputs, expected", [ - ([], ArgumentError), - (["test_config_file"], ConfigureLoggingArgs()), - (["test_config_file", "-q"], ConfigureLoggingArgs(log_level_console="ERROR")), - (["test_config_file", "--quiet"], ConfigureLoggingArgs(log_level_console="ERROR")), - (["test_config_file", "-v"], ConfigureLoggingArgs(log_level_console="INFO")), - ( - ["test_config_file", "--verbose"], - ConfigureLoggingArgs(log_level_console="INFO"), - ), - (["test_config_file", "-qv"], ArgumentError), - ( - ["test_config_file", "--log", "logFile"], - ConfigureLoggingArgs(log_file=Path("logFile")), - ), - (["test_config_file", "--log"], ArgumentError), - ( - ["test_config_file", "--log-level", "INFO"], - ConfigureLoggingArgs(log_level_file="INFO"), - ), - (["test_config_file", "--log-level"], ArgumentError), + ([], ConfigureLoggingArgs()), + (["-q"], ConfigureLoggingArgs(log_level_console="ERROR")), + (["--quiet"], ConfigureLoggingArgs(log_level_console="ERROR")), + (["-v"], ConfigureLoggingArgs(log_level_console="INFO")), + (["--verbose"], ConfigureLoggingArgs(log_level_console="INFO")), + (["-qv"], ArgumentError), + (["--log", "logFile"], ConfigureLoggingArgs(log_file=Path("logFile"))), + (["--log"], ArgumentError), + (["--log-level", "INFO"], ConfigureLoggingArgs(log_level_file="INFO")), + (["--log-level"], ArgumentError), ], ) def test_logging_configuration( @@ -111,7 +98,7 @@ def test_logging_configuration( # sourcery skip: no-conditionals-in-tests # sourcery skip: no-loop-in-tests # Prepare - monkeypatch.setattr(sys, "argv", ["maritime-schema"] + inputs) + monkeypatch.setattr(sys, "argv", ["publish-schema"] + inputs) args: ConfigureLoggingArgs = ConfigureLoggingArgs() def fake_configure_logging( @@ -123,13 +110,11 @@ def fake_configure_logging( args.log_file = log_file args.log_level_file = log_level_file - def fake_run( - config_file: Path, - ): + def fake_publish_schema(): pass - monkeypatch.setattr(maritime_schema, "configure_logging", fake_configure_logging) - monkeypatch.setattr(maritime_schema, "run", fake_run) + monkeypatch.setattr(publish_schema, "configure_logging", fake_configure_logging) + monkeypatch.setattr(publish_schema, "publish_schema", fake_publish_schema) # Execute if isinstance(expected, ConfigureLoggingArgs): args_expected: ConfigureLoggingArgs = expected @@ -144,53 +129,3 @@ def fake_run( main() else: raise AssertionError() - - -# *****Ensure the CLI correctly invokes the API**************************************************** - - -@dataclass() -class ApiArgs: - # Values that main() is expected to pass to run() by default when invoking the API - config_file: Path = field(default_factory=lambda: Path("test_config_file")) - - -@pytest.mark.parametrize( - "inputs, expected", - [ - ([], ArgumentError), - (["test_config_file"], ApiArgs()), - (["test_config_file", "-o"], ArgumentError), - ], -) -def test_api_invokation( - inputs: List[str], - expected: Union[ApiArgs, type], - monkeypatch: MonkeyPatch, -): - # sourcery skip: no-conditionals-in-tests - # sourcery skip: no-loop-in-tests - # Prepare - monkeypatch.setattr(sys, "argv", ["maritime-schema"] + inputs) - args: ApiArgs = ApiArgs() - - def fake_run( - config_file: Path, - ): - args.config_file = config_file - - monkeypatch.setattr(maritime_schema, "run", fake_run) - # Execute - if isinstance(expected, ApiArgs): - args_expected: ApiArgs = expected - main() - # Assert args - for key in args_expected.__dataclass_fields__: - assert args.__getattribute__(key) == args_expected.__getattribute__(key) - elif issubclass(expected, Exception): - exception: type = expected - # Assert that expected exception is raised - with pytest.raises((exception, SystemExit)): - main() - else: - raise AssertionError() diff --git a/tests/conftest.py b/tests/conftest.py index 129f993..fdd1c07 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -20,6 +20,8 @@ def test_dir(): output_dirs = [ "results", + "schema", + "docs/schema", ] output_files = [ "*test*.pdf", diff --git a/tests/test_api.py b/tests/test_api.py index 121b356..d479ccf 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,49 +1,10 @@ -# pyright: reportPrivateUsage=false -from pathlib import Path +from maritime_schema.api import publish_schema -import pytest -from maritime_schema.api import MaritimeSchemaProcess, run - - -def test_file_not_found_exception(): - # Prepare - config_file = Path("this_file_does_not_exist") - # Execute and Assert - with pytest.raises(FileNotFoundError): - _ = run(config_file) - - -def test_run(): +def test_publish_schema(): # Prepare - config_file = Path("test_config_file") + # (nothing to prepare) # Execute - run(config_file=config_file) + publish_schema() # Assert # (nothing to assert. Assertion is that no exception is thrown.) - - -class TestMaritimeSchemaProcess: - def test_init(self): - # Prepare - config_file = Path("test_config_file.json") - # Execute - process = MaritimeSchemaProcess(config_file=config_file) - # Assert - assert process.config_file is config_file - - def test_init_with_empty_config_file(self): - # sourcery skip: class-extract-method - # Prepare - config_file = Path("test_config_file_empty.json") - # Execute - process = MaritimeSchemaProcess(config_file=config_file) - # Assert - assert process.config_file is config_file - - -# @TODO: To be implemented -@pytest.mark.skip(reason="To be implemented") -def test_example_skip(): - """Example of a test skipped because it is not yet implemented.""" - pass diff --git a/tests/types/test_caga.py b/tests/types/test_caga.py index 0ff4159..cf92453 100644 --- a/tests/types/test_caga.py +++ b/tests/types/test_caga.py @@ -7,20 +7,24 @@ def test_publish_schema(): # Prepare - target_dir: Path = Path(__file__).parent.parent.parent / "src/maritime_schema/schema/caga" - docs_dir: Path = Path(__file__).parent.parent.parent / "docs/source/schema/caga" - input_schema_json_file: Path = target_dir / "input_schema.json" + schema_dir: Path = Path.cwd() / "schema/caga" + docs_dir: Path = Path.cwd() / "docs/schema/caga" + input_schema_json_file: Path = schema_dir / "input_schema.json" input_schema_html_file: Path = docs_dir / "input_schema.html" - output_schema_json_file: Path = target_dir / "output_schema.json" + output_schema_json_file: Path = schema_dir / "output_schema.json" output_schema_html_file: Path = docs_dir / "output_schema.html" input_schema_json_file.unlink(missing_ok=True) input_schema_html_file.unlink(missing_ok=True) output_schema_json_file.unlink(missing_ok=True) output_schema_html_file.unlink(missing_ok=True) # Execute - publish_schema() + publish_schema( + schema_dir=schema_dir, + docs_dir=docs_dir, + ) # Assert - assert target_dir.exists() + assert schema_dir.exists() + assert docs_dir.exists() print(f"location of input_schema_json_file: {input_schema_json_file.absolute()}") assert input_schema_json_file.exists() assert input_schema_html_file.exists() From 763aebeb48649b433f8dc40961237ed25187aae4 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 20:54:56 +0100 Subject: [PATCH 34/36] Sphinx documentation: adapted to new schema and docs/schema directories --- .../schema/caga/input_schema.html | 16 +-- .../schema/caga/output_schema.html | 104 +++++++++--------- docs/source/cli.maritime_schema.rst | 3 - docs/source/cli.publish_schema.rst | 3 + docs/source/cli.rst | 14 +-- docs/source/schema.caga.input_schema.rst | 2 +- docs/source/schema.caga.output_schema.rst | 2 +- 7 files changed, 72 insertions(+), 72 deletions(-) rename docs/{source => }/schema/caga/input_schema.html (99%) rename docs/{source => }/schema/caga/output_schema.html (99%) delete mode 100644 docs/source/cli.maritime_schema.rst create mode 100644 docs/source/cli.publish_schema.rst diff --git a/docs/source/schema/caga/input_schema.html b/docs/schema/caga/input_schema.html similarity index 99% rename from docs/source/schema/caga/input_schema.html rename to docs/schema/caga/input_schema.html index 139e9cd..4382e9d 100644 --- a/docs/source/schema/caga/input_schema.html +++ b/docs/schema/caga/input_schema.html @@ -1,6 +1,6 @@ Test Input Schema

Test Input Schema

Type: object

Title

Type: string

The title of the traffic situation


Example:

"overtaking_18"
 

Description

Type: string

A description of the traffic situation


Example:

"Crossing situation with 3 target vessels in the Oslofjord"
-

Situation starting time

Default: null

Starting time of the situation in ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: null

Example:

"2024-02-22T18:09:43.984842"
+

Situation starting time

Default: null

Starting time of the situation in ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: null

Example:

"2024-02-22T20:45:32.777083"
 

Own Ship data

Type: object

Own Ship data


Example:

{
     "initial": {
         "cog": 284.2,
@@ -14,7 +14,7 @@
     },
     "static": {
         "height": 15.0,
-        "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
+        "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324",
         "imo": null,
         "length": 230.0,
         "mmsi": 123456789,
@@ -47,7 +47,7 @@
         }
     ]
 }
-


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"0a9d3443-d305-4c28-a41b-09ed3f167254"
+


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"88331243-a2c6-4d5e-9f46-77bd0268c725"
 

Length

Type: number

Length of the ship in meters


Example:

230.0
 

Width

Type: number

Width of the ship in meters


Example:

30.0
 

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
@@ -56,7 +56,7 @@
 

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
 

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
     "height": 15.0,
-    "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
+    "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324",
     "imo": null,
     "length": 230.0,
     "mmsi": 123456789,
@@ -130,7 +130,7 @@
     },
     "turnRadius": 500.0
 }
-

Target Ship data

Type: array Default: null

Target Ship data

No Additional Items

Each item of this array must be:

Type: object


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"0a9d3443-d305-4c28-a41b-09ed3f167254"
+

Target Ship data

Type: array Default: null

Target Ship data

No Additional Items

Each item of this array must be:

Type: object


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"88331243-a2c6-4d5e-9f46-77bd0268c725"
 

Length

Type: number

Length of the ship in meters


Example:

230.0
 

Width

Type: number

Width of the ship in meters


Example:

30.0
 

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
@@ -139,7 +139,7 @@
 

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
 

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
     "height": 15.0,
-    "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
+    "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324",
     "imo": null,
     "length": 230.0,
     "mmsi": 123456789,
@@ -227,7 +227,7 @@
         },
         "static": {
             "height": 15.0,
-            "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
+            "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324",
             "imo": null,
             "length": 230.0,
             "mmsi": 123456789,
@@ -289,4 +289,4 @@
     "windDirection": 180.0,
     "windSpeed": 10.0
 }
-

Additional Properties of any type are allowed.

Type: object
\ No newline at end of file +

Additional Properties of any type are allowed.

Type: object
\ No newline at end of file diff --git a/docs/source/schema/caga/output_schema.html b/docs/schema/caga/output_schema.html similarity index 99% rename from docs/source/schema/caga/output_schema.html rename to docs/schema/caga/output_schema.html index 01b99f8..6abc746 100644 --- a/docs/source/schema/caga/output_schema.html +++ b/docs/schema/caga/output_schema.html @@ -1,7 +1,7 @@ - Test Output Schema

Test Output Schema

Type: object

This is a JSON schema for result data originating from Collision and Grounding Avoidance systems

Creationtime

Type: stringFormat: date-time

Date and Time that this file was created, in ISO 8601 format YYYY-MM-DDThh:mm:ssZ. This should be the simulation end time.


Example:

"2024-02-22T18:09:44.004768"
+ Test Output Schema 

Test Output Schema

Type: object

This is a JSON schema for result data originating from Collision and Grounding Avoidance systems

Creationtime

Type: stringFormat: date-time

Date and Time that this file was created, in ISO 8601 format YYYY-MM-DDThh:mm:ssZ. This should be the simulation end time.


Example:

"2024-02-22T20:45:32.794525"
 

Default: null

The traffic situation that was simulated (input file). This should remain unmofidied.

Type: object

Title

Type: string

The title of the traffic situation


Example:

"overtaking_18"
 

Description

Type: string

A description of the traffic situation


Example:

"Crossing situation with 3 target vessels in the Oslofjord"
-

Situation starting time

Default: null

Starting time of the situation in ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: null

Example:

"2024-02-22T18:09:43.984842"
+

Situation starting time

Default: null

Starting time of the situation in ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: null

Example:

"2024-02-22T20:45:32.777083"
 

Own Ship data

Type: object

Own Ship data


Example:

{
     "initial": {
         "cog": 284.2,
@@ -15,7 +15,7 @@
     },
     "static": {
         "height": 15.0,
-        "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
+        "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324",
         "imo": null,
         "length": 230.0,
         "mmsi": 123456789,
@@ -48,7 +48,7 @@
         }
     ]
 }
-


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"0a9d3443-d305-4c28-a41b-09ed3f167254"
+


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"88331243-a2c6-4d5e-9f46-77bd0268c725"
 

Length

Type: number

Length of the ship in meters


Example:

230.0
 

Width

Type: number

Width of the ship in meters


Example:

30.0
 

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
@@ -57,7 +57,7 @@
 

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
 

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
     "height": 15.0,
-    "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
+    "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324",
     "imo": null,
     "length": 230.0,
     "mmsi": 123456789,
@@ -131,7 +131,7 @@
     },
     "turnRadius": 500.0
 }
-

Target Ship data

Type: array Default: null

Target Ship data

No Additional Items

Each item of this array must be:

Type: object


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"0a9d3443-d305-4c28-a41b-09ed3f167254"
+

Target Ship data

Type: array Default: null

Target Ship data

No Additional Items

Each item of this array must be:

Type: object


Static ship information which does not change during a scenario.

Type: object

Static ship data that will not change during the scenario.

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"88331243-a2c6-4d5e-9f46-77bd0268c725"
 

Length

Type: number

Length of the ship in meters


Example:

230.0
 

Width

Type: number

Width of the ship in meters


Example:

30.0
 

Height

Default: 10

Height of the ship in meters

Type: number
Type: null

Example:

15.0
@@ -140,7 +140,7 @@
 

Name

Default: null

Ship title

Type: string
Type: null

Example:

"RMS Titanic"
 

Type: enum (of string)

General ship type, based on AIS

Must be one of:

  • "Wing in ground"
  • "Fishing"
  • "Towing"
  • "Dredging or underwater ops"
  • "Diving ops"
  • "Military ops"
  • "Sailing"
  • "Pleasure Craft"
  • "High speed craft"
  • "Pilot Vessel"
  • "Search and Rescue vessel"
  • "Tug"
  • "Port Tender"
  • "Anti-pollution"
  • "Law Enforcement"
  • "Medical Transport"
  • "Noncombatant ship"
  • "Passenger"
  • "Cargo"
  • "Tanker"
  • "Other Type"
Type: null

Example:

{
     "height": 15.0,
-    "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
+    "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324",
     "imo": null,
     "length": 230.0,
     "mmsi": 123456789,
@@ -228,7 +228,7 @@
         },
         "static": {
             "height": 15.0,
-            "id": "632da7fb-8c07-46ce-b147-0bd07fe2ec25",
+            "id": "96ff9d91-aa58-4d1b-b3c0-4aba5d071324",
             "imo": null,
             "length": 230.0,
             "mmsi": 123456789,
@@ -313,8 +313,8 @@
 

Vendormanoeuverdelay

Type: number Default: null

Time given in seconds to the navigator / system, before the proposed manoeuver is no longer able to be excecuted


Example:

20
 

Vendorsafetydepth

Type: number Default: null

Minimum safety depth


Example:

30
 

Vendorautomaticmanoeuveracceptancetime

Type: number Default: null

If automatic maneuver acceptance is enabled, the new route will be activated after a specified number of seconds


Example:

20
-

Additional Properties of any type are allowed.

Type: object

Timeseriesdata

Type: array

Time series data from the system

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:09:43.995843"
-

Targetships

Type: array

list of target ships detected by the CAGA system

No Additional Items

Each item of this array must be:

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"a8c08c4a-12c3-4f75-94e9-05f43df79e3b"
+

Additional Properties of any type are allowed.

Type: object

Timeseriesdata

Type: array

Time series data from the system

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T20:45:32.794525"
+

Targetships

Type: array

list of target ships detected by the CAGA system

No Additional Items

Each item of this array must be:

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"8c5c24ae-39b5-40d4-87b6-d5821d644980"
 

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
     "latitude": 51.2123,
     "longitude": 11.2313
@@ -334,28 +334,28 @@
 

Tcpa

Default: null

calculated time to closest point of approach in seconds

Type: number
Type: null

Example:

2131
 

Predictions

Type: object Default: null

List of predicted future values. This can be used to store data like a predicted path for each target vessel. The value field supports both numbers and objects


Example:

[
     {
-        "time": "2024-02-22T18:09:43.990808",
+        "time": "2024-02-22T20:45:32.794525",
         "value": {
             "latitude": 57.2343,
             "longitude": 10.3432
         }
     },
     {
-        "time": "2024-02-22T18:09:53.990808",
+        "time": "2024-02-22T20:45:42.794525",
         "value": {
             "latitude": 57.2345,
             "longitude": 10.3432
         }
     },
     {
-        "time": "2024-02-22T18:10:03.990808",
+        "time": "2024-02-22T20:45:52.794525",
         "value": {
             "latitude": 57.2349,
             "longitude": 10.343
         }
     }
 ]
-

Each additional property must conform to the following schema

Type: array
No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:09:43.989767"
+

Each additional property must conform to the following schema

Type: array
No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T20:45:32.794525"
 

Value


Value of the prediction

Type: number
Type: object

Examples:

{
     "latitude": 57.2343,
     "longitude": 10.3432
@@ -371,7 +371,7 @@
         "distanceToTarget": 874.0,
         "encounterType": "Head-on",
         "heading": null,
-        "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f",
+        "id": "01c81ba8-5f7f-4c51-a56a-06a0664fa541",
         "navStatus": "Under way using engine",
         "position": {
             "latitude": 57.2343,
@@ -380,21 +380,21 @@
         "predictions": {
             "position": [
                 {
-                    "time": "2024-02-22T18:09:43.990808",
+                    "time": "2024-02-22T20:45:32.794525",
                     "value": {
                         "latitude": 57.2343,
                         "longitude": 10.3432
                     }
                 },
                 {
-                    "time": "2024-02-22T18:09:53.990808",
+                    "time": "2024-02-22T20:45:42.794525",
                     "value": {
                         "latitude": 57.2345,
                         "longitude": 10.3432
                     }
                 },
                 {
-                    "time": "2024-02-22T18:10:03.990808",
+                    "time": "2024-02-22T20:45:52.794525",
                     "value": {
                         "latitude": 57.2349,
                         "longitude": 10.343
@@ -419,7 +419,7 @@
                 "distanceToTarget": 874.0,
                 "encounterType": "Head-on",
                 "heading": null,
-                "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f",
+                "id": "01c81ba8-5f7f-4c51-a56a-06a0664fa541",
                 "navStatus": "Under way using engine",
                 "position": {
                     "latitude": 57.2343,
@@ -428,21 +428,21 @@
                 "predictions": {
                     "position": [
                         {
-                            "time": "2024-02-22T18:09:43.990808",
+                            "time": "2024-02-22T20:45:32.794525",
                             "value": {
                                 "latitude": 57.2343,
                                 "longitude": 10.3432
                             }
                         },
                         {
-                            "time": "2024-02-22T18:09:53.990808",
+                            "time": "2024-02-22T20:45:42.794525",
                             "value": {
                                 "latitude": 57.2345,
                                 "longitude": 10.3432
                             }
                         },
                         {
-                            "time": "2024-02-22T18:10:03.990808",
+                            "time": "2024-02-22T20:45:52.794525",
                             "value": {
                                 "latitude": 57.2349,
                                 "longitude": 10.343
@@ -454,10 +454,10 @@
                 "tcpa": 1200.0
             }
         ],
-        "time": "2024-02-22T18:09:43.997843"
+        "time": "2024-02-22T20:45:32.794525"
     }
 ]
-

Eventdata

Type: array Default: null

Event data from the system

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the event

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:09:43.997843"
+

Eventdata

Type: array Default: null

Event data from the system

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the event

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T20:45:32.794525"
 

Route

Type: array Default: null

Planned CAGA Route

No Additional Items

Each item of this array must be:

Type: object

Type: object

A geographical coordinate


Example:

{
     "latitude": 51.2123,
     "longitude": 11.2313
@@ -597,7 +597,7 @@
                 "turnRadius": 500.0
             }
         ],
-        "time": "2024-02-22T18:09:43.998842"
+        "time": "2024-02-22T20:45:32.794525"
     }
 ]
 
Type: null

Example:

{
@@ -674,7 +674,7 @@
                     "turnRadius": 500.0
                 }
             ],
-            "time": "2024-02-22T18:09:43.998842"
+            "time": "2024-02-22T20:45:32.794525"
         }
     ],
     "timeSeriesData": [
@@ -690,7 +690,7 @@
                     "distanceToTarget": 874.0,
                     "encounterType": "Head-on",
                     "heading": null,
-                    "id": "d8819394-fecb-4a6c-8b08-c5fbbea89b1f",
+                    "id": "01c81ba8-5f7f-4c51-a56a-06a0664fa541",
                     "navStatus": "Under way using engine",
                     "position": {
                         "latitude": 57.2343,
@@ -699,21 +699,21 @@
                     "predictions": {
                         "position": [
                             {
-                                "time": "2024-02-22T18:09:43.990808",
+                                "time": "2024-02-22T20:45:32.794525",
                                 "value": {
                                     "latitude": 57.2343,
                                     "longitude": 10.3432
                                 }
                             },
                             {
-                                "time": "2024-02-22T18:09:53.990808",
+                                "time": "2024-02-22T20:45:42.794525",
                                 "value": {
                                     "latitude": 57.2345,
                                     "longitude": 10.3432
                                 }
                             },
                             {
-                                "time": "2024-02-22T18:10:03.990808",
+                                "time": "2024-02-22T20:45:52.794525",
                                 "value": {
                                     "latitude": 57.2349,
                                     "longitude": 10.343
@@ -725,7 +725,7 @@
                     "tcpa": 1200.0
                 }
             ],
-            "time": "2024-02-22T18:09:43.997843"
+            "time": "2024-02-22T20:45:32.794525"
         }
     ]
 }
@@ -737,8 +737,8 @@
 

Name

Type: string

The name of the system


Example:

"AutoNavigation-System 1"
 

Version

Type: string

The software version


Example:

"1.2.3"
 

Vendor

Type: string

The name of the system vendor


Example:

"CompanyABC"
-

Additional Properties of any type are allowed.

Type: object

Timeseriesdata

Type: array

TimeSeries data originating from the Simulator

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:09:44.001842"
-

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"a61becc8-2e93-4acf-9629-2b22131716ac"
+

Additional Properties of any type are allowed.

Type: object

Timeseriesdata

Type: array

TimeSeries data originating from the Simulator

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the predicted value ISO 8601 format YYYY-MM-DDThh:mm:ssZ

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T20:45:32.794525"
+

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"88aae6cb-f758-4994-b2ad-60bae5a55cb6"
 

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
     "latitude": 51.2123,
     "longitude": 11.2313
@@ -750,7 +750,7 @@
 

ship heading

Default: null

Initial ship heading in degrees

Type: number

Value must be greater or equal to 0.0 and lesser or equal to 360.0

Type: null

Example:

45.2
 

Type: enum (of string)

AIS Navigational Status

Must be one of:

  • "Under way using engine"
  • "At anchor"
  • "Not under command"
  • "Restricted manoeuverability"
  • "Constrained by her draught"
  • "Moored"
  • "Aground"
  • "Engaged in fishing"
  • "Under way sailing"
  • "Reserved for future amendment of navigational status for HSC"
  • "Reserved for future amendment of navigational status for WIG"
  • "Reserved for future use 1"
  • "Reserved for future use 2"
  • "Reserved for future use 3"
  • "AIS SART is active"
  • "Not defined (default)"

Acceleration

Type: number Default: null

Ship acceleration in ms^-2


Example:

0.01
 

Rateofturn

Type: number Default: null

Ship rate of turn in deg/s


Example:

1.8
-

Additional Properties of any type are allowed.

Type: object

Targetships

Type: array
No Additional Items

Each item of this array must be:

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"a61becc8-2e93-4acf-9629-2b22131716ac"
+

Additional Properties of any type are allowed.

Type: object

Targetships

Type: array
No Additional Items

Each item of this array must be:

Type: object

Id

Type: stringFormat: uuid

Unique Identifier


Example:

"88aae6cb-f758-4994-b2ad-60bae5a55cb6"
 

Longitude and Latitude Values

Type: object

A geographical coordinate


Example:

{
     "latitude": 51.2123,
     "longitude": 11.2313
@@ -768,7 +768,7 @@
             "acceleration": null,
             "cog": 97.0,
             "heading": null,
-            "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab",
+            "id": "a4217ba8-2577-43d3-94e4-77bbed948a5d",
             "mmsi": 987654321,
             "navStatus": "Under way using engine",
             "position": {
@@ -783,7 +783,7 @@
                 "acceleration": 0.01,
                 "cog": 181.0,
                 "heading": null,
-                "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7",
+                "id": "aa6152cc-86b5-45c5-bb1e-667c11083af4",
                 "navStatus": "Engaged in fishing",
                 "position": {
                     "latitude": 57.2343,
@@ -796,7 +796,7 @@
                 "acceleration": null,
                 "cog": 7.0,
                 "heading": null,
-                "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b",
+                "id": "74cedb4f-8cd1-4b65-9b1e-543118cfa0da",
                 "mmsi": 123456789,
                 "navStatus": "Under way using engine",
                 "position": {
@@ -807,14 +807,14 @@
                 "sog": 14.0
             }
         ],
-        "time": "2024-02-22T18:09:44.002844"
+        "time": "2024-02-22T20:45:32.794525"
     },
     {
         "ownShip": {
             "acceleration": null,
             "cog": 97.0,
             "heading": null,
-            "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab",
+            "id": "a4217ba8-2577-43d3-94e4-77bbed948a5d",
             "mmsi": 987654321,
             "navStatus": "Under way using engine",
             "position": {
@@ -829,7 +829,7 @@
                 "acceleration": 0.01,
                 "cog": 181.0,
                 "heading": null,
-                "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7",
+                "id": "aa6152cc-86b5-45c5-bb1e-667c11083af4",
                 "navStatus": "Engaged in fishing",
                 "position": {
                     "latitude": 57.2343,
@@ -842,7 +842,7 @@
                 "acceleration": null,
                 "cog": 7.0,
                 "heading": null,
-                "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b",
+                "id": "74cedb4f-8cd1-4b65-9b1e-543118cfa0da",
                 "mmsi": 123456789,
                 "navStatus": "Under way using engine",
                 "position": {
@@ -853,10 +853,10 @@
                 "sog": 14.0
             }
         ],
-        "time": "2024-02-22T18:09:54.002844"
+        "time": "2024-02-22T20:45:42.794525"
     }
 ]
-

Eventdata

Type: array Default: null

Event data from the simulator

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the event

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T18:09:43.998842"
+

Eventdata

Type: array Default: null

Event data from the simulator

No Additional Items

Each item of this array must be:

Type: object

Time


Date and Time of the event

Type: stringFormat: date-time
Type: integer

Example:

"2024-02-22T20:45:32.794525"
 

Additional Properties of any type are allowed.

Type: object
Type: null

Example:

{
     "configuration": {
         "name": "Simulator-System 1",
@@ -870,7 +870,7 @@
                 "acceleration": null,
                 "cog": 97.0,
                 "heading": null,
-                "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab",
+                "id": "a4217ba8-2577-43d3-94e4-77bbed948a5d",
                 "mmsi": 987654321,
                 "navStatus": "Under way using engine",
                 "position": {
@@ -885,7 +885,7 @@
                     "acceleration": 0.01,
                     "cog": 181.0,
                     "heading": null,
-                    "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7",
+                    "id": "aa6152cc-86b5-45c5-bb1e-667c11083af4",
                     "navStatus": "Engaged in fishing",
                     "position": {
                         "latitude": 57.2343,
@@ -898,7 +898,7 @@
                     "acceleration": null,
                     "cog": 7.0,
                     "heading": null,
-                    "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b",
+                    "id": "74cedb4f-8cd1-4b65-9b1e-543118cfa0da",
                     "mmsi": 123456789,
                     "navStatus": "Under way using engine",
                     "position": {
@@ -909,14 +909,14 @@
                     "sog": 14.0
                 }
             ],
-            "time": "2024-02-22T18:09:44.002844"
+            "time": "2024-02-22T20:45:32.794525"
         },
         {
             "ownShip": {
                 "acceleration": null,
                 "cog": 97.0,
                 "heading": null,
-                "id": "888eb03b-0576-4540-b7d2-1bb7a261c9ab",
+                "id": "a4217ba8-2577-43d3-94e4-77bbed948a5d",
                 "mmsi": 987654321,
                 "navStatus": "Under way using engine",
                 "position": {
@@ -931,7 +931,7 @@
                     "acceleration": 0.01,
                     "cog": 181.0,
                     "heading": null,
-                    "id": "7a2704f3-776e-4ceb-9ee3-641c035199b7",
+                    "id": "aa6152cc-86b5-45c5-bb1e-667c11083af4",
                     "navStatus": "Engaged in fishing",
                     "position": {
                         "latitude": 57.2343,
@@ -944,7 +944,7 @@
                     "acceleration": null,
                     "cog": 7.0,
                     "heading": null,
-                    "id": "f698344c-9d45-47aa-9e8b-ea381c9cc18b",
+                    "id": "74cedb4f-8cd1-4b65-9b1e-543118cfa0da",
                     "mmsi": 123456789,
                     "navStatus": "Under way using engine",
                     "position": {
@@ -955,8 +955,8 @@
                     "sog": 14.0
                 }
             ],
-            "time": "2024-02-22T18:09:54.002844"
+            "time": "2024-02-22T20:45:42.794525"
         }
     ]
 }
-

Additional Properties of any type are allowed.

Type: object
\ No newline at end of file +

Additional Properties of any type are allowed.

Type: object
\ No newline at end of file diff --git a/docs/source/cli.maritime_schema.rst b/docs/source/cli.maritime_schema.rst deleted file mode 100644 index 6df5178..0000000 --- a/docs/source/cli.maritime_schema.rst +++ /dev/null @@ -1,3 +0,0 @@ -.. sphinx_argparse_cli:: - :module: maritime_schema.cli.maritime_schema - :func: _argparser diff --git a/docs/source/cli.publish_schema.rst b/docs/source/cli.publish_schema.rst new file mode 100644 index 0000000..5fee3d9 --- /dev/null +++ b/docs/source/cli.publish_schema.rst @@ -0,0 +1,3 @@ +.. sphinx_argparse_cli:: + :module: maritime_schema.cli.publish_schema + :func: _argparser diff --git a/docs/source/cli.rst b/docs/source/cli.rst index 3e02ae3..b7cd000 100644 --- a/docs/source/cli.rst +++ b/docs/source/cli.rst @@ -1,7 +1,7 @@ -CLI Documentation -================= - -.. toctree:: - :maxdepth: 2 - - cli.maritime_schema +CLI Documentation +================= + +.. toctree:: + :maxdepth: 2 + + cli.publish_schema diff --git a/docs/source/schema.caga.input_schema.rst b/docs/source/schema.caga.input_schema.rst index d5d328a..56ddf2f 100644 --- a/docs/source/schema.caga.input_schema.rst +++ b/docs/source/schema.caga.input_schema.rst @@ -2,4 +2,4 @@ CAGA Input Schema ================= .. raw:: html - :file: ./schema/caga/input_schema.html + :file: ../schema/caga/input_schema.html diff --git a/docs/source/schema.caga.output_schema.rst b/docs/source/schema.caga.output_schema.rst index 2d19b78..0d324e2 100644 --- a/docs/source/schema.caga.output_schema.rst +++ b/docs/source/schema.caga.output_schema.rst @@ -2,4 +2,4 @@ CAGA Output Schema ================== .. raw:: html - :file: ./schema/caga/output_schema.html + :file: ../schema/caga/output_schema.html From e2bca9651365b9a5acfba5b98971d10703275306 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 20:56:00 +0100 Subject: [PATCH 35/36] pyproject.toml: changed name of cli script from 'maritime-schema' to 'publish-schema' --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ddf25b4..718bfe3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ Issues = "https://github.com/dnv-opensource/maritime-schema/issues" Changelog = "https://github.com/dnv-opensource/maritime-schema/blob/main/CHANGELOG.md" [project.scripts] -maritime-schema = "maritime_schema.cli.maritime_schema:main" +publish-schema = "maritime_schema.cli.publish_schema:main" [tool.setuptools.packages.find] where = ["src"] From cbd8aab7954b5e3c9f7b16c21b5984c4f3cef4a0 Mon Sep 17 00:00:00 2001 From: Claas Date: Thu, 22 Feb 2024 21:07:57 +0100 Subject: [PATCH 36/36] GitHub workflow _build_and_publish_documentation.yml : Added a step that makes sure to (re-)generate the schema and corresponding documentation. This to ensure that the documentation always represents the latest state of the pydantic models in src/maritime_schema/types --- .../_build_and_publish_documentation.yml | 225 +++++++++--------- 1 file changed, 115 insertions(+), 110 deletions(-) diff --git a/.github/workflows/_build_and_publish_documentation.yml b/.github/workflows/_build_and_publish_documentation.yml index e89e8f9..d07a233 100644 --- a/.github/workflows/_build_and_publish_documentation.yml +++ b/.github/workflows/_build_and_publish_documentation.yml @@ -1,110 +1,115 @@ -name: Build and publish documentation - -on: workflow_call - -env: - DEFAULT_BRANCH: 'release' - #SPHINXOPTS: '-W --keep-going -T' - # ^-- If these SPHINXOPTS are enabled, then be strict about the builds and fail on any warnings - -jobs: - build-and-publish-docs: - name: Build and publish documentation - runs-on: ubuntu-latest - steps: - - name: Checkout active branch - uses: actions/checkout@v4 - with: - fetch-depth: 1 - lfs: true - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - cache: 'pip' # cache pip dependencies - - name: Install dependencies - run: | - pip install -r requirements-dev.txt - - name: Print debugging information - run: | - echo "github.ref:" ${{github.ref}} - echo "github.event_name:" ${{github.event_name}} - echo "github.head_ref:" ${{github.head_ref}} - echo "github.base_ref:" ${{github.base_ref}} - set -x - git rev-parse --abbrev-ref HEAD - git branch - git branch -a - git remote -v - python -V - pip list --not-required - pip list - - # Build documentation - - uses: sphinx-doc/github-problem-matcher@master - - name: Build documentation - run: | - cd docs - make html - - - name: Clone and cleanup gh-pages branch - run: | - set -x - git fetch - ( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages - rm -rf _gh-pages/.git/ - mkdir -p _gh-pages/branch/ - - # Delete orphaned branch-folders: - # Go through each subfolder in _gh-pages/branch/ - # If it relates to an orphaned branch, delete it. - - name: Delete orphaned branch-folders - run: | - set -x - for brdir in `ls _gh-pages/branch/` ; do - brname=${brdir//--/\/} # replace '--' with '/' - if ! git show-ref remotes/origin/$brname ; then - echo "Removing $brdir" - rm -r _gh-pages/branch/$brdir/ - fi - done - - # Copy documentation to _gh-pages/ (if push happened on release branch) - - name: Copy documentation to _gh-pages/ - if: | - contains(github.ref, env.DEFAULT_BRANCH) - run: | - set -x - # Delete everything under _gh-pages/ that is from the - # primary branch deployment. Excludes the other branches - # _gh-pages/branch-* paths, and not including - # _gh-pages itself. - find _gh-pages/ -mindepth 1 ! -path '_gh-pages/branch*' -delete - rsync -a docs/build/html/ _gh-pages/ - - # Copy documentation to _gh-pages/branch/$brname (if push happened on any other branch) - # ('/' gets replaced by '--') - - name: Copy documentation to _gh-pages/branch/${{github.ref}} - if: | - !contains(github.ref, env.DEFAULT_BRANCH) - run: | - set -x - #brname=$(git rev-parse --abbrev-ref HEAD) - brname="${{github.ref}}" - brname="${brname##refs/heads/}" - brdir=${brname//\//--} # replace '/' with '--' - rm -rf _gh-pages/branch/${brdir} - rsync -a docs/build/html/ _gh-pages/branch/${brdir} - - # Add .nojekyll file - - name: Add .nojekyll file - run: touch _gh-pages/.nojekyll - - # Publish: Commit gh-pages branch and publish it to GitHub Pages - - name: Publish documentation - uses: peaceiris/actions-gh-pages@v3 - with: - publish_branch: gh-pages - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: _gh-pages/ - force_orphan: true +name: Build and publish documentation + +on: workflow_call + +env: + DEFAULT_BRANCH: 'release' + #SPHINXOPTS: '-W --keep-going -T' + # ^-- If these SPHINXOPTS are enabled, then be strict about the builds and fail on any warnings + +jobs: + build-and-publish-docs: + name: Build and publish documentation + runs-on: ubuntu-latest + steps: + - name: Checkout active branch + uses: actions/checkout@v4 + with: + fetch-depth: 1 + lfs: true + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: 'pip' # cache pip dependencies + - name: Install dependencies + run: | + pip install -r requirements-dev.txt + - name: Print debugging information + run: | + echo "github.ref:" ${{github.ref}} + echo "github.event_name:" ${{github.event_name}} + echo "github.head_ref:" ${{github.head_ref}} + echo "github.base_ref:" ${{github.base_ref}} + set -x + git rev-parse --abbrev-ref HEAD + git branch + git branch -a + git remote -v + python -V + pip list --not-required + pip list + + - name: Generate schema and -documentation + run: | + pip install -e . + publish-schema + + # Build documentation + - uses: sphinx-doc/github-problem-matcher@master + - name: Build documentation + run: | + cd docs + make html + + - name: Clone and cleanup gh-pages branch + run: | + set -x + git fetch + ( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages + rm -rf _gh-pages/.git/ + mkdir -p _gh-pages/branch/ + + # Delete orphaned branch-folders: + # Go through each subfolder in _gh-pages/branch/ + # If it relates to an orphaned branch, delete it. + - name: Delete orphaned branch-folders + run: | + set -x + for brdir in `ls _gh-pages/branch/` ; do + brname=${brdir//--/\/} # replace '--' with '/' + if ! git show-ref remotes/origin/$brname ; then + echo "Removing $brdir" + rm -r _gh-pages/branch/$brdir/ + fi + done + + # Copy documentation to _gh-pages/ (if push happened on release branch) + - name: Copy documentation to _gh-pages/ + if: | + contains(github.ref, env.DEFAULT_BRANCH) + run: | + set -x + # Delete everything under _gh-pages/ that is from the + # primary branch deployment. Excludes the other branches + # _gh-pages/branch-* paths, and not including + # _gh-pages itself. + find _gh-pages/ -mindepth 1 ! -path '_gh-pages/branch*' -delete + rsync -a docs/build/html/ _gh-pages/ + + # Copy documentation to _gh-pages/branch/$brname (if push happened on any other branch) + # ('/' gets replaced by '--') + - name: Copy documentation to _gh-pages/branch/${{github.ref}} + if: | + !contains(github.ref, env.DEFAULT_BRANCH) + run: | + set -x + #brname=$(git rev-parse --abbrev-ref HEAD) + brname="${{github.ref}}" + brname="${brname##refs/heads/}" + brdir=${brname//\//--} # replace '/' with '--' + rm -rf _gh-pages/branch/${brdir} + rsync -a docs/build/html/ _gh-pages/branch/${brdir} + + # Add .nojekyll file + - name: Add .nojekyll file + run: touch _gh-pages/.nojekyll + + # Publish: Commit gh-pages branch and publish it to GitHub Pages + - name: Publish documentation + uses: peaceiris/actions-gh-pages@v3 + with: + publish_branch: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: _gh-pages/ + force_orphan: true