Skip to content

start_phi_detection_job

start_phi_detection_job(
    input_data_config: InputDataConfig,
    output_data_config: OutputDataConfig,
    data_access_role_arn: IamRoleArn,
    language_code: LanguageCode,
    *,
    config_overrides: Optional[ComprehendMedicalClientConfig] = None,
    job_name: Optional[JobName] = None,
    client_request_token: Optional[ClientRequestTokenString] = None,
    kms_key: Optional[KMSKey] = None,
) -> StartPHIDetectionJobResponse

Starts an asynchronous job to detect protected health information (PHI). Use the DescribePHIDetectionJob operation to track the status of a job.

Parameters:

  • input_data_config (InputDataConfig) –

    Specifies the format and location of the input data for the job.

  • output_data_config (OutputDataConfig) –

    Specifies where to send the output files.

  • data_access_role_arn (IamRoleArn) –

    The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend Medical read access to your input data. For more information, see Role-Based Permissions Required for Asynchronous Operations.

  • job_name (Optional[JobName], default: None ) –

    The identifier of the job.

  • client_request_token (Optional[ClientRequestTokenString], default: None ) –

    A unique identifier for the request. If you don't set the client request token, Amazon Comprehend Medical generates one.

  • kms_key (Optional[KMSKey], default: None ) –

    An AWS Key Management Service key to encrypt your output files. If you do not specify a key, the files are written in plain text.

  • language_code (LanguageCode) –

    The language of the input documents. All documents must be in the same language.

Raises:

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • InvalidRequestException –

    The request that you made is invalid. Check your request to determine why it's invalid and then retry the request.

  • ResourceNotFoundException –

    The resource identified by the specified Amazon Resource Name (ARN) was not found. Check the ARN and try your request again.

  • TooManyRequestsException –

    You have made too many requests within a short period of time. Wait for a short time and then try your request again. Contact customer support for more information about a service limit increase.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_comprehendmedical/_services/comprehend_medical.py
def start_phi_detection_job(
    self,
    input_data_config: "capo_comprehendmedical.types.input_data_config.InputDataConfig",
    output_data_config: "capo_comprehendmedical.types.output_data_config.OutputDataConfig",
    data_access_role_arn: "capo_comprehendmedical.types.iam_role_arn.IamRoleArn",
    language_code: "capo_comprehendmedical.types.language_code.LanguageCode",
    *,
    config_overrides: Optional[ComprehendMedicalClientConfig] = None,
    job_name: Optional["capo_comprehendmedical.types.job_name.JobName"] = None,
    client_request_token: Optional[
        "capo_comprehendmedical.types.client_request_token_string.ClientRequestTokenString"
    ] = None,
    kms_key: Optional["capo_comprehendmedical.types.kms_key.KMSKey"] = None,
) -> "capo_comprehendmedical.types.start_phi_detection_job_response.StartPHIDetectionJobResponse":
    """<p>Starts an asynchronous job to detect protected health information (PHI). Use the <code>DescribePHIDetectionJob</code> operation to track the status of a job.</p>

    Args:
        input_data_config: <p>Specifies the format and location of the input data for the job.</p>
        output_data_config: <p>Specifies where to send the output files.</p>
        data_access_role_arn: <p>The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend Medical read access to your input data. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions-med.html#auth-role-permissions-med"> Role-Based Permissions Required for Asynchronous Operations</a>.</p>
        job_name: <p>The identifier of the job.</p>
        client_request_token: <p>A unique identifier for the request. If you don't set the client request token, Amazon Comprehend Medical generates one.</p>
        kms_key: <p>An AWS Key Management Service key to encrypt your output files. If you do not specify a key, the files are written in plain text.</p>
        language_code: <p>The language of the input documents. All documents must be in the same language.</p>

    Raises:
        capo_comprehendmedical.errors.internal_server_exception.InternalServerException: <p> An internal server error occurred. Retry your request. </p>
        capo_comprehendmedical.errors.invalid_request_exception.InvalidRequestException: <p> The request that you made is invalid. Check your request to determine why it's invalid and then retry the request.</p>
        capo_comprehendmedical.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource identified by the specified Amazon Resource Name (ARN) was not found. Check the ARN and try your request again.</p>
        capo_comprehendmedical.errors.too_many_requests_exception.TooManyRequestsException: <p> You have made too many requests within a short period of time. Wait for a short time and then try your request again. Contact customer support for more information about a service limit increase. </p>
        capo_comprehendmedical.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_comprehendmedical.types.start_phi_detection_job_request.StartPHIDetectionJobRequest]",
    ) -> OperationResponse[
        "capo_comprehendmedical.types.start_phi_detection_job_response.StartPHIDetectionJobResponse"
    ]:
        import capo_comprehendmedical._operations.comprehend_medical_20181030.start_phi_detection_job

        output, http_response = (
            capo_comprehendmedical._operations.comprehend_medical_20181030.start_phi_detection_job.start_phi_detection_job(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartPHIDetectionJob")
    )
    input_: capo_comprehendmedical.types.start_phi_detection_job_request.StartPHIDetectionJobRequest = {
        "input_data_config": input_data_config,
        "output_data_config": output_data_config,
        "data_access_role_arn": data_access_role_arn,
        "language_code": language_code,
    }
    if job_name is not None:
        input_["job_name"] = job_name
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if kms_key is not None:
        input_["kms_key"] = kms_key

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output