Skip to content

RominaElenaMendezEscobar/google-healthcare-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Buy Me A Coffee


☁️ Healthcare Natural Language API - (PoC)

Project Overview

This project is a Proof of Concept (PoC) using Google Cloud's Healthcare Natural Language API. The goal is to test the API's ability to extract medical entities and relationships from unstructured clinical notes, leveraging pre-trained natural language models.

img

About Healthcare Natural Language API

The Healthcare Natural Language API is part of the Google Cloud Healthcare API. It uses natural language processing (NLP) models to extract healthcare-related information from medical text.

Key Features

The API can identify and extract:

  • 🏥 Medical concepts such as medications, procedures, and health conditions.
  • 📅 Functional attributes like temporal relationships, subjects, and certainty assessments.
  • 🔗 Relationships between entities, such as side effects or drug dosages.

Core Functionality

In this tutorial, we will focus on the following function:

  • Entity Analysis: The analyzeEntities method inspects medical text to detect and return medical concepts and their relationships.

Prerequisites

Before running this PoC, ensure you have completed the following steps:

  1. Google Cloud account: You must have a Google Cloud account set up.
  2. 🌐 Enable APIs: Ensure the Cloud Healthcare API and Healthcare Natural Language API are enabled.
  3. 🛠️ Install Google Cloud CLI (gcloud): Download and install the Google Cloud CLI.
  4. 📄 Create a .env file: This file will store the necessary environment variables.

Create a .env file

To configure the environment variables, create a .env file in your project directory and add the following content:

PROJECT_ID = "project_name"
LOCATION = "location_name"
TOKEN = "token_value"

How to obtain the token value

Follow these steps to authenticate and get your access token:

  1. Authenticate with Google Cloud by running the following command in your terminal:
gcloud auth login
  1. Get the access token by running:
gcloud auth print-access-token

Copy the token value and paste it into the .env file under the TOKEN variable.

📊 Streamlit Dashboard

This project includes an interactive Streamlit dashboard for visualizing and analyzing the Healthcare API results.

Features

The dashboard provides three main sections:

1. Dashboard Tab

  • Compact metrics cards showing file info, total entities, unique types, and texts
  • Interactive confidence filtering to filter entities by subject confidence
  • Visual charts for entity type distribution, subject analysis, and temporal assessment

Dashboard

2. Entity Table Tab

  • Filterable data table with all entity details
  • Export functionality to download results as CSV
  • Advanced filtering by type, subject, and confidence levels

Entity Table

3. Note Tab

  • Original medical note with color-coded entity highlighting
  • Dynamic filtering to show/hide specific entity types
  • Interactive legend showing colors for each entity type
  • Real-time highlighting based on selected filters

Note Highlighting

Sample Data

The data/ folder includes:

  • note_es.txt - Sample Spanish medical note (fictitious)
  • entities_*.json - Example API response with extracted entities

Running the Streamlit App

  1. Install dependencies:
cd streamlit
pip install -r requirements.txt
  1. Run the application:
streamlit run app.py
  1. Access the dashboard: Open your browser and navigate to http://localhost:8501

App Structure

streamlit/
├── app.py              # Main Streamlit application
├── google_api.py       # Google Healthcare API service
├── data_etl.py         # Data transformation functions
├── requirements.txt    # Python dependencies
└── README.md          # Setup instructions

Goals

  • Test entity extraction from clinical notes.
  • Evaluate how well the API identifies medical concepts and maps relationships.
  • Understand the output format and how to integrate the extracted data into a larger cloud architecture.
  • Visualize and analyze results through an interactive dashboard.

Next Steps

  1. Set up Google Cloud Healthcare API.
  2. Enable the Healthcare Natural Language API.
  3. Implement entity analysis using the analyzeEntities method.
  4. Analyze the results and review entity mapping.
  5. Use the Streamlit dashboard to explore and visualize the extracted entities.

⚠️ Important Note: The medical note included in this repository is entirely fictitious. It was generated for a fictional healthcare professional and does not belong to any real patient. This data is solely for testing and demonstration purposes.

About

PoC project using Google Cloud Healthcare API and the goal is to test the extraction of medical entities from unstructured clinical notes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors