我正在尝试通过 Ruby 客户端从 FHIR 商店获取患者,但它始终返回 null。
通过 CURL 查询时我成功了。这是我正在运行的 CURL 命令(已编辑完整路径):
curl -X GET \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
"https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStores/FHIR_STORE_ID/fhir/Patient/PATIENT_ID"
这将返回正确的 FHIR 患者资源。
我的 Ruby 代码如下所示:
require 'google/apis/healthcare_v1'
require 'googleauth'
service = Google::Apis::HealthcareV1::CloudHealthcareService.new
scope = 'https://www.googleapis.com/auth/cloud-platform'
service.authorization = Google::Auth::ServiceAccountCredentials.make_creds(
json_key_io: File.open('REDACTED'),
scope: scope
)
service.authorization.fetch_access_token!
project_id = REDACTED
location = REDACTED
dataset_id = REDACTED
fhir_store_id = REDACTED
resource_type = 'Patient'
patient_id = REDACTED
name = "projects/#{project_id}/locations/#{location}/datasets/#{dataset_id}/fhirStores/#{fhir_store_id}/fhir/Patient/#{patient_id}"
response = service.read_project_location_dataset_fhir_store_fhir(name)
puts response.to_json
我没有收到任何身份验证错误。CURL 示例返回适当的结果,而 Ruby 客户端示例返回 null。
有任何想法吗?