Skip to content

start_patient_insights_job async

start_patient_insights_job(
    domain_id: DomainId,
    patient_context: PatientInsightsPatientContext,
    insights_context: InsightsContext,
    encounter_context: PatientInsightsEncounterContext,
    user_context: UserContext,
    input_data_config: InputDataConfig,
    output_data_config: OutputDataConfig,
    *,
    config_overrides: Optional[AsyncConnectHealthClientConfig] = None,
    client_token: Optional[NonEmptyString] = None,
) -> StartPatientInsightsJobResponse

Starts a new patient insights job.

Parameters:

Raises:

Source code in docs_src/capo_connecthealth/_services/async_connect_health.py
async def start_patient_insights_job(
    self,
    domain_id: "capo_connecthealth.types.domain_id.DomainId",
    patient_context: "capo_connecthealth.types.patient_insights_patient_context.PatientInsightsPatientContext",
    insights_context: "capo_connecthealth.types.insights_context.InsightsContext",
    encounter_context: "capo_connecthealth.types.patient_insights_encounter_context.PatientInsightsEncounterContext",
    user_context: "capo_connecthealth.types.user_context.UserContext",
    input_data_config: "capo_connecthealth.types.input_data_config.InputDataConfig",
    output_data_config: "capo_connecthealth.types.output_data_config.OutputDataConfig",
    *,
    config_overrides: Optional[AsyncConnectHealthClientConfig] = None,
    client_token: Optional[
        "capo_connecthealth.types.non_empty_string.NonEmptyString"
    ] = None,
) -> "capo_connecthealth.types.start_patient_insights_job_response.StartPatientInsightsJobResponse":
    """<p>Starts a new patient insights job.</p>

    Args:
        domain_id: <p/>
        patient_context: <p/>
        insights_context: <p/>
        encounter_context: <p/>
        user_context: <p/>
        input_data_config: <p/>
        output_data_config: <p/>
        client_token: <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>

    Raises:
        capo_connecthealth.errors.access_denied_exception.AccessDeniedException: <p>This error is thrown when the client does not supply proper credentials to the API.</p>
        capo_connecthealth.errors.conflict_exception.ConflictException: <p>This error is thrown when a resource update is no longer valid due to assumptions about initial state changing.</p>
        capo_connecthealth.errors.internal_server_exception.InternalServerException: <p>This error is thrown when a transient error causes our API to fail.</p>
        capo_connecthealth.errors.resource_not_found_exception.ResourceNotFoundException: <p>This error is thrown when the requested resource is not found.</p>
        capo_connecthealth.errors.throttling_exception.ThrottlingException: <p>This error is thrown when the client exceeds the allowed request rate.</p>
        capo_connecthealth.errors.validation_exception.ValidationException: <p>This error is thrown when the client supplies invalid input to the API.</p>
        capo_connecthealth.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connecthealth.types.start_patient_insights_job_request.StartPatientInsightsJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_connecthealth.types.start_patient_insights_job_response.StartPatientInsightsJobResponse"
    ]:
        import capo_connecthealth._operations.connect_health.start_patient_insights_job

        (
            output,
            http_response,
        ) = await capo_connecthealth._operations.connect_health.start_patient_insights_job.async_start_patient_insights_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_connecthealth.types.start_patient_insights_job_request.StartPatientInsightsJobRequest",
    ) -> dict[str, Any]:
        import capo_connecthealth.types.start_patient_insights_job_request

        return capo_connecthealth.types.start_patient_insights_job_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartPatientInsightsJob", redact_input=_redact_input),
    )
    input_: capo_connecthealth.types.start_patient_insights_job_request.StartPatientInsightsJobRequest = {
        "domain_id": domain_id,
        "patient_context": patient_context,
        "insights_context": insights_context,
        "encounter_context": encounter_context,
        "user_context": user_context,
        "input_data_config": input_data_config,
        "output_data_config": output_data_config,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output