Skip to content

start_medical_coding_job async

start_medical_coding_job(
    domain_id: DomainId,
    text: SensitiveNonEmptyString,
    output_data_config: MedicalCodingOutputDataConfig,
    *,
    config_overrides: Optional[AsyncConnectHealthClientConfig] = None,
    patient_context: Optional[MedicalCodesPatientContext] = None,
    encounter_context: Optional[MedicalCodesEncounterContext] = None,
    dataset_id: Optional[DatasetId] = None,
    client_token: Optional[NonEmptyString] = None,
) -> StartMedicalCodingJobResponse

Starts an asynchronous job that generates medical codes (ICD-10 and CPT) for clinical text. Call GetMedicalCodingJob to check the status of the job. When the job succeeds, Amazon Connect Health writes the results to the output Amazon S3 location.

To tailor the codes to your organization, specify an ACTIVE medical coding dataset in the Domain. If you don't specify a dataset, the job uses the general medical coding knowledge base.

Medical coding jobs are in preview release and are subject to change.

Parameters:

  • domain_id (DomainId) –

    The unique identifier of the parent Domain.

  • text (SensitiveNonEmptyString) –

    The clinical text to generate medical codes for, such as a clinical note.

  • patient_context (Optional[MedicalCodesPatientContext], default: None ) –

    Patient context for the job. Providing this information can improve the accuracy of the medical codes.

  • encounter_context (Optional[MedicalCodesEncounterContext], default: None ) –

    Encounter context for the job. Providing this information can improve the accuracy of the medical codes.

  • output_data_config (MedicalCodingOutputDataConfig) –

    The output configuration for the job.

  • dataset_id (Optional[DatasetId], default: None ) –

    The unique identifier of an ACTIVE medical coding dataset in the Domain to code against. If you don't specify a dataset, the job uses the general medical coding knowledge base.

  • client_token (Optional[NonEmptyString], default: None ) –

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Raises:

Source code in docs_src/capo_connecthealth/_services/async_connect_health.py
async def start_medical_coding_job(
    self,
    domain_id: "capo_connecthealth.types.domain_id.DomainId",
    text: "capo_connecthealth.types.sensitive_non_empty_string.SensitiveNonEmptyString",
    output_data_config: "capo_connecthealth.types.medical_coding_output_data_config.MedicalCodingOutputDataConfig",
    *,
    config_overrides: Optional[AsyncConnectHealthClientConfig] = None,
    patient_context: Optional[
        "capo_connecthealth.types.medical_codes_patient_context.MedicalCodesPatientContext"
    ] = None,
    encounter_context: Optional[
        "capo_connecthealth.types.medical_codes_encounter_context.MedicalCodesEncounterContext"
    ] = None,
    dataset_id: Optional["capo_connecthealth.types.dataset_id.DatasetId"] = None,
    client_token: Optional[
        "capo_connecthealth.types.non_empty_string.NonEmptyString"
    ] = None,
) -> "capo_connecthealth.types.start_medical_coding_job_response.StartMedicalCodingJobResponse":
    """<p>Starts an asynchronous job that generates medical codes (ICD-10 and CPT) for clinical text. Call GetMedicalCodingJob to check the status of the job. When the job succeeds, Amazon Connect Health writes the results to the output Amazon S3 location.</p> <p>To tailor the codes to your organization, specify an ACTIVE medical coding dataset in the Domain. If you don't specify a dataset, the job uses the general medical coding knowledge base.</p> <p>Medical coding jobs are in preview release and are subject to change.</p>

    Args:
        domain_id: <p>The unique identifier of the parent Domain.</p>
        text: <p>The clinical text to generate medical codes for, such as a clinical note.</p>
        patient_context: <p>Patient context for the job. Providing this information can improve the accuracy of the medical codes.</p>
        encounter_context: <p>Encounter context for the job. Providing this information can improve the accuracy of the medical codes.</p>
        output_data_config: <p>The output configuration for the job.</p>
        dataset_id: <p>The unique identifier of an ACTIVE medical coding dataset in the Domain to code against. If you don't specify a dataset, the job uses the general medical coding knowledge base.</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_medical_coding_job_request.StartMedicalCodingJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_connecthealth.types.start_medical_coding_job_response.StartMedicalCodingJobResponse"
    ]:
        import capo_connecthealth._operations.connect_health.start_medical_coding_job

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

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

        return capo_connecthealth.types.start_medical_coding_job_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartMedicalCodingJob", redact_input=_redact_input),
    )
    input_: capo_connecthealth.types.start_medical_coding_job_request.StartMedicalCodingJobRequest = {
        "domain_id": domain_id,
        "text": text,
        "output_data_config": output_data_config,
    }
    if patient_context is not None:
        input_["patient_context"] = patient_context
    if encounter_context is not None:
        input_["encounter_context"] = encounter_context
    if dataset_id is not None:
        input_["dataset_id"] = dataset_id
    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