flip_api.step_functions_services.cohort_query_step_function

Attributes

router

Functions

cohort_query_step_function_endpoint(request, cohort_query)

Process a cohort query by orchestrating the workflow:

Module Contents

flip_api.step_functions_services.cohort_query_step_function.router
flip_api.step_functions_services.cohort_query_step_function.cohort_query_step_function_endpoint(request: fastapi.Request, cohort_query: flip_api.domain.schemas.cohort.CohortQueryInput, db: sqlmodel.Session = Depends(get_session), user_id: uuid.UUID = Depends(verify_token))

Process a cohort query by orchestrating the workflow: 1. Validate the project exists. 2. Save the cohort query. 3. Submit the cohort query.

This mimics the AWS Step Functions workflow defined in cohortQuery.yml

Parameters:
  • request (Request) – The FastAPI request object.

  • cohort_query (flip_api.domain.schemas.cohort.CohortQueryInput) – The input data for the cohort query.

  • db (Session) – The database session.

  • user_id (UUID) – The ID of the current user.

Returns:

A dictionary containing the result of the cohort query submission.

Return type:

SubmitCohortQueryOutput

Raises:

HTTPException – If an error occurs during any step of the process.