Transforming Healthcare Apps with Google Cloud Healthcare API (FHIR): Effortless Integration for Unparalleled Efficiency!
Tags: cloud, webdev, tutorial, productivity
Published: 2023-07-02 16:07:30

#Introduction to Google Healthcare API
Google Healthcare API is a Google cloud managed solution, which can store, access and exchange healthcare data in Google Cloud.

Now storing and again accessing can be an extra step for your healthcare systems or applications, so here are some perks which adds up into the special edge which this service provides into your systems for better performance or insights:
1.	Cloud Healthcare API being a cloud native solution comes with multiple advantages of cloud's robust security and compliance measurements.
2.	Managed storage platform, easy access with addition of actionable insights and manage exchange APIs for different systems and applications.
3.	Manage storage for DICOM data (medical images and related information in a digital format).
4.	De-identify sensitive information for different cloud services for analytics purposes or AI insights.
5.	Manage privacy and consent at Google-scale to empower your users with data transparency and control.
6. The Google Healthcare API leverages the power of Google Cloud's infrastructure, which offers high scalability and flexibility.
7. Google Cloud provides a range of advanced analytics and machine learning tools that can be integrated with the Healthcare API.

**And finally, being on cloud rapid building of features and cost efficiency plays a major role in choosing Cloud Native Services.**

# Introduction to FHIR
FHIR stands for Fast healthcare Interoperability Resources, developed by Health Level Seven International Organization (HL7). This modern healthcare standard is designed to facilitate fast exchange and integration of healthcare data between different systems.

_Do not worry, with screenshots I will be explaining very soon._

So basically, FHIR is modular and inter-referencing at the same time. So each resourcetype in a FHIR EHR(Electronic Health Record) can have dependency of some other resourcetype for semantic or syntaxical purposes.

_First JSON FHIR screenshot coming up, try not to get scared. Everything data inside it is synthetically generated, so try not to use it._

**Full code of Patient Resource:** https://build.fhir.org/patient-example.json.html
Here we can see the resource name as Patient. This resourcetype have all the patient identification information in it. 
![Start of Patient resource](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p7vy0vrjqjdp43mdde9u.png)

Each field in the FHIR JSON has some meaning, in the above we can see some personal details of this Patient. (Random generated Data)
![Code snippet of FHIR JSON](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/41wztnoecyx2tt5e0d0p.png)

Next, in this you can see the referencing of some other resource (Organization), which is the Medical organization which created this EHR.
![Dependency in FHIR JSON](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nxnfy0qvydatjlkammtg.png)

Full detailed resource content, terminology binding and constraints of any resource can be visited on the official FHIR website.
[Everything About Patient Resource](https://build.fhir.org/patient.html)

# A Practical Guide for Implementation and Usage

### Upload a FHIR JSON file to Cloud storage.
_Small assignment for you, search for a valid FHIR EHR, or generator, I want you guys to get hands on some FHIR JSON to move forward._

**Step 1:** Upload fhir.json into some bucket of your Cloud Storage.
**Step 2:** Select the fhir.json file using the checkbox and click Download to verify the file. 

_If you have scorched the internet and didn't find any FHIR file, MAIL ME. I will provide you with one sample JSON._

### Setup of Cloud Healthcare API.
**Step 3**: Search for Cloud Healthcare API.(Search "Healthcare")
![Healthcare searching](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdp01qb3ygpoj7erh30t.png)
**Step 4:** Enable the Service, it may ask for other services to be enabled as well.
**Step 5:** Create a Dataset, select a Name for it and a specific region for it.(you can choose location type as per your requirements)
**Step 6:** Once, you see a list of dataset(s), click on your dataset and create your Datastore.
**Step 7:** Choose type as FHIR and version as R4(check your FHIR file, but R4 is most probable), you can read through more setting but for basic start these are good to go.
**Step 8:** Select your datastore from the list to verify settings.
![Specific Datastore settings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wyj94oduw9fvutuhzy8f.png)

### Import Data to API (Cloud Service)
**Step 9:** From the datastore list, select import from actions dropdown.
![The import button](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1mzkn9wbns3ntpgy5ua6.png)
**Step 10:** Select the Bucket where you have your fhir.json, and in the Content Structure of import settings choose Bundle(if file contains multiple resources in one file) or Resource(if one resource in one file) and pretty and non-pretty is a basic JSON terminology.
**Step 11:** If you are doing this for the first time you'll get "Failed to initialize import from GCS" issue, this means the service account being used by Cloud Healthcare API has no access on Storage Buckets. So, add the necessary permissions to the healthcare service account in IAM & Admin(Search IAM).
**Step 12:** After import you can view your progress of importation in the operations tab.
![Long running operations tab](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/exvf5wfog7aga9jzieym.png)
### View data in the FHIR Viewer.
**Step 13:** If you are in the Cloud Healthcare API then in the left collapsible menu you can select FHIR Viewer or search FHIR Viewer from search bar above.
**Step 14:** Select your Dataset and Datastore.
**Step 15:** Below you'll get a list of 146 resources but the resources which will be there in your fhir.json will only be containing data in them.
**Step 16:** One resource which will be definitely be there is **Patient** resource.
**Step 17:** If everything works well until here, then you'll be able to see something like this.
![Patient resource in FHIR Viewer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tyyfd4osxhigiy56syon.png)
**Step 18:** Likewise, you can go back to the list and see different resources and the data inside it from your fhir.json or other files uploaded into the datastore.

### Use Search query builder.
**Step 19:** Click on Search Tab and then on Open Query Builder.
**Step 20:** Select the resource you want to query from, then the parameters(fields, you can add multiple fields as well) and the value against it, to search.
**Step 21:** On the right, a complete Query preview can be viewed for assisting the REST operations.
![Inside Query Builder](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vsjzezgr4phwg1kjq336.png)
**Step 22:** Once Done, click on Run Query. You can see the records which were fetched by the query and can be viewed on the right panel itself.
![Query run results](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8p1q9y21w7wf71n3c8wn.png)
**Step 23:** You can also unlink the query and edit it right away  without opening the query builder and test more complex queries on your data.

### Rest API for integration.
**Step 24:** API & Services > Credentials > Create Credentials > Service Account
**Step 25:** Give the service account all necessary permissions for smooth functioning and then download a JSON key file of it to attach to your application. This will then authorized the app to use functions, features and services of your Google Cloud Project.(Cloud Healthcare API)
**Step 26:** View the below link on all the functionalities which can be performed by REST through your code.
[REST Functionalities for Cloud Healthcare API](https://cloud.google.com/healthcare-api/docs/how-tos/fhir-resources)

# Conclusion
In conclusion, Google Cloud's Cloud Healthcare API offers an array of powerful tools and capabilities that can revolutionize the world of healthcare applications. By leveraging the cloud infrastructure and advanced features provided by Google, developers can create innovative solutions that enhance patient care, improve efficiency, and drive forward the future of healthcare.

Throughout this article, we explored the key features and functionalities of the Cloud Healthcare API. We discussed how it enables secure and scalable data storage, seamless interoperability between systems, and can incorporate advanced analytics and machine learning capabilities.

With the Cloud Healthcare API, developers can focus on building transformative healthcare applications without worrying about the complexities of data management, compliance, or scalability. The API provides a robust foundation for storing and processing healthcare data, allowing developers to harness the power of the cloud and AI technologies to improve patient outcomes and drive innovation in the healthcare industry.

In summary, the Cloud Healthcare API of Google Cloud is poised to revolutionize the healthcare industry by providing developers with the tools they need to create secure, scalable, and innovative applications. As we look towards the future, it's clear that this powerful API will play a significant role in shaping the next generation of healthcare technologies and improving the lives of patients worldwide.