Complete incident selection and 112 to DDS workflow
This commit is contained in:
parent
0526b11f91
commit
68dd83c7c2
21 changed files with 281 additions and 56 deletions
|
|
@ -26,7 +26,7 @@ async def groups() -> dict:
|
|||
|
||||
|
||||
@router.get("/signs")
|
||||
async def signs(prefix: list[str] = Query(default=[])) -> dict:
|
||||
async def signs(prefix: list[str] = Query(default=[]), group: int | None = None) -> dict:
|
||||
"""Значения следующего признака при уже выбранных.
|
||||
|
||||
Пустой `prefix` — значения первого уровня. Возвращается и найденное
|
||||
|
|
@ -34,10 +34,10 @@ async def signs(prefix: list[str] = Query(default=[])) -> dict:
|
|||
он классифицировал, до того, как отправит карточку.
|
||||
"""
|
||||
level = len(prefix) + 1
|
||||
found = ekp.by_signs(prefix) if prefix else None
|
||||
found = ekp.by_signs(prefix, group) if prefix else None
|
||||
return {
|
||||
"level": level,
|
||||
"values": ekp.signs_at_level(level, prefix) if level <= 3 else [],
|
||||
"values": ekp.signs_at_level(level, prefix, group) if level <= 3 else [],
|
||||
"incident": (
|
||||
{
|
||||
"code": found.code,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ from pydantic import BaseModel, Field
|
|||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.api.auth import audit, require
|
||||
from app.domain import ekp
|
||||
from app.db.base import get_session
|
||||
from app.domain.roles import Role
|
||||
from app.scenarios import store
|
||||
|
|
@ -131,6 +132,11 @@ async def listing() -> list[dict]:
|
|||
"topics": scenario.topics,
|
||||
"modes": scenario.modes,
|
||||
"dds": scenario.ground_truth.dds.value if scenario.ground_truth.dds else None,
|
||||
"ticket": scenario.ticket,
|
||||
"position": scenario.position,
|
||||
"ekp_group": (ekp.incident(scenario.ground_truth.incident_code).group
|
||||
if scenario.ground_truth.incident_code
|
||||
and ekp.incident(scenario.ground_truth.incident_code) else None),
|
||||
}
|
||||
for scenario in store.all_scenarios()
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue