Ship162¶
tangram_ship162
¶
router
module-attribute
¶
router = APIRouter(
prefix="/ship162",
tags=["ship162"],
responses={404: {"description": "Not found"}},
)
plugin
module-attribute
¶
plugin = Plugin(
frontend_path="dist-frontend",
routers=[router],
config_class=ShipsConfig,
frontend_config_class=ShipsFrontendConfig,
into_frontend_config_function=into_frontend,
)
TrailColorOptions
dataclass
¶
Source code in packages/tangram_ship162/src/tangram_ship162/__init__.py
169 170 171 172 173 | |
by_attribute
class-attribute
instance-attribute
¶
by_attribute: Annotated[
Literal["speed"], FrontendMutable()
] = "speed"
__init__
¶
__init__(
by_attribute: Annotated[
Literal["speed"], FrontendMutable()
] = "speed",
min: Annotated[float, FrontendMutable()] = 0.0,
max: Annotated[float, FrontendMutable()] = 14.0,
) -> None
ShipsConfig
dataclass
¶
Source code in packages/tangram_ship162/src/tangram_ship162/__init__.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
history_control_channel
class-attribute
instance-attribute
¶
history_control_channel: str = 'history:control'
history_flush_interval_secs
class-attribute
instance-attribute
¶
history_flush_interval_secs: int = 5
history_optimize_interval_secs
class-attribute
instance-attribute
¶
history_optimize_interval_secs: int = 120
history_optimize_target_file_size
class-attribute
instance-attribute
¶
history_optimize_target_file_size: int = 134217728
history_vacuum_interval_secs
class-attribute
instance-attribute
¶
history_vacuum_interval_secs: int = 120
history_vacuum_retention_period_secs
class-attribute
instance-attribute
¶
history_vacuum_retention_period_secs: int | None = 120
history_checkpoint_interval
class-attribute
instance-attribute
¶
history_checkpoint_interval: int = 10
trail_color
class-attribute
instance-attribute
¶
trail_color: str | TrailColorOptions = TrailColorOptions()
__init__
¶
__init__(
ship162_channel: str = "ship162",
history_table_name: str = "ship162",
history_control_channel: str = "history:control",
search_channel: str = "ship162:search",
state_vector_expire: int = 600,
stream_interval_secs: float = 1.0,
log_level: str = "INFO",
history_buffer_size: int = 100000,
history_flush_interval_secs: int = 5,
history_optimize_interval_secs: int = 120,
history_optimize_target_file_size: int = 134217728,
history_vacuum_interval_secs: int = 120,
history_vacuum_retention_period_secs: int | None = 120,
history_checkpoint_interval: int = 10,
topbar_order: int = 100,
sidebar_order: int = 100,
trail_color: str
| TrailColorOptions = TrailColorOptions(),
trail_alpha: float = 0.6,
) -> None
ShipsFrontendConfig
dataclass
¶
Bases: HasTopbarUiConfig, HasSidebarUiConfig
Source code in packages/tangram_ship162/src/tangram_ship162/__init__.py
198 199 200 201 202 203 204 205 206 | |
trail_color
instance-attribute
¶
trail_color: (
Annotated[str, FrontendMutable(kind="color")]
| TrailColorOptions
)
__init__
¶
__init__(
search_channel: str,
topbar_order: Annotated[int, FrontendMutable()],
sidebar_order: Annotated[int, FrontendMutable()],
trail_color: Annotated[
str, FrontendMutable(kind="color")
]
| TrailColorOptions,
trail_alpha: Annotated[
float, Ge(0), Le(1), FrontendMutable()
],
) -> None
get_trajectory_data
async
¶
get_trajectory_data(
mmsi: int, backend_state: InjectBackendState
) -> Response
Get the full trajectory for a given ship MMSI.
Source code in packages/tangram_ship162/src/tangram_ship162/__init__.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
search_ships
async
¶
search_ships(
q: str, backend_state: InjectBackendState
) -> Response
Source code in packages/tangram_ship162/src/tangram_ship162/__init__.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
get_history_slice
async
¶
get_history_slice(
mmsi: int,
start_timestamp: int,
end_timestamp: int,
backend_state: InjectBackendState,
) -> Response
Source code in packages/tangram_ship162/src/tangram_ship162/__init__.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
into_frontend
¶
into_frontend(config: ShipsConfig) -> ShipsFrontendConfig
Source code in packages/tangram_ship162/src/tangram_ship162/__init__.py
209 210 211 212 213 214 215 216 | |
run_ships
async
¶
run_ships(backend_state: BackendState) -> None
Source code in packages/tangram_ship162/src/tangram_ship162/__init__.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | |
tangram_ship162._ships
¶
ShipsConfig
¶
history_vacuum_retention_period_secs
property
writable
¶
history_vacuum_retention_period_secs: Optional[int]
__new__
¶
__new__(
redis_url: str,
ship162_channel: str,
history_control_channel: str,
state_vector_expire: int,
stream_interval_secs: float,
history_table_name: str,
history_buffer_size: int,
history_flush_interval_secs: int,
history_optimize_interval_secs: int,
history_optimize_target_file_size: int,
history_vacuum_interval_secs: int,
history_vacuum_retention_period_secs: Optional[int],
history_checkpoint_interval: int,
search_channel: str,
) -> ShipsConfig