backend.api.modules.declarative_router

Contains the routes for handling declarative constraints.

Attributes

Functions

compute_declarative_constraints(, min_confidence, ...)

Computes the declarative constraints and stores it.

get_existance_violations(→ ReturnGraphType)

Retrieves the existance violations from the declarative model.

get_absence_violations(→ ReturnGraphType)

Retrieves the absence violations from the declarative model.

get_exactly_one_violations(→ ReturnGraphType)

Retrieves the exactly_one violations from the declarative model.

get_init_violations(→ ReturnGraphType)

Retrieves the init violations from the declarative model.

get_responded_existence_violations(→ ReturnGraphType)

Retrieves the responded_existence violations from the declarative model.

get_coexistence_violations(→ ReturnGraphType)

Retrieves the coexistence violations from the declarative model.

get_response_violations(→ ReturnGraphType)

Retrieves the response violations from the declarative model.

get_precedence_violations(→ ReturnGraphType)

Retrieves the precedence violations from the declarative model.

get_succession_violations(→ ReturnGraphType)

Retrieves the succession violations from the declarative model.

get_altprecedence_violations(→ ReturnGraphType)

Retrieves the altprecedence violations from the declarative model.

get_altsuccession_violations(→ ReturnGraphType)

Retrieves the altsuccession violations from the declarative model.

get_chainresponse_violations(→ ReturnGraphType)

Retrieves the chainresponse violations from the declarative model.

get_chainprecedence_violations(→ ReturnGraphType)

Retrieves the chainprecedence violations from the declarative model.

get_chainsuccession_violations(→ ReturnGraphType)

Retrieves the chainsuccession violations from the declarative model.

get_noncoexistence_violations(→ ReturnGraphType)

Retrieves the noncoexistence violations from the declarative model.

get_nonsuccession_violations(→ ReturnGraphType)

Retrieves the nonsuccession violations from the declarative model.

get_nonchainsuccession_violations(→ ReturnGraphType)

Retrieves the nonchainsuccession violations from the declarative model.

get_always_after_pql() → Dict[str, ...)

Retrieves the always-after relations via PQL.

get_always_before_pql() → Dict[str, ...)

Retrieves the always-before relations via PQL.

Module Contents

type backend.api.modules.declarative_router.TableType = Dict[str, List[str] | List[List[str]]]
type backend.api.modules.declarative_router.GraphType = Dict[str, List[Dict[str, str]]]
type backend.api.modules.declarative_router.ReturnGraphType = Dict[str, List[TableType] | List[GraphType]]
backend.api.modules.declarative_router.router
backend.api.modules.declarative_router.MODULE_NAME = 'declarative_constraints'
async backend.api.modules.declarative_router.compute_declarative_constraints(background_tasks: fastapi.BackgroundTasks, request: fastapi.Request, min_support: float = Query(0.3, description='Minimum support ratio'), min_confidence: float = Query(0.75, description='Minimum confidence ratio'), fitness_score: float = Query(1.0, description='Fitness score for the constraints'), celonis: backend.celonis_connection.celonis_connection_manager.CelonisConnectionManager = Depends(get_celonis_connection)) Dict[str, str]

Computes the declarative constraints and stores it.

The declarative model is computed in the background and stored in the app state.

Parameters:
  • background_tasks – The background tasks object. This is used to schedule the computation of the declarative model.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

  • celonis (optional) – The CelonisManager dependency injection. Defaults to Depends(get_celonis_connection).

  • min_support – The minimum support ratio for the constraints.

  • min_confidence – The minimum confidence ratio for the constraints.

  • fitness_score – The fitness score for the constraints.

Returns:

A dictionary containing the job ID of the scheduled task.

backend.api.modules.declarative_router.get_existance_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the existance violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the existance violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the existance violations for the specified job.

backend.api.modules.declarative_router.get_absence_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the absence violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the absence violations for the specified job.

backend.api.modules.declarative_router.get_exactly_one_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the exactly_one violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the exactly_one violations for the specified job.

backend.api.modules.declarative_router.get_init_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the init violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the init violations for the specified job.

backend.api.modules.declarative_router.get_responded_existence_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the responded_existence violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the responded_existence violations for the specified job.

backend.api.modules.declarative_router.get_coexistence_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the coexistence violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the coexistence violations for the specified job.

backend.api.modules.declarative_router.get_response_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the response violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the response violations for the specified job.

backend.api.modules.declarative_router.get_precedence_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the precedence violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the precedence violations for the specified job.

backend.api.modules.declarative_router.get_succession_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the succession violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the succession violations for the specified job.

backend.api.modules.declarative_router.get_altprecedence_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the altprecedence violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the altprecedence violations for the specified job.

backend.api.modules.declarative_router.get_altsuccession_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the altsuccession violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the altsuccession violations for the specified job.

backend.api.modules.declarative_router.get_chainresponse_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the chainresponse violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the chainresponse violations for the specified job.

backend.api.modules.declarative_router.get_chainprecedence_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the chainprecedence violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the chainprecedence violations for the specified job.

backend.api.modules.declarative_router.get_chainsuccession_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the chainsuccession violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the chainsuccession violations for the specified job.

backend.api.modules.declarative_router.get_noncoexistence_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the noncoexistence violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the noncoexistence violations for the specified job.

backend.api.modules.declarative_router.get_nonsuccession_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the nonsuccession violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the nonsuccession violations for the specified job.

backend.api.modules.declarative_router.get_nonchainsuccession_violations(job_id: str, request: fastapi.Request) ReturnGraphType

Retrieves the nonchainsuccession violations from the declarative model.

Parameters:
  • job_id – The ID of the job for which to retrieve the violations.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Returns:

A list of lists containing the nonchainsuccession violations for the specified job.

backend.api.modules.declarative_router.get_always_after_pql(request: fastapi.Request, celonis: backend.celonis_connection.celonis_connection_manager.CelonisConnectionManager = Depends(get_celonis_connection)) Dict[str, List[TableType] | List[GraphType]]

Retrieves the always-after relations via PQL.

Parameters:
  • request – The FastAPI request object.

  • celonis – The CelonisManager dependency injection.

Returns:

A JSON object with “tables” and “graphs” keys.

backend.api.modules.declarative_router.get_always_before_pql(request: fastapi.Request, celonis: backend.celonis_connection.celonis_connection_manager.CelonisConnectionManager = Depends(get_celonis_connection)) Dict[str, List[TableType] | List[GraphType]]

Retrieves the always-before relations via PQL.

Parameters:
  • request – The FastAPI request object.

  • celonis – The CelonisManager dependency injection.

Returns:

A JSON object with “tables” and “graphs” keys.