Skip to content

Define AnalyticsService Interface for Workflow Execution and Trigger Management #502

@NGrech

Description

@NGrech

Define a RESTless API-like interface for the Analytics module, providing CRUD operations for Workflows, Triggers, and Schedules, following the same architectural and implementation pattern used in DataStreamService.

This service will form the core application layer entry point for clients to:

  1. Create, update, retrieve, and delete analytic workflows
  2. Manage triggers and schedules
  3. Import workflows or triggers from a shared library
  4. Execute a workflow given a workflow or workflow name

(Updated) Acceptance Criteria for Analytics Services

TriggersService

  • TriggersService interface defined in carp.analytics.core.
  • Interface extends ApplicationService<TriggersService, TriggersService.Event> using correct type.
  • Includes methods:
    • createTrigger(trigger)
    • updateTrigger(trigger)
    • deleteTrigger(triggerId)
    • getTrigger(triggerId)
    • listTriggers(studyId)
    • startTrigger(triggerId, at)
    • endTrigger(triggerId, at)
  • API_VERSION set to 1.0.
  • Sealed TriggersService.Event defined and implements IntegrationEvent<TriggersService>.
  • TriggersServiceRequest defined with full serializer setup and docstrings.
  • TriggersServiceInvoker manually dispatches to implementation methods.
  • TriggersServiceRequest.json schema generated with correct __type constants and polymorphic response anchors.
  • Trigger.json schema supports polymorphism with ManualTrigger.
  • Example request and response pairs defined in exampleRequests.
  • JSON schema validation tests pass.

WorkflowService

  • WorkflowService interface defined with methods:
    • createWorkflow(studyId, workflow)
    • updateWorkflow(studyId, metadata, workflow)
    • getWorkflow(studyId, workflowId)
    • deleteWorkflow(studyId, workflowId)
    • listWorkflows(studyId)
  • WorkflowServiceRequest sealed class with serializers and docstrings.
  • WorkflowServiceInvoker manually routes each request.
  • WorkflowServiceRequest.json schema implemented with all request types and response anchors.
  • Workflow.json and WorkflowMetadata.json schemas generated.
  • Example requests for all methods added to exampleRequests.
  • Round-trip validation tests added and pass.

ExecutionService

  • ExecutionService interface defined with methods:
    • executeWorkflow(studyId, workflowId)
    • executeWorkflowFromDefinition(studyId, workflow)
    • getExecutionState(executionId)
    • getExecutionResult(executionId)
    • findExecutions(studyId, workflowId?, from?, to?)
    • getLatestExecutionStatus(studyId, workflowId?)
  • ExecutionServiceRequest defined with serializers and docstrings.
  • ExecutionServiceInvoker manually dispatches all request types.
  • ExecutionServiceRequest.json schema created with:
    • oneOf entry for each request
    • version field
    • Response anchor for each type
  • Schemas created for all domain models:
    • ExecutionState
    • ExecutionResult (with subtype: BasicExecutionResult)
    • ExecutionArtifact, ArtifactType
  • Example requests for all methods added to exampleRequests.
  • JSON schema test coverage added and validated.

Documentation Table (Optional)

  • Add a Markdown table (similar to DataStreamService) summarizing TriggersService methods.

Metadata

Metadata

Assignees

Labels

featureNew functionality.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions