API Reference¶
Apps¶
api ¶
map ¶
ranking ¶
Project: MyCyclingCity Generation: AI-based
Ranking application for MyCyclingCity.
leaderboard ¶
Project: MyCyclingCity Generation: AI-based
Leaderboard application for MyCyclingCity.
kiosk ¶
iot ¶
game ¶
mgmt ¶
Utilities¶
api.utils ¶
Project: MyCyclingCity Generation: AI-based
Shared utility functions for MyCyclingCity applications.
format_km_de ¶
format_km_de(
value: Optional[float],
decimals: int = 3,
language_code: Optional[str] = None,
) -> str
Format number based on language: German format (dot thousands, comma decimal) or English format (comma thousands, dot decimal).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Optional[float]
|
The numeric value to format. Can be None. |
required |
decimals
|
int
|
Number of decimal places (default: 3). |
3
|
language_code
|
Optional[str]
|
Optional language code override. If None, uses current language. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted string with appropriate thousands and decimal separators. |
Examples:
Source code in api/utils.py
api.helpers ¶
Project: MyCyclingCity Generation: AI-based
Shared helper functions for building group hierarchies and data structures. Used by map, ranking, and leaderboard apps.
are_all_parents_visible ¶
Check if all parent groups in the hierarchy are visible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group
|
Group
|
The group to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the group and all its parents are visible, False otherwise. |
Source code in api/helpers.py
build_events_data ¶
Build event data structure for display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kiosk
|
bool
|
Whether in kiosk mode (filters groups with distance > 0). |
False
|
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing event data. |
Source code in api/helpers.py
build_group_hierarchy ¶
build_group_hierarchy(
target_group: Optional[Group] = None,
kiosk: bool = False,
show_cyclists: bool = True,
) -> List[Dict[str, Any]]
Build a hierarchical data structure of groups with their members and subgroups.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_group
|
Optional[Group]
|
Optional specific group to filter by. |
None
|
kiosk
|
bool
|
Whether in kiosk mode (filters groups with distance_total > 0). |
False
|
show_cyclists
|
bool
|
Whether to include cyclist data in the hierarchy. |
True
|
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing group hierarchy data. |
Source code in api/helpers.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |