

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 故障診斷 AWS HealthLake
<a name="reference-healthlake-troubleshooting"></a>

下列主題提供使用 、 AWS CLI AWS SDKs 或 HealthLake 主控台時可能遇到的錯誤和問題的疑難排解建議。如果您發現本節未列出的問題，請使用此頁面右側的**提供意見回饋**按鈕進行報告。

**Topics**
+ [資料存放區動作](#troubleshooting-data-store)
+ [匯入動作](#troubleshooting-import)
+ [FHIR APIs](#troubleshooting-fhir-apis)
+ [NLP 整合](#troubleshooting-nlp-integrations)
+ [SQL 整合](#troubleshooting-sql-integrations)

## 資料存放區動作
<a name="troubleshooting-data-store"></a>

**問題：***當我嘗試建立 HealthLake 資料存放區時，會收到下列錯誤：*

```
AccessDeniedException: Insufficient Lake Formation permission(s): Required Database on Catalog
```

2022 年 11 月 14 日，HealthLake 更新了建立新資料存放區所需的 IAM 許可。如需詳細資訊，請參閱[設定 IAM 使用者或角色以使用 HealthLake (IAM 管理員）](getting-started-setting-up.md#setting-up-configure-iam)。

**問題：***使用 AWS SDKs 建立 HealthLake 資料存放區時，資料存放區建立狀態會傳回例外狀況或未知狀態。*

如果您的 `DescribeFHIRDatastore`或 `ListFHIRDatastores` API 呼叫傳回例外狀況或未知的資料存放區狀態，請將 SDK 更新 AWS 為最新版本。

## 匯入動作
<a name="troubleshooting-import"></a>

**問題：***如果我的資料不是 FHIR R4 格式，我是否仍然可以使用 HealthLake？*

只有 FHIR R4 格式的資料可以匯入 HealthLake 資料存放區。如需可協助將現有運作狀態資料轉換為 FHIR R4 格式的合作夥伴清單，請參閱 [AWS HealthLake 合作夥伴](https://docs.aws.amazon.com/healthlake/partners/)。

**問題：***為什麼我的 FHIR 匯入任務失敗？*

成功的匯入任務將產生具有`.ndjson`格式結果 （輸出日誌） 的資料夾，不過，個別記錄可能無法匯入。發生這種情況時，會產生第二個`FAILURE`資料夾，其中包含無法匯入的記錄清單。如需詳細資訊，請參閱[使用 匯入 FHIR 資料 AWS HealthLake](importing-fhir-data.md)。

若要分析匯入任務失敗的原因，請使用 `DescribeFHIRImportJob` API 來分析 JobProperties。建議使用下列項目：
+ 如果狀態為 `FAILED`且訊息存在，則失敗與任務參數有關，例如輸入資料大小或輸入檔案的數量超出 HealthLake 配額。
+ 如果匯入任務狀態為 `COMPLETED_WITH_ERRORS`，請檢查資訊清單檔案 `manifest.json`，以取得哪些檔案未成功匯入的資訊。
+ 如果匯入任務狀態為 `FAILED`且訊息不存在，請前往任務輸出位置以存取資訊清單檔案 `manifest.json`。

 對於每個輸入檔案，都有失敗輸出檔案，其中包含任何無法匯入之資源的輸入檔案名稱。回應包含對應於輸入資料位置的行號 (lineId)、FHIR 回應物件 (UpdateResourceResponse) 和回應的狀態碼 (statusCode)。

範例輸出檔案可能類似下列內容：

```
{"lineId":3, UpdateResourceResponse:{"jsonBlob":{"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"1 validation error detected: Value 'Patient123' at 'resourceType' failed to satisfy constraint: Member must satisfy regular expression pattern: [A-Za-z]{1,256}"}]}, "statusCode":400}
{"lineId":5, UpdateResourceResponse:{"jsonBlob":{"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"This property must be an simple value, not a com.google.gson.JsonArray","location":["/EffectEvidenceSynthesis/name"]},{"severity":"error","code":"processing","diagnostics":"Unrecognised property '@telecom'","location":["/EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Unrecognised property '@gender'","location":["/EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Unrecognised property '@birthDate'","location":["/EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Unrecognised property '@address'","location":["/EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Unrecognised property '@maritalStatus'","location":["/EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Unrecognised property '@multipleBirthBoolean'","location":["/EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Unrecognised property '@communication'","location":["/EffectEvidenceSynthesis"]},{"severity":"warning","code":"processing","diagnostics":"Name should be usable as an identifier for the module by machine processing applications such as code generation [name.matches('[A-Z]([A-Za-z0-9_]){0,254}')]","location":["EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Profile http://hl7.org/fhir/StructureDefinition/EffectEvidenceSynthesis, Element 'EffectEvidenceSynthesis.status': minimum required = 1, but only found 0","location":["EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Profile http://hl7.org/fhir/StructureDefinition/EffectEvidenceSynthesis, Element 'EffectEvidenceSynthesis.population': minimum required = 1, but only found 0","location":["EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Profile http://hl7.org/fhir/StructureDefinition/EffectEvidenceSynthesis, Element 'EffectEvidenceSynthesis.exposure': minimum required = 1, but only found 0","location":["EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Profile http://hl7.org/fhir/StructureDefinition/EffectEvidenceSynthesis, Element 'EffectEvidenceSynthesis.exposureAlternative': minimum required = 1, but only found 0","location":["EffectEvidenceSynthesis"]},{"severity":"error","code":"processing","diagnostics":"Profile http://hl7.org/fhir/StructureDefinition/EffectEvidenceSynthesis, Element 'EffectEvidenceSynthesis.outcome': minimum required = 1, but only found 0","location":["EffectEvidenceSynthesis"]},{"severity":"information","code":"processing","diagnostics":"Unknown extension http://synthetichealth.github.io/synthea/disability-adjusted-life-years","location":["EffectEvidenceSynthesis.extension[3]"]},{"severity":"information","code":"processing","diagnostics":"Unknown extension http://synthetichealth.github.io/synthea/quality-adjusted-life-years","location":["EffectEvidenceSynthesis.extension[4]"]}]}, "statusCode":400}
{"lineId":7, UpdateResourceResponse:{"jsonBlob":{"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"2 validation errors detected: Value at 'resourceId' failed to satisfy constraint: Member must satisfy regular expression pattern: [A-Za-z0-9-.]{1,64}; Value at 'resourceId' failed to satisfy constraint: Member must have length greater than or equal to 1"}]}, "statusCode":400}
{"lineId":9, UpdateResourceResponse:{"jsonBlob":{"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"Missing required id field in resource json"}]}, "statusCode":400}
{"lineId":15, UpdateResourceResponse:{"jsonBlob":{"resourceType":"OperationOutcome","issue":[{"severity":"error","code":"processing","diagnostics":"Invalid JSON found in input file"}]}, "statusCode":400}
```

上述範例顯示輸入檔案中對應輸入行的第 3、4、7、9、15 行失敗。對於每行，說明如下：
+ 在第 3 行，回應說明輸入檔案第 3 行`resourceType`所提供的 是無效的。
+ 在第 5 行，回應說明輸入檔案的第 5 行中存在 FHIR 驗證錯誤。
+ 在第 7 行，回應說明`resourceId`提供 做為輸入時發生驗證問題。
+ 在第 9 行，回應說明輸入檔案必須包含有效的資源 ID。
+ 在第 15 行，輸入檔案的回應是檔案不是有效的 JSON 格式。

## FHIR APIs
<a name="troubleshooting-fhir-apis"></a>

**問題：***如何實作 FHIR RESTful APIs的授權？*

決定[資料存放區授權策略](getting-started-concepts.md#concept-data-store-authorization-strategy)要使用的 。

若要使用 建立 SigV4 授權 適用於 Python (Boto3) 的 AWS SDK，請建立類似下列範例的指令碼。

```
import boto3
import requests
import json
from requests_auth_aws_sigv4 import AWSSigV4
 
# Set the input arguments
data_store_endpoint = 'https://healthlake.us-east-1.amazonaws.com/datastore/<datastore id>/r4//'
resource_path = "Patient"
requestBody = {"resourceType": "Patient", "active": True, "name": [{"use": "official","family": "Dow","given": ["Jen"]},{"use": "usual","given": ["Jen"]}],"gender": "female","birthDate": "1966-09-01"}
region = 'us-east-1'
 
#Frame the resource endpoint
resource_endpoint = data_store_endpoint+resource_path
session = boto3.session.Session(region_name=region)
client = session.client("healthlake")
 
# Frame authorization
auth = AWSSigV4("healthlake", session=session)
 
# Call data store FHIR endpoint using SigV4 auth

r = requests.post(resource_endpoint, json=requestBody, auth=auth, )
print(r.json())
```

**問題：***為什麼針對使用客戶受管 KMS 金鑰加密的資料存放區使用 FHIR RESTful APIs 時收到`AccessDenied`錯誤？*

使用者或角色需要客戶受管金鑰和 IAM 政策的許可，才能存取資料存放區。使用者必須擁有使用客戶受管金鑰所需的 IAM 許可。如果使用者撤銷或淘汰授予 HealthLake 使用客戶受管 KMS 金鑰的許可，HealthLake 將傳回`AccessDenied`錯誤。

HealthLake 必須具備存取客戶資料的許可、加密匯入資料存放區的新 FHIR 資源，以及在請求時解密 FHIR 資源。如需詳細資訊，請參閱[故障診斷 AWS KMS 許可](https://docs.aws.amazon.com/kms/latest/developerguide/policy-evaluation.html)。

**問題：***使用 10MB 文件的 FHIR `POST` API 操作向 HealthLake 傳回`413 Request Entity Too Large`錯誤。*

AWS HealthLake 具有 5MB 的同步建立和更新 API 限制，以避免增加延遲和逾時。您可以使用大量匯入 API，使用 `Binary` 資源類型擷取最多 164MB 的大型文件。

## NLP 整合
<a name="troubleshooting-nlp-integrations"></a>

**問題：***如何開啟 HealthLake 整合的自然語言處理功能？*

截至 2022 年 11 月 14 日，HealthLake 資料存放區的預設行為已變更。

**目前的資料存放**區：所有目前的 HealthLake 資料存放區都將停止使用 base64 編碼`DocumentReference`資源上的自然語言處理 (NLP)。這表示將不會使用 NLP 分析新`DocumentReference`資源，也不會根據資源類型中的文字產生新`DocumentReference`資源。對於現有`DocumentReference`資源，透過 NLP 產生的資料和資源仍會保留，但不會在 2023 年 2 月 20 日之後更新。

**新資料存放**區：2023 年 2 月 20 日之後建立的 HealthLake 資料存放區*將不會*對 base64 編碼`DocumentReference`的資源執行自然語言處理 (NLP)。

若要開啟 HealthLake NLP 整合，請使用 建立支援案例[AWS Support Center Console](https://console.aws.amazon.com/support/home#/)。若要建立您的案例，請登入您的 AWS 帳戶，然後選擇**建立案例**。若要進一步了解如何建立案例和案例管理，請參閱*支援 《 使用者指南*》中的[建立支援案例和案例管理](https://docs.aws.amazon.com/awssupport/latest/user/case-management.html)。

**問題：***>如何尋找整合式 NLP 無法處理`DocumentReference`的資源？*

如果`DocumentReference`資源無效，HealthLake 會提供表示驗證錯誤的延伸，而不是在整合的醫療 NLP 輸出中提供。若要尋找在 NLP 處理期間導致驗證錯誤`DocumentReference`的資源，您可以使用 HealthLake 的 FHIR `search`函數搭配搜尋索引鍵 **cm-decoration-status** 和搜尋值 **VALIDATION\$1ERROR**。此搜尋會列出導致驗證錯誤的所有`DocumentReference`資源，以及描述錯誤性質的錯誤訊息。這些`DocumentReference`資源中具有驗證錯誤的延伸欄位結構將類似下列範例。

```
"extension": [
          {
              "extension": [
                  {
                      "url": "http://healthlake.amazonaws.com/aws-cm/status/",
                      "valueString": "VALIDATION_ERROR"
                  },
                  {
                      "url": "http://healthlake.amazonaws.com/aws-cm/message/",
                      "valueString": "Resource led to too many nested objects after NLP operation processed the document. 10937 nested objects exceeds the limit of 10000."
                  }
              ],
              "url": "http://healthlake.amazonaws.com/aws-cm/"
          }
    ]
```

**注意**  
如果 NLP 裝飾建立超過 10，000 個巢狀物件，`VALIDATION_ERROR`也可能發生 。發生這種情況時，文件必須在處理之前分割成較小的文件。

## SQL 整合
<a name="troubleshooting-sql-integrations"></a>

**問題：***新增資料湖管理員`permissions error: lakeformation:PutDataLakeSettings`時，為什麼要取得 Lake Formation？*

如果您的 IAM 使用者或角色包含 `AWSLakeFormationDataAdmin` AWS 受管政策，則無法新增資料湖管理員。您會收到包含下列內容的錯誤：

```
User arn:aws:sts::111122223333:assumed-role/lakeformation-admin-user is not authorized to perform: lakeformation:PutDataLakeSettings on resource: arn:aws:lakeformation:us-east-2:111122223333:catalog:111122223333 with an explicit deny in an identity-based policy
```

`AdministratorAccess` 需要 AWS 受管政策，才能將 IAM 使用者或角色新增為 AWS Lake Formation 資料湖管理員。如果您的 IAM 使用者或角色也包含 `AWSLakeFormationDataAdmin` 動作將會失敗。`AWSLakeFormationDataAdmin` AWS 受管政策包含 AWS Lake Formation API 操作 的明確拒絕`PutDataLakeSetting`。即使是具有 AWS 使用 `AdministratorAccess`受管政策之完整存取權的管理員，也可以受到`AWSLakeFormationDataAdmin`政策的限制。

**問題：***如何遷移現有的 HealthLake 資料存放區以使用 Amazon Athena SQL 整合？*

在 2022 年 11 月 14 日之前建立的 HealthLake 資料存放區可正常運作，但無法使用 SQL 在 Athena 中查詢。若要使用 Athena 查詢預先存在的資料存放區，您必須先將其遷移至新的資料存放區。

**將 HealthLake 資料遷移至新的資料存放區**

1. 建立新的資料存放區。

1. 從預先存在的資料匯出至 Amazon S3 儲存貯體。

1. 從 Amazon S3 儲存貯體將資料匯入新的資料存放區。

**注意**  
將資料匯出至 Amazon S3 儲存貯體會產生額外費用。額外費用取決於您匯出的資料大小。

**問題：***為 SQL 整合建立新的 HealthLake 資料存放區時，資料存放區狀態不會從 變更`Creating`。*

如果您嘗試建立新的 HealthLake 資料存放區，且資料存放區狀態並未從**建立**中變更，則需要更新 Athena 才能使用 AWS Glue Data Catalog。如需詳細資訊，請參閱《Amazon Athena [AWS 使用者指南》中的step-by-step升級至 Glue Data Catalog](https://docs.aws.amazon.com/athena/latest/ug/glue-upgrade.html)。 *Amazon Athena *

成功升級 後 AWS Glue Data Catalog，您可以建立 HealthLake 資料存放區。

若要移除舊的 HealthLake 資料存放區，請使用 建立支援案例[AWS Support Center Console](https://console.aws.amazon.com/support/home#/)。若要建立您的案例，請登入您的 AWS 帳戶，然後選擇**建立案例**。若要進一步了解，請參閱*支援 《 使用者指南*》中的[建立支援案例和案例管理](https://docs.aws.amazon.com/awssupport/latest/user/case-management.html)。

**問題：***Athena 主控台在將資料匯入新的 HealthLake 資料存放區後無法運作*

將資料匯入新的 HealthLake 資料存放區後，資料可能無法立即使用。這是為了讓資料有時間擷取到 Apache Iceberg 資料表。請稍後重試。

**問題：***如何將 Athena 中的搜尋結果連接到其他 AWS 服務？*

當您將 Athena 的搜尋結果與其他 AWS 服務共用時，當您使用 `json_extract[1]`做為 SQL 搜尋查詢的一部分時，可能會發生問題。若要修正此問題，您必須更新為 `CATVAR`。

嘗試**建立**儲存結果、**資料表** （靜態） 或**檢視** （動態） 時，您可能會遇到此問題。