

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在音频文件中识别 PHI
<a name="phi-id-batch"></a>

使用批量转录作业来转录音频文件并识别其中的个人健康信息 (PHI)。当您激活个人健康信息 (PHI) 识别时，M Amazon Transcribe edical 会对其在转录结果中识别的 PHI 进行标记。有关 Medic Amazon Transcribe al 可以识别的 PHI 的信息，请参阅[识别转录中的个人健康信息（PHI）](phi-id.md)。

您可以使用 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html) API 或 AWS 管理控制台来启动批量转录作业。

## AWS 管理控制台
<a name="batch-med-phi-console"></a>

**要使用转录临床医生与患者的对话，请创建转录作业，然后选择**对话**作为音频输入类型。 AWS 管理控制台 **

**转录音频文件并识别其 PHI (AWS 管理控制台)**

1. 登录到 [AWS 管理控制台](https://console.aws.amazon.com/transcribe/)。

1. 在导航窗格的 “ Amazon Transcribe 医疗” 下，选择 “**转录作业**”。

1. 请选择**创建任务**。

1. 在**指定作业详细信息**页面上的**作业设置**下，指定以下设置。

   1. **名称**-您的 AWS 账户专属转录作业的名称。

   1. **音频输入类型** - **对话**或**口述**。

1. 对于其余字段，请指定音频文件的 Amazon S3 位置以及要存储转录作业输出的位置。

1. 选择**下一步**。

1. 在**音频设置** 下，选择 **PHI 识别**。

1. 选择**创建**。

## API
<a name="batch-med-phi-api"></a>

**使用批量转录作业转录音频文件并识别其 PHI (API)**
+ 对于 [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartMedicalTranscriptionJob.html) API，请指定以下内容。

  1. 对于 `MedicalTranscriptionJobName`，请指定对于您 AWS 账户而言唯一的名称。

  1. 对于 `LanguageCode`，指定与音频文件中所用语言对应的语言代码。

  1. 在 `Media` 对象的 `MediaFileUri` 参数中，指定要转录的音频文件的名称。

  1. 对于 `Specialty`，请将音频文件中说话的临床医生的医学专科指定为 `PRIMARYCARE`。

  1. 对于 `Type`，请指定 `CONVERSATION` 或 `DICTATION`。

  1. 对于 `OutputBucketName`，请指定要将转录结果存储到的 Amazon S3 存储桶。

  以下是使用转录音频文件并识别患者的 PHI 的请求示例。 适用于 Python (Boto3) 的 AWS SDK 

  ```
  from __future__ import print_function
  import time
  import boto3
  transcribe = boto3.client('transcribe')
  job_name = "my-first-transcription-job"
  job_uri = "s3://amzn-s3-demo-bucket/my-input-files/my-audio-file.flac"
  transcribe.start_medical_transcription_job(
        MedicalTranscriptionJobName = job_name,
        Media = {'MediaFileUri': job_uri},
        LanguageCode = 'en-US',
        ContentIdentificationType = 'PHI',
        Specialty = 'PRIMARYCARE',
        Type = 'type', # Specify 'CONVERSATION' for a medical conversation. Specify 'DICTATION' for a medical dictation.
        OutputBucketName = 'amzn-s3-demo-bucket'
    )
  while True:
      status = transcribe.get_medical_transcription_job(MedicalTranscriptionJobName = job_name)
      if status['MedicalTranscriptionJob']['TranscriptionJobStatus'] in ['COMPLETED', 'FAILED']:
          break
      print("Not ready yet...")
      time.sleep(5)
  print(status)
  ```

以下示例代码演示了识别患者 PHI 的转录结果。

```
{
    "jobName": "my-medical-transcription-job-name",
    "accountId": "111122223333",
    "results": {
        "transcripts": [{
            "transcript": "The patient's name is Bertrand."
        }],
        "items": [{
                "id": 0,
            "start_time": "0.0",
            "end_time": "0.37",
            "alternatives": [{
                "confidence": "0.9993",
                "content": "The"
            }],
            "type": "pronunciation"
        }, {
                "id": 1,
            "start_time": "0.37",
            "end_time": "0.44",
            "alternatives": [{
                "confidence": "0.9981",
                "content": "patient's"
            }],
            "type": "pronunciation"
        }, {
                "id": 2,
            "start_time": "0.44",
            "end_time": "0.52",
            "alternatives": [{
                "confidence": "1.0",
                "content": "name"
            }],
            "type": "pronunciation"
        }, {
                "id": 3,
            "start_time": "0.52",
            "end_time": "0.92",
            "alternatives": [{
                "confidence": "1.0",
                "content": "is"
            }],
            "type": "pronunciation"
        }, {
                "id": 4,
            "start_time": "0.92",
            "end_time": "0.9989",
            "alternatives": [{
                "confidence": "1.0",
                "content": "Bertrand"
            }],
            "type": "pronunciation"
        }, {
                "id": 5,
            "alternatives": [{
                "confidence": "0.0",
                "content": "."
            }],
            "type": "punctuation"
        }],
        "entities": [{
            "content": "Bertrand",
            "category": "PHI*-Personal*",
            "startTime": 0.92,
            "endTime": 1.2,
            "confidence": 0.9989
        }],
        "audio_segments": [
            {
                "id": 0,
                "transcript": "The patient's name is Bertrand.",
                "start_time": "0.0",
                "end_time": "0.9989",
                "items": [
                    0,
                    1,
                    2,
                    3,
                    4,
                    5
                ]
            }
        ]
    },
    "status": "COMPLETED"
}
```

## AWS CLI
<a name="batch-med-conversation-cli"></a>

**使用批量转录作业转录音频文件并识别 PHI (AWS CLI)**
+ 运行以下代码。

  ```
  aws transcribe start-medical-transcription-job \
  --medical-transcription-job-name my-medical-transcription-job-name\
  --language-code en-US \
  --media MediaFileUri="s3://amzn-s3-demo-bucket/my-input-files/my-audio-file.flac" \
  --output-bucket-name amzn-s3-demo-bucket \
  --specialty PRIMARYCARE \
  --type type \ # Choose CONVERSATION to transcribe a medical conversation. Choose DICTATION to transcribe a medical dictation.
  --content-identification-type PHI
  ```