Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
How to use Healthcare API?
2.1.
Create a Dataset
2.2.
Store and View a DICOM instance
2.2.1.
Create a DICOM store
2.2.2.
Store a DICOM Instance
2.2.3.
View DICOM Instance metadata
2.3.
Store and View an FHIR Resources
2.3.1.
Create an FHIR store
2.3.2.
Store an FHIR resource
2.3.3.
View FHIR resource contents
2.4.
Store and View an HL7v2 Message
2.4.1.
Create an HL7v2 store
2.4.2.
Store an HL7v2 message
2.4.3.
View HLv72 message contents
2.5.
Delete the Dataset
3.
Frequently Asked Questions
3.1.
What is cloud computing?
3.2.
What is an API?
3.3.
What is Cloud Services?
3.4.
What is Google Cloud?
3.5.
What is AR used for?
4.
Conclusion
Last Updated: Mar 27, 2024
Easy

Cloud Healthcare API

Author Rajat Agrawal
0 upvote

Introduction

The Cloud Healthcare API offers a managed solution for storing and retrieving healthcare data in Google Cloud, acting as a vital link between applications running on Google Cloud and current healthcare systems.

Cloud Healthcare API

In this blog, we will learn about Cloud Healthcare API.

How to use Healthcare API?

Steps to use Healthcare API:-

  • Create a dataset for the Cloud Healthcare API.
  • In the dataset, establish one of the following data stores:
    • Store for Digital Imaging and Communications in Medicine(DICOM).
    • Store for Fast Healthcare Interoperability (FHIR)
    • Store for Health Level Seven International Version 2 (HL7v2)
  • Store and analyze a certain kind of medical data in the HL7v2, FHIR, or DICOM stores.

Let’s discuss the above steps briefly.

Create a Dataset

Healthcare data may be found in data stores, which are part of datasets. You must provide at least one dataset in order to use the Cloud Healthcare API.

Dataset

Create a dataset using the datasets.create method:

curl -X POST \
    --data "" \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets?datasetId=my-dataset"
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

Store and View a DICOM instance

The tasks we need to do are:-

DICOM

Create a DICOM store

DICOM stores are DICOM instances that reside within datasets. Using the dicomStores.create method, create a DICOM store.

curl -X POST \
    --data "" \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores?dicomStoreId=my-dicom-store"
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

Store a DICOM Instance

There are two steps you need to follow to store a DICOM instance.

Step1: Download the sample DICOM instance file to your computer. A de-identified patient X-ray is in the file.

curl -O https://cloud.google.com/healthcare-api/docs/resources/dicom_00000001_000.dcm
You can also try this code with Online Java Compiler
Run Code


Step2: Use the dicomStores.storeInstances function to store the DICOM instance. 

curl -X POST \
    -H "Content-Type: application/dicom" \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    --data-binary @dicom_00000001_000.dcm \
    https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/studies
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

View DICOM Instance metadata

Using the dicomStores.searchForInstances function, view the instance's metadata:

curl -X GET \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/dicomStores/my-dicom-store/dicomWeb/instances"
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

Store and View an FHIR Resources

The tasks we need to do are:-

FHIR

Create an FHIR store

FHIR stores, which include FHIR resources, are present inside datasets. Using the fhirStores.create method, create an FHIR store.

curl -X POST \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    --data "{
      'version': 'R4'
    }" "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores?fhirStoreId=my-fhir-store"
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

Store an FHIR resource

There are two steps you need to follow to store an FHIR resource.

Step1: Save the sample JSON FHIR resource file to your computer. The file includes fundamental patient resource information.

curl -O https://cloud.google.com/healthcare-api/docs/resources/Patient.json
You can also try this code with Online Java Compiler
Run Code


Step2: Use the fhir.create function to store the Patient resource. 

curl -X POST \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    -H "Content-Type: application/fhir+json; charset=utf-8" \
    --data @Patient.json \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient"
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

View FHIR resource contents

Use the fhir.search to view information about the Patient resource.

curl -X GET \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/fhirStores/my-fhir-store/fhir/Patient?family:exact=Ninjas"
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

Store and View an HL7v2 Message

The tasks we need to do are:-

HL7v2

Create an HL7v2 store

HL7v2 stores are found within datasets and contain HL7v2 messages. Using the hl7V2Stores.create method, create an HL7v2 store.

curl -X POST \
    --data "" \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores?hl7V2StoreId=my-hl7v2-store"
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

Store an HL7v2 message

There are two steps you need to follow to store an HL7v2 message.

Step1: To your computer, download the sample HL7v2 message file.

curl -O https://cloud.google.com/healthcare-api/docs/resources/hl7v2-sample.json
You can also try this code with Online Java Compiler
Run Code


Step2: Use the messages.create method to store the HL7v2 message.

curl -X POST \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    --data-binary @hl7v2-sample.json \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages"
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

View HLv72 message contents

Take note of the MESSAGE_ID from the answer you received after creating the HL7v2 message. Use the messages.get method to view message’s details.

curl -X GET \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset/hl7V2Stores/my-hl7v2-store/messages/MESSAGE_ID"
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

Replace MESSAGE_ID with the ID you received after creating the HL7v2 message.

Delete the Dataset

If you no longer need the dataset, you can delete it. When you delete a dataset, you permanently erase it, and any FHIR, HL7v2, or DICOM stores it includes.

curl -X DELETE \
    -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
    "https://healthcare.googleapis.com/v1/projects/PROJECT_ID/locations/us-central1/datasets/my-dataset"
You can also try this code with Online Java Compiler
Run Code


You need to replace PROJECT_ID with the ID of your Google Cloud project.

Frequently Asked Questions

What is cloud computing?

The on-demand availability of computer system resources, in particular data storage and processing power, without direct active supervision by the user.

What is an API?

Application Programming Interface, or API, is a software bridge that enables communication between two programs.

What is Cloud Services?

The term "cloud services" refers to a wide range of services supplied on demand to businesses and customers over the internet. These services are created to offer quick, inexpensive access to resources and applications without needing internal hardware or infrastructure.

What is Google Cloud?

The Google Cloud Platform is a collection of cloud computing services that Google offers. It utilizes the same internal architecture that Google does for its consumer products, including Google Search, Gmail, Drive, and YouTube.

What is AR used for?

Augmented reality (AR) is a technology that allows users to superimpose digital material (images, audio, and text) on top of a real-world environment.

Conclusion

In this article, we have extensively discussed how to use the google cloud healthcare API. If you want to learn more, check out our articles on What Is Web2Py?What is Sinatra?Why To Use Web2py?Postbacks and Internationalization in web2pyThird Party Modules In Web2pyTasks In Web2py, and  XML in Web2py.

Happy Coding!

Live masterclass