FHIR 리소스 번들링 - AWS HealthLake

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

FHIR 리소스 번들링

FHIRBundle은의 FHIR 리소스 모음을 위한 컨테이너입니다 AWS HealthLake.는 또는 동작이 다른 두 가지 유형의 번들을 AWS HealthLake 지원합니다batchtransaction.

  • '배치' 번들의 경우 번들에 포함된 각 FHIR 리소스가 개별적으로 처리되고 로깅됩니다. 각 리소스 작업은 다른 리소스와 독립적으로 처리됩니다.

  • '트랜잭션' 번들의 경우 번들에 포함된 모든 FHIR 리소스는 원자성 작업으로 처리됩니다. 작업의 모든 리소스가 성공해야 합니다. 그렇지 않으면 번들의 리소스 업데이트가 커밋 및 저장되지 않습니다.

동일하거나 다른 유형의 FHIR 리소스를 번들링할 수 있으며,이 장에 정의된 다른 FHIR 상호 작용(예: create, read, delete, updatesearch)을 혼합하여 포함할 수 있습니다. 자세한 내용은 FHIR R4 설명서리소스 번들을 참조하세요.

배치와 트랜잭션 유형 번들의 주요 차이점:

Batch
  • 개별적으로 성공하거나 실패할 수 있는 독립적인 작업

  • 일부 작업이 실패하더라도 처리가 계속됩니다.

  • 실행 순서가 보장되지 않음

  • 부분적 성공이 허용되는 대량 작업에 이상적

트랜잭션
  • 원자성 보장 - 모두 성공 또는 모두 실패

  • 로컬 참조(번들 내) 리소스에 대한 참조 무결성을 유지합니다.

  • 지정된 순서로 처리된 작업

  • 작업이 실패하면 완전히 실패합니다.

사용 사례의 예:

  • 배치: 관련이 없는 여러 환자 레코드 업로드

  • 트랜잭션: 모든이 함께 성공해야 하는 관련 관찰 및 조건이 있는 환자 생성

참고

둘 다 번들 리소스 유형을 사용하지만 '유형' 필드는 다릅니다.

{ "resourceType": "Bundle", "type": "transaction", "entry": [ { "fullUrl": "urn:uuid:4f6a30fb-cd3c-4ab6-8757-532101f72065", "resource": { "resourceType": "Patient", "id": "new-patient", "active": true, "name": [ { "family": "Johnson", "given": [ "Sarah" ] } ], "gender": "female", "birthDate": "1985-08-12", "telecom": [ { "system": "phone", "value": "555-123-4567", "use": "home" } ] }, "request": { "method": "POST", "url": "Patient" } }, { "fullUrl": "urn:uuid:7f83f473-d8cc-4a8d-86d3-9d9876a3248b", "resource": { "resourceType": "Observation", "id": "blood-pressure", "status": "final", "code": { "coding": [ { "system": "http://loinc.org", "code": "85354-9", "display": "Blood pressure panel" } ], "text": "Blood pressure panel" }, "subject": { "reference": "urn:uuid:4f6a30fb-cd3c-4ab6-8757-532101f72065" }, "effectiveDateTime": "2023-10-15T09:30:00Z", "component": [ { "code": { "coding": [ { "system": "http://loinc.org", "code": "8480-6", "display": "Systolic blood pressure" } ] }, "valueQuantity": { "value": 120, "unit": "mmHg", "system": "http://unitsofmeasure.org", "code": "mm[Hg]" } }, { "code": { "coding": [ { "system": "http://loinc.org", "code": "8462-4", "display": "Diastolic blood pressure" } ] }, "valueQuantity": { "value": 80, "unit": "mmHg", "system": "http://unitsofmeasure.org", "code": "mm[Hg]" } } ] }, "request": { "method": "POST", "url": "Observation" } }, { "resource": { "resourceType": "Appointment", "id": "appointment-123", "status": "booked", "description": "Annual physical examination", "start": "2023-11-15T09:00:00Z", "end": "2023-11-15T09:30:00Z", "participant": [ { "actor": { "reference": "urn:uuid:4f6a30fb-cd3c-4ab6-8757-532101f72065" }, "status": "accepted" } ] }, "request": { "method": "PUT", "url": "Appointment/appointment-123" } }, { "request": { "method": "DELETE", "url": "MedicationRequest/med-request-456" } } ] }

FHIR 리소스를 독립 엔터티로 번들링

FHIR 리소스를 독립 엔터티로 번들링하려면

  1. HealthLake regiondatastoreId 값을 수집합니다. 자세한 내용은 데이터 스토어 속성 가져오기 단원을 참조하십시오.

  2. HealthLake region 및에 대해 수집된 값을 사용하여 요청에 대한 URL을 구성합니다datastoreId. URL에 FHIR 리소스 유형을 지정하지 마십시오. 다음 예제에서 전체 URL 경로를 보려면 복사 버튼을 스크롤합니다.

    POST https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/
  3. 각 HTTP 동사를 method 요소의 일부로 지정하여 요청에 대한 JSON 본문을 구성합니다. 다음 예제에서는 Bundle 리소스와의 batch 유형 상호 작용을 사용하여 새 PatientMedication 리소스를 생성합니다. 그에 따라 모든 필수 섹션에 주석이 추가됩니다. 이 절차의 목적상 파일을 로 저장합니다batch-independent.json.

    { "resourceType": "Bundle", "id": "bundle-batch", "meta": { "lastUpdated": "2014-08-18T01:43:30Z" }, "type": "batch", "entry": [ { "resource": { "resourceType": "Patient", "meta": { "lastUpdated": "2022-06-03T17:53:36.724Z" }, "text": { "status": "generated", "div": "Some narrative" }, "active": true, "name": [ { "use": "official", "family": "Jackson", "given": [ "Mateo", "James" ] } ], "gender": "male", "birthDate": "1974-12-25" }, "request": { "method": "POST", "url": "Patient" } }, { "resource": { "resourceType": "Medication", "id": "med0310", "contained": [ { "resourceType": "Substance", "id": "sub03", "code": { "coding": [ { "system": "http://snomed.info/sct", "code": "55452001", "display": "Oxycodone (substance)" } ] } } ], "code": { "coding": [ { "system": "http://snomed.info/sct", "code": "430127000", "display": "Oral Form Oxycodone (product)" } ] }, "form": { "coding": [ { "system": "http://snomed.info/sct", "code": "385055001", "display": "Tablet dose form (qualifier value)" } ] }, "ingredient": [ { "itemReference": { "reference": "#sub03" }, "strength": { "numerator": { "value": 5, "system": "http://unitsofmeasure.org", "code": "mg" }, "denominator": { "value": 1, "system": "http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm", "code": "TAB" } } } ] }, "request": { "method": "POST", "url": "Medication" } } ] }
  4. 요청을 보냅니다. FHIR Bundle 배치 유형은 FHIR 권한 부여 시 AWS 서명 버전 4 또는 SMART인 POST 요청을 사용합니다. 다음 코드 예제에서는 데모용으로 curl 명령줄 도구를 사용합니다.

    SigV4

    SigV4 권한 부여

    curl --request POST \ 'https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/' \ --aws-sigv4 'aws:amz:region:healthlake' \ --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \ --header "x-amz-security-token:$AWS_SESSION_TOKEN" \ --header 'Accept: application/json' \ --data @batch-type.json
    SMART on FHIR

    IdentityProviderConfiguration 데이터 형식에 대한 SMART on FHIR 권한 부여 예제입니다.

    { "AuthorizationStrategy": "SMART_ON_FHIR", "FineGrainedAuthorizationEnabled": true, "IdpLambdaArn": "arn:aws:lambda:your-region:your-account-id:function:your-lambda-name", "Metadata": "{\"issuer\":\"https://ehr.example.com\", \"jwks_uri\":\"https://ehr.example.com/.well-known/jwks.json\",\"authorization_endpoint\":\"https://ehr.example.com/auth/authorize\",\"token_endpoint\":\"https://ehr.token.com/auth/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_basic\",\"foo\"],\"grant_types_supported\":[\"client_credential\",\"foo\"],\"registration_endpoint\":\"https://ehr.example.com/auth/register\",\"scopes_supported\":[\"openId\",\"profile\",\"launch\"],\"response_types_supported\":[\"code\"],\"management_endpoint\":\"https://ehr.example.com/user/manage\",\"introspection_endpoint\":\"https://ehr.example.com/user/introspect\",\"revocation_endpoint\":\"https://ehr.example.com/user/revoke\",\"code_challenge_methods_supported\":[\"S256\"],\"capabilities\":[\"launch-ehr\",\"sso-openid-connect\",\"client-public\",\"permission-v2\"]}" }

    호출자는 권한 부여 Lambda에 권한을 할당할 수 있습니다. 자세한 내용은 OAuth 2.0 범위 단원을 참조하십시오.

    서버는 Bundle 배치 유형 요청의 결과로 생성된 PatientMedication 리소스를 보여주는 응답을 반환합니다.

번들의 조건부 PUTs

AWS HealthLake는 다음 쿼리 파라미터를 사용하여 번들 내에서 조건부 업데이트를 지원합니다.

  • _id (독립 실행형)

  • _id 다음 중 하나와 함께 사용할 수 있습니다.

    • _tag

    • _createdAt

    • _lastUpdated

기존 리소스에 제공된 조건을 일치시킨 결과에 따라 다음과 같은 작업이 수행되었음을 나타내는 관련 결과 코드가 표시됩니다.

FHIR 리소스를 생성하거나 업데이트할 때 시스템은 리소스 ID 프로비저닝 및 기존 일치 항목에 따라 다양한 시나리오를 처리합니다.

  • IDs 없는 리소스는 항상 생성됩니다(201).

  • 새 IDs 있는 리소스가 생성됩니다(201).

  • 기존 IDs가 있는 리소스는 일치하는 리소스(200)를 업데이트하거나 충돌(409) 또는 ID 불일치(400)가 있는 경우 오류를 반환합니다.

  • 일치하는 여러 리소스가 사전 조건 실패(419)를 트리거합니다.

조건부 업데이트가 포함된 번들 예제에서 FHIR ID가 인 환자 리소스456는 조건이 충족_lastUpdated=lt2025-04-20되는 경우에만 업데이트됩니다.

{ "resourceType": "Bundle", "id": "bundle-batch", "meta": { "lastUpdated": "2014-08-18T01:43:30Z" }, "type": "batch", "entry": [ { "resource": { "resourceType": "Patient", "id": "476", "meta": { "lastUpdated": "2022-06-03T17:53:36.724Z" }, "active": true, "name": [ { "use": "official", "family": "Jackson", "given": [ "Mateo", "James" ] } ], "gender": "male", "birthDate": "1974-12-25" }, "request": { "method": "PUT", "url": "Patient?_id=476&_lastUpdated=lt2025-04-20" } }, { "resource": { "resourceType": "Medication", "id": "med0310", "contained": [ { "resourceType": "Substance", "id": "sub03", "code": { "coding": [ { "system": "http://snomed.info/sct", "code": "55452001", "display": "Oxycodone (substance)" } ] } } ], "code": { "coding": [ { "system": "http://snomed.info/sct", "code": "430127000", "display": "Oral Form Oxycodone (product)" } ] }, "form": { "coding": [ { "system": "http://snomed.info/sct", "code": "385055001", "display": "Tablet dose form (qualifier value)" } ] }, "ingredient": [ { "itemReference": { "reference": "#sub03" }, "strength": { "numerator": { "value": 5, "system": "http://unitsofmeasure.org", "code": "mg" }, "denominator": { "value": 1, "system": "http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm", "code": "TAB" } } } ] }, "request": { "method": "POST", "url": "Medication" } } ] }

FHIR 리소스를 단일 엔터티로 번들링

FHIR 리소스를 단일 엔터티로 번들링하려면

  1. HealthLake regiondatastoreId 값을 수집합니다. 자세한 내용은 데이터 스토어 속성 가져오기 단원을 참조하십시오.

  2. HealthLake region 및에 대해 수집된 값을 사용하여 요청에 대한 URL을 구성합니다datastoreId. FHIR 리소스 유형을 URL의 Bundle 일부로 포함합니다. 다음 예제에서 전체 URL 경로를 보려면 복사 버튼을 스크롤합니다.

    POST https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Bundle
  3. 요청에 대한 JSON 본문을 구성하여 그룹화할 FHIR 리소스를 지정합니다. 다음 예제에서는 HealthLake에서 두 개의 Patient 리소스를 그룹화합니다. 이 절차의 목적상 파일을 로 저장합니다batch-single.json.

    { "resourceType": "Bundle", "id": "bundle-minimal", "language": "en-US", "identifier": { "system": "urn:oid:1.2.3.4.5", "value": "28b95815-76ce-457b-b7ae-a972e527db4f" }, "type": "document", "timestamp": "2020-12-11T14:30:00+01:00", "entry": [ { "fullUrl": "urn:uuid:f40b07e3-37e8-48c3-bf1c-ae70fe12dabf", "resource": { "resourceType": "Composition", "id": "f40b07e3-37e8-48c3-bf1c-ae70fe12dabf", "status": "final", "type": { "coding": [ { "system": "http://loinc.org", "code": "60591-5", "display": "Patient summary Document" } ] }, "date": "2020-12-11T14:30:00+01:00", "author": [ { "reference": "urn:uuid:45271f7f-63ab-4946-970f-3daaaa0663ff" } ], "title": "Patient Summary as of December 7, 2020 14:30" } }, { "fullUrl": "urn:uuid:45271f7f-63ab-4946-970f-3daaaa0663ff", "resource": { "resourceType": "Practitioner", "id": "45271f7f-63ab-4946-970f-3daaaa0663ff", "active": true, "name": [ { "family": "Doe", "given": [ "John" ] } ] } } ] }
  4. 요청을 보냅니다. FHIR Bundle 문서 유형은 AWS 서명 버전 4 서명 프로토콜과 함께 POST 요청을 사용합니다. 다음 코드 예제에서는 데모용으로 curl 명령줄 도구를 사용합니다.

    SigV4

    SigV4 권한 부여

    curl --request POST \ 'https://healthlake.region.amazonaws.com/datastore/datastoreId/r4/Bundle' \ --aws-sigv4 'aws:amz:region:healthlake' \ --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \ --header "x-amz-security-token:$AWS_SESSION_TOKEN" \ --header 'Accept: application/json' \ --data @document-type.json
    SMART on FHIR

    IdentityProviderConfiguration 데이터 형식에 대한 SMART on FHIR 권한 부여 예제입니다.

    { "AuthorizationStrategy": "SMART_ON_FHIR", "FineGrainedAuthorizationEnabled": true, "IdpLambdaArn": "arn:aws:lambda:your-region:your-account-id:function:your-lambda-name", "Metadata": "{\"issuer\":\"https://ehr.example.com\", \"jwks_uri\":\"https://ehr.example.com/.well-known/jwks.json\",\"authorization_endpoint\":\"https://ehr.example.com/auth/authorize\",\"token_endpoint\":\"https://ehr.token.com/auth/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_basic\",\"foo\"],\"grant_types_supported\":[\"client_credential\",\"foo\"],\"registration_endpoint\":\"https://ehr.example.com/auth/register\",\"scopes_supported\":[\"openId\",\"profile\",\"launch\"],\"response_types_supported\":[\"code\"],\"management_endpoint\":\"https://ehr.example.com/user/manage\",\"introspection_endpoint\":\"https://ehr.example.com/user/introspect\",\"revocation_endpoint\":\"https://ehr.example.com/user/revoke\",\"code_challenge_methods_supported\":[\"S256\"],\"capabilities\":[\"launch-ehr\",\"sso-openid-connect\",\"client-public\",\"permission-v2\"]}" }

    호출자는 권한 부여 Lambda에 권한을 할당할 수 있습니다. 자세한 내용은 OAuth 2.0 범위 단원을 참조하십시오.

    서버는 Bundle 문서 유형 요청의 결과로 생성된 두 개의 Patient 리소스를 보여주는 응답을 반환합니다.

번들에 대한 검증 수준 구성

FHIR 리소스를 번들링할 때 선택적으로 x-amzn-healthlake-fhir-validation-level HTTP 헤더를 지정하여 리소스에 대한 검증 수준을 구성할 수 있습니다. 이 검증 수준은 번들 내의 모든 생성 및 업데이트 요청에 대해 설정됩니다.는 AWS HealthLake 현재 다음 검증 수준을 지원합니다.

  • strict: 리소스는 리소스의 프로필 요소 또는 프로필이 없는 경우 R4 사양에 따라 검증됩니다. 이는의 기본 검증 수준입니다 AWS HealthLake.

  • structure-only: 리소스는 R4에 대해 검증되며 참조된 프로파일은 무시합니다.

  • minimal: 리소스는 특정 R4 규칙을 무시하고 최소한으로 검증됩니다. 검색/분석에 필요한 구조 검사에 실패한 리소스는 감사 경고를 포함하도록 업데이트됩니다.

최소 검증 수준으로 번들링된 리소스는 검색 인덱싱에 필요한 검증에 실패하더라도 데이터 스토어에 수집될 수 있습니다. 이 경우 리소스는 해당 실패를 문서화하기 위한 Healthlake별 확장을 포함하도록 업데이트되며 번들 응답 내의 항목에는 다음과 같이 OperationOutcome 리소스가 포함됩니다.

{ "resourceType": "Bundle", "type": "batch-response", "timestamp": "2025-08-25T22:58:48.846287342Z", "entry": [ { "response": { "status": "201", "location": "Patient/195abc49-ba8e-4c8b-95c2-abc88fef7544/_history/1", "etag": "W/\"1\"", "lastModified": "2025-08-25T22:58:48.801245445Z", "outcome": { "resourceType": "OperationOutcome", "issue": [ { "severity": "error", "code": "processing", "details": { "text": "FHIR resource in payload failed FHIR validation rules." }, "diagnostics": "FHIR resource in payload failed FHIR validation rules." } ] } } } ] }

또한 다음 HTTP 응답 헤더는 "true" 값과 함께 포함됩니다.

x-amzn-healthlake-validation-issues : true
참고

R4 사양에 따라 잘못된 형식으로 수집된 데이터는 이러한 오류가 있는 경우 예상대로 검색하지 못할 수 있습니다.