AWS HealthLake
AWS HealthLake คือบริการ FHIR-compliant สำหรับจัดเก็บ, แปลง และวิเคราะห์ข้อมูลสุขภาพในระดับองค์กร บริการนี้ทำให้ healthcare data จากแหล่งต่างๆ อยู่ในรูปแบบมาตรฐาน FHIR R4 (Fast Healthcare Interoperability Resources) เดียว ช่วยให้องค์กรสาธารณสุขสามารถรวม, ค้นหา และวิเคราะห์ข้อมูลสุขภาพของประชากรได้อย่างมีประสิทธิภาพ
AWS HealthLake มี built-in NLP ที่สามารถแปลง unstructured clinical notes เป็น structured FHIR data โดยอัตโนมัติ รองรับ FHIR REST API มาตรฐาน ทำให้ healthcare applications และ analytics tools สามารถ query ข้อมูลได้ทันที บริการนี้ผ่าน HIPAA eligibility และ HITRUST certification รองรับทั้ง clinical care, population health management และ research
AWS Docs: https://docs.aws.amazon.com/healthlake/latest/devguide/what-is-amazon-health-lake.html
สถาปัตยกรรม
ฟีเจอร์หลัก
Store/Transform/Query FHIR R4 Data
จัดเก็บ FHIR R4 resources ทุกประเภท เช่น Patient, Observation, Condition, Medication, DiagnosticReport, Encounter, Procedure รองรับ create, read, update, delete และ search ผ่าน FHIR REST API มาตรฐาน
Built-In NLP to Structure Clinical Notes
ใช้ Amazon Comprehend Medical แปลง unstructured clinical text เช่น doctor's notes, discharge summaries, radiology reports เป็น structured FHIR Observations และ Conditions โดยอัตโนมัติ ระบุ medical entities, diagnoses, medications, dosages และ test results
FHIR REST API
รองรับ FHIR REST API R4 standard อย่างสมบูรณ์ ทำให้ EHR systems, mobile health apps และ analytics tools ที่รองรับ FHIR สามารถ integrate ได้ทันที รองรับ search parameters, chaining, includes และ paging ตาม FHIR specification
Bulk Import/Export
Import ข้อมูล FHIR จำนวนมากจาก S3 ในรูปแบบ NDJSON (Newline Delimited JSON) หรือ export ทั้ง datastore ออกมาสำหรับ migration, backup หรือ analytics ด้วย bulk FHIR operations (FHIR $export และ $import)
Analytics Queries (Amazon Athena)
Export ข้อมูล FHIR ออกมาเป็น Parquet หรือ JSON บน S3 และ query ด้วย Amazon Athena หรือ SageMaker Data Wrangler เพื่อ population health analytics, cohort analysis และ quality reporting
Medical Entity Extraction from Unstructured Notes
สกัด medical entities จาก clinical text อัตโนมัติ เช่น โรค (diagnoses), ยา (medications), ขนาดยา (dosages), ผลแล็บ (lab results), อาการ (symptoms) และระบุความสัมพันธ์ระหว่าง entities
SMART on FHIR Authorization
รองรับ SMART on FHIR authorization framework สำหรับ secure access control ในระดับผู้ป่วย, แพทย์ และองค์กร ทำให้ patient apps และ provider apps ขอ access token ได้ตาม SMART scopes
Compliance (HIPAA, HITRUST)
ผ่าน HIPAA Business Associate Agreement (BAA), HITRUST CSF Certification, รองรับ SOC 2, ISO 27001 และ PCI DSS ทำให้เหมาะสำหรับการจัดเก็บ Protected Health Information (PHI) ตามกฎหมาย
Integrated with QuickSight for Dashboards
ส่งออก FHIR data ไปยัง Amazon QuickSight สำหรับสร้าง dashboards แสดงผล population health metrics, readmission rates, medication adherence, quality measures และ outcomes analytics
การติดตั้งและการตั้งค่า
เปิดใช้งานผ่าน Console
- เข้า AWS Console > AWS HealthLake
- สร้าง FHIR Datastore (เลือก FHIR R4, KMS key)
- Import ข้อมูล FHIR จาก S3 หรือเริ่ม write ผ่าน FHIR API
- Configure access control (IAM หรือ SMART on FHIR)
- Setup analytics export ไปยัง S3
ติดตั้ง SDK
pip install boto3 requests
IAM Permissions ที่จำเป็น
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"healthlake:CreateFHIRDatastore",
"healthlake:DescribeFHIRDatastore",
"healthlake:StartFHIRImportJob",
"healthlake:StartFHIRExportJob",
"healthlake:GetFHIRImportJob",
"healthlake:GetFHIRExportJob",
"s3:GetObject",
"s3:PutObject",
"kms:GenerateDataKey",
"kms:Decrypt"
],
"Resource": "*"
}
]
}
วิธีใช้งาน
สร้าง FHIR Datastore
import boto3
healthlake = boto3.client('healthlake', region_name='us-east-1')
# สร้าง FHIR R4 datastore
response = healthlake.create_fhir_datastore(
DatastoreName='hospital-fhir-datastore',
DatastoreTypeVersion='R4',
SseConfiguration={
'KmsEncryptionConfig': {
'CmkType': 'CUSTOMER_MANAGED_KMS_KEY',
'KmsKeyId': 'arn:aws:kms:us-east-1:123456789:key/my-key'
}
},
PreloadDataConfig={
'PreloadDataType': 'SYNTHEA' # โหลด synthetic patient data สำหรับทดสอบ
},
Tags={
'Project': 'Hospital FHIR Integration',
'Environment': 'Production'
}
)
datastore_id = response['DatastoreId']
datastore_endpoint = response['DatastoreEndpoint']
print(f"Datastore ID: {datastore_id}")
print(f"FHIR Endpoint: {datastore_endpoint}")
Import FHIR Data จาก S3
# Import FHIR R4 data จาก S3 (NDJSON format)
import_response = healthlake.start_fhir_import_job(
JobName='ehr-migration-2024',
InputDataConfig={
'S3Uri': 's3://my-fhir-data/input-data/'
},
DatastoreId=datastore_id,
DataAccessRoleArn='arn:aws:iam::123456789:role/HealthLakeRole',
JobOutputDataConfig={
'S3Configuration': {
'S3Uri': 's3://my-fhir-data/import-output/',
'KmsKeyId': 'arn:aws:kms:us-east-1:123456789:key/my-key'
}
}
)
import_job_id = import_response['JobId']
print(f"Import Job ID: {import_job_id}")
# ตรวจสอบสถานะ
import_status = healthlake.describe_fhir_import_job(
DatastoreId=datastore_id,
JobId=import_job_id
)
print(f"Status: {import_status['ImportJobProperties']['JobStatus']}")
FHIR REST API สำหรับ Create/Read Resources
import requests
import json
import boto3
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest
def fhir_request(method, path, body=None):
"""ส่ง FHIR API request ด้วย AWS SigV4 authentication"""
url = f"{datastore_endpoint}/r4/{path}"
session = boto3.Session()
credentials = session.get_credentials()
headers = {'Content-Type': 'application/fhir+json'}
data = json.dumps(body) if body else None
request = AWSRequest(method=method, url=url, data=data, headers=headers)
SigV4Auth(credentials, 'healthlake', 'us-east-1').add_auth(request)
response = requests.request(
method=method,
url=url,
headers=dict(request.headers),
data=data
)
return response.json()
# สร้าง Patient resource
patient = {
'resourceType': 'Patient',
'id': 'patient-001',
'identifier': [
{
'system': 'https://hospital.example.com/patient-id',
'value': 'HN-2024-001'
}
],
'name': [
{
'family': 'สมบูรณ์',
'given': ['สมชาย'],
'text': 'สมชาย สมบูรณ์'
}
],
'gender': 'male',
'birthDate': '1985-06-15',
'address': [
{
'text': 'กรุงเทพมหานคร 10110',
'city': 'กรุงเทพมหานคร',
'country': 'TH'
}
]
}
result = fhir_request('PUT', 'Patient/patient-001', patient)
print(f"Created/Updated Patient: {result.get('id')}")
# สร้าง Observation (ผลแล็บ)
observation = {
'resourceType': 'Observation',
'status': 'final',
'code': {
'coding': [
{
'system': 'http://loinc.org',
'code': '2339-0',
'display': 'Glucose [Mass/volume] in Blood'
}
]
},
'subject': {'reference': 'Patient/patient-001'},
'valueQuantity': {
'value': 126,
'unit': 'mg/dL',
'system': 'http://unitsofmeasure.org',
'code': 'mg/dL'
},
'effectiveDateTime': '2024-01-15T08:00:00+07:00'
}
obs_result = fhir_request('POST', 'Observation', observation)
print(f"Created Observation: {obs_result.get('id')}")
ค้นหา FHIR Resources
# ค้นหา patients ทั้งหมดที่เป็นโรคเบาหวาน (ICD-10: E11)
search_result = fhir_request(
'GET',
'Condition?code=http://hl7.org/fhir/sid/icd-10|E11&_include=Condition:patient'
)
print(f"Found {search_result.get('total', 0)} diabetes conditions")
for entry in search_result.get('entry', []):
resource = entry.get('resource', {})
if resource.get('resourceType') == 'Patient':
name = resource.get('name', [{}])[0]
print(f"Patient: {name.get('text', 'N/A')}")
# ค้นหา Observations ของ patient เฉพาะ
observations = fhir_request(
'GET',
'Observation?patient=patient-001&code=http://loinc.org|2339-0&_sort=-date&_count=10'
)
print("\nRecent Glucose Readings:")
for entry in observations.get('entry', []):
obs = entry.get('resource', {})
value = obs.get('valueQuantity', {})
date = obs.get('effectiveDateTime', 'N/A')
print(f" {date}: {value.get('value')} {value.get('unit')}")
Export และ Analyze ด้วย Athena
# Export FHIR data ไปยัง S3 สำหรับ analytics
export_response = healthlake.start_fhir_export_job(
JobName='monthly-analytics-export',
OutputDataConfig={
'S3Configuration': {
'S3Uri': 's3://my-analytics-bucket/fhir-export/',
'KmsKeyId': 'arn:aws:kms:us-east-1:123456789:key/my-key'
}
},
DatastoreId=datastore_id,
DataAccessRoleArn='arn:aws:iam::123456789:role/HealthLakeRole'
)
# หลังจาก export เสร็จ query ด้วย Athena
athena = boto3.client('athena', region_name='us-east-1')
query = """
SELECT
p.id as patient_id,
JSON_EXTRACT_SCALAR(p.name[1], '$.text') as patient_name,
COUNT(o.id) as glucose_readings,
AVG(CAST(JSON_EXTRACT_SCALAR(o.valueQuantity, '$.value') AS DOUBLE)) as avg_glucose
FROM
healthlake_export.patient p
JOIN healthlake_export.observation o ON o.subject.reference = CONCAT('Patient/', p.id)
WHERE
JSON_EXTRACT_SCALAR(o.code.coding[1], '$.code') = '2339-0'
AND o.effectivedatetime >= '2024-01-01'
GROUP BY p.id, patient_name
HAVING avg_glucose > 126
ORDER BY avg_glucose DESC
"""
response = athena.start_query_execution(
QueryString=query,
QueryExecutionContext={'Database': 'healthlake_analytics'},
ResultConfiguration={'OutputLocation': 's3://my-athena-results/'}
)
print(f"Athena Query Execution ID: {response['QueryExecutionId']}")
ราคา (ประมาณการในบาท)
| รายการ | ราคา USD | ราคา THB (1 USD = 35 บาท) |
|---|---|---|
| Data ingest | $1.00/GB | ~35 บาท/GB |
| Storage | $0.10/GB/เดือน | ~3.50 บาท/GB/เดือน |
| Data queried (FHIR search) | $0.18/GB queried | ~6.30 บาท/GB queried |
| Bulk export | ค่า S3 เท่านั้น | ~0.83 บาท/GB |
| NLP (Comprehend Medical) | ตาม Comprehend Medical rates | แยกคิด |
ตัวอย่างค่าใช้จ่าย: โรงพยาบาลที่ ingest FHIR data 10 GB/เดือน
- Ingest: 10 GB x $1.00 = $10/เดือน (~350 บาท)
- Storage (สะสม 6 เดือน = 60 GB): 60 x $0.10 = $6/เดือน (~210 บาท)
- Queries: 5 GB queried/เดือน x $0.18 = $0.90 (~31.50 บาท)
- รวมประมาณ ~590 บาท/เดือน
เหมาะสำหรับ
- โรงพยาบาลและระบบสุขภาพที่ต้องการรวมข้อมูลจาก EHR หลายระบบในรูปแบบมาตรฐาน
- บริษัทประกันสุขภาพที่ต้องการวิเคราะห์ population health, claims และ quality measures
- นักวิจัยทางการแพทย์ที่ต้องการ secure, compliant data platform
- หน่วยงานรัฐที่ต้องการ health information exchange (HIE)
- ผู้พัฒนา healthcare apps ที่ต้องการ FHIR API พร้อมใช้งาน
- องค์กรที่ต้องการ HIPAA-compliant health data lake
ใช้ร่วมกับ AWS Services
- Amazon Comprehend Medical - NLP สำหรับ extract medical entities จาก clinical text
- Amazon Athena - SQL analytics บน exported FHIR data
- Amazon QuickSight - dashboards สำหรับ population health analytics
- Amazon SageMaker - train ML models บน structured FHIR data
- AWS Glue - ETL pipeline สำหรับ transform ข้อมูลจาก EHR เป็น FHIR
- Amazon S3 - staging area สำหรับ bulk import/export
- AWS Lambda - serverless FHIR operations และ integrations
- AWS PrivateLink - secure connectivity จาก VPC
Use Case ตัวอย่าง
1. สปสช. วิเคราะห์ Population Health ระดับประเทศ
สำนักงานหลักประกันสุขภาพแห่งชาติใช้ AWS HealthLake รวมข้อมูล claims และ clinical data จากโรงพยาบาลในโครงการบัตรทองกว่า 11,000 แห่ง ข้อมูล FHIR ที่ได้รับการ de-identify ใช้วิเคราะห์ disease burden, treatment outcomes และ cost effectiveness ของโปรแกรมสุขภาพต่างๆ ทีมนโยบายสาธารณสุขสามารถ query ข้อมูลผู้ป่วยกว่า 50 ล้านรายด้วย SQL ได้ภายในไม่กี่นาที
2. เครือโรงพยาบาลรวม EHR หลายระบบ
เครือโรงพยาบาลขนาดใหญ่ที่มี EHR 5 ระบบต่างกัน (HIS เดิม, ระบบใหม่ที่ซื้อมา, และระบบของโรงพยาบาลที่ M&A มา) ใช้ AWS HealthLake เป็น central health data repository โดยใช้ AWS Glue แปลงข้อมูลจากทุกระบบเป็น FHIR R4 แพทย์เห็นประวัติผู้ป่วยครบถ้วนจากทุกสาขาในหน้าจอเดียว ลด medical errors จาก information gaps ได้ 25%
3. Pharma Company วิจัย Real-World Evidence
บริษัทยา AstraZeneca Thailand ใช้ AWS HealthLake เก็บ real-world clinical data (de-identified) จากโรงพยาบาล partner เพื่อวิจัย treatment outcomes ในประชากรไทย ใช้ Athena query cohorts ผู้ป่วยที่ตรงกับ inclusion/exclusion criteria ของงานวิจัย และใช้ SageMaker สร้าง predictive models สำหรับ treatment response ลดเวลาในการ identify patient cohorts จาก 6 เดือนเหลือ 2 สัปดาห์